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
108c7b79
Commit
108c7b79
authored
Apr 12, 2012
by
Serge S. Koval
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added 'x' to the filter remove button.
parent
5fe6bd03
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
7 deletions
+25
-7
TODO.txt
TODO.txt
+1
-1
admin.css
flask_adminex/static/css/admin.css
+17
-1
filters.js
flask_adminex/static/js/filters.js
+6
-4
list.html
flask_adminex/templates/admin/model/list.html
+1
-1
No files found.
TODO.txt
View file @
108c7b79
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
- Reduce number of parameters passed to list view
- Reduce number of parameters passed to list view
- Checkboxes and mass operations
- Checkboxes and mass operations
- Filters
- Filters
-
Add 'x' to remove filter and remove button
-
Use table to draw filters so column names will line up?
- Custom filters for date fields?
- Custom filters for date fields?
- Change boolean filter to True/False instead of Yes/No
- Change boolean filter to True/False instead of Yes/No
- Ability to sort by fields that are not visible?
- Ability to sort by fields that are not visible?
...
...
flask_adminex/static/css/admin.css
View file @
108c7b79
...
@@ -43,4 +43,20 @@ form.search-form a.clear i {
...
@@ -43,4 +43,20 @@ form.search-form a.clear i {
{
{
margin-bottom
:
0px
;
margin-bottom
:
0px
;
width
:
208px
;
width
:
208px
;
}
}
\ No newline at end of file
.filter-row
.remove-filter
{
vertical-align
:
middle
;
}
.filter-row
.remove-filter
.close-icon
{
font-size
:
16px
;
}
.filter-row
.remove-filter
.close-icon
:hover
{
color
:
black
;
opacity
:
0.4
;
}
flask_adminex/static/js/filters.js
View file @
108c7b79
...
@@ -24,8 +24,10 @@ var AdminFilters = function(element, filters_element, adminForm, operations, opt
...
@@ -24,8 +24,10 @@ var AdminFilters = function(element, filters_element, adminForm, operations, opt
function
addFilter
(
name
,
op
)
{
function
addFilter
(
name
,
op
)
{
var
$el
=
$
(
'<div class="filter-row" />'
).
appendTo
(
$container
);
var
$el
=
$
(
'<div class="filter-row" />'
).
appendTo
(
$container
);
$
(
'<a href="#" class="btn remove-filter" title="Remove Filter" />'
)
$
(
'<a href="#" class="btn remove-filter" />'
)
.
text
(
name
)
.
append
(
$
(
'<span class="close-icon">×</span>'
))
.
append
(
' '
)
.
append
(
name
)
.
appendTo
(
$el
)
.
appendTo
(
$el
)
.
click
(
removeFilter
);
.
click
(
removeFilter
);
...
@@ -47,7 +49,7 @@ var AdminFilters = function(element, filters_element, adminForm, operations, opt
...
@@ -47,7 +49,7 @@ var AdminFilters = function(element, filters_element, adminForm, operations, opt
$field
=
$
(
'<select class="filter-val" />'
)
$field
=
$
(
'<select class="filter-val" />'
)
.
attr
(
'name'
,
'flt'
+
lastCount
+
'_'
+
optId
)
.
attr
(
'name'
,
'flt'
+
lastCount
+
'_'
+
optId
)
.
appendTo
(
$el
);
.
appendTo
(
$el
);
$
(
options
[
optId
]).
each
(
function
()
{
$
(
options
[
optId
]).
each
(
function
()
{
$field
.
append
(
$
(
'<option/>'
)
$field
.
append
(
$
(
'<option/>'
)
.
val
(
this
[
0
]).
text
(
this
[
1
]))
.
val
(
this
[
0
]).
text
(
this
[
1
]))
...
@@ -72,7 +74,7 @@ var AdminFilters = function(element, filters_element, adminForm, operations, opt
...
@@ -72,7 +74,7 @@ var AdminFilters = function(element, filters_element, adminForm, operations, opt
$
(
'a.filter'
,
filters_element
).
click
(
function
()
{
$
(
'a.filter'
,
filters_element
).
click
(
function
()
{
var
name
=
$
(
this
).
text
().
trim
();
var
name
=
$
(
this
).
text
().
trim
();
addFilter
(
name
,
operations
[
name
]);
addFilter
(
name
,
operations
[
name
]);
$
(
'button'
,
$root
).
show
();
$
(
'button'
,
$root
).
show
();
...
...
flask_adminex/templates/admin/model/list.html
View file @
108c7b79
...
@@ -65,7 +65,7 @@
...
@@ -65,7 +65,7 @@
<div
class=
"filter-row"
>
<div
class=
"filter-row"
>
{% set filter = admin_view._filters[flt[0]] %}
{% set filter = admin_view._filters[flt[0]] %}
<a
href=
"#"
class=
"btn remove-filter"
title=
"{{ _gettext('Remove Filter') }}"
>
<a
href=
"#"
class=
"btn remove-filter"
title=
"{{ _gettext('Remove Filter') }}"
>
{{ filters[flt[0]] }}
<span
class=
"close-icon"
>
×
</span>
{{ filters[flt[0]] }}
</a><select
class=
"filter-op"
data-role=
"chosen"
>
</a><select
class=
"filter-op"
data-role=
"chosen"
>
{% for op in admin_view._filter_dict[filter.name] %}
{% for op in admin_view._filter_dict[filter.name] %}
<option
value=
"{{ op[0] }}"
{%
if
flt
[
0
]
==
op
[
0
]
%}
selected=
"selected"
{%
endif
%}
>
{{ op[1] }}
</option>
<option
value=
"{{ op[0] }}"
{%
if
flt
[
0
]
==
op
[
0
]
%}
selected=
"selected"
{%
endif
%}
>
{{ op[1] }}
</option>
...
...
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