1
0
Fork 0
mirror of https://codeberg.org/Mo8it/AdvLabDB.git synced 2024-09-19 18:31:16 +00:00

Upgrade to bootstrap 4

This commit is contained in:
Mo 2022-03-02 23:35:20 +01:00
parent 820bde2541
commit 158e6603f1
17 changed files with 423 additions and 367 deletions

View file

@ -1,27 +1,27 @@
{% import 'admin/static.html' as admin_static with context %} {% import 'admin/static.html' as admin_static with context %}
{% macro dropdown(actions, btn_class='btn dropdown-toggle') -%} {% macro dropdown(actions, btn_class='nav-link dropdown-toggle') -%}
<a class="{{ btn_class }}" data-toggle="dropdown" href="javascript:void(0)">{{ _gettext('With selected') }}<b class="caret"></b></a> <a class="{{ btn_class }}" data-toggle="dropdown" href="javascript:void(0)" role="button" aria-haspopup="true"
<ul class="dropdown-menu"> aria-expanded="false">{{ _gettext('With selected') }}<b class="caret"></b></a>
<div class="dropdown-menu">
{% for p in actions %} {% for p in actions %}
<li> <a class="dropdown-item" href="javascript:void(0)"
<a href="javascript:void(0)" onclick="return modelActions.execute('{{ p[0] }}');">{{ _gettext(p[1]) }}</a> onclick="return modelActions.execute('{{ p[0] }}');">{{ _gettext(p[1]) }}</a>
</li>
{% endfor %} {% endfor %}
</ul> </div>
{% endmacro %} {% endmacro %}
{% macro form(actions, url) %} {% macro form(actions, url) %}
{% if actions %} {% if actions %}
<form id="action_form" action="{{ url }}" method="POST" style="display: none"> <form id="action_form" action="{{ url }}" method="POST" style="display: none">
{% if action_form.csrf_token %} {% if action_form.csrf_token %}
{{ action_form.csrf_token }} {{ action_form.csrf_token }}
{% elif csrf_token %} {% elif csrf_token %}
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/> <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
{% endif %} {% endif %}
{{ action_form.url(value=return_url) }} {{ action_form.url(value=return_url) }}
{{ action_form.action() }} {{ action_form.action() }}
</form> </form>
{% endif %} {% endif %}
{% endmacro %} {% endmacro %}

View file

@ -12,21 +12,22 @@
<meta name="author" content=""> <meta name="author" content="">
{% endblock %} {% endblock %}
{% block head_css %} {% block head_css %}
<link href="{{ admin_static.url(filename='bootstrap/bootstrap3/swatch/{swatch}/bootstrap.min.css'.format(swatch=config.get('FLASK_ADMIN_SWATCH', 'default')), v='3.3.5') }}" rel="stylesheet"> <link href="{{ admin_static.url(filename='bootstrap/bootstrap4/swatch/{swatch}/bootstrap.min.css'.format(swatch=config.get('FLASK_ADMIN_SWATCH', 'default')), v='4.2.1') }}"
{%if config.get('FLASK_ADMIN_SWATCH', 'default') == 'default' %} rel="stylesheet">
<link href="{{ admin_static.url(filename='bootstrap/bootstrap3/css/bootstrap-theme.min.css', v='3.3.5') }}" rel="stylesheet"> {% if config.get('FLASK_ADMIN_SWATCH', 'default') == 'default' %}
{%endif%} <link href="{{ admin_static.url(filename='bootstrap/bootstrap4/css/bootstrap.min.css', v='4.2.1') }}" rel="stylesheet">
<link href="{{ admin_static.url(filename='admin/css/bootstrap3/admin.css', v='1.1.1') }}" rel="stylesheet"> {% endif %}
<link href="{{ admin_static.url(filename='admin/css/bootstrap3/submenu.css') }}" rel="stylesheet"> <link href="{{ admin_static.url(filename='admin/css/bootstrap4/admin.css', v='1.1.1') }}" rel="stylesheet">
<link href="{{ admin_static.url(filename='bootstrap/bootstrap4/css/font-awesome.min.css', v='4.7.0') }}" rel="stylesheet">
{% if admin_view.extra_css %} {% if admin_view.extra_css %}
{% for css_url in admin_view.extra_css %} {% for css_url in admin_view.extra_css %}
<link href="{{ css_url }}" rel="stylesheet"> <link href="{{ css_url }}" rel="stylesheet">
{% endfor %} {% endfor %}
{% endif %} {% endif %}
<style> <style>
body { .hide {
padding-top: 4px; display: none;
} }
</style> </style>
{% endblock %} {% endblock %}
{% block head %} {% block head %}
@ -34,63 +35,65 @@
{% block head_tail %} {% block head_tail %}
{% endblock %} {% endblock %}
</head> </head>
<body> <body>
{% block page_body %} {% block page_body %}
<div class="container{%if config.get('FLASK_ADMIN_FLUID_LAYOUT', False) %}-fluid{% endif %}"> <div class="container{% if config.get('FLASK_ADMIN_FLUID_LAYOUT', False) %}-fluid{% endif %}">
<nav class="navbar navbar-default" role="navigation"> <nav class="navbar navbar-expand-lg navbar-dark bg-dark mb-2" role="navigation">
<!-- Brand and toggle get grouped for better mobile display --> <!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header"> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#admin-navbar-collapse"
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#admin-navbar-collapse"> aria-controls="admin-navbar-collapse" aria-expanded="false" aria-label="Toggle navigation">
<span class="sr-only">Toggle navigation</span> <span class="navbar-toggler-icon"></span>
<span class="icon-bar"></span> </button>
<span class="icon-bar"></span> <!-- navbar content -->
<span class="icon-bar"></span> <div class="collapse navbar-collapse" id="admin-navbar-collapse">
</button> {% block brand %}
{% block brand %} <a class="navbar-brand" href="{{ admin_view.admin.url }}">{{ admin_view.admin.name }}</a>
<a class="navbar-brand" href="{{ admin_view.admin.url }}">{{ admin_view.admin.name }}</a> {% endblock %}
{% endblock %} {% block main_menu %}
</div> <ul class="nav navbar-nav mr-auto">
<!-- navbar content --> {{ layout.menu() }}
<div class="collapse navbar-collapse" id="admin-navbar-collapse"> </ul>
{% block main_menu %} {% endblock %}
<ul class="nav navbar-nav">
{{ layout.menu() }}
</ul>
{% endblock %}
{% block menu_links %} {% block menu_links %}
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
{{ layout.menu_links() }} {{ layout.menu_links() }}
</ul> </ul>
{% endblock %} {% endblock %}
{% block access_control %} {% block access_control %}
{% endblock %} {% endblock %}
</div> </div>
</nav> </nav>
{% block messages %} {% block messages %}
{{ layout.messages() }} {{ layout.messages() }}
{% endblock %} {% endblock %}
{# store the jinja2 context for form_rules rendering logic #} {# store the jinja2 context for form_rules rendering logic #}
{% set render_ctx = h.resolve_ctx() %} {% set render_ctx = h.resolve_ctx() %}
{% block body %}{% endblock %} {% block body %}{% endblock %}
</div> </div>
{% endblock %} {% endblock %}
{% block tail_js %} {% block tail_js %}
<script src="{{ admin_static.url(filename='vendor/jquery.min.js', v='3.5.1') }}" type="text/javascript"></script> <script src="{{ admin_static.url(filename='vendor/jquery.min.js', v='3.5.1') }}" type="text/javascript"></script>
<script src="{{ admin_static.url(filename='bootstrap/bootstrap3/js/bootstrap.min.js', v='3.3.5') }}" type="text/javascript"></script> <script src="{{ admin_static.url(filename='bootstrap/bootstrap4/js/popper.min.js') }}" type="text/javascript"></script>
<script src="{{ admin_static.url(filename='vendor/moment.min.js', v='2.22.2') }}" type="text/javascript"></script> <script src="{{ admin_static.url(filename='bootstrap/bootstrap4/js/bootstrap.min.js', v='4.2.1') }}"
<script src="{{ admin_static.url(filename='vendor/select2/select2.min.js', v='3.5.2') }}" type="text/javascript"></script> type="text/javascript"></script>
<script src="{{ admin_static.url(filename='vendor/moment.min.js', v='2.9.0') }}" type="text/javascript"></script>
<script src="{{ admin_static.url(filename='vendor/bootstrap4/util.js', v='4.3.1') }}" type="text/javascript"></script>
<script src="{{ admin_static.url(filename='vendor/bootstrap4/dropdown.js', v='4.3.1') }}" type="text/javascript"></script>
<script src="{{ admin_static.url(filename='vendor/select2/select2.min.js', v='4.2.1') }}"
type="text/javascript"></script>
<script src="{{ admin_static.url(filename='vendor/multi-level-dropdowns-bootstrap/bootstrap4-dropdown-ml-hack.js') }}" type="text/javascript"></script>
<script src="{{ admin_static.url(filename='admin/js/helpers.js', v='1.0.0') }}" type="text/javascript"></script> <script src="{{ admin_static.url(filename='admin/js/helpers.js', v='1.0.0') }}" type="text/javascript"></script>
{% if admin_view.extra_js %} {% if admin_view.extra_js %}
{% for js_url in admin_view.extra_js %} {% for js_url in admin_view.extra_js %}
<script src="{{ js_url }}" type="text/javascript"></script> <script src="{{ js_url }}" type="text/javascript"></script>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block tail %} {% block tail %}
{% endblock %} {% endblock %}

View file

@ -4,21 +4,23 @@
{% block body %} {% block body %}
{% block breadcrums %} {% block breadcrums %}
<ul class="breadcrumb"> <nav area-label="breadcrumb">
<li> <ol class="breadcrumb">
<li class="breadcrumb-item">
<a href="{{ get_dir_url('.index_view', path=None) }}">{{ _gettext('Root') }}</a> <a href="{{ get_dir_url('.index_view', path=None) }}">{{ _gettext('Root') }}</a>
</li> </li>
{% for name, path in breadcrumbs[:-1] %} {% for name, path in breadcrumbs[:-1] %}
<li> <li class="breadcrumb-item">
<a href="{{ get_dir_url('.index_view', path=path) }}">{{ name }}</a> <a href="{{ get_dir_url('.index_view', path=path) }}">{{ name }}</a>
</li> </li>
{% endfor %} {% endfor %}
{% if breadcrumbs %} {% if breadcrumbs %}
<li> <li class="breadcrumb-item">
<a href="{{ get_dir_url('.index_view', path=breadcrumbs[-1][1]) }}">{{ breadcrumbs[-1][0] }}</a> <a href="{{ get_dir_url('.index_view', path=breadcrumbs[-1][1]) }}">{{ breadcrumbs[-1][0] }}</a>
</li> </li>
{% endif %} {% endif %}
</ul> </ol>
</nav>
{% endblock %} {% endblock %}
{% block file_list_table %} {% block file_list_table %}
@ -32,7 +34,7 @@
<input type="checkbox" name="rowtoggle" class="action-rowtoggle" /> <input type="checkbox" name="rowtoggle" class="action-rowtoggle" />
</th> </th>
{% endif %} {% endif %}
<th class="col-md-1">&nbsp;</th> <th class="">&nbsp;</th>
{% for column in admin_view.column_list %} {% for column in admin_view.column_list %}
<th> <th>
{% if admin_view.is_column_sortable(column) %} {% if admin_view.is_column_sortable(column) %}
@ -84,11 +86,7 @@
{% if name != '..' and admin_view.can_delete_dirs %} {% if name != '..' and admin_view.can_delete_dirs %}
<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) }}
{% if delete_form.csrf_token %} {{ delete_form.csrf_token }}
{{ delete_form.csrf_token }}
{% elif csrf_token %}
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
{% endif %}
<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\\\' recursively?', name=name) }}')">
<i class="fa fa-times glyphicon glyphicon-remove"></i> <i class="fa fa-times glyphicon glyphicon-remove"></i>
</button> </button>
@ -97,11 +95,7 @@
{% else %} {% 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) }}
{% if delete_form.csrf_token %} {{ delete_form.csrf_token }}
{{ delete_form.csrf_token }}
{% elif csrf_token %}
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
{% endif %}
<button onclick="return confirm('{{ _gettext('Are you sure you want to delete \\\'%(name)s\\\'?', name=name) }}')"> <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> <i class="fa fa-trash glyphicon glyphicon-trash"></i>
</button> </button>
@ -152,27 +146,27 @@
<div class="btn-group"> <div class="btn-group">
{%- if admin_view.upload_modal -%} {%- if admin_view.upload_modal -%}
{{ lib.add_modal_button(url=get_dir_url('.upload', path=dir_path, modal=True), {{ lib.add_modal_button(url=get_dir_url('.upload', path=dir_path, modal=True),
btn_class="btn btn-default btn-large", btn_class="btn btn-secondary",
content=_gettext('Upload File')) }} content=_gettext('Upload File')) }}
{% else %} {% else %}
<a class="btn btn-default btn-large" href="{{ get_dir_url('.upload', path=dir_path) }}">{{ _gettext('Upload File') }}</a> <a class="btn btn-secondary" href="{{ get_dir_url('.upload', path=dir_path) }}">{{ _gettext('Upload File') }}</a>
{%- endif -%} {%- endif -%}
</div> </div>
{% endif %} {% endif %}
{% if admin_view.can_mkdir %} {% if admin_view.can_mkdir %}
<div class="btn-group"> <div class="mx-1">
{%- if admin_view.mkdir_modal -%} {%- if admin_view.mkdir_modal -%}
{{ lib.add_modal_button(url=get_dir_url('.mkdir', path=dir_path, modal=True), {{ lib.add_modal_button(url=get_dir_url('.mkdir', path=dir_path, modal=True),
btn_class="btn btn-default btn-large", btn_class="btn btn-secondary",
content=_gettext('Create Directory')) }} content=_gettext('Create Directory')) }}
{% else %} {% else %}
<a class="btn btn-default btn-large" href="{{ get_dir_url('.mkdir', path=dir_path) }}">{{ _gettext('Create Directory') }}</a> <a class="btn btn-secondary" href="{{ get_dir_url('.mkdir', path=dir_path) }}">{{ _gettext('Create Directory') }}</a>
{%- endif -%} {%- endif -%}
</div> </div>
{% endif %} {% endif %}
{% if actions %} {% if actions %}
<div class="btn-group"> <div class="mx-1">
{{ actionslib.dropdown(actions, 'dropdown-toggle btn btn-default btn-large') }} {{ actionslib.dropdown(actions, 'dropdown-toggle btn btn-secondary') }}
</div> </div>
{% endif %} {% endif %}
</div> </div>
@ -193,4 +187,5 @@
{{ actionslib.script(_gettext('Please select at least one file.'), {{ actionslib.script(_gettext('Please select at least one file.'),
actions, actions,
actions_confirmation) }} actions_confirmation) }}
<script src="{{ admin_static.url(filename='admin/js/bs4_modal.js', v='1.0.0') }}"></script>
{% endblock %} {% endblock %}

View file

@ -4,8 +4,8 @@
{% block body %} {% block body %}
{# content added to modal-content #} {# content added to modal-content #}
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
{% block header %}<h3>{{ header_text }}</h3>{% endblock %} {% block header %}<h3>{{ header_text }}</h3>{% endblock %}
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
{% block fa_form %} {% block fa_form %}
@ -15,5 +15,5 @@
{% endblock %} {% endblock %}
{% block tail %} {% block tail %}
<script src="{{ admin_static.url(filename='admin/js/bs3_modal.js', v='1.0.0') }}"></script> <script src="{{ admin_static.url(filename='admin/js/bs4_modal.js', v='1.0.0') }}"></script>
{% endblock %} {% endblock %}

View file

@ -1,20 +1,21 @@
{% macro menu_icon(item) -%} {% macro menu_icon(item) -%}
{% set icon_type = item.get_icon_type() %} {% set icon_type = item.get_icon_type() %}
{%- if icon_type %} {%- if icon_type %}
{% set icon_value = item.get_icon_value() %} {% set icon_value = item.get_icon_value() %}
{% if icon_type == 'glyph' %} {% if icon_type == 'glyph' %}
<i class="glyphicon {{ icon_value }}"></i> <i class="glyphicon {{ icon_value }}"></i>
{% elif icon_type == 'fa' %} {% elif icon_type == 'fa' %}
<i class="fa {{ icon_value }}"></i> <i class="fa {{ icon_value }}"></i>
{% elif icon_type == 'image' %} {% elif icon_type == 'image' %}
<img src="{{ url_for('static', filename=icon_value) }}" alt="menu image"> <img src="{{ url_for('static', filename=icon_value) }}" alt="menu image">
{% elif icon_type == 'image-url' %} {% elif icon_type == 'image-url' %}
<img src="{{ icon_value }}" alt="menu image"> <img src="{{ icon_value }}" alt="menu image">
{% endif %}
{% endif %} {% endif %}
{% endif %}
{%- endmacro %} {%- endmacro %}
{% macro menu(menu_root=None) %} {% macro menu(menu_root=None) %}
{% set is_main_nav = menu_root == None %}
{% if menu_root is none %}{% set menu_root = admin_view.admin.menu() %}{% endif %} {% if menu_root is none %}{% set menu_root = admin_view.admin.menu() %}{% endif %}
{%- for item in menu_root %} {%- for item in menu_root %}
{%- if item.is_category() -%} {%- if item.is_category() -%}
@ -22,49 +23,52 @@
{%- if children %} {%- if children %}
{% set class_name = item.get_class_name() or '' %} {% set class_name = item.get_class_name() or '' %}
{%- if item.is_active(admin_view) %} {%- if item.is_active(admin_view) %}
<li class="active dropdown{% if class_name %} {{class_name}}{% endif %}"> <li class="active dropdown{% if class_name %} {{ class_name }}{% endif %}">
{% else -%} {% else -%}
<li class="dropdown{% if class_name %} {{class_name}}{% endif %}"> <li class="dropdown{% if class_name %} {{ class_name }}{% endif %}">
{%- endif %} {%- endif %}
<a class="dropdown-toggle" data-toggle="dropdown" href="javascript:void(0)"> <a class="dropdown-toggle {% if is_main_nav %}nav-link{% else %}dropdown-item{% endif %}" data-toggle="dropdown" href="javascript:void(0)">
{% if item.class_name %}<span class="{{ item.class_name }}"></span> {% endif %} {% if item.class_name %}<span class="{{ item.class_name }}"></span> {% endif %}
{{ menu_icon(item) }}{{ item.name }} {{ menu_icon(item) }}{{ item.name }}
{%- if 'dropdown-submenu' in class_name -%} {%- if 'dropdown-submenu' in class_name -%}
<i class="glyphicon glyphicon-chevron-right small"></i> <i class="glyphicon glyphicon-chevron-right small"></i>
{%- else -%} {%- else -%}
<i class="glyphicon glyphicon-chevron-down small"></i> <i class="glyphicon glyphicon-chevron-down small"></i>
{%- endif -%} {%- endif -%}
</a> </a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
{%- for child in children -%} {%- for child in children -%}
{%- if child.is_category() -%} {%- if child.is_category() -%}
{{ menu(menu_root=[child]) }} {{ menu(menu_root=[child]) }}
{% else %} {% else %}
{% set class_name = child.get_class_name() %} {% set class_name = child.get_class_name() %}
<li{% if class_name %} class="{{ class_name }}"{% endif %}>
{%- if child.is_active(admin_view) %} {%- if child.is_active(admin_view) %}
<li class="active{% if class_name %} {{class_name}}{% endif %}"> <a class="dropdown-item active" href="{{ child.get_url() }}"{% if child.target %}
target="{{ child.target }}"{% endif %}>
{{ menu_icon(child) }}{{ child.name }}</a>
{% else %} {% else %}
<li{% if class_name %} class="{{class_name}}"{% endif %}> <a class="dropdown-item" href="{{ child.get_url() }}"{% if child.target %}
target="{{ child.target }}"{% endif %}>
{{ menu_icon(child) }}{{ child.name }}</a>
{%- endif %} {%- endif %}
<a href="{{ child.get_url() }}"{% if child.target %} </li>
target="{{ child.target }}"{% endif %}> {%- endif %}
{{ menu_icon(child) }}{{ child.name }}</a> {%- endfor %}
</li> </ul>
{%- endif %} </li>
{%- endfor %}
</ul>
</li>
{% endif %} {% endif %}
{%- else %} {%- else %}
{%- if item.is_accessible() and item.is_visible() -%} {%- if item.is_accessible() and item.is_visible() -%}
{% set class_name = item.get_class_name() %} {% set class_name = item.get_class_name() %}
{%- if item.is_active(admin_view) %} {%- if item.is_active(admin_view) %}
<li class="active{% if class_name %} {{class_name}}{% endif %}"> <li class="active{% if class_name %} {{ class_name }}{% endif %}">
{%- else %} {%- else %}
<li{% if class_name %} class="{{class_name}}"{% endif %}> <li{% if class_name %} class="{{ class_name }}"{% endif %}>
{%- endif %} {%- endif %}
<a href="{{ item.get_url() }}"{% if item.target %} target="{{ item.target }}"{% endif %}>{{ menu_icon(item) }}{{ item.name }}</a> <a class="nav-link" href="{{ item.get_url() }}"{% if item.target %} target="{{ item.target }}"{% endif %}>
</li> {{ menu_icon(item) }}{{ item.name }}</a>
</li>
{%- endif -%} {%- endif -%}
{% endif -%} {% endif -%}
{% endfor %} {% endfor %}
@ -76,7 +80,8 @@
{% set class_name = item.get_class_name() %} {% set class_name = item.get_class_name() %}
{% if item.is_accessible() and item.is_visible() %} {% if item.is_accessible() and item.is_visible() %}
<li{% if class_name %} class="{{ class_name }}"{% endif %}> <li{% if class_name %} class="{{ class_name }}"{% endif %}>
<a href="{{ item.get_url() }}">{{ menu_icon(item) }}{{ item.name }}</a> <a class="nav-link" href="{{ item.get_url() }}"{% if item.target %} target="{{ item.target }}"{% endif %}>
{{ menu_icon(item) }}{{ item.name }}</a>
</li> </li>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
@ -87,15 +92,15 @@
{% if messages %} {% if messages %}
{% for category, m in messages %} {% for category, m in messages %}
{% if category %} {% if category %}
{# alert-error changed to alert-danger in bootstrap 3, mapping is for backwards compatibility #} {# alert-error changed to alert-danger in bootstrap 3, mapping is for backwards compatibility #}
{% set mapping = {'message': 'info', 'error': 'danger'} %} {% set mapping = {'message': 'info', 'error': 'danger'} %}
<div class="alert alert-{{ mapping.get(category, category) }} alert-dismissable"> <div class="alert alert-{{ mapping.get(category, category) }} alert-dismissable">
{% else %} {% else %}
<div class="alert alert-dismissable"> <div class="alert alert-dismissable">
{% endif %} {% endif %}
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
{{ m }} {{ m }}
</div> </div>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% endwith %} {% endwith %}

View file

@ -22,52 +22,52 @@
{% endif %} {% endif %}
{% if min > 0 %} {% if min > 0 %}
<li> <li class="page-item">
<a href="{{ generator(0) }}">&laquo;</a> <a class="page-link" href="{{ generator(0) }}">&laquo;</a>
</li> </li>
{% else %} {% else %}
<li class="disabled"> <li class="page-item disabled">
<a href="javascript:void(0)">&laquo;</a> <a class="page-link" href="javascript:void(0)">&laquo;</a>
</li> </li>
{% endif %} {% endif %}
{% if page > 0 %} {% if page > 0 %}
<li> <li class="page-item">
<a href="{{ generator(page-1) }}">&lt;</a> <a class="page-link" href="{{ generator(page-1) }}">&lt;</a>
</li> </li>
{% else %} {% else %}
<li class="disabled"> <li class="page-item disabled">
<a href="javascript:void(0)">&lt;</a> <a class="page-link" href="javascript:void(0)">&lt;</a>
</li> </li>
{% endif %} {% endif %}
{% for p in range(min, max) %} {% for p in range(min, max) %}
{% if page == p %} {% if page == p %}
<li class="active"> <li class="page-item active">
<a href="javascript:void(0)">{{ p + 1 }}</a> <a class="page-link" href="javascript:void(0)">{{ p + 1 }}</a>
</li> </li>
{% else %} {% else %}
<li> <li class="page-item">
<a href="{{ generator(p) }}">{{ p + 1 }}</a> <a class="page-link" href="{{ generator(p) }}">{{ p + 1 }}</a>
</li> </li>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% if page + 1 < pages %} {% if page + 1 < pages %}
<li> <li class="page-item">
<a href="{{ generator(page + 1) }}">&gt;</a> <a class="page-link" href="{{ generator(page + 1) }}">&gt;</a>
</li> </li>
{% else %} {% else %}
<li class="disabled"> <li class="page-item disabled">
<a href="javascript:void(0)">&gt;</a> <a class="page-link" href="javascript:void(0)">&gt;</a>
</li> </li>
{% endif %} {% endif %}
{% if max < pages %} {% if max < pages %}
<li> <li class="page-item">
<a href="{{ generator(pages - 1) }}">&raquo;</a> <a class="page-link" href="{{ generator(pages - 1) }}">&raquo;</a>
</li> </li>
{% else %} {% else %}
<li class="disabled"> <li class="page-item disabled">
<a href="javascript:void(0)">&raquo;</a> <a class="page-link" href="javascript:void(0)">&raquo;</a>
</li> </li>
{% endif %} {% endif %}
</ul> </ul>
@ -77,20 +77,20 @@
{% macro simple_pager(page, have_next, generator) -%} {% macro simple_pager(page, have_next, generator) -%}
<ul class="pagination"> <ul class="pagination">
{% if page > 0 %} {% if page > 0 %}
<li> <li class="page-item">
<a href="{{ generator(page - 1) }}">&lt;</a> <a href="{{ generator(page - 1) }}">&lt;</a>
</li> </li>
{% else %} {% else %}
<li class="disabled"> <li class="page-item disabled">
<a href="{{ generator(0) }}">&lt;</a> <a href="{{ generator(0) }}">&lt;</a>
</li> </li>
{% endif %} {% endif %}
{% if have_next %} {% if have_next %}
<li> <li class="page-item">
<a href="{{ generator(page + 1) }}">&gt;</a> <a href="{{ generator(page + 1) }}">&gt;</a>
</li> </li>
{% else %} {% else %}
<li class="disabled"> <li class="page-item disabled">
<a href="{{ generator(page) }}">&gt;</a> <a href="{{ generator(page) }}">&gt;</a>
</li> </li>
{% endif %} {% endif %}
@ -100,7 +100,7 @@
{# ---------------------- Modal Window ------------------- #} {# ---------------------- Modal Window ------------------- #}
{% macro add_modal_window(modal_window_id='fa_modal_window', modal_label_id='fa_modal_label') %} {% macro add_modal_window(modal_window_id='fa_modal_window', modal_label_id='fa_modal_label') %}
<div class="modal fade" id="{{ modal_window_id }}" tabindex="-1" role="dialog" aria-labelledby="{{ modal_label_id }}"> <div class="modal fade" id="{{ modal_window_id }}" tabindex="-1" role="dialog" aria-labelledby="{{ modal_label_id }}">
<div class="modal-dialog" role="document"> <div class="modal-dialog modal-xl" role="document">
{# bootstrap version > 3.1.0 required for this to work #} {# bootstrap version > 3.1.0 required for this to work #}
<div class="modal-content"> <div class="modal-content">
</div> </div>
@ -117,28 +117,52 @@
{# ---------------------- Forms -------------------------- #} {# ---------------------- Forms -------------------------- #}
{% macro render_field(form, field, kwargs={}, caller=None) %} {% macro render_field(form, field, kwargs={}, caller=None) %}
{% set direct_error = h.is_field_error(field.errors) %} {% set direct_error = h.is_field_error(field.errors) %}
<div class="form-group{{ ' has-error' if direct_error else '' }}"> {% set prepend = kwargs.pop('prepend', None) %}
<label for="{{ field.id }}" class="col-md-2 control-label">{{ field.label.text }} {% set append = kwargs.pop('append', None) %}
<div class="form-group {{ kwargs.get('column_class', '') }}">
<label for="{{ field.id }}" class="control-label" {% if field.widget.input_type == 'checkbox' %}style="display: block"{% endif %}>{{ field.label.text }}
{% if h.is_required_form_field(field) %} {% if h.is_required_form_field(field) %}
<strong style="color: red">&#42;</strong> <strong style="color: red">&#42;</strong>
{%- else -%} {%- else -%}
&nbsp; &nbsp;
{%- endif %} {%- endif %}
</label> </label>
<div class="{{ kwargs.get('column_class', 'col-md-10') }}"> {% if prepend or append %}
{% set _dummy = kwargs.setdefault('class', 'form-control') %} <div class="input-group">
{{ field(**kwargs)|safe }} {%- if prepend -%}
{% if field.description %} <div class="input-group-prepend">
<p class="help-block">{{ field.description|safe }}</p> {{ prepend }}
</div>
{%- endif -%}
{% endif %}
{% if field.widget.input_type == 'checkbox' %}
{% set _class = kwargs.setdefault('class', 'form-control-lg') %}
{% elif field.widget.input_type == 'file' %}
{% set _class = kwargs.setdefault('class', 'form-control-file') %}
{% else %}
{% set _class = kwargs.setdefault('class', 'form-control') %}
{% endif %} {% endif %}
{%- if direct_error %} {% set _ = kwargs.update({'class': kwargs['class'] ~ ' is-invalid'}) %} {% endif -%}
{{ field(**kwargs) | safe }}
{%- if append -%}
<div class="input-group-append">
{{ append }}
</div>
{%- endif -%}
{% if direct_error %} {% if direct_error %}
<ul class="help-block input-errors"> <div class="invalid-feedback">
{% for e in field.errors if e is string %} <ul class="help-block">
<li>{{ e }}</li> {% for e in field.errors if e is string %}
{% endfor %} <li>{{ e }}</li>
</ul> {% endfor %}
</ul>
</div>
{% elif field.description %}
<div class="help-block">{{ field.description|safe }}</div>
{% endif %} {% endif %}
{% if prepend or append %}
</div> </div>
{% endif %}
{% if caller %} {% if caller %}
{{ caller(form, field, direct_error, kwargs) }} {{ caller(form, field, direct_error, kwargs) }}
{% endif %} {% endif %}
@ -178,12 +202,23 @@
{% endmacro %} {% endmacro %}
{% macro form_tag(form=None, action=None) %} {% macro form_tag(form=None, action=None) %}
<form action="{{ action or '' }}" method="POST" role="form" class="admin-form form-horizontal" enctype="multipart/form-data"> <form action="{{ action or '' }}" method="POST" role="form" class="admin-form" enctype="multipart/form-data">
<fieldset>
{{ caller() }} {{ caller() }}
</fieldset>
</form> </form>
{% endmacro %} {% endmacro %}
{% macro render_form_buttons(cancel_url, extra=None, is_modal=False) %} {% macro render_form_buttons(cancel_url, extra=None, is_modal=False) %}
{% if is_modal %}
<input type="submit" class="btn btn-primary" value="{{ _gettext('Save') }}" />
{% if extra %}
{{ extra }}
{% endif %}
{% if cancel_url %}
<a href="{{ cancel_url }}" class="btn btn-danger" role="button" {% if is_modal %}data-dismiss="modal"{% endif %}>{{ _gettext('Cancel') }}</a>
{% endif %}
{% else %}
<hr> <hr>
<div class="form-group"> <div class="form-group">
<div class="col-md-offset-2 col-md-10 submit-row"> <div class="col-md-offset-2 col-md-10 submit-row">
@ -196,6 +231,7 @@
{% endif %} {% endif %}
</div> </div>
</div> </div>
{% endif %}
{% endmacro %} {% endmacro %}
{% macro render_form(form, cancel_url, extra=None, form_opts=None, action=None, is_modal=False) -%} {% macro render_form(form, cancel_url, extra=None, form_opts=None, action=None, is_modal=False) -%}
@ -206,15 +242,15 @@
{% endmacro %} {% endmacro %}
{% macro form_css() %} {% macro form_css() %}
<link href="{{ admin_static.url(filename='vendor/select2/select2.css', v='3.5.2') }}" rel="stylesheet"> <link href="{{ admin_static.url(filename='vendor/select2/select2.css', v='4.2.1') }}" rel="stylesheet">
<link href="{{ admin_static.url(filename='vendor/select2/select2-bootstrap3.css', v='1.4.6') }}" rel="stylesheet"> <link href="{{ admin_static.url(filename='vendor/select2/select2-bootstrap4.css', v='1.4.6') }}" rel="stylesheet">
<link href="{{ admin_static.url(filename='vendor/bootstrap-daterangepicker/daterangepicker-bs3.css', v='1.3.22') }}" rel="stylesheet"> <link href="{{ admin_static.url(filename='vendor/bootstrap-daterangepicker/daterangepicker-bs4.css', v='1.3.22') }}" rel="stylesheet">
{% if config.MAPBOX_MAP_ID %} {% if config.MAPBOX_MAP_ID %}
<link href="{{ admin_static.url(filename='vendor/leaflet/leaflet.css', v='1.0.2') }}" rel="stylesheet"> <link href="{{ admin_static.url(filename='vendor/leaflet/leaflet.css', v='1.0.2') }}" rel="stylesheet">
<link href="{{ admin_static.url(filename='vendor/leaflet/leaflet.draw.css', v='0.4.6') }}" rel="stylesheet"> <link href="{{ admin_static.url(filename='vendor/leaflet/leaflet.draw.css', v='0.4.6') }}" rel="stylesheet">
{% endif %} {% endif %}
{% if editable_columns %} {% if editable_columns %}
<link href="{{ admin_static.url(filename='vendor/x-editable/css/bootstrap3-editable.css', v='1.5.1.1') }}" rel="stylesheet"> <link href="{{ admin_static.url(filename='vendor/x-editable/css/bootstrap4-editable.css', v='1.5.1.1') }}" rel="stylesheet">
{% endif %} {% endif %}
{% endmacro %} {% endmacro %}
@ -241,16 +277,16 @@
{% endif %} {% endif %}
<script src="{{ admin_static.url(filename='vendor/bootstrap-daterangepicker/daterangepicker.js', v='1.3.22') }}"></script> <script src="{{ admin_static.url(filename='vendor/bootstrap-daterangepicker/daterangepicker.js', v='1.3.22') }}"></script>
{% if editable_columns %} {% if editable_columns %}
<script src="{{ admin_static.url(filename='vendor/x-editable/js/bootstrap3-editable.min.js', v='1.5.1.1') }}"></script> <script src="{{ admin_static.url(filename='vendor/x-editable/js/bootstrap4-editable.min.js', v='1.5.1.1') }}"></script>
{% endif %} {% endif %}
<script src="{{ admin_static.url(filename='admin/js/form.js', v='1.0.1') }}"></script> <script src="{{ admin_static.url(filename='admin/js/form.js', v='1.0.1') }}"></script>
{% endmacro %} {% endmacro %}
{% macro extra() %} {% macro extra() %}
{% if admin_view.can_create %} {% if admin_view.can_create %}
<input name="_add_another" type="submit" class="btn btn-default" value="{{ _gettext('Save and Add Another') }}" /> <input name="_add_another" type="submit" class="btn btn-secondary" value="{{ _gettext('Save and Add Another') }}" />
{% endif %} {% endif %}
{% if admin_view.can_edit %} {% if admin_view.can_edit %}
<input name="_continue_editing" type="submit" class="btn btn-default" value="{{ _gettext('Save and Continue Editing') }}" /> <input name="_continue_editing" type="submit" class="btn btn-secondary" value="{{ _gettext('Save and Continue Editing') }}" />
{% endif %} {% endif %}
{% endmacro %} {% endmacro %}

View file

@ -10,11 +10,11 @@
{% block body %} {% block body %}
{% block navlinks %} {% block navlinks %}
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li> <li class="nav-item">
<a href="{{ return_url }}">{{ _gettext('List') }}</a> <a href="{{ return_url }}" class="nav-link">{{ _gettext('List') }}</a>
</li> </li>
<li class="active"> <li class="nav-item">
<a href="javascript:void(0)">{{ _gettext('Create') }}</a> <a href="javascript:void(0)" class="nav-link active">{{ _gettext('Create') }}</a>
</li> </li>
</ul> </ul>
{% endblock %} {% endblock %}

View file

@ -4,29 +4,29 @@
{% block body %} {% block body %}
{% block navlinks %} {% block navlinks %}
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li> <li class="nav-item">
<a href="{{ return_url }}">{{ _gettext('List') }}</a> <a class="nav-link" href="{{ return_url }}">{{ _gettext('List') }}</a>
</li> </li>
{%- if admin_view.can_create -%} {%- if admin_view.can_create -%}
<li> <li class="nav-item">
<a href="{{ get_url('.create_view', url=return_url) }}">{{ _gettext('Create') }}</a> <a class="nav-link" href="{{ get_url('.create_view', url=return_url) }}">{{ _gettext('Create') }}</a>
</li> </li>
{%- endif -%} {%- endif -%}
{%- if admin_view.can_edit -%} {%- if admin_view.can_edit -%}
<li> <li class="nav-item">
<a href="{{ get_url('.edit_view', id=request.args.get('id'), url=return_url) }}">{{ _gettext('Edit') }}</a> <a class="nav-link" href="{{ get_url('.edit_view', id=request.args.get('id'), url=return_url) }}">{{ _gettext('Edit') }}</a>
</li> </li>
{%- endif -%} {%- endif -%}
<li class="active"> <li class="nav-item">
<a href="javascript:void(0)">{{ _gettext('Details') }}</a> <a class="nav-link active disabled" href="javascript:void(0)">{{ _gettext('Details') }}</a>
</li> </li>
</ul> </ul>
{% endblock %} {% endblock %}
{% block details_search %} {% block details_search %}
<div class="input-group fa_filter_container col-lg-6"> <div class="form-inline fa_filter_container col-lg-6">
<span class="input-group-addon">{{ _gettext('Filter') }}</span> <label for="fa_filter">{{ _gettext('Filter') }}</label>
<input id="fa_filter" type="text" class="form-control"> <input id="fa_filter" type="text" class="ml-3 form-control">
</div> </div>
{% endblock %} {% endblock %}

View file

@ -10,20 +10,20 @@
{% block body %} {% block body %}
{% block navlinks %} {% block navlinks %}
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li> <li class="nav-item">
<a href="{{ return_url }}">{{ _gettext('List') }}</a> <a href="{{ return_url }}" class="nav-link">{{ _gettext('List') }}</a>
</li> </li>
{%- if admin_view.can_create -%} {%- if admin_view.can_create -%}
<li> <li class="nav-item">
<a href="{{ get_url('.create_view', url=return_url) }}">{{ _gettext('Create') }}</a> <a href="{{ get_url('.create_view', url=return_url) }}" class="nav-link">{{ _gettext('Create') }}</a>
</li> </li>
{%- endif -%} {%- endif -%}
<li class="active"> <li class="nav-item">
<a href="javascript:void(0)">{{ _gettext('Edit') }}</a> <a href="javascript:void(0)" class="nav-link active">{{ _gettext('Edit') }}</a>
</li> </li>
{%- if admin_view.can_view_details -%} {%- if admin_view.can_view_details -%}
<li> <li class="nav-item">
<a href="{{ get_url('.details_view', id=request.args.get('id'), url=return_url) }}">{{ _gettext('Details') }}</a> <a class="nav-link" href="{{ get_url('.details_view', id=request.args.get('id'), url=return_url) }}">{{ _gettext('Details') }}</a>
</li> </li>
{%- endif -%} {%- endif -%}
</ul> </ul>

View file

@ -3,7 +3,7 @@
{# existing inline form fields #} {# existing inline form fields #}
<div class="inline-field-list"> <div class="inline-field-list">
{% for subfield in field %} {% for subfield in field %}
<div id="{{ subfield.id }}" class="inline-field well well-sm"> <div id="{{ subfield.id }}" class="inline-field card card-body bg-light">
{%- if not check or check(subfield) %} {%- if not check or check(subfield) %}
<legend> <legend>
<small> <small>
@ -28,7 +28,7 @@
{# template for new inline form fields #} {# template for new inline form fields #}
<div class="inline-field-template hide"> <div class="inline-field-template hide">
{% filter forceescape %} {% filter forceescape %}
<div class="inline-field well well-sm"> <div class="inline-field card card-body bg-light">
<legend> <legend>
<small>{{ _gettext('New') }} {{ field.label.text }}</small> <small>{{ _gettext('New') }} {{ field.label.text }}</small>
<div class="pull-right"> <div class="pull-right">
@ -40,6 +40,6 @@
</div> </div>
{% endfilter %} {% endfilter %}
</div> </div>
<a id="{{ field.id }}-button" href="javascript:void(0)" class="btn btn-default" onclick="faForm.addInlineField(this, '{{ field.id }}');">{{ _gettext('Add') }} {{ field.label.text }}</a> <a id="{{ field.id }}-button" href="javascript:void(0)" class="btn btn-primary" role="button" onclick="faForm.addInlineField(this, '{{ field.id }}');">{{ _gettext('Add') }} {{ field.label.text }}</a>
</div> </div>
{% endmacro %} {% endmacro %}

View file

@ -1,58 +1,51 @@
{% macro filter_options(btn_class='dropdown-toggle') %} {% macro filter_options(btn_class='dropdown-toggle') %}
<a class="{{ btn_class }}" data-toggle="dropdown" href="javascript:void(0)"> <a class="nav-link {{ btn_class }}" data-toggle="dropdown" href="javascript:void(0)">{{ _gettext('Add Filter') }}<b class="caret"></b></a>
{{ _gettext('Add Filter') }}<b class="caret"></b> <div class="dropdown-menu field-filters">
</a>
<ul class="dropdown-menu field-filters">
{% for k in filter_groups %} {% for k in filter_groups %}
<li> <a href="javascript:void(0)" class="dropdown-item filter" onclick="return false;">{{ k }}</a>
<a href="javascript:void(0)" class="filter" onclick="return false;">{{ k }}</a>
</li>
{% endfor %} {% endfor %}
</ul> </div>
{% endmacro %} {% endmacro %}
{% macro export_options(btn_class='dropdown-toggle') %} {% macro export_options(btn_class='dropdown-toggle') %}
{% if admin_view.export_types|length > 1 %} {% if admin_view.export_types|length > 1 %}
<li class="dropdown"> <li class="dropdown">
<a class="{{ btn_class }}" data-toggle="dropdown" href="javascript:void(0)"> <a class="nav-link {{ btn_class }}" data-toggle="dropdown" href="javascript:void(0)" role="button"
{{ _gettext('Export') }}<b class="caret"></b> aria-haspopup="true" aria-expanded="false">{{ _gettext('Export') }}<b class="caret"></b></a>
</a> <div class="dropdown-menu">
<ul class="dropdown-menu field-filters"> {% for export_type in admin_view.export_types %}
{% for export_type in admin_view.export_types %} <a class="dropdown-item"
<li> href="{{ get_url('.export', export_type=export_type, **request.args) }}"
<a href="{{ get_url('.export', export_type=export_type, **request.args) }}" title="{{ _gettext('Export') }}">{{ _gettext('Export') + ' ' + export_type|upper }}</a> title="{{ _gettext('Export') }}">{{ _gettext('Export') + ' ' + export_type|upper }}</a>
</li> {% endfor %}
{% endfor %} </div>
</ul> </li>
</li>
{% else %} {% else %}
<li> <li>
<a href="{{ get_url('.export', export_type=admin_view.export_types[0], **request.args) }}" title="{{ _gettext('Export') }}">{{ _gettext('Export') }}</a> <a class="nav-link" href="{{ get_url('.export', export_type=admin_view.export_types[0], **request.args) }}"
</li> title="{{ _gettext('Export') }}">{{ _gettext('Export') }}</a>
</li>
{% endif %} {% endif %}
{% endmacro %} {% endmacro %}
{% macro filter_form() %} {% macro filter_form() %}
<form id="filter_form" method="GET" action="{{ return_url }}"> <form id="filter_form" method="GET" action="{{ return_url }}">
{% for arg_name, arg_value in extra_args.items() %}
<input type="hidden" name="{{ arg_name }}" value="{{ arg_value }}">
{% endfor %}
{% if sort_column is not none %} {% if sort_column is not none %}
<input type="hidden" name="sort" value="{{ sort_column }}"> <input type="hidden" name="sort" value="{{ sort_column }}">
{% endif %} {% endif %}
{% if sort_desc %} {% if sort_desc %}
<input type="hidden" name="desc" value="{{ sort_desc }}"> <input type="hidden" name="desc" value="{{ sort_desc }}">
{% endif %} {% endif %}
{% if search %} {% if search %}
<input type="hidden" name="search" value="{{ search }}"> <input type="hidden" name="search" value="{{ search }}">
{% endif %} {% endif %}
{% if page_size != default_page_size %} {% if page_size != default_page_size %}
<input type="hidden" name="page_size" value="{{ page_size }}"> <input type="hidden" name="page_size" value="{{ page_size }}">
{% endif %} {% endif %}
<div class="pull-right"> <div class="pull-right">
<button type="submit" class="btn btn-primary" style="display: none">{{ _gettext('Apply') }}</button> <button type="submit" class="btn btn-primary" style="display: none">{{ _gettext('Apply') }}</button>
{% if active_filters %} {% if active_filters %}
<a href="{{ clear_search_url }}" class="btn btn-default">{{ _gettext('Reset Filters') }}</a> <a href="{{ clear_search_url }}" class="btn btn-secondary">{{ _gettext('Reset Filters') }}</a>
{% endif %} {% endif %}
</div> </div>
@ -61,47 +54,53 @@
<div class="clearfix"></div> <div class="clearfix"></div>
{% endmacro %} {% endmacro %}
{% macro search_form(input_class=None) %} {% macro search_form(input_class="col-auto") %}
<form method="GET" action="{{ return_url }}" class="navbar-form navbar-left" role="search"> <form method="GET" action="{{ return_url }}" class="form-inline my-2 my-lg-0" role="search">
{% for flt_name, flt_value in filter_args.items() %} {% for flt_name, flt_value in filter_args.items() %}
<input type="hidden" name="{{ flt_name }}" value="{{ flt_value }}"> <input type="hidden" name="{{ flt_name }}" value="{{ flt_value }}">
{% endfor %} {% endfor %}
{% for arg_name, arg_value in extra_args.items() %} {% if page_size != default_page_size %}
<input type="hidden" name="{{ arg_name }}" value="{{ arg_value }}"> <input type="hidden" name="page_size" value="{{ page_size }}">
{% endfor %} {% endif %}
{% if page_size != default_page_size %} {% for arg_name, arg_value in extra_args.items() %}
<input type="hidden" name="page_size" value="{{ page_size }}"> <input type="hidden" name="{{ arg_name }}" value="{{ arg_value }}">
{% endif %} {% endfor %}
{% if sort_column is not none %} {% if sort_column is not none %}
<input type="hidden" name="sort" value="{{ sort_column }}"> <input type="hidden" name="sort" value="{{ sort_column }}">
{% endif %} {% endif %}
{% if sort_desc %} {% if sort_desc %}
<input type="hidden" name="desc" value="{{ sort_desc }}"> <input type="hidden" name="desc" value="{{ sort_desc }}">
{% endif %} {% endif %}
{%- set full_search_placeholder = _gettext('Search') %} {% if search %}
{%- set max_size = config.get('FLASK_ADMIN_SEARCH_SIZE_MAX', 100) %} <div class="form-inline input-group">
{%- if search_placeholder %}{% set full_search_placeholder = [full_search_placeholder, search_placeholder] | join(": ") %}{% endif %} <input class="form-control {{ input_class }}" size="30" type="text" name="search" value="{{ search }}"
{%- set input_size = [[full_search_placeholder | length, 30] | max, max_size] | min %} placeholder="{{ _gettext('%(placeholder)s', placeholder=search_placeholder) }}">
{% if search %} <div class="input-group-append">
<div class="input-group"> <span class="input-group-text">
<input type="search" name="search" value="{{ search }}" class="form-control{% if input_class %} {{ input_class }}{% endif %}" size="{{ input_size }}" placeholder="{{ full_search_placeholder }}"> <a href="{{ clear_search_url }}" class="align-middle">
<a href="{{ clear_search_url }}" class="input-group-addon clear"><span class="fa fa-times glyphicon glyphicon-remove"></span></a> <span class="fa fa-times glyphicon glyphicon-remove"></span>
</div> </a>
{% else %} </span>
<div class="form-group"> </div>
<input type="search" name="search" value="" class="form-control{% if input_class %} {{ input_class }}{% endif %}" size="{{ input_size }}" placeholder="{{ full_search_placeholder }}"> <button class="btn btn-secondary my-2 my-sm-0 ml-2" type="submit">{{ _gettext('Search') }}</button>
</div> </div>
{% endif %} {% else %}
</form> <div class="form-inline">
<input class="form-control {{ input_class }}" size="30" type="text" name="search" value=""
placeholder="{{ _gettext('%(placeholder)s', placeholder=search_placeholder) }}">
<button class="btn btn-secondary my-2 my-sm-0 ml-2" type="submit">{{ _gettext('Search') }}</button>
</div>
{% endif %}
</form>
{% endmacro %} {% endmacro %}
{% macro page_size_form(generator, btn_class='dropdown-toggle') %} {% macro page_size_form(generator, btn_class='nav-link dropdown-toggle') %}
<a class="{{ btn_class }}" data-toggle="dropdown" href="javascript:void(0)"> <a class="{{ btn_class }}" data-toggle="dropdown" href="javascript:void(0)">
{{ page_size }} {{ _gettext('items') }}<b class="caret"></b> {{ page_size }} {{ _gettext('items') }}<b class="caret"></b>
</a> </a>
<ul class="dropdown-menu"> <div class="dropdown-menu">
<li><a href="{{ generator(20) }}">20 {{ _gettext('items') }}</a></li> <a class="dropdown-item{% if page_size == 20 %} active{% endif %}" href="{{ generator(20) }}">20 {{ _gettext('items') }}</a>
<li><a href="{{ generator(50) }}">50 {{ _gettext('items') }}</a></li> <a class="dropdown-item{% if page_size == 50 %} active{% endif %}" href="{{ generator(50) }}">50 {{ _gettext('items') }}</a>
<li><a href="{{ generator(100) }}">100 {{ _gettext('items') }}</a></li> <a class="dropdown-item{% if page_size == 100 %} active{% endif %}" href="{{ generator(100) }}">100 {{ _gettext('items') }}</a>
</ul> </div>
{% endmacro %} {% endmacro %}

View file

@ -12,17 +12,17 @@
{% block body %} {% block body %}
{% block model_menu_bar %} {% block model_menu_bar %}
<ul class="nav nav-tabs actions-nav"> <ul class="nav nav-tabs">
<li class="active"> <li class="nav-item">
<a href="javascript:void(0)">{{ _gettext('List') }}{% if count %} ({{ count }}){% endif %}</a> <a href="javascript:void(0)" class="nav-link active">{{ _gettext('List') }}{% if count %} ({{ count }}){% endif %}</a>
</li> </li>
{% if admin_view.can_create %} {% if admin_view.can_create %}
<li> <li class="nav-item">
{%- if admin_view.create_modal -%} {%- if admin_view.create_modal -%}
{{ lib.add_modal_button(url=get_url('.create_view', url=return_url, modal=True), title=_gettext('Create New Record'), content=_gettext('Create')) }} {{ lib.add_modal_button(url=get_url('.create_view', url=return_url, modal=True), btn_class='nav-link', title=_gettext('Create New Record'), content=_gettext('Create')) }}
{% else %} {% else %}
<a href="{{ get_url('.create_view', url=return_url) }}" title="{{ _gettext('Create New Record') }}">{{ _gettext('Create') }}</a> <a href="{{ get_url('.create_view', url=return_url) }}" title="{{ _gettext('Create New Record') }}" class="nav-link">{{ _gettext('Create') }}</a>
{%- endif -%} {%- endif -%}
</li> </li>
{% endif %} {% endif %}
@ -34,25 +34,25 @@
{% block model_menu_bar_before_filters %}{% endblock %} {% block model_menu_bar_before_filters %}{% endblock %}
{% if filters %} {% if filters %}
<li class="dropdown"> <li class="nav-item dropdown">
{{ model_layout.filter_options() }} {{ model_layout.filter_options() }}
</li> </li>
{% endif %} {% endif %}
{% if can_set_page_size %} {% if can_set_page_size %}
<li class="dropdown"> <li class="nav-item dropdown">
{{ model_layout.page_size_form(page_size_url) }} {{ model_layout.page_size_form(page_size_url) }}
</li> </li>
{% endif %} {% endif %}
{% if actions %} {% if actions %}
<li class="dropdown"> <li class="nav-item dropdown">
{{ actionlib.dropdown(actions) }} {{ actionlib.dropdown(actions) }}
</li> </li>
{% endif %} {% endif %}
{% if search_supported %} {% if search_supported %}
<li> <li class="nav-item ml-2">
{{ model_layout.search_form() }} {{ model_layout.search_form() }}
</li> </li>
{% endif %} {% endif %}
@ -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 class="">&nbsp;</th>
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% for c, name in list_columns %} {% for c, name in list_columns %}
@ -187,9 +187,10 @@
<div id="filter-groups-data" style="display:none;">{{ filter_groups|tojson|safe }}</div> <div id="filter-groups-data" style="display:none;">{{ filter_groups|tojson|safe }}</div>
<div id="active-filters-data" style="display:none;">{{ active_filters|tojson|safe }}</div> <div id="active-filters-data" style="display:none;">{{ active_filters|tojson|safe }}</div>
{% endif %} {% endif %}
{{ lib.form_js() }} {{ lib.form_js() }}
<script src="{{ admin_static.url(filename='admin/js/filters.js', v='1.0.0') }}"></script> <script src="{{ admin_static.url(filename='admin/js/bs4_modal.js', v='1.0.0') }}"></script>
<script src="{{ admin_static.url(filename='admin/js/bs4_filters.js', v='1.0.0') }}"></script>
{{ actionlib.script(_gettext('Please select at least one record.'), {{ actionlib.script(_gettext('Please select at least one record.'),
actions, actions,

View file

@ -5,20 +5,32 @@
{% set render_ctx = h.resolve_ctx() %} {% set render_ctx = h.resolve_ctx() %}
{% block body %} {% block body %}
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> {% block header_text %}<h5 class="modal-title">{{ _gettext('Create New Record') }}</h5>{% endblock %}
{% block header_text %}<h3>{{ _gettext('Create New Record') }}</h3>{% endblock %} <button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div> </div>
{% call lib.form_tag(action=url_for('.create_view', url=return_url)) %}
<div class="modal-body"> <div class="modal-body">
{{ lib.render_form_fields(form, form_opts=form_opts) }}
</div>
<div class="modal-footer">
{{ lib.render_form_buttons(return_url, extra=None, is_modal=True) }}
</div>
{% endcall %}
{# "save and add" button is removed from modal (it won't function properly) #} {# "save and add" button is removed from modal (it won't function properly) #}
{% block create_form %} {# % block create_form %}
{{ lib.render_form(form, return_url, extra=None, form_opts=form_opts, {{ lib.render_form(form, return_url, extra=None, form_opts=form_opts,
action=url_for('.create_view', url=return_url), action=url_for('.create_view', url=return_url),
is_modal=True) }} is_modal=True) }}
{% endblock %} {% endblock % #}
</div>
{% endblock %} {% endblock %}
{% block tail %} {% block tail %}
<script src="{{ admin_static.url(filename='admin/js/bs3_modal.js', v='1.0.0') }}"></script> <script src="{{ admin_static.url(filename='admin/js/bs4_modal.js', v='1.0.0') }}"></script>
{% endblock %} {% endblock %}

View file

@ -3,17 +3,17 @@
{% block body %} {% block body %}
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
{% block header_text %} {% block header_text %}
<h3>{{ _gettext('View Record') + ' #' + request.args.get('id') }}</h3> <h3>{{ _gettext('View Record') + ' #' + request.args.get('id') }}</h3>
{% endblock %} {% endblock %}
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
{% block details_search %} {% block details_search %}
<div class="input-group fa_filter_container col-lg-6"> <div class="form-inline fa_filter_container col-lg-6">
<span class="input-group-addon">{{ _gettext('Filter') }}</span> <label for="fa_filter">{{ _gettext('Filter') }}</label>
<input id="fa_filter" type="text" class="form-control"> <input id="fa_filter" type="text" class="ml-3 form-control">
</div> </div>
{% endblock %} {% endblock %}
@ -36,5 +36,5 @@
{% block tail %} {% block tail %}
<script src="{{ admin_static.url(filename='admin/js/details_filter.js', v='1.0.0') }}"></script> <script src="{{ admin_static.url(filename='admin/js/details_filter.js', v='1.0.0') }}"></script>
<script src="{{ admin_static.url(filename='admin/js/bs3_modal.js', v='1.0.0') }}"></script> <script src="{{ admin_static.url(filename='admin/js/bs4_modal.js', v='1.0.0') }}"></script>
{% endblock %} {% endblock %}

View file

@ -6,21 +6,26 @@
{% block body %} {% block body %}
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
{% block header_text %} {% block header_text %}
<h3>{{ _gettext('Edit Record') + ' #' + request.args.get('id') }}</h3> <h5 class="modal-title">{{ _gettext('Edit Record') + ' #' + request.args.get('id') }}</h5>
{% endblock %} {% endblock %}
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div> </div>
{% call lib.form_tag(action=url_for('.edit_view', id=request.args.get('id'), url=return_url)) %}
<div class="modal-body"> <div class="modal-body">
{# "save and continue" button is removed from modal (it won't function properly) #} {{ lib.render_form_fields(form, form_opts=form_opts) }}
{% block edit_form %}
{{ lib.render_form(form, return_url, extra=None, form_opts=form_opts,
action=url_for('.edit_view', id=request.args.get('id'), url=return_url),
is_modal=True) }}
{% endblock %}
</div> </div>
<div class="modal-footer">
{{ lib.render_form_buttons(return_url, extra=None, is_modal=True) }}
</div>
{% endcall %}
{% endblock %} {% endblock %}
{% block tail %} {% block tail %}
<script src="{{ admin_static.url(filename='admin/js/bs3_modal.js', v='1.0.0') }}"></script> <script src="{{ admin_static.url(filename='admin/js/bs4_modal.js', v='1.0.0') }}"></script>
{% endblock %} {% endblock %}

View file

@ -4,14 +4,14 @@
{% block head %} {% block head %}
{{ super() }} {{ super() }}
<link href="{{ admin_static.url(filename='admin/css/bootstrap3/rediscli.css', v='1.0.0') }}" rel="stylesheet"> <link href="{{ admin_static.url(filename='admin/css/bootstrap4/rediscli.css', v='1.0.0') }}" rel="stylesheet">
{% endblock %} {% endblock %}
{% block body %} {% block body %}
<div class="console"> <div class="console">
<div class="console-container"> <div class="console-container">
</div> </div>
<div class="console-line"> <div class="console-line mb-4">
<form action="#"> <form action="#">
<input type="text"></input> <input type="text"></input>
</form> </form>

View file

@ -5,7 +5,7 @@ from flask_admin import __file__ as flaskAdminPath
def copyAdminTemplates(): def copyAdminTemplates():
src = flaskAdminPath.removesuffix("__init__.py") + "templates/bootstrap3/admin" src = flaskAdminPath.removesuffix("__init__.py") + "templates/bootstrap4/admin"
if not exists(src): if not exists(src):
print("Templates could not be found in", src) print("Templates could not be found in", src)
print("You can also copy them manually.") print("You can also copy them manually.")