From 39c3933026e95d3fd1043c0f7850433e5a3af7fd Mon Sep 17 00:00:00 2001 From: PrinceWebCoder Date: Fri, 25 Jul 2025 18:01:04 +0500 Subject: [PATCH 01/42] New theme added to theme.py: FomanticUI --- flask_admin/theme.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/flask_admin/theme.py b/flask_admin/theme.py index 0143447459..334ec4a6b2 100644 --- a/flask_admin/theme.py +++ b/flask_admin/theme.py @@ -17,4 +17,10 @@ class BootstrapTheme(Theme): fluid: bool = False +@dataclass +class FomanticUI(Theme): + folder: typing.Literal["fomanticui"] = "fomanticui" + base_template: str = "admin/base.html" + + Bootstrap4Theme = partial(BootstrapTheme, folder="bootstrap4") From c05a77a6be605bd7e6352752e28f6888a6b9e271 Mon Sep 17 00:00:00 2001 From: PrinceWebCoder Date: Mon, 28 Jul 2025 00:49:20 +0500 Subject: [PATCH 02/42] Theme FomanticUI templates: add index.html --- flask_admin/templates/fomanticui/admin/index.html | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 flask_admin/templates/fomanticui/admin/index.html diff --git a/flask_admin/templates/fomanticui/admin/index.html b/flask_admin/templates/fomanticui/admin/index.html new file mode 100644 index 0000000000..6c4bda4484 --- /dev/null +++ b/flask_admin/templates/fomanticui/admin/index.html @@ -0,0 +1,2 @@ +{% extends 'admin/master.html' %} +{% block body %}{% endblock %} From cf2113b6da3ec0086e979f9be7d8eef66b8e1882 Mon Sep 17 00:00:00 2001 From: PrinceWebCoder Date: Mon, 28 Jul 2025 00:50:52 +0500 Subject: [PATCH 03/42] Theme FomanticUI templates: add master.html --- flask_admin/templates/fomanticui/admin/master.html | 1 + 1 file changed, 1 insertion(+) create mode 100644 flask_admin/templates/fomanticui/admin/master.html diff --git a/flask_admin/templates/fomanticui/admin/master.html b/flask_admin/templates/fomanticui/admin/master.html new file mode 100644 index 0000000000..8f27dad00c --- /dev/null +++ b/flask_admin/templates/fomanticui/admin/master.html @@ -0,0 +1 @@ +{% extends admin_base_template %} From 82c22a8413c99e3cd16fd85a7a45da5df976f4dd Mon Sep 17 00:00:00 2001 From: PrinceWebCoder Date: Mon, 28 Jul 2025 00:51:21 +0500 Subject: [PATCH 04/42] Theme FomanticUI templates: add static.html --- flask_admin/templates/fomanticui/admin/static.html | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 flask_admin/templates/fomanticui/admin/static.html diff --git a/flask_admin/templates/fomanticui/admin/static.html b/flask_admin/templates/fomanticui/admin/static.html new file mode 100644 index 0000000000..35bf7fe164 --- /dev/null +++ b/flask_admin/templates/fomanticui/admin/static.html @@ -0,0 +1,3 @@ +{% macro url() -%} + {{ get_url('{admin_endpoint}.static'.format(admin_endpoint=admin_view.admin.endpoint) , *varargs, **kwargs) }} +{%- endmacro %} From 490f13c9534d91921f3abedd836ad3a1776e4626 Mon Sep 17 00:00:00 2001 From: PrinceWebCoder Date: Mon, 28 Jul 2025 01:27:13 +0500 Subject: [PATCH 05/42] Theme FomanticUI templates: add layout.html --- .../templates/fomanticui/admin/layout.html | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 flask_admin/templates/fomanticui/admin/layout.html diff --git a/flask_admin/templates/fomanticui/admin/layout.html b/flask_admin/templates/fomanticui/admin/layout.html new file mode 100644 index 0000000000..474c3f2bed --- /dev/null +++ b/flask_admin/templates/fomanticui/admin/layout.html @@ -0,0 +1,88 @@ +{% macro menu_icon(item) -%} + {% set icon_type = item.get_icon_type() %} + {% set icon_value = item.get_icon_value() %} + {% if icon_value %} + {% if icon_type == 'default' or not icon_type %} + + {% 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.class_name %}{% endif %} + {{ menu_icon(item) }} + {{ item.name }} + +
+ {% endif %} + {%- else %} + {%- if item.is_accessible() and item.is_visible() -%} + {% set class_name = item.get_class_name() or '' %} + + {{ 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 %} + {% set mapping = {"message": "info", "None": ""} %} +
+ + {{ m }} +
+ {% endfor %} + {% endif %} + {% endwith %} +{% endmacro %} From cc403887b862e377511ba11efd2c8224a60f94d0 Mon Sep 17 00:00:00 2001 From: PrinceWebCoder Date: Mon, 28 Jul 2025 01:28:54 +0500 Subject: [PATCH 06/42] Theme FomanticUI templates: add actions.html --- .../templates/fomanticui/admin/actions.html | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 flask_admin/templates/fomanticui/admin/actions.html diff --git a/flask_admin/templates/fomanticui/admin/actions.html b/flask_admin/templates/fomanticui/admin/actions.html new file mode 100644 index 0000000000..8417d539ad --- /dev/null +++ b/flask_admin/templates/fomanticui/admin/actions.html @@ -0,0 +1,35 @@ +{% import 'admin/static.html' as admin_static with context %} + +{% macro dropdown_menu_items(actions, btn_class='') -%} + {% for p in actions %} +
{{ _gettext(p[1]) }}
+ {% endfor %} +{% endmacro %} + +{% macro form(actions, url) %} + {% if actions %} +
+ {% if action_form.csrf_token is defined and action_form.csrf_token %} + {{ action_form.csrf_token }} + {% elif csrf_token is defined and csrf_token %} + + {% endif %} + {% if return_url is defined and return_url %} + {{ action_form.url(value=return_url) }} + {% else %} + {{ action_form.url() }} + {% endif %} + {{ action_form.action() }} +
+ {% endif %} +{% endmacro %} + +{% macro script(message, actions, actions_confirmation) %} + {% if actions %} +
{{ actions_confirmation|tojson|safe }}
+
{{ message|tojson|safe }}
+ + {% endif %} +{% endmacro %} From ea2ea4344174842c80bdf7dc60e5d5c2aec40a1e Mon Sep 17 00:00:00 2001 From: PrinceWebCoder Date: Mon, 28 Jul 2025 01:30:58 +0500 Subject: [PATCH 07/42] Theme FomanticUI: add actions.js --- flask_admin/static/fomanticui/js/actions.js | 65 +++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 flask_admin/static/fomanticui/js/actions.js diff --git a/flask_admin/static/fomanticui/js/actions.js b/flask_admin/static/fomanticui/js/actions.js new file mode 100644 index 0000000000..52e51076f7 --- /dev/null +++ b/flask_admin/static/fomanticui/js/actions.js @@ -0,0 +1,65 @@ +var AdminModelActions = function (actionErrorMessage, actionConfirmations) { + // batch actions helpers + this.execute = function (name) { + var selected = $('input.action-checkbox:checked').length; + + if (selected === 0) { + $.toast({ + 'class': 'warning yellow inverted', + 'message': actionErrorMessage + }); + return false; + } + + var msg = actionConfirmations[name]; + + if (!!msg) + // @TODO: change to modal: https://fomantic-ui.com/modules/modal.html + if (!confirm(msg)) + return false; + + // Update hidden form and submit it + var form = $('#action_form'); + $('#action', form).val(name); + + $('input.action-checkbox', form).remove(); + $('input.action-checkbox:checked').each(function () { + form.append($(this).clone()); + }); + form.submit(); + + return false; + }; + + $(function () { + $('.action-rowtoggle').change(function () { + $('input.action-checkbox').prop('checked', this.checked); + $('input.action-checkbox').closest('tr').toggleClass('violet', this.checked); + }); + }); + + $(function () { + $('input.action-checkbox').change(function () { + $(this).closest('tr').toggleClass('violet', this.checked); + }); + }); + $(function () { + var inputs = $('input.action-checkbox'); + inputs.change(function () { + var allInputsChecked = true; + for (var i = 0; i < inputs.length; i++) { + if (!inputs[i].checked) { + allInputsChecked = false; + break; + } + } + $('.action-rowtoggle').attr('checked', allInputsChecked); + }); + }); +}; +var modelActions = new AdminModelActions(JSON.parse($('#message-data').text()), JSON.parse($('#actions-confirmation-data').text())); + + + + + From 29c701f18d3192a8550c8ffaf6222bf3152f9a58 Mon Sep 17 00:00:00 2001 From: PrinceWebCoder Date: Mon, 28 Jul 2025 01:36:05 +0500 Subject: [PATCH 08/42] Theme FomanticUI templates: add model/layout.html --- .../fomanticui/admin/model/layout.html | 102 ++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 flask_admin/templates/fomanticui/admin/model/layout.html diff --git a/flask_admin/templates/fomanticui/admin/model/layout.html b/flask_admin/templates/fomanticui/admin/model/layout.html new file mode 100644 index 0000000000..83466e732d --- /dev/null +++ b/flask_admin/templates/fomanticui/admin/model/layout.html @@ -0,0 +1,102 @@ +{% macro filter_options_items() %} + {% for k in filter_groups %} +
+ {{ k }} +
+ {% endfor %} +{% endmacro %} + +{% macro export_options_items() %} + {% for export_type in admin_view.export_types %} + + {{ _gettext("Export") + ' ' + export_type|upper }} + + {% endfor %} +{% endmacro %} + +{% macro filter_form() %} + + + + + + + + + + + + + + + + +
+
+ {% for arg_name, arg_value in extra_args.items() %} + + {% endfor %} + {% 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="") %} + +{% endmacro %} + +{% macro page_size_form_items(generator, page_size_options, btn_class='nav-link dropdown-toggle') %} + {% for option in page_size_options %} + + {{ _ngettext('{} item'.format(option) , '{} items'.format(option), option) }} + + {% endfor %} +{% endmacro %} From 7b7891c73c3eba8734af2b0d665eb3f47b7fb087 Mon Sep 17 00:00:00 2001 From: PrinceWebCoder Date: Mon, 28 Jul 2025 01:36:30 +0500 Subject: [PATCH 09/42] Theme FomanticUI templates: add model/list.html --- .../fomanticui/admin/model/list.html | 262 ++++++++++++++++++ 1 file changed, 262 insertions(+) create mode 100644 flask_admin/templates/fomanticui/admin/model/list.html diff --git a/flask_admin/templates/fomanticui/admin/model/list.html b/flask_admin/templates/fomanticui/admin/model/list.html new file mode 100644 index 0000000000..37c0e2df0d --- /dev/null +++ b/flask_admin/templates/fomanticui/admin/model/list.html @@ -0,0 +1,262 @@ +{% 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 %} +

+ {{ admin_view.name }} + {% if admin_view.can_create %} + {%- if admin_view.create_modal -%} + {{ 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 %} + + + {{ _gettext("Create") }} + + {%- endif -%} + {% endif %} +

+ {% block model_menu_bar %} +
+ {# djlint:off #} + {% if search_supported %} +
+ {{ model_layout.search_form() }} +
+ {% endif %} + {# djlint:on #} +
+
+ {% block model_menu_bar_before_filters %}{% endblock %} + {% if can_set_page_size %} + + {% endif %} + {% if filters %} + + {% endif %} + {% block model_menu_bar_after_filters %}{% endblock %} + {% if admin_view.can_export %} + + {% endif %} + {% if actions %} + + {% endif %} +
+
+
+ {% if filters %} +
+
+ + {{ model_layout.filter_form() }} +
+
+ {% endif %} + {% endblock %} +
+
+ {% if num_pages is not none %} + {{ lib.pager(page, num_pages, pager_url, True) }} + {% else %} + {{ lib.simple_pager(page, data|length == page_size, pager_url, True) }} + {% endif %} +
+
+ {% block model_list_table %} +
+ + + + {% block list_header scoped %} + {% if actions %} + + {% endif %} + {% for c, name in list_columns %} + {% set column = loop.index0 %} + + {% endfor %} + {% block list_row_actions_header %} + {% if admin_view.column_display_actions %}{% endif %} + {% endblock %} + {% endblock %} + + + + {% for row in data %} + + {% block list_row scoped %} + {% if actions %} + + {% endif %} + {% for c, name in list_columns %} + + {% endfor %} + {% block list_row_actions_column scoped %} + {% if admin_view.column_display_actions %} + + {%- endif -%} + {% endblock %} + {% 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 %} +  
+
+ + +
+
+ {% if admin_view.is_editable(c) %} + {% set form = list_forms[get_pk_value(row)] %} + {% if form.csrf_token is defined and form.csrf_token %} + {{ form[c](pk=get_pk_value(row) , display_value=get_value(row, c), csrf=form.csrf_token._value()) }} + {% elif csrf_token is defined and 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 list_row_actions scoped %} + {% for action in list_row_actions %}{{ action.render_ctx(get_pk_value(row) , row) }}{% endfor %} + {% endblock %} +
+
+ {% block empty_list_message %} +
{{ admin_view.get_empty_list_message() }}
+ {% endblock %} +
+
+ +
+ {% if count and count > 0 %} + {% set start = (page * page_size) + 1 %} + {% set end = (page * page_size) + data|length %} + {{ start }}-{{ end }} of {{ count }} + {% endif %} +
+
+ {% 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_js %} + {{ super() }} + + {% if filter_groups %} +
{{ filter_groups|tojson|safe }}
+
{{ active_filters|tojson|safe }}
+ {% endif %} + {{ lib.form_js() }} + + {{ actionlib.script(_gettext('Please select at least one record.') , actions, actions_confirmation) }} +{% endblock %} From dad7c54f7b998eaf1c78d40f2cb01b1000e64452 Mon Sep 17 00:00:00 2001 From: PrinceWebCoder Date: Mon, 28 Jul 2025 01:55:46 +0500 Subject: [PATCH 10/42] Theme FomanticUI templates: add inline_form.html --- flask_admin/templates/fomanticui/admin/model/inline_form.html | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 flask_admin/templates/fomanticui/admin/model/inline_form.html diff --git a/flask_admin/templates/fomanticui/admin/model/inline_form.html b/flask_admin/templates/fomanticui/admin/model/inline_form.html new file mode 100644 index 0000000000..dcad7adaff --- /dev/null +++ b/flask_admin/templates/fomanticui/admin/model/inline_form.html @@ -0,0 +1,4 @@ +{% import 'admin/lib.html' as lib with context %} +
+ {{ lib.render_form_fields(field.form, form_opts=form_opts) }} +
From 331b7be25c11f12f13107f3f3a8150d3b68815f0 Mon Sep 17 00:00:00 2001 From: PrinceWebCoder Date: Mon, 28 Jul 2025 01:58:01 +0500 Subject: [PATCH 11/42] Theme FomanticUI templates: add inline_list_base.html --- .../admin/model/inline_list_base.html | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 flask_admin/templates/fomanticui/admin/model/inline_list_base.html diff --git a/flask_admin/templates/fomanticui/admin/model/inline_list_base.html b/flask_admin/templates/fomanticui/admin/model/inline_list_base.html new file mode 100644 index 0000000000..c3e653c513 --- /dev/null +++ b/flask_admin/templates/fomanticui/admin/model/inline_list_base.html @@ -0,0 +1,61 @@ +{% macro render_inline_fields(field, template, render, check=None) %} +
+ {# existing inline form fields #} +
+ {% for subfield in field %} +
+
+ + {{ field.label.text }} #{{ loop.index }} +
+
+ {{ render(subfield) }} +
+ {%- if not check or check(subfield) %} +
+ {% if subfield.get_pk and subfield.get_pk() %} +
+ + +
+ {% else %} +
+ +
+ {% endif %} +
+ {%- endif -%} +
+ {% endfor %} +
+ {# template for new inline form fields #} +
+ {% filter forceescape %} +
+
+ + {{ _gettext('New') }} {{ field.label.text }} +
+
+ {{ render(template) }} +
+
+ +
+
+ {% endfilter %} +
+ +
+{% endmacro %} From 0fa05bd5b87342ab84bb622d5c6f8ae128d90fa4 Mon Sep 17 00:00:00 2001 From: PrinceWebCoder Date: Mon, 28 Jul 2025 02:01:11 +0500 Subject: [PATCH 12/42] Theme FomanticUI templates: add row_actions.html --- .../fomanticui/admin/model/row_actions.html | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 flask_admin/templates/fomanticui/admin/model/row_actions.html diff --git a/flask_admin/templates/fomanticui/admin/model/row_actions.html b/flask_admin/templates/fomanticui/admin/model/row_actions.html new file mode 100644 index 0000000000..71b1768e8a --- /dev/null +++ b/flask_admin/templates/fomanticui/admin/model/row_actions.html @@ -0,0 +1,45 @@ +{% 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) , 'eye icon') }} +{% 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) , 'pen alternate icon') }} +{% 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 is defined and delete_form.csrf_token %} + {{ delete_form.csrf_token }} + {% elif csrf_token is defined and csrf_token %} + + {% endif %} + {# @TODO: Use modal for confirmation >> #} + +
+{% endmacro %} From e6a23a1b0bf6f092e87e168c6f0f082d577cbd8a Mon Sep 17 00:00:00 2001 From: PrinceWebCoder Date: Mon, 28 Jul 2025 18:41:32 +0500 Subject: [PATCH 13/42] Add type="button" to Inline Field adder button element & format doc --- .../admin/model/inline_list_base.html | 107 +++++++++--------- 1 file changed, 54 insertions(+), 53 deletions(-) diff --git a/flask_admin/templates/fomanticui/admin/model/inline_list_base.html b/flask_admin/templates/fomanticui/admin/model/inline_list_base.html index c3e653c513..ed172cf061 100644 --- a/flask_admin/templates/fomanticui/admin/model/inline_list_base.html +++ b/flask_admin/templates/fomanticui/admin/model/inline_list_base.html @@ -1,61 +1,62 @@ {% macro render_inline_fields(field, template, render, check=None) %} -
- {# existing inline form fields #} -
- {% for subfield in field %} -
-
- - {{ field.label.text }} #{{ loop.index }} +
+ {# existing inline form fields #} +
+ {% for subfield in field %} +
+
+ + {{ field.label.text }} #{{ loop.index }} +
+
{{ render(subfield) }}
+ {%- if not check or check(subfield) %} +
+ {% if subfield.get_pk and subfield.get_pk() %} +
+ +
-
- {{ render(subfield) }} + {% else %} +
+
- {%- if not check or check(subfield) %} -
- {% if subfield.get_pk and subfield.get_pk() %} -
- - -
- {% else %} -
- -
- {% endif %} -
- {%- endif -%} + {% endif %}
- {% endfor %} + {%- endif -%}
- {# template for new inline form fields #} -
- {% filter forceescape %} -
-
- - {{ _gettext('New') }} {{ field.label.text }} -
-
- {{ render(template) }} -
-
- -
-
- {% endfilter %} + {% endfor %} +
+ {# template for new inline form fields #} +
+ {% filter forceescape %} +
+
+ + {{ _gettext("New") }} {{ field.label.text }} +
+
+ {{ render(template) }} +
+
+ +
- + {% endfilter %}
+ +
{% endmacro %} From e83306e77c56d7941aace9637ec67b7787a3edac Mon Sep 17 00:00:00 2001 From: PrinceWebCoder Date: Wed, 30 Jul 2025 13:52:16 +0500 Subject: [PATCH 14/42] Theme FomanticUI: add RedisCLI templates --- .../fomanticui/admin/rediscli/console.html | 94 +++++++++++++++++++ .../fomanticui/admin/rediscli/response.html | 34 +++++++ 2 files changed, 128 insertions(+) create mode 100644 flask_admin/templates/fomanticui/admin/rediscli/console.html create mode 100644 flask_admin/templates/fomanticui/admin/rediscli/response.html diff --git a/flask_admin/templates/fomanticui/admin/rediscli/console.html b/flask_admin/templates/fomanticui/admin/rediscli/console.html new file mode 100644 index 0000000000..f3807faaa3 --- /dev/null +++ b/flask_admin/templates/fomanticui/admin/rediscli/console.html @@ -0,0 +1,94 @@ +{% 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() }} +
{{ admin_view.get_url(".execute_view") |tojson|safe }}
+ +{% endblock %} diff --git a/flask_admin/templates/fomanticui/admin/rediscli/response.html b/flask_admin/templates/fomanticui/admin/rediscli/response.html new file mode 100644 index 0000000000..0b65ea64c5 --- /dev/null +++ b/flask_admin/templates/fomanticui/admin/rediscli/response.html @@ -0,0 +1,34 @@ +{% 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', 'replace') }}" + {% 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) }} From dd70021bd3b0c11f2b13eaf1bae971747a0029b0 Mon Sep 17 00:00:00 2001 From: PrinceWebCoder Date: Wed, 30 Jul 2025 13:52:53 +0500 Subject: [PATCH 15/42] Theme FomanticUI: add initial base.html for testing --- .../templates/fomanticui/admin/base.html | 125 ++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 flask_admin/templates/fomanticui/admin/base.html diff --git a/flask_admin/templates/fomanticui/admin/base.html b/flask_admin/templates/fomanticui/admin/base.html new file mode 100644 index 0000000000..aa3c607de1 --- /dev/null +++ b/flask_admin/templates/fomanticui/admin/base.html @@ -0,0 +1,125 @@ +{% import 'admin/layout.html' as layout with context -%} +{% import 'admin/static.html' as admin_static with context %} +{% import 'admin/lib.html' as lib with context %} +{% import 'admin/footer.html' as footer with context %} +{% import 'admin/utils.html' as utils 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_preload %} + {# runs before CSS to avoid flash #} + + {% endblock %} + {% block head_css %} + + + {% if admin_view.extra_css %} + {% for css_url in admin_view.extra_css %} + + {% endfor %} + {% endif %} + {% endblock %} + {% block head %}{% endblock %} + {% block head_tail %}{% endblock %} + + + Skip to main content + {% block page_body %} + + +
+
+ {{ utils.breadcrumb() }} + {% block messages %}{{ layout.messages() }}{% endblock %} + {# store the jinja2 context for form_rules rendering logic #} + {% set render_ctx = h.resolve_ctx() %} + {% block body %}{% endblock %} +
+ {% block footer %}{{ footer.footer() }}{% endblock %} +
+ {% endblock %} + {% block tail_js %} + {# @TODO: offline externals #} + + + + + {% if admin_view.extra_js %} + {% for js_url in admin_view.extra_js %} + + {% endfor %} + {% endif %} + {% endblock %} + {% block tail %}{% endblock %} + + From 8debbf623a72c252a94864f1abcf9f63c83ae98a Mon Sep 17 00:00:00 2001 From: PrinceWebCoder Date: Wed, 30 Jul 2025 18:51:14 +0500 Subject: [PATCH 16/42] Refactor list template: remove inline styles, improve modal handling, and update button classes --- .../fomanticui/admin/model/list.html | 50 ++++++++++--------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/flask_admin/templates/fomanticui/admin/model/list.html b/flask_admin/templates/fomanticui/admin/model/list.html index 37c0e2df0d..d278235a35 100644 --- a/flask_admin/templates/fomanticui/admin/model/list.html +++ b/flask_admin/templates/fomanticui/admin/model/list.html @@ -4,28 +4,23 @@ {% 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 %} +{% import 'admin/model/modals/lib.html' as modal_lib with context %} {% block head %} {{ super() }} {{ lib.form_css() }} - {% endblock %} {% block body %}

{{ admin_view.name }} {% if admin_view.can_create %} - {%- if admin_view.create_modal -%} - {{ 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')) }} + {% if admin_view.create_modal %} + + + {{ _gettext("Create") }} + {% else %} {{ _gettext("Create") }} - {%- endif -%} + {% endif %} {% endif %}

{% block model_menu_bar %} @@ -46,31 +41,30 @@

{% endif %} {# djlint:on #}
-
+
{% block model_menu_bar_before_filters %}{% endblock %} {% if can_set_page_size %} -