Skip to content

Commit d73ef0e

Browse files
committed
Merge pull request pallets-eco#1048 from pawl/fix_form_rules_modals2
Fix form_rules rendering in modal dialogs
2 parents 9b24bc8 + c7e168d commit d73ef0e

File tree

6 files changed

+29
-15
lines changed

6 files changed

+29
-15
lines changed

flask_admin/templates/bootstrap2/admin/base.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
{{ layout.messages() }}
5454
{% endblock %}
5555

56+
{# store the jinja2 context for form_rules rendering logic #}
5657
{% set render_ctx = h.resolve_ctx() %}
5758

5859
{% block body %}{% endblock %}

flask_admin/templates/bootstrap2/admin/model/modals/create.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{% import 'admin/static.html' as admin_static with context%}
22
{% import 'admin/lib.html' as lib with context %}
33

4+
{# store the jinja2 context for form_rules rendering logic #}
5+
{% set render_ctx = h.resolve_ctx() %}
6+
47
{% block body %}
58
{# "save and add" button is removed from modal (it won't function properly) #}
69
{{ lib.render_form(form, return_url, extra=None, form_opts=form_opts,

flask_admin/templates/bootstrap2/admin/model/modals/edit.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{% import 'admin/static.html' as admin_static with context%}
22
{% import 'admin/lib.html' as lib with context %}
33

4+
{# store the jinja2 context for form_rules rendering logic #}
5+
{% set render_ctx = h.resolve_ctx() %}
6+
47
{% block body %}
58
{# "save and continue" button is removed from modal (it won't function properly) #}
69
{{ lib.render_form(form, return_url, extra=None, form_opts=form_opts,

flask_admin/templates/bootstrap3/admin/base.html

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
<head>
66
<title>{% block title %}{% if admin_view.category %}{{ admin_view.category }} - {% endif %}{{ admin_view.name }} - {{ admin_view.admin.name }}{% endblock %}</title>
77
{% block head_meta %}
8-
<meta charset="UTF-8">
9-
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
8+
<meta charset="UTF-8">
9+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
1010
<meta name="viewport" content="width=device-width, initial-scale=1.0">
1111
<meta name="description" content="">
1212
<meta name="author" content="">
@@ -30,19 +30,19 @@
3030
{% block page_body %}
3131
<div class="container">
3232
<nav class="navbar navbar-default" role="navigation">
33-
<!-- Brand and toggle get grouped for better mobile display -->
34-
<div class="navbar-header">
35-
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#admin-navbar-collapse">
36-
<span class="sr-only">Toggle navigation</span>
37-
<span class="icon-bar"></span>
38-
<span class="icon-bar"></span>
39-
<span class="icon-bar"></span>
40-
</button>
41-
{% block brand %}
42-
<a class="navbar-brand" href="#">{{ admin_view.admin.name }}</a>
43-
{% endblock %}
44-
</div>
45-
<!-- navbar content -->
33+
<!-- Brand and toggle get grouped for better mobile display -->
34+
<div class="navbar-header">
35+
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#admin-navbar-collapse">
36+
<span class="sr-only">Toggle navigation</span>
37+
<span class="icon-bar"></span>
38+
<span class="icon-bar"></span>
39+
<span class="icon-bar"></span>
40+
</button>
41+
{% block brand %}
42+
<a class="navbar-brand" href="#">{{ admin_view.admin.name }}</a>
43+
{% endblock %}
44+
</div>
45+
<!-- navbar content -->
4646
<div class="collapse navbar-collapse" id="admin-navbar-collapse">
4747
{% block main_menu %}
4848
<ul class="nav navbar-nav">
@@ -64,6 +64,7 @@
6464
{{ layout.messages() }}
6565
{% endblock %}
6666

67+
{# store the jinja2 context for form_rules rendering logic #}
6768
{% set render_ctx = h.resolve_ctx() %}
6869

6970
{% block body %}{% endblock %}

flask_admin/templates/bootstrap3/admin/model/modals/create.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{% import 'admin/static.html' as admin_static with context%}
22
{% import 'admin/lib.html' as lib with context %}
33

4+
{# store the jinja2 context for form_rules rendering logic #}
5+
{% set render_ctx = h.resolve_ctx() %}
6+
47
{% block body %}
58
<div class="modal-header">
69
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>

flask_admin/templates/bootstrap3/admin/model/modals/edit.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{% import 'admin/static.html' as admin_static with context%}
22
{% import 'admin/lib.html' as lib with context %}
33

4+
{# store the jinja2 context for form_rules rendering logic #}
5+
{% set render_ctx = h.resolve_ctx() %}
6+
47
{% block body %}
58
<div class="modal-header">
69
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>

0 commit comments

Comments
 (0)