Commit accb9aad authored by Bruno Rocha's avatar Bruno Rocha

responsive tables for screens smaller than 800px wide

parent 0ab53eda
...@@ -89,3 +89,53 @@ table.filters tr td { ...@@ -89,3 +89,53 @@ table.filters tr td {
.admin-form .controls { .admin-form .controls {
margin-left: 110px; margin-left: 110px;
} }
@media only screen and (max-width: 800px) {
/* Force table to not be like tables anymore */
#no-more-tables table,
#no-more-tables thead,
#no-more-tables tbody,
#no-more-tables th,
#no-more-tables td,
#no-more-tables tr {
display: block;
}
/* Hide table headers (but not display: none;, for accessibility) */
#no-more-tables thead tr {
position: absolute;
top: -9999px;
left: -9999px;
}
#no-more-tables tr { border: 1px solid #ccc; }
#no-more-tables td {
/* Behave like a "row" */
border: none;
border-bottom: 1px solid #eee;
position: relative;
padding-left: 50%;
white-space: normal;
text-align:left;
}
#no-more-tables td:before {
/* Now like a table header */
position: absolute;
/* Top/left values mimic padding */
top: 6px;
left: 6px;
width: 45%;
padding-right: 10px;
white-space: nowrap;
text-align:left;
font-weight: bold;
}
/*
Label the data
*/
#no-more-tables td:before { content: attr(data-title); }
}
...@@ -98,3 +98,8 @@ body.modal-open { ...@@ -98,3 +98,8 @@ body.modal-open {
margin-top: 20px; margin-top: 20px;
margin-bottom: 10px; margin-bottom: 10px;
} }
.table-responsive
{
overflow-x: auto;
}
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
{% endblock %} {% endblock %}
{% block file_list_table %} {% block file_list_table %}
<div id="no-more-tables">
<table class="table table-striped table-bordered model-list"> <table class="table table-striped table-bordered model-list">
<thead> <thead>
<tr> <tr>
...@@ -84,13 +85,13 @@ ...@@ -84,13 +85,13 @@
{% endblock %} {% endblock %}
</td> </td>
{% if is_dir %} {% if is_dir %}
<td colspan="2"> <td colspan="2" data-title="{{ _gettext('Name') }}">
<a href="{{ get_dir_url('.index', path)|safe }}"> <a href="{{ get_dir_url('.index', path)|safe }}">
<i class="fa fa-folder-o icon-folder-close"></i> <span>{{ name }}</span> <i class="fa fa-folder-o icon-folder-close"></i> <span>{{ name }}</span>
</a> </a>
</td> </td>
{% else %} {% else %}
<td> <td data-title="{{ _gettext('Name') }}">
{% if admin_view.can_download %} {% if admin_view.can_download %}
{%- if admin_view.edit_modal and admin_view.is_file_editable(path) -%} {%- if admin_view.edit_modal and admin_view.is_file_editable(path) -%}
{{ lib.add_modal_button(url=get_file_url(path, modal=True)|safe, {{ lib.add_modal_button(url=get_file_url(path, modal=True)|safe,
...@@ -102,7 +103,7 @@ ...@@ -102,7 +103,7 @@
{{ name }} {{ name }}
{% endif %} {% endif %}
</td> </td>
<td> <td data-title="{{ _gettext('Size') }}">
{{ size|filesizeformat }} {{ size|filesizeformat }}
</td> </td>
{% endif %} {% endif %}
...@@ -110,6 +111,7 @@ ...@@ -110,6 +111,7 @@
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
</div>
{% endblock %} {% endblock %}
{% block toolbar %} {% block toolbar %}
<div class="btn-toolbar"> <div class="btn-toolbar">
......
...@@ -52,8 +52,9 @@ ...@@ -52,8 +52,9 @@
{% endif %} {% endif %}
{% block model_list_table %} {% block model_list_table %}
<table class="table table-striped table-bordered table-hover model-list"> <div id="no-more-tables">
<thead> <table class="table table-striped table-bordered table-hover model-list cf">
<thead class="cf">
<tr> <tr>
{% block list_header scoped %} {% block list_header scoped %}
{% if actions %} {% if actions %}
...@@ -143,7 +144,7 @@ ...@@ -143,7 +144,7 @@
{% endblock %} {% endblock %}
{% for c, name in list_columns %} {% for c, name in list_columns %}
<td class="col-{{c}}"> <td class="col-{{c}}" data-title="{{ name }}">
{% if admin_view.is_editable(c) %} {% if admin_view.is_editable(c) %}
{% if form.csrf_token %} {% if form.csrf_token %}
{{ form[c](pk=get_pk_value(row), value=get_value(row, c), csrf=form.csrf_token._value()) }} {{ form[c](pk=get_pk_value(row), value=get_value(row, c), csrf=form.csrf_token._value()) }}
...@@ -169,6 +170,7 @@ ...@@ -169,6 +170,7 @@
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
</div>
{% block list_pager %} {% block list_pager %}
{% if num_pages is not none %} {% if num_pages is not none %}
{{ lib.pager(page, num_pages, pager_url) }} {{ lib.pager(page, num_pages, pager_url) }}
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
{% endblock %} {% endblock %}
{% block file_list_table %} {% block file_list_table %}
<div class="table-responsive">
<table class="table table-striped table-bordered model-list"> <table class="table table-striped table-bordered model-list">
<thead> <thead>
<tr> <tr>
...@@ -110,6 +111,7 @@ ...@@ -110,6 +111,7 @@
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
</div>
{% endblock %} {% endblock %}
{% block toolbar %} {% block toolbar %}
<div class="btn-toolbar"> <div class="btn-toolbar">
......
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
{% endif %} {% endif %}
{% block model_list_table %} {% block model_list_table %}
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover model-list"> <table class="table table-striped table-bordered table-hover model-list">
<thead> <thead>
<tr> <tr>
...@@ -168,6 +169,7 @@ ...@@ -168,6 +169,7 @@
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
</div>
{% block list_pager %} {% block list_pager %}
{% if num_pages is not none %} {% if num_pages is not none %}
{{ lib.pager(page, num_pages, pager_url) }} {{ lib.pager(page, num_pages, pager_url) }}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment