Commit 46d64f69 authored by Ryan Beymer's avatar Ryan Beymer

flask-admin/flask-admin#1486 - fix column sizing

parent 8e11da2c
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
{% block file_list_table %} {% block file_list_table %}
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped table-bordered model-list"> <table class="table table-hover">
<thead> <thead>
<tr> <tr>
{% block list_header scoped %} {% block list_header scoped %}
...@@ -55,85 +55,87 @@ ...@@ -55,85 +55,87 @@
{% endblock %} {% endblock %}
</tr> </tr>
</thead> </thead>
{% for name, path, is_dir, size, date in items %} <tbody>
<tr> {% for name, path, is_dir, size, date in items %}
{% block list_row scoped %} <tr>
{% if actions %} {% block list_row scoped %}
<td> {% if actions %}
{% if not is_dir %} <td>
<input type="checkbox" name="rowid" class="action-checkbox" value="{{ path }}" /> {% if not is_dir %}
{% endif %} <input type="checkbox" name="rowid" class="action-checkbox" value="{{ path }}" />
</td> {% endif %}
{% endif %} </td>
<td>
{% block list_row_actions scoped %}
{% if admin_view.can_rename and path and name != '..' %}
{%- if admin_view.rename_modal -%}
{{ lib.add_modal_button(url=get_url('.rename', path=path, modal=True),
title=_gettext('Rename File'),
content='<i class="fas fa-pencil-alt"></i>') }}
{% else %}
<a class="icon" href="{{ get_url('.rename', path=path) }}" title="{{ _gettext('Rename File') }}">
<i class="fas fa-pencil-alt"></i>
</a>
{%- endif -%}
{% endif %} {% endif %}
{%- if admin_view.can_delete and path -%} <td>
{% if is_dir %} {% block list_row_actions scoped %}
{% if name != '..' and admin_view.can_delete_dirs %} {% if admin_view.can_rename and path and name != '..' %}
{%- if admin_view.rename_modal -%}
{{ lib.add_modal_button(url=get_url('.rename', path=path, modal=True),
title=_gettext('Rename File'),
content='<i class="fas fa-pencil-alt"></i>') }}
{% else %}
<a class="icon" href="{{ get_url('.rename', path=path) }}" title="{{ _gettext('Rename File') }}">
<i class="fas fa-pencil-alt"></i>
</a>
{%- endif -%}
{% endif %}
{%- if admin_view.can_delete and path -%}
{% if is_dir %}
{% if name != '..' and admin_view.can_delete_dirs %}
<form class="icon" method="POST" action="{{ get_url('.delete') }}">
{{ delete_form.path(value=path) }}
{{ delete_form.csrf_token }}
<button onclick="return confirm('{{ _gettext('Are you sure you want to delete \\\'%(name)s\\\' recursively?', name=name) }}')">
<i class="fas fa-times glyphicon glyphicon-remove"></i>
</button>
</form>
{% endif %}
{% else %}
<form class="icon" method="POST" action="{{ get_url('.delete') }}"> <form class="icon" method="POST" action="{{ get_url('.delete') }}">
{{ delete_form.path(value=path) }} {{ delete_form.path(value=path) }}
{{ delete_form.csrf_token }} {{ delete_form.csrf_token }}
<button onclick="return confirm('{{ _gettext('Are you sure you want to delete \\\'%(name)s\\\' recursively?', name=name) }}')"> <button onclick="return confirm('{{ _gettext('Are you sure you want to delete \\\'%(name)s\\\'?', name=name) }}')">
<i class="fas fa-times glyphicon glyphicon-remove"></i> <i class="fa fa-trash glyphicon glyphicon-trash"></i>
</button> </button>
</form> </form>
{% endif %} {% endif %}
{%- endif -%}
{% endblock %}
</td>
{% if is_dir %}
<td colspan="2">
<a href="{{ get_dir_url('.index_view', path)|safe }}">
<i class="fa fa-folder-o glyphicon glyphicon-folder-close"></i> <span>{{ name }}</span>
</a>
</td>
{% else %}
<td>
{% if admin_view.can_download %}
{%- if admin_view.edit_modal and admin_view.is_file_editable(path) -%}
{{ lib.add_modal_button(url=get_file_url(path, modal=True)|safe,
btn_class='', content=name) }}
{% else %}
<a href="{{ get_file_url(path)|safe }}">{{ name }}</a>
{%- endif -%}
{% else %} {% else %}
<form class="icon" method="POST" action="{{ get_url('.delete') }}"> {{ name }}
{{ delete_form.path(value=path) }}
{{ delete_form.csrf_token }}
<button onclick="return confirm('{{ _gettext('Are you sure you want to delete \\\'%(name)s\\\'?', name=name) }}')">
<i class="fa fa-trash glyphicon glyphicon-trash"></i>
</button>
</form>
{% endif %} {% endif %}
{%- endif -%} </td>
{% endblock %} {% if admin_view.is_column_visible('size') %}
</td> <td>
{% if is_dir %} {{ size|filesizeformat }}
<td colspan="2"> </td>
<a href="{{ get_dir_url('.index_view', path)|safe }}">
<i class="fa fa-folder-o glyphicon glyphicon-folder-close"></i> <span>{{ name }}</span>
</a>
</td>
{% else %}
<td>
{% if admin_view.can_download %}
{%- if admin_view.edit_modal and admin_view.is_file_editable(path) -%}
{{ lib.add_modal_button(url=get_file_url(path, modal=True)|safe,
btn_class='', content=name) }}
{% else %}
<a href="{{ get_file_url(path)|safe }}">{{ name }}</a>
{%- endif -%}
{% else %}
{{ name }}
{% endif %} {% endif %}
</td> {% if admin_view.is_column_visible('date') %}
{% if admin_view.is_column_visible('size') %} <td>
<td> {{ timestamp_format(date) }}
{{ size|filesizeformat }} </td>
</td> {% endif %}
{% endif %} {% endif %}
{% if admin_view.is_column_visible('date') %} {% endblock %}
<td> </tr>
{{ timestamp_format(date) }} {% endfor %}
</td> </tbody>
{% endif %}
{% endif %}
{% endblock %}
</tr>
{% endfor %}
</table> </table>
</div> </div>
{% endblock %} {% endblock %}
......
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
{% endif %} {% endif %}
{% block list_row_actions_header %} {% block list_row_actions_header %}
{% if admin_view.column_display_actions %} {% if admin_view.column_display_actions %}
<th class="col-md-1">&nbsp;</th> <th>&nbsp;</th>
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% for c, name in list_columns %} {% for c, name in list_columns %}
......
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