Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
flask-admin
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Python-Dev
flask-admin
Commits
e6baed0c
Commit
e6baed0c
authored
Jul 06, 2015
by
Paul Brown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move request.args.get('modal') into base, only use 'modal' in templates
parent
353e644e
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
48 additions
and
42 deletions
+48
-42
fileadmin.py
flask_admin/contrib/fileadmin.py
+8
-4
base.py
flask_admin/model/base.py
+4
-2
edit.html
flask_admin/templates/bootstrap2/admin/file/edit.html
+3
-3
form.html
flask_admin/templates/bootstrap2/admin/file/form.html
+3
-3
rename.html
flask_admin/templates/bootstrap2/admin/file/rename.html
+5
-5
create.html
flask_admin/templates/bootstrap2/admin/model/create.html
+4
-4
edit.html
flask_admin/templates/bootstrap2/admin/model/edit.html
+4
-4
edit.html
flask_admin/templates/bootstrap3/admin/file/edit.html
+3
-3
form.html
flask_admin/templates/bootstrap3/admin/file/form.html
+3
-3
rename.html
flask_admin/templates/bootstrap3/admin/file/rename.html
+3
-3
create.html
flask_admin/templates/bootstrap3/admin/model/create.html
+4
-4
edit.html
flask_admin/templates/bootstrap3/admin/model/edit.html
+4
-4
No files found.
flask_admin/contrib/fileadmin.py
View file @
e6baed0c
...
...
@@ -661,7 +661,8 @@ class FileAdmin(BaseView, ActionsMixin):
flash
(
gettext
(
'Failed to save file:
%(error)
s'
,
error
=
ex
),
'error'
)
return
self
.
render
(
self
.
upload_template
,
form
=
form
,
header_text
=
gettext
(
'Upload File'
))
header_text
=
gettext
(
'Upload File'
),
modal
=
request
.
args
.
get
(
'modal'
))
@
expose
(
'/download/<path:path>'
)
def
download
(
self
,
path
=
None
):
...
...
@@ -721,7 +722,8 @@ class FileAdmin(BaseView, ActionsMixin):
helpers
.
flash_errors
(
form
,
message
=
'Failed to create directory:
%(error)
s'
)
return
self
.
render
(
self
.
mkdir_template
,
form
=
form
,
dir_url
=
dir_url
,
header_text
=
gettext
(
'Create Directory'
))
header_text
=
gettext
(
'Create Directory'
),
modal
=
request
.
args
.
get
(
'modal'
))
@
expose
(
'/delete/'
,
methods
=
(
'POST'
,))
def
delete
(
self
):
...
...
@@ -819,7 +821,8 @@ class FileAdmin(BaseView, ActionsMixin):
form
=
form
,
path
=
op
.
dirname
(
path
),
name
=
op
.
basename
(
path
),
dir_url
=
return_url
)
dir_url
=
return_url
,
modal
=
request
.
args
.
get
(
'modal'
))
@
expose
(
'/edit/'
,
methods
=
(
'GET'
,
'POST'
))
def
edit
(
self
):
...
...
@@ -887,7 +890,8 @@ class FileAdmin(BaseView, ActionsMixin):
form
.
content
.
data
=
content
return
self
.
render
(
self
.
edit_template
,
dir_url
=
dir_url
,
path
=
path
,
form
=
form
,
error
=
error
)
form
=
form
,
error
=
error
,
modal
=
request
.
args
.
get
(
'modal'
))
@
expose
(
'/action/'
,
methods
=
(
'POST'
,))
def
action_view
(
self
):
...
...
flask_admin/model/base.py
View file @
e6baed0c
...
...
@@ -1611,7 +1611,8 @@ class BaseModelView(BaseView, ActionsMixin):
return
self
.
render
(
self
.
create_template
,
form
=
form
,
form_opts
=
form_opts
,
return_url
=
return_url
)
return_url
=
return_url
,
modal
=
request
.
args
.
get
(
'modal'
))
@
expose
(
'/edit/'
,
methods
=
(
'GET'
,
'POST'
))
def
edit_view
(
self
):
...
...
@@ -1654,7 +1655,8 @@ class BaseModelView(BaseView, ActionsMixin):
model
=
model
,
form
=
form
,
form_opts
=
form_opts
,
return_url
=
return_url
)
return_url
=
return_url
,
modal
=
request
.
args
.
get
(
'modal'
))
@
expose
(
'/delete/'
,
methods
=
(
'POST'
,))
def
delete_view
(
self
):
...
...
flask_admin/templates/bootstrap2/admin/file/edit.html
View file @
e6baed0c
{%- if not
request.args.get('modal')
-%}
{%- if not
modal
-%}
{% extends 'admin/master.html' %}
{%- endif -%}
{% import 'admin/lib.html' as lib with context %}
...
...
@@ -13,7 +13,7 @@
{% block body %}
{% call check_error(error) %}
{%- if
request.args.get('modal')
-%}
{%- if
modal
-%}
{# content added to modal-content #}
{{ lib.render_form(form, dir_url, action=request.url, is_modal=True) }}
{%- else -%}
...
...
@@ -26,7 +26,7 @@
{% endblock %}
{% block tail %}
{%- if
request.args.get('modal')
-%}
{%- if
modal
-%}
<script>
// fill the header of modal dynamically
$
(
'.modal-header h3'
).
html
(
'{{ self.header_text() }}'
);
...
...
flask_admin/templates/bootstrap2/admin/file/form.html
View file @
e6baed0c
{%- if not
request.args.get('modal')
-%}
{%- if not
modal
-%}
{% extends 'admin/master.html' %}
{%- endif -%}
{% import 'admin/lib.html' as lib with context %}
{% block body %}
{%- if
request.args.get('modal')
-%}
{%- if
modal
-%}
{{ lib.render_form(form, dir_url, action=request.url, is_modal=True) }}
{%- else -%}
<h3>
{{ header_text }}
</h3>
...
...
@@ -13,7 +13,7 @@
{% endblock %}
{% block tail %}
{%- if
request.args.get('modal')
-%}
{%- if
modal
-%}
<script>
// fill the header of modal dynamically
$
(
'.modal-header h3'
).
html
(
'{{ header_text }}'
);
...
...
flask_admin/templates/bootstrap2/admin/file/rename.html
View file @
e6baed0c
{%- if not
request.args.get('modal')
-%}
{%- if not
modal
-%}
{% extends 'admin/master.html' %}
{%- endif -%}
{% import 'admin/lib.html' as lib with context %}
{% block body %}
{%- if
request.args.get('modal')
-%}
{%- if
modal
-%}
{# content added to modal-content #}
{{ lib.render_form(form, dir_url, action=request.url, is_modal=True) }}
{%- else -%}
{% block header_text -%}
<h3>
{% block header_text -%}
{{ _gettext('Rename %(name)s', name=name) }}
{%- endblock %}
{%- endblock %}
</h3>
{{ lib.render_form(form, dir_url) }}
{%- endif -%}
{% endblock %}
{% block tail %}
{%- if
request.args.get('modal')
-%}
{%- if
modal
-%}
<script>
// fill the header of modal dynamically
$
(
'.modal-header h3'
).
html
(
'{{ self.header_text() }}'
);
...
...
flask_admin/templates/bootstrap2/admin/model/create.html
View file @
e6baed0c
{%- if not
request.args.get('modal')
-%}
{%- if not
modal
-%}
{% extends 'admin/master.html' %}
{%- endif -%}
{% import 'admin/lib.html' as lib with context %}
...
...
@@ -8,14 +8,14 @@
{% endmacro %}
{% block head %}
{%- if not
request.args.get('modal')
-%}
{%- if not
modal
-%}
{{ super() }}
{{ lib.form_css() }}
{%- endif -%}
{% endblock %}
{% block body %}
{%- if
request.args.get('modal')
-%}
{%- if
modal
-%}
{{ lib.render_form(form, return_url, extra=None, form_opts=form_opts,
action=request.url, is_modal=True) }}
{%- else -%}
...
...
@@ -35,7 +35,7 @@
{% endblock %}
{% block tail %}
{%- if
request.args.get('modal')
-%}
{%- if
modal
-%}
<script>
// fill the header of modal dynamically
$
(
'.modal-header h3'
).
html
(
'{% block header_text %}<h3>{{ _gettext('
Create
New
Record
') }}</h3>{% endblock %}'
);
...
...
flask_admin/templates/bootstrap2/admin/model/edit.html
View file @
e6baed0c
{%- if not
request.args.get('modal')
-%}
{%- if not
modal
-%}
{% extends 'admin/master.html' %}
{%- endif -%}
{% import 'admin/lib.html' as lib with context %}
...
...
@@ -8,14 +8,14 @@
{% endmacro %}
{% block head %}
{%- if not
request.args.get('modal')
-%}
{%- if not
modal
-%}
{{ super() }}
{{ lib.form_css() }}
{%- endif -%}
{% endblock %}
{% block body %}
{%- if
request.args.get('modal')
-%}
{%- if
modal
-%}
{# remove save and continue button for modal (it won't function properly) #}
{{ lib.render_form(form, return_url, extra=None, form_opts=form_opts,
action=request.url, is_modal=True) }}
...
...
@@ -39,7 +39,7 @@
{% endblock %}
{% block tail %}
{%- if
request.args.get('modal')
-%}
{%- if
modal
-%}
<script>
// fill the header of modal dynamically
$
(
'.modal-header h3'
).
html
(
'{% block header_text -%}
...
...
flask_admin/templates/bootstrap3/admin/file/edit.html
View file @
e6baed0c
{%- if not
request.args.get('modal')
-%}
{%- if not
modal
-%}
{% extends 'admin/master.html' %}
{%- endif -%}
{% import 'admin/lib.html' as lib with context %}
...
...
@@ -12,7 +12,7 @@
{% endmacro %}
{% block body %}
{%- if
request.args.get('modal')
-%}
{%- if
modal
-%}
{# content added to modal-content #}
<div
class=
"modal-header"
>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
aria-label=
"Close"
><span
aria-hidden=
"true"
>
×
</span></button>
...
...
@@ -34,7 +34,7 @@
{% endblock %}
{% block tail %}
{%- if
request.args.get('modal')
-%}
{%- if
modal
-%}
<script>
// fixes "remote modal shows same content every time", avoiding the flicker
$
(
'body'
).
on
(
'hidden.bs.modal'
,
'.modal'
,
function
()
{
...
...
flask_admin/templates/bootstrap3/admin/file/form.html
View file @
e6baed0c
{%- if not
request.args.get('modal')
-%}
{%- if not
modal
-%}
{% extends 'admin/master.html' %}
{%- endif -%}
{% import 'admin/lib.html' as lib with context %}
{% block body %}
{%- if
request.args.get('modal')
-%}
{%- if
modal
-%}
{# content added to modal-content #}
<div
class=
"modal-header"
>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
aria-label=
"Close"
><span
aria-hidden=
"true"
>
×
</span></button>
...
...
@@ -21,7 +21,7 @@
{% endblock %}
{% block tail %}
{%- if
request.args.get('modal')
-%}
{%- if
modal
-%}
<script>
// fixes "remote modal shows same content every time", avoiding the flicker
$
(
'body'
).
on
(
'hidden.bs.modal'
,
'.modal'
,
function
()
{
...
...
flask_admin/templates/bootstrap3/admin/file/rename.html
View file @
e6baed0c
{%- if not
request.args.get('modal')
-%}
{%- if not
modal
-%}
{% extends 'admin/master.html' %}
{%- endif -%}
{% import 'admin/lib.html' as lib with context %}
{% block body %}
{%- if
request.args.get('modal')
-%}
{%- if
modal
-%}
{# content added to modal-content #}
<div
class=
"modal-header"
>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
aria-label=
"Close"
><span
aria-hidden=
"true"
>
×
</span></button>
...
...
@@ -22,7 +22,7 @@
{% endblock %}
{% block tail %}
{%- if
request.args.get('modal')
-%}
{%- if
modal
-%}
<script>
// fixes "remote modal shows same content every time", avoiding the flicker
$
(
'body'
).
on
(
'hidden.bs.modal'
,
'.modal'
,
function
()
{
...
...
flask_admin/templates/bootstrap3/admin/model/create.html
View file @
e6baed0c
{%- if not
request.args.get('modal')
-%}
{%- if not
modal
-%}
{% extends 'admin/master.html' %}
{%- endif -%}
{% import 'admin/lib.html' as lib with context %}
...
...
@@ -8,14 +8,14 @@
{% endmacro %}
{% block head %}
{%- if not
request.args.get('modal')
-%}
{%- if not
modal
-%}
{{ super() }}
{{ lib.form_css() }}
{%- endif -%}
{% endblock %}
{% block body %}
{%- if
request.args.get('modal')
-%}
{%- if
modal
-%}
<div
class=
"modal-header"
>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
aria-label=
"Close"
><span
aria-hidden=
"true"
>
×
</span></button>
{% block header_text %}
<h3>
{{ _gettext('Create New Record') }}
</h3>
{% endblock %}
...
...
@@ -42,7 +42,7 @@
{% endblock %}
{% block tail %}
{%- if
request.args.get('modal')
-%}
{%- if
modal
-%}
<script>
// fixes "remote modal shows same content every time", avoiding the flicker
$
(
'body'
).
on
(
'hidden.bs.modal'
,
'.modal'
,
function
()
{
...
...
flask_admin/templates/bootstrap3/admin/model/edit.html
View file @
e6baed0c
{%- if not
request.args.get('modal')
-%}
{%- if not
modal
-%}
{% extends 'admin/master.html' %}
{%- endif -%}
{% import 'admin/lib.html' as lib with context %}
...
...
@@ -8,14 +8,14 @@
{% endmacro %}
{% block head %}
{%- if not
request.args.get('modal')
-%}
{%- if not
modal
-%}
{{ super() }}
{{ lib.form_css() }}
{%- endif -%}
{% endblock %}
{% block body %}
{%- if
request.args.get('modal')
-%}
{%- if
modal
-%}
{# content added to modal-content #}
<div
class=
"modal-header"
>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
aria-label=
"Close"
><span
aria-hidden=
"true"
>
×
</span></button>
...
...
@@ -48,7 +48,7 @@
{% endblock %}
{% block tail %}
{%- if
request.args.get('modal')
-%}
{%- if
modal
-%}
<script>
// fixes "remote modal shows same content every time", avoiding the flicker
$
(
'body'
).
on
(
'hidden.bs.modal'
,
'.modal'
,
function
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment