Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cto
g1
Commits
b57ab9dd
Commit
b57ab9dd
authored
Feb 18, 2019
by
Pratap Vardhan
Browse files
ENH: g1.formhandler supports multiple sort
#75
parent
ead12162
Pipeline
#77388
passed with stage
in 2 minutes and 53 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
src/formhandler.template.html
View file @
b57ab9dd
...
...
@@ -71,16 +71,21 @@ Each template receives these variables:
col_defaults
(
colinfo
,
data
)
var
menu_item =
false
var
col_id =
idcount++
var
qsort =
parse('?')
var
isSorted =
_.includes(args['_sort'],
colinfo.name
)
?
{
op:
'',
cls:
'
table-primary
'}
:
_.includes
(
args
['
_sort
'],
'
-
'
+
colinfo.name
)
?
{
op:
'
-
',
cls:
'
table-danger
'}
:
{}
%
>
<th
class=
"<%-
args['_sort'] == colinfo.name ? 'table-primary' : args['_sort'] == '-' + colinfo.name ? 'table-danger' : ''
%>"
data-col=
"<%- colinfo.name %>"
>
<th
class=
"<%-
isSorted.cls
%>"
data-col=
"<%- colinfo.name %>"
>
<div
class=
"dropdown"
>
<a
href=
"#"
class=
"dropdown-toggle text-nowrap"
id=
"fh-dd-<%- col_id %>"
data-toggle=
"dropdown"
aria-haspopup=
"true"
aria-expanded=
"false"
>
<
%
-
colinfo.title
||
colinfo.name
%
>
</a>
<div
class=
"dropdown-menu"
aria-labelledby=
"fh-dd-<%- col_id %>"
>
<
%
_.each
(
colinfo.sort
,
function
(
title
,
op
)
{
menu_item =
true
var
active =
args['_sort']
==
op
+
colinfo.name
%
>
<a
class=
"dropdown-item urlfilter <%- active ? 'active': '' %>"
href=
"?_sort=<%- active ? '' : op + colinfo.name %>"
>
qsort =
qsort.update({_sort:
args
['
_sort
']
||
[]})
if
(!
_.isEmpty
(
isSorted
))
qsort =
qsort.update({_sort:
[
colinfo.name
,
'
-
'
+
colinfo.name
]},
'
del
')
var
active =
_.includes(args['_sort'],
op
+
colinfo.name
)
%
>
<a
class=
"dropdown-item urlfilter <%- active ? 'active': '' %>"
href=
"<%- qsort.update({_sort: [op + colinfo.name]}, active ? 'del': 'add').toString() %>"
>
<
%
-
title
%
>
</a>
<
%
})
%
>
...
...
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