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
0b285adc
Commit
0b285adc
authored
Dec 13, 2013
by
bryhoyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Generate named filter attributes for html forms in filters.js
parent
686394f5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
filters.js
flask_admin/static/admin/js/filters.js
+5
-4
No files found.
flask_admin/static/admin/js/filters.js
View file @
0b285adc
...
@@ -42,7 +42,8 @@ var AdminFilters = function(element, filters_element, operations, options, types
...
@@ -42,7 +42,8 @@ var AdminFilters = function(element, filters_element, operations, options, types
.
change
(
changeOperation
);
.
change
(
changeOperation
);
$
(
op
).
each
(
function
()
{
$
(
op
).
each
(
function
()
{
$select
.
append
(
$
(
'<option/>'
).
attr
(
'value'
,
this
[
0
]).
text
(
this
[
1
]));
var
filter_label
=
(
name
+
'_'
+
this
[
1
]).
toLowerCase
().
replace
(
/ /g
,
'_'
);
$select
.
append
(
$
(
'<option/>'
).
attr
(
'value'
,
filter_label
).
text
(
this
[
1
]));
});
});
$el
.
append
(
$el
.
append
(
...
@@ -53,12 +54,13 @@ var AdminFilters = function(element, filters_element, operations, options, types
...
@@ -53,12 +54,13 @@ var AdminFilters = function(element, filters_element, operations, options, types
// Input
// Input
var
optId
=
op
[
0
][
0
];
var
optId
=
op
[
0
][
0
];
var
filter_label
=
(
name
+
'_'
+
op
[
0
][
1
]).
toLowerCase
().
replace
(
/ /g
,
'_'
);
var
$field
;
var
$field
;
if
(
optId
in
options
)
{
if
(
optId
in
options
)
{
$field
=
$
(
'<select class="filter-val" />'
)
$field
=
$
(
'<select class="filter-val" />'
)
.
attr
(
'name'
,
'flt'
+
lastCount
+
'_'
+
optId
);
.
attr
(
'name'
,
'flt'
+
lastCount
+
'_'
+
filter_label
);
$
(
options
[
optId
]).
each
(
function
()
{
$
(
options
[
optId
]).
each
(
function
()
{
$field
.
append
(
$
(
'<option/>'
)
$field
.
append
(
$
(
'<option/>'
)
...
@@ -70,7 +72,7 @@ var AdminFilters = function(element, filters_element, operations, options, types
...
@@ -70,7 +72,7 @@ var AdminFilters = function(element, filters_element, operations, options, types
}
else
}
else
{
{
$field
=
$
(
'<input type="text" class="filter-val" />'
)
$field
=
$
(
'<input type="text" class="filter-val" />'
)
.
attr
(
'name'
,
'flt'
+
lastCount
+
'_'
+
optId
);
.
attr
(
'name'
,
'flt'
+
lastCount
+
'_'
+
filter_label
);
$el
.
append
(
$
(
'<td/>'
).
append
(
$field
));
$el
.
append
(
$
(
'<td/>'
).
append
(
$field
));
}
}
...
@@ -84,7 +86,6 @@ var AdminFilters = function(element, filters_element, operations, options, types
...
@@ -84,7 +86,6 @@ var AdminFilters = function(element, filters_element, operations, options, types
$
(
'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
();
...
...
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