From 5d0f99a3810e1047b9a3ebe5ea76af332c2631e8 Mon Sep 17 00:00:00 2001 From: Mo8it Date: Tue, 20 Sep 2022 18:15:56 +0200 Subject: [PATCH] Remove redundant admin templates --- advlabdb/templates/admin/actions.html | 34 -- advlabdb/templates/admin/base.html | 101 ------ advlabdb/templates/admin/file/form.html | 9 - advlabdb/templates/admin/file/list.html | 191 ------------ .../templates/admin/file/modals/form.html | 19 -- advlabdb/templates/admin/index.html | 4 - advlabdb/templates/admin/layout.html | 107 ------- advlabdb/templates/admin/lib.html | 292 ------------------ advlabdb/templates/admin/master.html | 1 - advlabdb/templates/admin/model/create.html | 30 -- advlabdb/templates/admin/model/details.html | 52 ---- advlabdb/templates/admin/model/edit.html | 40 --- .../admin/model/inline_field_list.html | 15 - .../templates/admin/model/inline_form.html | 4 - .../admin/model/inline_list_base.html | 45 --- advlabdb/templates/admin/model/layout.html | 106 ------- advlabdb/templates/admin/model/list.html | 198 ------------ .../templates/admin/model/modals/create.html | 36 --- .../templates/admin/model/modals/details.html | 40 --- .../templates/admin/model/modals/edit.html | 31 -- .../templates/admin/model/row_actions.html | 38 --- .../templates/admin/rediscli/console.html | 27 -- .../templates/admin/rediscli/response.html | 32 -- advlabdb/templates/admin/static.html | 3 - cli/maintain/copy_admin_templates/main.py | 50 --- manage.py | 9 - 26 files changed, 1514 deletions(-) delete mode 100644 advlabdb/templates/admin/actions.html delete mode 100644 advlabdb/templates/admin/base.html delete mode 100644 advlabdb/templates/admin/file/form.html delete mode 100644 advlabdb/templates/admin/file/list.html delete mode 100644 advlabdb/templates/admin/file/modals/form.html delete mode 100644 advlabdb/templates/admin/index.html delete mode 100644 advlabdb/templates/admin/layout.html delete mode 100644 advlabdb/templates/admin/lib.html delete mode 100644 advlabdb/templates/admin/master.html delete mode 100644 advlabdb/templates/admin/model/create.html delete mode 100644 advlabdb/templates/admin/model/details.html delete mode 100644 advlabdb/templates/admin/model/edit.html delete mode 100644 advlabdb/templates/admin/model/inline_field_list.html delete mode 100644 advlabdb/templates/admin/model/inline_form.html delete mode 100644 advlabdb/templates/admin/model/inline_list_base.html delete mode 100644 advlabdb/templates/admin/model/layout.html delete mode 100755 advlabdb/templates/admin/model/list.html delete mode 100644 advlabdb/templates/admin/model/modals/create.html delete mode 100755 advlabdb/templates/admin/model/modals/details.html delete mode 100644 advlabdb/templates/admin/model/modals/edit.html delete mode 100644 advlabdb/templates/admin/model/row_actions.html delete mode 100644 advlabdb/templates/admin/rediscli/console.html delete mode 100644 advlabdb/templates/admin/rediscli/response.html delete mode 100644 advlabdb/templates/admin/static.html delete mode 100644 cli/maintain/copy_admin_templates/main.py diff --git a/advlabdb/templates/admin/actions.html b/advlabdb/templates/admin/actions.html deleted file mode 100644 index cd645d8..0000000 --- a/advlabdb/templates/admin/actions.html +++ /dev/null @@ -1,34 +0,0 @@ -{% import 'admin/static.html' as admin_static with context %} - -{% macro dropdown(actions, btn_class='nav-link dropdown-toggle') -%} - - -{% endmacro %} - -{% macro form(actions, url) %} - {% if actions %} - - {% endif %} -{% endmacro %} - -{% macro script(message, actions, actions_confirmation) %} - {% if actions %} - - - - {% endif %} -{% endmacro %} diff --git a/advlabdb/templates/admin/base.html b/advlabdb/templates/admin/base.html deleted file mode 100644 index d2ee49a..0000000 --- a/advlabdb/templates/admin/base.html +++ /dev/null @@ -1,101 +0,0 @@ -{% import 'admin/layout.html' as layout with context -%} -{% import 'admin/static.html' as admin_static with context %} - - - - {% block title %}{% if admin_view.category %}{{ admin_view.category }} - {% endif %}{{ admin_view.name }} - {{ admin_view.admin.name }}{% endblock %} - {% block head_meta %} - - - - - - {% endblock %} - {% block head_css %} - - {% if config.get('FLASK_ADMIN_SWATCH', 'default') == 'default' %} - - {% endif %} - - - {% if admin_view.extra_css %} - {% for css_url in admin_view.extra_css %} - - {% endfor %} - {% endif %} - - {% endblock %} - {% block head %} - {% endblock %} - {% block head_tail %} - {% endblock %} - - -{% block page_body %} -
- - - {% block messages %} - {{ layout.messages() }} - {% endblock %} - - {# store the jinja2 context for form_rules rendering logic #} - {% set render_ctx = h.resolve_ctx() %} - - {% block body %}{% endblock %} -
-{% endblock %} - -{% block tail_js %} - - - - - - - - - - {% if admin_view.extra_js %} - {% for js_url in admin_view.extra_js %} - - {% endfor %} - {% endif %} -{% endblock %} - - {% block tail %} - {% endblock %} - - diff --git a/advlabdb/templates/admin/file/form.html b/advlabdb/templates/admin/file/form.html deleted file mode 100644 index 7a4474a..0000000 --- a/advlabdb/templates/admin/file/form.html +++ /dev/null @@ -1,9 +0,0 @@ -{% extends 'admin/master.html' %} -{% import 'admin/lib.html' as lib with context %} - -{% block body %} - {% block header %}

{{ header_text }}

{% endblock %} - {% block fa_form %} - {{ lib.render_form(form, dir_url) }} - {% endblock %} -{% endblock %} diff --git a/advlabdb/templates/admin/file/list.html b/advlabdb/templates/admin/file/list.html deleted file mode 100644 index bd9f345..0000000 --- a/advlabdb/templates/admin/file/list.html +++ /dev/null @@ -1,191 +0,0 @@ -{% extends 'admin/master.html' %} -{% import 'admin/lib.html' as lib with context %} -{% import 'admin/actions.html' as actionslib with context %} - -{% block body %} - {% block breadcrums %} - - {% endblock %} - - {% block file_list_table %} -
- - - - {% block list_header scoped %} - {% if actions %} - - {% endif %} - - {% for column in admin_view.column_list %} - - {% endfor %} - {% endblock %} - - - {% for name, path, is_dir, size, date in items %} - - {% block list_row scoped %} - {% if actions %} - - {% endif %} - - {% if is_dir %} - - {% else %} - - {% if admin_view.is_column_visible('size') %} - - {% endif %} - {% endif %} - {% if admin_view.is_column_visible('date') %} - - {% endif %} - {% endblock %} - - {% endfor %} -
- -   - {% if admin_view.is_column_sortable(column) %} - {% if sort_column == column %} - - {{ admin_view.column_label(column) }} - {% if sort_desc %} - - {% else %} - - {% endif %} - - {% else %} - {{ admin_view.column_label(column) }} - {% endif %} - {% else %} - {{ _gettext(admin_view.column_label(column)) }} - {% endif %} -
- {% if not is_dir %} - - {% endif %} - - {% 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='') }} - {% else %} - - - - {%- endif -%} - {% endif %} - {%- if admin_view.can_delete and path -%} - {% if is_dir %} - {% if name != '..' and admin_view.can_delete_dirs %} -
- {{ delete_form.path(value=path) }} - {{ delete_form.csrf_token }} - -
- {% endif %} - {% else %} -
- {{ delete_form.path(value=path) }} - {{ delete_form.csrf_token }} - -
- {% endif %} - {%- endif -%} - {% endblock %} -
- - {{ name }} - - - {% 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 %} - {{ name }} - {%- endif -%} - {% else %} - {{ name }} - {% endif %} - - {{ size|filesizeformat }} - - {{ timestamp_format(date) }} -
-
- {% endblock %} - {% block toolbar %} -
- {% if admin_view.can_upload %} -
- {%- if admin_view.upload_modal -%} - {{ lib.add_modal_button(url=get_dir_url('.upload', path=dir_path, modal=True), - btn_class="btn btn-secondary", - content=_gettext('Upload File')) }} - {% else %} - {{ _gettext('Upload File') }} - {%- endif -%} -
- {% endif %} - {% if admin_view.can_mkdir %} -
- {%- if admin_view.mkdir_modal -%} - {{ lib.add_modal_button(url=get_dir_url('.mkdir', path=dir_path, modal=True), - btn_class="btn btn-secondary", - content=_gettext('Create Directory')) }} - {% else %} - {{ _gettext('Create Directory') }} - {%- endif -%} -
- {% endif %} - {% if actions %} -
- {{ actionslib.dropdown(actions, 'dropdown-toggle btn btn-secondary') }} -
- {% endif %} -
- {% endblock %} - - {% block actions %} - {{ actionslib.form(actions, get_url('.action_view')) }} - {% endblock %} - - {%- if admin_view.rename_modal or admin_view.mkdir_modal - or admin_view.upload_modal or admin_view.edit_modal -%} - {{ lib.add_modal_window() }} - {%- endif -%} -{% endblock %} - -{% block tail %} - {{ super() }} - {{ actionslib.script(_gettext('Please select at least one file.'), - actions, - actions_confirmation) }} - -{% endblock %} diff --git a/advlabdb/templates/admin/file/modals/form.html b/advlabdb/templates/admin/file/modals/form.html deleted file mode 100644 index eebc699..0000000 --- a/advlabdb/templates/admin/file/modals/form.html +++ /dev/null @@ -1,19 +0,0 @@ -{% import 'admin/static.html' as admin_static with context %} -{% import 'admin/lib.html' as lib with context %} - -{% block body %} - {# content added to modal-content #} - - -{% endblock %} - -{% block tail %} - -{% endblock %} diff --git a/advlabdb/templates/admin/index.html b/advlabdb/templates/admin/index.html deleted file mode 100644 index fbfdf4c..0000000 --- a/advlabdb/templates/admin/index.html +++ /dev/null @@ -1,4 +0,0 @@ -{% extends 'admin/master.html' %} - -{% block body %} -{% endblock %} diff --git a/advlabdb/templates/admin/layout.html b/advlabdb/templates/admin/layout.html deleted file mode 100644 index 0ffb212..0000000 --- a/advlabdb/templates/admin/layout.html +++ /dev/null @@ -1,107 +0,0 @@ -{% macro menu_icon(item) -%} - {% set icon_type = item.get_icon_type() %} - {%- if icon_type %} - {% set icon_value = item.get_icon_value() %} - {% if icon_type == 'glyph' %} - - {% elif icon_type == 'fa' %} - - {% elif icon_type == 'image' %} - menu image - {% elif icon_type == 'image-url' %} - menu image - {% endif %} - {% endif %} -{%- endmacro %} - -{% 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 %} - {%- for item in menu_root %} - {%- if item.is_category() -%} - {% set children = item.get_children() %} - {%- if children %} - {% set class_name = item.get_class_name() or '' %} - {%- if item.is_active(admin_view) %} - - {% endif %} - {%- else %} - {%- if item.is_accessible() and item.is_visible() -%} - {% set class_name = item.get_class_name() %} - {%- if item.is_active(admin_view) %} -
  • - {%- else %} - - {%- endif %} - - {{ menu_icon(item) }}{{ item.name }} -
  • - {%- endif -%} - {% endif -%} - {% endfor %} -{% endmacro %} - -{% macro menu_links(links=None) %} - {% if links is none %}{% set links = admin_view.admin.menu_links() %}{% endif %} - {% for item in links %} - {% set class_name = item.get_class_name() %} - {% if item.is_accessible() and item.is_visible() %} - - - {{ menu_icon(item) }}{{ item.name }} - - {% endif %} - {% endfor %} -{% endmacro %} - -{% macro messages() %} - {% with messages = get_flashed_messages(with_categories=True) %} - {% if messages %} - {% for category, m in messages %} - {% if category %} - {# alert-error changed to alert-danger in bootstrap 3, mapping is for backwards compatibility #} - {% set mapping = {'message': 'info', 'error': 'danger'} %} -
    - {% else %} -
    - {% endif %} - - {{ m }} -
    - {% endfor %} - {% endif %} - {% endwith %} -{% endmacro %} diff --git a/advlabdb/templates/admin/lib.html b/advlabdb/templates/admin/lib.html deleted file mode 100644 index 40db5bb..0000000 --- a/advlabdb/templates/admin/lib.html +++ /dev/null @@ -1,292 +0,0 @@ -{% import 'admin/static.html' as admin_static with context %} - -{# ---------------------- Pager -------------------------- #} -{% macro pager(page, pages, generator) -%} -{% if pages > 1 %} -
      - {% set min = page - 3 %} - {% set max = page + 3 + 1 %} - - {% if min < 0 %} - {% set max = max - min %} - {% endif %} - {% if max >= pages %} - {% set min = min - max + pages %} - {% endif %} - - {% if min < 0 %} - {% set min = 0 %} - {% endif %} - {% if max >= pages %} - {% set max = pages %} - {% endif %} - - {% if min > 0 %} -
    • - « -
    • - {% else %} -
    • - « -
    • - {% endif %} - {% if page > 0 %} -
    • - < -
    • - {% else %} -
    • - < -
    • - {% endif %} - - {% for p in range(min, max) %} - {% if page == p %} -
    • - {{ p + 1 }} -
    • - {% else %} -
    • - {{ p + 1 }} -
    • - {% endif %} - {% endfor %} - - {% if page + 1 < pages %} -
    • - > -
    • - {% else %} -
    • - > -
    • - {% endif %} - {% if max < pages %} -
    • - » -
    • - {% else %} -
    • - » -
    • - {% endif %} -
    -{% endif %} -{%- endmacro %} - -{% macro simple_pager(page, have_next, generator) -%} -
      - {% if page > 0 %} -
    • - < -
    • - {% else %} -
    • - < -
    • - {% endif %} - {% if have_next %} -
    • - > -
    • - {% else %} -
    • - > -
    • - {% endif %} -
    -{%- endmacro %} - -{# ---------------------- Modal Window ------------------- #} -{% macro add_modal_window(modal_window_id='fa_modal_window', modal_label_id='fa_modal_label') %} - -{% endmacro %} - -{% macro add_modal_button(url='', title='', content='', modal_window_id='fa_modal_window', btn_class='icon') %} - - {{ content|safe }} - -{% endmacro %} - -{# ---------------------- Forms -------------------------- #} -{% macro render_field(form, field, kwargs={}, caller=None) %} - {% set direct_error = h.is_field_error(field.errors) %} - {% set prepend = kwargs.pop('prepend', None) %} - {% set append = kwargs.pop('append', None) %} -
    - - {% if prepend or append %} -
    - {%- if prepend -%} -
    - {{ prepend }} -
    - {%- 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 %} - {%- if direct_error %} {% set _ = kwargs.update({'class': kwargs['class'] ~ ' is-invalid'}) %} {% endif -%} - {{ field(**kwargs) | safe }} - {%- if append -%} -
    - {{ append }} -
    - {%- endif -%} - {% if direct_error %} -
    -
      - {% for e in field.errors if e is string %} -
    • {{ e }}
    • - {% endfor %} -
    -
    - {% elif field.description %} -
    {{ field.description|safe }}
    - {% endif %} - {% if prepend or append %} -
    - {% endif %} - {% if caller %} - {{ caller(form, field, direct_error, kwargs) }} - {% endif %} -
    -{% endmacro %} - -{% macro render_header(form, text) %} -

    {{ text }}

    -{% endmacro %} - -{% macro render_form_fields(form, form_opts=None) %} - {% if form.hidden_tag is defined %} - {{ form.hidden_tag() }} - {% else %} - {% if csrf_token %} - - {% endif %} - {% for f in form if f.widget.input_type == 'hidden' %} - {{ f }} - {% endfor %} - {% endif %} - - {% if form_opts and form_opts.form_rules %} - {% for r in form_opts.form_rules %} - {{ r(form, form_opts=form_opts) }} - {% endfor %} - {% else %} - {% for f in form if f.widget.input_type != 'hidden' %} - {% if form_opts %} - {% set kwargs = form_opts.widget_args.get(f.short_name, {}) %} - {% else %} - {% set kwargs = {} %} - {% endif %} - {{ render_field(form, f, kwargs) }} - {% endfor %} - {% endif %} -{% endmacro %} - -{% macro form_tag(form=None, action=None) %} -
    -
    - {{ caller() }} -
    -
    -{% endmacro %} - -{% macro render_form_buttons(cancel_url, extra=None, is_modal=False) %} - {% if is_modal %} - - {% if extra %} - {{ extra }} - {% endif %} - {% if cancel_url %} - {{ _gettext('Cancel') }} - {% endif %} - {% else %} -
    -
    -
    - - {% if extra %} - {{ extra }} - {% endif %} - {% if cancel_url %} - {{ _gettext('Cancel') }} - {% endif %} -
    -
    - {% endif %} -{% endmacro %} - -{% macro render_form(form, cancel_url, extra=None, form_opts=None, action=None, is_modal=False) -%} - {% call form_tag(action=action) %} - {{ render_form_fields(form, form_opts=form_opts) }} - {{ render_form_buttons(cancel_url, extra, is_modal) }} - {% endcall %} -{% endmacro %} - -{% macro form_css() %} - - - - {% if config.MAPBOX_MAP_ID %} - - - {% endif %} - {% if editable_columns %} - - {% endif %} -{% endmacro %} - -{% macro form_js() %} - {% if config.MAPBOX_MAP_ID %} - - - - {% if config.MAPBOX_SEARCH %} - - - {% endif %} - {% endif %} - - {% if editable_columns %} - - {% endif %} - -{% endmacro %} - -{% macro extra() %} - {% if admin_view.can_create %} - - {% endif %} - {% if admin_view.can_edit %} - - {% endif %} -{% endmacro %} diff --git a/advlabdb/templates/admin/master.html b/advlabdb/templates/admin/master.html deleted file mode 100644 index 8f27dad..0000000 --- a/advlabdb/templates/admin/master.html +++ /dev/null @@ -1 +0,0 @@ -{% extends admin_base_template %} diff --git a/advlabdb/templates/admin/model/create.html b/advlabdb/templates/admin/model/create.html deleted file mode 100644 index 1620f24..0000000 --- a/advlabdb/templates/admin/model/create.html +++ /dev/null @@ -1,30 +0,0 @@ -{% extends 'admin/master.html' %} -{% import 'admin/lib.html' as lib with context %} -{% from 'admin/lib.html' import extra with context %} {# backward compatible #} - -{% block head %} - {{ super() }} - {{ lib.form_css() }} -{% endblock %} - -{% block body %} - {% block navlinks %} - - {% endblock %} - - {% block create_form %} - {{ lib.render_form(form, return_url, extra(), form_opts) }} - {% endblock %} -{% endblock %} - -{% block tail %} - {{ super() }} - {{ lib.form_js() }} -{% endblock %} diff --git a/advlabdb/templates/admin/model/details.html b/advlabdb/templates/admin/model/details.html deleted file mode 100644 index f4017e3..0000000 --- a/advlabdb/templates/admin/model/details.html +++ /dev/null @@ -1,52 +0,0 @@ -{% extends 'admin/master.html' %} -{% import 'admin/lib.html' as lib with context %} - -{% block body %} - {% block navlinks %} - - {% endblock %} - - {% block details_search %} -
    - - -
    - {% endblock %} - - {% block details_table %} - - {% for c, name in details_columns %} - - - - - {% endfor %} -
    - {{ name }} - - {{ get_value(model, c) }} -
    - {% endblock %} -{% endblock %} - -{% block tail %} - {{ super() }} - -{% endblock %} diff --git a/advlabdb/templates/admin/model/edit.html b/advlabdb/templates/admin/model/edit.html deleted file mode 100644 index c5631a8..0000000 --- a/advlabdb/templates/admin/model/edit.html +++ /dev/null @@ -1,40 +0,0 @@ -{% extends 'admin/master.html' %} -{% import 'admin/lib.html' as lib with context %} -{% from 'admin/lib.html' import extra with context %} {# backward compatible #} - -{% block head %} - {{ super() }} - {{ lib.form_css() }} -{% endblock %} - -{% block body %} - {% block navlinks %} - - {% endblock %} - - {% block edit_form %} - {{ lib.render_form(form, return_url, extra(), form_opts) }} - {% endblock %} -{% endblock %} - -{% block tail %} - {{ super() }} - {{ lib.form_js() }} -{% endblock %} diff --git a/advlabdb/templates/admin/model/inline_field_list.html b/advlabdb/templates/admin/model/inline_field_list.html deleted file mode 100644 index b19dc2e..0000000 --- a/advlabdb/templates/admin/model/inline_field_list.html +++ /dev/null @@ -1,15 +0,0 @@ -{% import 'admin/model/inline_list_base.html' as base with context %} - -{% macro render_field(field) %} - {{ field }} - - {% if h.is_field_error(field.errors) %} -
      - {% for e in field.errors if e is string %} -
    • {{ e }}
    • - {% endfor %} -
    - {% endif %} -{% endmacro %} - -{{ base.render_inline_fields(field, template, render_field, check) }} diff --git a/advlabdb/templates/admin/model/inline_form.html b/advlabdb/templates/admin/model/inline_form.html deleted file mode 100644 index 6ae3f6c..0000000 --- a/advlabdb/templates/admin/model/inline_form.html +++ /dev/null @@ -1,4 +0,0 @@ -{% import 'admin/lib.html' as lib with context %} -
    - {{ lib.render_form_fields(field.form, form_opts=form_opts) }} -
    diff --git a/advlabdb/templates/admin/model/inline_list_base.html b/advlabdb/templates/admin/model/inline_list_base.html deleted file mode 100644 index 3f84c14..0000000 --- a/advlabdb/templates/admin/model/inline_list_base.html +++ /dev/null @@ -1,45 +0,0 @@ -{% macro render_inline_fields(field, template, render, check=None) %} -
    - {# existing inline form fields #} -
    - {% for subfield in field %} -
    - {%- if not check or check(subfield) %} - - - {{ field.label.text }} #{{ loop.index }} -
    - {% if subfield.get_pk and subfield.get_pk() %} - - - {% else %} - - {% endif %} -
    -
    -
    -
    - {%- endif -%} - {{ render(subfield) }} -
    - {% endfor %} -
    - - {# template for new inline form fields #} -
    - {% filter forceescape %} -
    - - {{ _gettext('New') }} {{ field.label.text }} -
    - -
    -
    -
    - {{ render(template) }} -
    - {% endfilter %} -
    - {{ _gettext('Add') }} {{ field.label.text }} -
    -{% endmacro %} diff --git a/advlabdb/templates/admin/model/layout.html b/advlabdb/templates/admin/model/layout.html deleted file mode 100644 index 3766701..0000000 --- a/advlabdb/templates/admin/model/layout.html +++ /dev/null @@ -1,106 +0,0 @@ -{% macro filter_options(btn_class='dropdown-toggle') %} - {{ _gettext('Add Filter') }} - -{% endmacro %} - -{% macro export_options(btn_class='dropdown-toggle') %} - {% if admin_view.export_types|length > 1 %} - - {% else %} -
  • - {{ _gettext('Export') }} -
  • - {% endif %} -{% endmacro %} - -{% macro filter_form() %} -
    - {% if sort_column is not none %} - - {% endif %} - {% if sort_desc %} - - {% endif %} - {% if search %} - - {% endif %} - {% if page_size != default_page_size %} - - {% endif %} -
    - - {% if active_filters %} - {{ _gettext('Reset Filters') }} - {% endif %} -
    - -
    -
    -
    -{% endmacro %} - -{% macro search_form(input_class="col-auto") %} - -{% endmacro %} - -{% macro page_size_form(generator, btn_class='nav-link dropdown-toggle') %} - - {{ page_size }} {{ _gettext('items') }} - - -{% endmacro %} diff --git a/advlabdb/templates/admin/model/list.html b/advlabdb/templates/admin/model/list.html deleted file mode 100755 index b58a7e2..0000000 --- a/advlabdb/templates/admin/model/list.html +++ /dev/null @@ -1,198 +0,0 @@ -{% extends 'admin/master.html' %} -{% import 'admin/lib.html' as lib with context %} -{% import 'admin/static.html' as admin_static with context%} -{% import 'admin/model/layout.html' as model_layout with context %} -{% import 'admin/actions.html' as actionlib with context %} -{% import 'admin/model/row_actions.html' as row_actions with context %} - -{% block head %} - {{ super() }} - {{ lib.form_css() }} -{% endblock %} - -{% block body %} - {% block model_menu_bar %} - - {% endblock %} - - {% if filters %} - {{ model_layout.filter_form() }} -
    - {% endif %} - - {% block model_list_table %} -
    - - - - {% block list_header scoped %} - {% if actions %} - - {% endif %} - {% block list_row_actions_header %} - {% if admin_view.column_display_actions %} - - {% endif %} - {% endblock %} - {% for c, name in list_columns %} - {% set column = loop.index0 %} - - {% endfor %} - {% endblock %} - - - {% for row in data %} - - {% block list_row scoped %} - {% if actions %} - - {% endif %} - {% block list_row_actions_column scoped %} - {% if admin_view.column_display_actions %} - - {%- endif -%} - {% endblock %} - - {% for c, name in list_columns %} - - {% endfor %} - {% endblock %} - - {% else %} - - - - {% endfor %} -
    - -   - {% if admin_view.is_sortable(c) %} - {% if sort_column == column %} - - {{ name }} - {% if sort_desc %} - - {% else %} - - {% endif %} - - {% else %} - {{ name }} - {% endif %} - {% else %} - {{ name }} - {% endif %} - {% if admin_view.column_descriptions.get(c) %} - - {% endif %} -
    - - - {% block list_row_actions scoped %} - {% for action in list_row_actions %} - {{ action.render_ctx(get_pk_value(row), row) }} - {% endfor %} - {% endblock %} - - {% if admin_view.is_editable(c) %} - {% set form = list_forms[get_pk_value(row)] %} - {% if form.csrf_token %} - {{ form[c](pk=get_pk_value(row), display_value=get_value(row, c), csrf=form.csrf_token._value()) }} - {% elif csrf_token %} - {{ form[c](pk=get_pk_value(row), display_value=get_value(row, c), csrf=csrf_token()) }} - {% else %} - {{ form[c](pk=get_pk_value(row), display_value=get_value(row, c)) }} - {% endif %} - {% else %} - {{ get_value(row, c) }} - {% endif %} -
    - {% block empty_list_message %} -
    - {{ admin_view.get_empty_list_message() }} -
    - {% endblock %} -
    -
    - {% block list_pager %} - {% if num_pages is not none %} - {{ lib.pager(page, num_pages, pager_url) }} - {% else %} - {{ lib.simple_pager(page, data|length == page_size, pager_url) }} - {% endif %} - {% endblock %} - {% endblock %} - - {% block actions %} - {{ actionlib.form(actions, get_url('.action_view')) }} - {% endblock %} - - {%- if admin_view.edit_modal or admin_view.create_modal or admin_view.details_modal -%} - {{ lib.add_modal_window() }} - {%- endif -%} -{% endblock %} - -{% block tail %} - {{ super() }} - - {% if filter_groups %} - - - {% endif %} - {{ lib.form_js() }} - - - - - {{ actionlib.script(_gettext('Please select at least one record.'), - actions, - actions_confirmation) }} -{% endblock %} diff --git a/advlabdb/templates/admin/model/modals/create.html b/advlabdb/templates/admin/model/modals/create.html deleted file mode 100644 index 3f5097f..0000000 --- a/advlabdb/templates/admin/model/modals/create.html +++ /dev/null @@ -1,36 +0,0 @@ -{% import 'admin/static.html' as admin_static with context%} -{% import 'admin/lib.html' as lib with context %} - -{# store the jinja2 context for form_rules rendering logic #} -{% set render_ctx = h.resolve_ctx() %} - -{% block body %} - - - {% call lib.form_tag(action=url_for('.create_view', url=return_url)) %} - - - {% endcall %} - - {# "save and add" button is removed from modal (it won't function properly) #} - {# % block create_form %} - {{ lib.render_form(form, return_url, extra=None, form_opts=form_opts, - action=url_for('.create_view', url=return_url), - is_modal=True) }} - {% endblock % #} - - -{% endblock %} - -{% block tail %} - -{% endblock %} diff --git a/advlabdb/templates/admin/model/modals/details.html b/advlabdb/templates/admin/model/modals/details.html deleted file mode 100755 index 793b4d0..0000000 --- a/advlabdb/templates/admin/model/modals/details.html +++ /dev/null @@ -1,40 +0,0 @@ -{% import 'admin/static.html' as admin_static with context%} -{% import 'admin/lib.html' as lib with context %} - -{% block body %} - - - -{% endblock %} - -{% block tail %} - - -{% endblock %} diff --git a/advlabdb/templates/admin/model/modals/edit.html b/advlabdb/templates/admin/model/modals/edit.html deleted file mode 100644 index dd9e777..0000000 --- a/advlabdb/templates/admin/model/modals/edit.html +++ /dev/null @@ -1,31 +0,0 @@ -{% import 'admin/static.html' as admin_static with context%} -{% import 'admin/lib.html' as lib with context %} - -{# store the jinja2 context for form_rules rendering logic #} -{% set render_ctx = h.resolve_ctx() %} - -{% block body %} - - - {% call lib.form_tag(action=url_for('.edit_view', id=request.args.get('id'), url=return_url)) %} - - - {% endcall %} - -{% endblock %} - -{% block tail %} - -{% endblock %} diff --git a/advlabdb/templates/admin/model/row_actions.html b/advlabdb/templates/admin/model/row_actions.html deleted file mode 100644 index 74d65ca..0000000 --- a/advlabdb/templates/admin/model/row_actions.html +++ /dev/null @@ -1,38 +0,0 @@ -{% import 'admin/lib.html' as lib with context %} - -{% macro link(action, url, icon_class=None) %} - - - -{% endmacro %} - -{% macro view_row(action, row_id, row) %} - {{ link(action, get_url('.details_view', id=row_id, url=return_url), 'fa fa-eye glyphicon glyphicon-eye-open') }} -{% endmacro %} - -{% macro view_row_popup(action, row_id, row) %} - {{ lib.add_modal_button(url=get_url('.details_view', id=row_id, url=return_url, modal=True), title=action.title, content='') }} -{% endmacro %} - -{% macro edit_row(action, row_id, row) %} - {{ link(action, get_url('.edit_view', id=row_id, url=return_url), 'fa fa-pencil glyphicon glyphicon-pencil') }} -{% endmacro %} - -{% macro edit_row_popup(action, row_id, row) %} - {{ lib.add_modal_button(url=get_url('.edit_view', id=row_id, url=return_url, modal=True), title=action.title, content='') }} -{% endmacro %} - -{% macro delete_row(action, row_id, row) %} -
    - {{ delete_form.id(value=get_pk_value(row)) }} - {{ delete_form.url(value=return_url) }} - {% if delete_form.csrf_token %} - {{ delete_form.csrf_token }} - {% elif csrf_token %} - - {% endif %} - -
    -{% endmacro %} diff --git a/advlabdb/templates/admin/rediscli/console.html b/advlabdb/templates/admin/rediscli/console.html deleted file mode 100644 index 498fdcc..0000000 --- a/advlabdb/templates/admin/rediscli/console.html +++ /dev/null @@ -1,27 +0,0 @@ -{% extends 'admin/master.html' %} -{% import 'admin/lib.html' as lib with context %} -{% import 'admin/static.html' as admin_static with context%} - -{% block head %} - {{ super() }} - -{% endblock %} - -{% block body %} -
    -
    -
    -
    -
    - -
    -
    -
    -{% endblock %} - -{% block tail %} - {{ super() }} - - - -{% endblock %} diff --git a/advlabdb/templates/admin/rediscli/response.html b/advlabdb/templates/admin/rediscli/response.html deleted file mode 100644 index f4a950a..0000000 --- a/advlabdb/templates/admin/rediscli/response.html +++ /dev/null @@ -1,32 +0,0 @@ -{% macro render(item, depth=0) %} - {% set type = type_name(item) %} - - {% if type == 'tuple' or type == 'list' %} - {% if not item %} - Empty {{ type }}. - {% else %} - {% for n in item %} - {{ loop.index }}) {{ render(n, depth + 1) }}
    - {% endfor %} - {% endif %} - {% elif type == 'bool' %} - {% if depth == 0 and item %} - OK - {% else %} - {{ item }} - {% endif %} - {% elif type == 'str' or type == 'unicode' %} - "{{ item }}" - {% elif type == 'bytes' %} - "{{ item.decode('utf-8') }}" - {% elif type == 'TextWrapper' %} -
    {{ item }}
    - {% elif type == 'dict' %} - {% for k, v in item.items() %} - {{ loop.index }}) {{ k }} - {{ render(v, depth + 1) }}
    - {% endfor %} - {% else %} - {{ item }} - {% endif %} -{% endmacro %} -{{ render(result) }} \ No newline at end of file diff --git a/advlabdb/templates/admin/static.html b/advlabdb/templates/admin/static.html deleted file mode 100644 index de632ee..0000000 --- a/advlabdb/templates/admin/static.html +++ /dev/null @@ -1,3 +0,0 @@ -{% macro url() -%} - {{ get_url('{admin_endpoint}.static'.format(admin_endpoint=admin_view.admin.endpoint), *varargs, **kwargs) }} -{%- endmacro %} diff --git a/cli/maintain/copy_admin_templates/main.py b/cli/maintain/copy_admin_templates/main.py deleted file mode 100644 index 242b2ad..0000000 --- a/cli/maintain/copy_admin_templates/main.py +++ /dev/null @@ -1,50 +0,0 @@ -from pathlib import Path -from shutil import copytree, rmtree - -import click -from flask_admin import __file__ as flask_admin_path - - -def _copy_admin_templates(): - src = Path(flask_admin_path).parent / "templates/bootstrap4/admin" - if not src.is_dir(): - click.echo(click.style(f"Templates could not be found at {src}", fg="red")) - return - - dist = Path("advlabdb/templates/admin") - if dist.is_dir(): - if not click.confirm( - click.style(f"The directory {dist} already exists! Do you want to overwrite it?", fg="yellow") - ): - return - - rmtree(dist) - click.echo(click.style("Old templates deleted!", fg="yellow")) - - copytree(src, dist) - click.echo(click.style(f"Copied {src} -> {dist}", fg="green")) - - click.echo( - click.style( - f""" -_________ -| WARNING -| ------- -| You might have to edit the file {dist}/base.html -| by adding nav in the following way: -| This line:\t