Commit 3ddaaeaf authored by PJ Janse van Rensburg's avatar PJ Janse van Rensburg

Merge branch 'table_responsive' of...

Merge branch 'table_responsive' of git://github.com/abandonedbyrochacbruno/flask-admin into prs-to-merge
parents fe5996d2 accb9aad
...@@ -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); }
}
...@@ -103,3 +103,8 @@ body.modal-open { ...@@ -103,3 +103,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>
...@@ -102,13 +103,13 @@ ...@@ -102,13 +103,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_view', path)|safe }}"> <a href="{{ get_dir_url('.index_view', 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,
...@@ -121,7 +122,7 @@ ...@@ -121,7 +122,7 @@
{% endif %} {% endif %}
</td> </td>
{% if admin_view.is_column_visible('size') %} {% if admin_view.is_column_visible('size') %}
<td> <td data-title="{{ _gettext('Size') }}">
{{ size|filesizeformat }} {{ size|filesizeformat }}
</td> </td>
{% endif %} {% endif %}
...@@ -135,6 +136,7 @@ ...@@ -135,6 +136,7 @@
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
</div>
{% endblock %} {% endblock %}
{% block toolbar %} {% block toolbar %}
<div class="btn-toolbar"> <div class="btn-toolbar">
......
...@@ -61,8 +61,9 @@ ...@@ -61,8 +61,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 %}
...@@ -127,7 +128,7 @@ ...@@ -127,7 +128,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) %}
{% set form = list_forms[get_pk_value(row)] %} {% set form = list_forms[get_pk_value(row)] %}
{% if form.csrf_token %} {% if form.csrf_token %}
...@@ -154,6 +155,7 @@ ...@@ -154,6 +155,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>
...@@ -135,6 +136,7 @@ ...@@ -135,6 +136,7 @@
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
</div>
{% endblock %} {% endblock %}
{% block toolbar %} {% block toolbar %}
<div class="btn-toolbar"> <div class="btn-toolbar">
......
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,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>
...@@ -153,6 +154,7 @@ ...@@ -153,6 +154,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