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
6a530760
Commit
6a530760
authored
Mar 19, 2013
by
Serge S. Koval
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Split HTML functional pieces into separate libraries
parent
6ae0e63f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
131 additions
and
103 deletions
+131
-103
base.html
flask_admin/templates/admin/base.html
+5
-45
layout.html
flask_admin/templates/admin/layout.html
+52
-0
lib.html
flask_admin/templates/admin/lib.html
+2
-1
layout.html
flask_admin/templates/admin/model/layout.html
+65
-0
list.html
flask_admin/templates/admin/model/list.html
+7
-57
No files found.
flask_admin/templates/admin/base.html
View file @
6a530760
{% import 'admin/layout.html' as layout with context -%}
<!DOCTYPE html>
<!DOCTYPE html>
<html>
<html>
<head>
<head>
...
@@ -24,57 +25,16 @@
...
@@ -24,57 +25,16 @@
<span
class=
"brand"
>
{{ admin_view.admin.name }}
</span>
<span
class=
"brand"
>
{{ admin_view.admin.name }}
</span>
{% endblock %}
{% endblock %}
<ul
class=
"nav"
>
<ul
class=
"nav"
>
{% for item in admin_view.admin.menu() %}
{{ layout.menu() }}
{% if item.is_category() %}
{% set children = item.get_children() %}
{% if children %}
{% if item.is_active(admin_view) %}
<li
class=
"active dropdown"
>
{% else %}
<li
class=
"dropdown"
>
{% endif %}
<a
class=
"dropdown-toggle"
data-toggle=
"dropdown"
href=
"#"
>
{{ item.name }}
<b
class=
"caret"
></b></a>
<ul
class=
"dropdown-menu"
>
{% for child in children %}
{% if child.is_active(admin_view) %}
<li
class=
"active"
>
{% else %}
<li>
{% endif %}
<a
href=
"{{ child.get_url() }}"
>
{{ child.name }}
</a>
</li>
{% endfor %}
</ul>
</li>
{% endif %}
{% else %}
{% if item.is_accessible() %}
{% if item.is_active(admin_view) %}
<li
class=
"active"
>
{% else %}
<li>
{% endif %}
<a
href=
"{{ item.get_url() }}"
>
{{ item.name }}
</a>
</li>
{% endif %}
{% endif %}
{% endfor %}
</ul>
</ul>
<ul
class=
"nav pull-right"
>
<ul
class=
"nav pull-right"
>
{% for item in admin_view.admin.menu_links() %}
{{ layout.menu_links() }}
{% if item.is_accessible() %}
<li>
<a
href=
"{{ item.get_url() }}"
>
{{ item.name }}
</a>
</li>
{% endif %}
{% endfor %}
</ul>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
{% with messages = get_flashed_messages(with_categories=True) %}
{{ layout.messages() }}
{% if messages %}
{% for category, m in messages %}
{% if category == 'error' %}
<div
class=
"alert alert-error"
>
{% else %}
<div
class=
"alert"
>
{% endif %}
<a
href=
"#"
class=
"close"
data-dismiss=
"alert"
>
x
</a>
{{ m }}
</div>
{% endfor %}
{% endif %}
{% endwith %}
<div
class=
"container"
>
<div
class=
"container"
>
{% block body %}{% endblock %}
{% block body %}{% endblock %}
...
@@ -87,4 +47,4 @@
...
@@ -87,4 +47,4 @@
{% block tail %}
{% block tail %}
{% endblock %}
{% endblock %}
</body>
</body>
</html>
</html>
\ No newline at end of file
flask_admin/templates/admin/layout.html
0 → 100644
View file @
6a530760
{% macro menu() %}
{% for item in admin_view.admin.menu() %}
{% if item.is_category() %}
{% set children = item.get_children() %}
{% if children %}
{% if item.is_active(admin_view) %}
<li
class=
"active dropdown"
>
{% else %}
<li
class=
"dropdown"
>
{% endif %}
<a
class=
"dropdown-toggle"
data-toggle=
"dropdown"
href=
"#"
>
{{ item.name }}
<b
class=
"caret"
></b></a>
<ul
class=
"dropdown-menu"
>
{% for child in children %}
{% if child.is_active(admin_view) %}
<li
class=
"active"
>
{% else %}
<li>
{% endif %}
<a
href=
"{{ child.get_url() }}"
>
{{ child.name }}
</a>
</li>
{% endfor %}
</ul>
</li>
{% endif %}
{% else %}
{% if item.is_accessible() %}
{% if item.is_active(admin_view) %}
<li
class=
"active"
>
{% else %}
<li>
{% endif %}
<a
href=
"{{ item.get_url() }}"
>
{{ item.name }}
</a>
</li>
{% endif %}
{% endif %}
{% endfor %}
{% endmacro %}
{% macro menu_links() %}
{% for item in admin_view.admin.menu_links() %}
{% if item.is_accessible() %}
<li>
<a
href=
"{{ item.get_url() }}"
>
{{ item.name }}
</a>
</li>
{% endif %}
{% endfor %}
{% endmacro %}
{% macro messages() %}
{% with messages = get_flashed_messages(with_categories=True) %}
{% if messages %}
{% for category, m in messages %}
{% if category == 'error' %}
<div
class=
"alert alert-error"
>
{% else %}
<div
class=
"alert"
>
{% endif %}
<a
href=
"#"
class=
"close"
data-dismiss=
"alert"
>
x
</a>
{{ m }}
</div>
{% endfor %}
{% endif %}
{% endwith %}
{% endmacro %}
flask_admin/templates/admin/lib.html
View file @
6a530760
{# ---------------------- Pager -------------------------- #}
{% macro pager(page, pages, generator) -%}
{% macro pager(page, pages, generator) -%}
{% if pages > 1 %}
{% if pages > 1 %}
<div
class=
"pagination"
>
<div
class=
"pagination"
>
...
@@ -73,6 +74,7 @@
...
@@ -73,6 +74,7 @@
{% endif %}
{% endif %}
{%- endmacro %}
{%- endmacro %}
{# ---------------------- Forms -------------------------- #}
{% macro render_field(form, field, set_focus=False, kwargs={}) %}
{% macro render_field(form, field, set_focus=False, kwargs={}) %}
<div
class=
"control-group{{ ' error' if field.errors }}"
>
<div
class=
"control-group{{ ' error' if field.errors }}"
>
<div
class=
"control-label"
>
<div
class=
"control-label"
>
...
@@ -142,4 +144,3 @@
...
@@ -142,4 +144,3 @@
{{ render_form_buttons(cancel_url, extra) }}
{{ render_form_buttons(cancel_url, extra) }}
{% endcall %}
{% endcall %}
{% endmacro %}
{% endmacro %}
flask_admin/templates/admin/model/layout.html
0 → 100644
View file @
6a530760
{% macro filter_options() %}
<a
class=
"dropdown-toggle"
data-toggle=
"dropdown"
href=
"#"
>
{{ _gettext('Add Filter') }}
<b
class=
"caret"
></b>
</a>
<ul
class=
"dropdown-menu field-filters"
>
{% for k in filter_groups %}
<li>
<a
href=
"#"
class=
"filter"
onclick=
"return false;"
>
{{ k[0] }}
</a>
</li>
{% endfor %}
</ul>
{% endmacro %}
{% macro filter_form() %}
<form
id=
"filter_form"
method=
"GET"
action=
"{{ return_url }}"
>
<div
class=
"pull-right"
>
<button
type=
"submit"
class=
"btn btn-primary"
style=
"display: none"
>
{{ _gettext('Apply') }}
</button>
{% if active_filters %}
<a
href=
"{{ clear_search_url }}"
class=
"btn"
>
{{ _gettext('Reset Filters') }}
</a>
{% endif %}
</div>
<div
class=
"filters"
>
{%- for i, flt in enumerate(active_filters) -%}
<div
class=
"filter-row"
>
{% set filter = admin_view._filters[flt[0]] %}
<a
href=
"#"
class=
"btn remove-filter"
title=
"{{ _gettext('Remove Filter') }}"
>
<span
class=
"close-icon"
>
×
</span>
{{ filters[flt[0]] }}
</a><select
class=
"filter-op"
data-role=
"select2"
>
{% for op in admin_view._filter_dict[filter.name] %}
<option
value=
"{{ op[0] }}"
{%
if
flt
[
0
]
==
op
[
0
]
%}
selected=
"selected"
{%
endif
%}
>
{{ op[1] }}
</option>
{% endfor %}
</select>
{%- set data = filter_data.get(flt[0]) -%}
{%- if data -%}
<select
name=
"flt{{ i }}_{{ flt[0] }}"
class=
"filter-val"
data-role=
"select2"
>
{%- for d in data %}
<option
value=
"{{ d[0] }}"
{%
if
flt
[
1
]
==
d
[
0
]
%}
selected
{%
endif
%}
>
{{ d[1] }}
</option>
{%- endfor %}
</select>
{%- else -%}
<input
name=
"flt{{ i }}_{{ flt[0] }}"
type=
"text"
value=
"{{ flt[1] or '' }}"
class=
"filter-val"
{%
if
flt
[
0
]
in
filter_types
%}
data-role=
"{{ filter_types[flt[0]] }}"
{%
endif
%}
></input>
{%- endif -%}
</div>
{% endfor %}
</div>
</form>
{% endmacro %}
{% macro search_form() %}
<form
method=
"GET"
action=
"{{ return_url }}"
class=
"search-form"
>
{% if sort_column is not none %}
<input
type=
"hidden"
name=
"sort"
value=
"{{ sort_column }}"
></input>
{% endif %}
{% if sort_desc %}
<input
type=
"hidden"
name=
"desc"
value=
"{{ sort_desc }}"
></input>
{% endif %}
<input
type=
"text"
name=
"search"
value=
"{{ search or '' }}"
class=
"search-query span2"
placeholder=
"{{ _gettext('Search') }}"
></input>
{% if search %}
<a
href=
"{{ clear_search_url }}"
class=
"clear"
>
<i
class=
"icon-remove"
></i>
</a>
{% endif %}
</form>
{% endmacro %}
flask_admin/templates/admin/model/list.html
View file @
6a530760
{% extends 'admin/master.html' %}
{% extends 'admin/master.html' %}
{% import 'admin/lib.html' as lib with context %}
{% import 'admin/lib.html' as lib with context %}
{% import 'admin/model/layout.html' as model_layout with context %}
{% import 'admin/actions.html' as actionlib with context %}
{% import 'admin/actions.html' as actionlib with context %}
{% block head %}
{% block head %}
...
@@ -8,6 +9,7 @@
...
@@ -8,6 +9,7 @@
{% endblock %}
{% endblock %}
{% block body %}
{% block body %}
{% block model_menu_bar %}
<ul
class=
"nav nav-tabs"
>
<ul
class=
"nav nav-tabs"
>
<li
class=
"active"
>
<li
class=
"active"
>
<a
href=
"#"
>
{{ _gettext('List') }} ({{ count }})
</a>
<a
href=
"#"
>
{{ _gettext('List') }} ({{ count }})
</a>
...
@@ -20,16 +22,7 @@
...
@@ -20,16 +22,7 @@
{% if filter_groups %}
{% if filter_groups %}
<li
class=
"dropdown"
>
<li
class=
"dropdown"
>
<a
class=
"dropdown-toggle"
data-toggle=
"dropdown"
href=
"#"
>
{{ model_layout.filter_options() }}
{{ _gettext('Add Filter') }}
<b
class=
"caret"
></b>
</a>
<ul
class=
"dropdown-menu field-filters"
>
{% for k in filter_groups %}
<li>
<a
href=
"#"
class=
"filter"
onclick=
"return false;"
>
{{ k[0] }}
</a>
</li>
{% endfor %}
</ul>
</li>
</li>
{% endif %}
{% endif %}
...
@@ -41,57 +34,14 @@
...
@@ -41,57 +34,14 @@
{% if search_supported %}
{% if search_supported %}
<li>
<li>
<form
method=
"GET"
action=
"{{ return_url }}"
class=
"search-form"
>
{{ model_layout.search_form() }}
{% if sort_column is not none %}
<input
type=
"hidden"
name=
"sort"
value=
"{{ sort_column }}"
></input>
{% endif %}
{% if sort_desc %}
<input
type=
"hidden"
name=
"desc"
value=
"{{ sort_desc }}"
></input>
{% endif %}
<input
type=
"text"
name=
"search"
value=
"{{ search or '' }}"
class=
"search-query span2"
placeholder=
"{{ _gettext('Search') }}"
></input>
{% if search %}
<a
href=
"{{ clear_search_url }}"
class=
"clear"
>
<i
class=
"icon-remove"
></i>
</a>
{% endif %}
</form>
</li>
</li>
{% endif %}
{% endif %}
</ul>
</ul>
{% if filter_groups %}
{% endblock %}
<form
id=
"filter_form"
method=
"GET"
action=
"{{ return_url }}"
>
<div
class=
"pull-right"
>
<button
type=
"submit"
class=
"btn btn-primary"
style=
"display: none"
>
{{ _gettext('Apply') }}
</button>
{% if active_filters %}
<a
href=
"{{ clear_search_url }}"
class=
"btn"
>
{{ _gettext('Reset Filters') }}
</a>
{% endif %}
</div>
<div
class=
"filters"
>
{% if filter_groups %}
{%- for i, flt in enumerate(active_filters) -%}
{{ model_layout.filter_form() }}
<div
class=
"filter-row"
>
{% set filter = admin_view._filters[flt[0]] %}
<a
href=
"#"
class=
"btn remove-filter"
title=
"{{ _gettext('Remove Filter') }}"
>
<span
class=
"close-icon"
>
×
</span>
{{ filters[flt[0]] }}
</a><select
class=
"filter-op"
data-role=
"select2"
>
{% for op in admin_view._filter_dict[filter.name] %}
<option
value=
"{{ op[0] }}"
{%
if
flt
[
0
]
==
op
[
0
]
%}
selected=
"selected"
{%
endif
%}
>
{{ op[1] }}
</option>
{% endfor %}
</select>
{%- set data = filter_data.get(flt[0]) -%}
{%- if data -%}
<select
name=
"flt{{ i }}_{{ flt[0] }}"
class=
"filter-val"
data-role=
"select2"
>
{%- for d in data %}
<option
value=
"{{ d[0] }}"
{%
if
flt
[
1
]
==
d
[
0
]
%}
selected
{%
endif
%}
>
{{ d[1] }}
</option>
{%- endfor %}
</select>
{%- else -%}
<input
name=
"flt{{ i }}_{{ flt[0] }}"
type=
"text"
value=
"{{ flt[1] or '' }}"
class=
"filter-val"
{%
if
flt
[
0
]
in
filter_types
%}
data-role=
"{{ filter_types[flt[0]] }}"
{%
endif
%}
></input>
{%- endif -%}
</div>
{% endfor %}
</div>
</form>
{% endif %}
{% endif %}
<table
class=
"table table-striped table-bordered model-list"
>
<table
class=
"table table-striped table-bordered model-list"
>
...
...
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