Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
42e0625d
Commit
42e0625d
authored
Apr 09, 2016
by
Jacob Schatz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Filter by multiple labels with little animation.
parent
1617d1e0
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
79 additions
and
21 deletions
+79
-21
app/assets/javascripts/issues.js.coffee
app/assets/javascripts/issues.js.coffee
+35
-1
app/assets/javascripts/labels_select.js.coffee
app/assets/javascripts/labels_select.js.coffee
+4
-5
app/assets/javascripts/lib/animate.js.coffee
app/assets/javascripts/lib/animate.js.coffee
+28
-4
app/controllers/projects/issues_controller.rb
app/controllers/projects/issues_controller.rb
+3
-2
app/views/shared/_label_row.html.haml
app/views/shared/_label_row.html.haml
+3
-5
app/views/shared/issuable/_filter.html.haml
app/views/shared/issuable/_filter.html.haml
+3
-3
app/views/shared/issuable/_label_dropdown.html.haml
app/views/shared/issuable/_label_dropdown.html.haml
+3
-1
No files found.
app/assets/javascripts/issues.js.coffee
View file @
42e0625d
@
Issues
=
@
Issues
=
init
:
->
init
:
->
Issues
.
initTemplates
()
Issues
.
initSearch
()
Issues
.
initSearch
()
Issues
.
initChecks
()
Issues
.
initChecks
()
...
@@ -15,6 +16,15 @@
...
@@ -15,6 +16,15 @@
else
else
$
(
this
).
html
totalIssues
-
1
$
(
this
).
html
totalIssues
-
1
initTemplates
:
->
Issue
.
labelRow
=
_
.
template
(
'<% _.each(labels, function(label){ %>
<span class="label-row">
<a href="#"><span class="label color-label" style="background-color: <%= label.color %>; color: #FFFFFF" title="<%= label.description %>" data-container="body"><%= label.title %></span></a>
</span>
<% }); %>'
)
reload
:
->
reload
:
->
Issues
.
initChecks
()
Issues
.
initChecks
()
$
(
'#filter_issue_search'
).
val
(
$
(
'#issue_search'
).
val
())
$
(
'#filter_issue_search'
).
val
(
$
(
'#issue_search'
).
val
())
...
@@ -50,7 +60,6 @@
...
@@ -50,7 +60,6 @@
,
500
)
,
500
)
filterResults
:
(
form
)
=>
filterResults
:
(
form
)
=>
formData
=
form
.
serialize
()
formData
=
form
.
serialize
()
$
(
'.issues-holder, .merge-requests-holder'
).
css
(
"opacity"
,
'0.5'
)
$
(
'.issues-holder, .merge-requests-holder'
).
css
(
"opacity"
,
'0.5'
)
...
@@ -70,6 +79,31 @@
...
@@ -70,6 +79,31 @@
history
.
replaceState
{
page
:
issuesUrl
},
document
.
title
,
issuesUrl
history
.
replaceState
{
page
:
issuesUrl
},
document
.
title
,
issuesUrl
Issues
.
reload
()
Issues
.
reload
()
Issues
.
updateStateFilters
()
Issues
.
updateStateFilters
()
$filteredLabels
=
$
(
'.filtered-labels'
)
$filteredLabelsSpans
=
$filteredLabels
.
find
(
'span'
)
gl
.
animate
.
animateEach
(
$filteredLabelsSpans
,
'fadeOutDown'
,
20
,
{
cssStart
:
{
opacity
:
1
},
cssEnd
:
{
opacity
:
0
}
}).
then
(
->
$filteredLabels
.
html
(
Issue
.
labelRow
(
data
))
$spans
=
$filteredLabels
.
find
(
'span'
)
$spans
.
css
(
'opacity'
,
0
)
return
gl
.
animate
.
animateEach
(
$spans
,
'fadeInUp'
,
20
,
{
cssStart
:
{
opacity
:
0
},
cssEnd
:
{
opacity
:
1
}
})
)
dataType
:
"json"
dataType
:
"json"
checkChanged
:
->
checkChanged
:
->
...
...
app/assets/javascripts/labels_select.js.coffee
View file @
42e0625d
...
@@ -16,6 +16,7 @@ class @LabelsSelect
...
@@ -16,6 +16,7 @@ class @LabelsSelect
abilityName
=
$dropdown
.
data
(
'ability-name'
)
abilityName
=
$dropdown
.
data
(
'ability-name'
)
$selectbox
=
$dropdown
.
closest
(
'.selectbox'
)
$selectbox
=
$dropdown
.
closest
(
'.selectbox'
)
$block
=
$selectbox
.
closest
(
'.block'
)
$block
=
$selectbox
.
closest
(
'.block'
)
$form
=
$dropdown
.
closest
(
'form'
)
$sidebarCollapsedValue
=
$block
.
find
(
'.sidebar-collapsed-icon span'
)
$sidebarCollapsedValue
=
$block
.
find
(
'.sidebar-collapsed-icon span'
)
$value
=
$block
.
find
(
'.value'
)
$value
=
$block
.
find
(
'.value'
)
$loading
=
$block
.
find
(
'.block-loading'
).
fadeOut
()
$loading
=
$block
.
find
(
'.block-loading'
).
fadeOut
()
...
@@ -171,7 +172,7 @@ class @LabelsSelect
...
@@ -171,7 +172,7 @@ class @LabelsSelect
.
find
(
'a'
)
.
find
(
'a'
)
.
each
((
i
)
->
.
each
((
i
)
->
setTimeout
(
=>
setTimeout
(
=>
gl
A
nimate
(
$
(
@
),
'pulse'
)
gl
.
animate
.
a
nimate
(
$
(
@
),
'pulse'
)
,
200
*
i
,
200
*
i
)
)
)
)
...
@@ -201,9 +202,9 @@ class @LabelsSelect
...
@@ -201,9 +202,9 @@ class @LabelsSelect
renderRow
:
(
label
)
->
renderRow
:
(
label
)
->
selectedClass
=
''
selectedClass
=
''
if
$
selectbox
.
find
(
"input[type='hidden']
\
if
$
form
.
find
(
"input[type='hidden']
\
[name='
#{
$dropdown
.
data
(
'field-name'
)
}
']
\
[name='
#{
$dropdown
.
data
(
'field-name'
)
}
']
\
[value='
#{
label
.
id
}
']"
).
length
[value='
#{
this
.
id
(
label
)
}
']"
).
length
selectedClass
=
'is-active'
selectedClass
=
'is-active'
color
=
if
label
.
color
?
then
"<span class='dropdown-label-box' style='background-color:
#{
label
.
color
}
'></span>"
else
""
color
=
if
label
.
color
?
then
"<span class='dropdown-label-box' style='background-color:
#{
label
.
color
}
'></span>"
else
""
...
@@ -248,8 +249,6 @@ class @LabelsSelect
...
@@ -248,8 +249,6 @@ class @LabelsSelect
.
find
(
"input[type='hidden'][name='
#{
$dropdown
.
data
(
'field-name'
)
}
']"
)
.
find
(
"input[type='hidden'][name='
#{
$dropdown
.
data
(
'field-name'
)
}
']"
)
Issues
.
filterResults
(
Issues
.
filterResults
(
$dropdown
.
closest
(
'form'
),
$dropdown
.
closest
(
'form'
),
selectedLabels
,
$dropdown
.
data
(
'singularFieldName'
),
$dropdown
.
data
(
'fieldName'
)
$dropdown
.
data
(
'fieldName'
)
)
)
else
if
$dropdown
.
hasClass
(
'js-filter-submit'
)
else
if
$dropdown
.
hasClass
(
'js-filter-submit'
)
...
...
app/assets/javascripts/lib/animate.js.coffee
View file @
42e0625d
((
w
)
->
((
w
)
->
if
not
w
.
gl
?
then
w
.
gl
=
{}
if
not
gl
.
animate
?
then
gl
.
animate
=
{}
w
.
glAnimate
=
(
$el
,
animation
,
done
)
->
gl
.
animate
.
animate
=
(
$el
,
animation
,
options
,
done
)
->
if
options
?
.
cssStart
?
$el
.
css
(
options
.
cssStart
)
$el
$el
.
removeClass
()
.
removeClass
(
animation
+
' animated'
)
.
addClass
(
animation
+
' animated'
)
.
addClass
(
animation
+
' animated'
)
.
one
'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend'
,
->
.
one
'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend'
,
->
$
(
this
).
removeClass
()
$
(
this
).
removeClass
(
animation
+
' animated'
)
return
if
done
?
done
()
if
options
?
.
cssEnd
?
$el
.
css
(
options
.
cssEnd
)
return
return
return
return
gl
.
animate
.
animateEach
=
(
$els
,
animation
,
time
,
options
,
done
)
->
dfd
=
$
.
Deferred
()
$els
.
each
((
i
)
->
setTimeout
(
=>
$this
=
$
(
@
)
gl
.
animate
.
animate
(
$this
,
animation
,
options
,
=>
if
i
is
$els
.
length
-
1
dfd
.
resolve
()
if
done
?
done
()
)
,
time
*
i
)
return
)
return
dfd
.
promise
()
return
)
window
)
window
\ No newline at end of file
app/controllers/projects/issues_controller.rb
View file @
42e0625d
...
@@ -33,14 +33,15 @@ class Projects::IssuesController < Projects::ApplicationController
...
@@ -33,14 +33,15 @@ class Projects::IssuesController < Projects::ApplicationController
end
end
@issues
=
@issues
.
page
(
params
[
:page
])
@issues
=
@issues
.
page
(
params
[
:page
])
@label
=
@project
.
labels
.
find_by
(
title:
params
[
:label_name
])
@label
s
=
@project
.
labels
.
where
(
title:
params
[
:label_name
])
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
format
.
html
format
.
atom
{
render
layout:
false
}
format
.
atom
{
render
layout:
false
}
format
.
json
do
format
.
json
do
render
json:
{
render
json:
{
html:
view_to_html_string
(
"projects/issues/_issues"
)
html:
view_to_html_string
(
"projects/issues/_issues"
),
labels:
@labels
}
}
end
end
end
end
...
...
app/views/shared/_label_row.html.haml
View file @
42e0625d
%span
.label-row
-
labels
.
each
do
|
l
|
%span
.label-name
%span
.label-row
=
link_to_label
(
label
,
tooltip:
false
)
=
link_to_label
(
l
,
tooltip:
false
)
%span
.prepend-left-10
\ No newline at end of file
=
markdown
(
label
.
description
,
pipeline: :single_line
)
app/views/shared/issuable/_filter.html.haml
View file @
42e0625d
...
@@ -46,9 +46,9 @@
...
@@ -46,9 +46,9 @@
.filter-item.inline
.filter-item.inline
=
button_tag
"Update issues"
,
class:
"btn update_selected_issues btn-save"
=
button_tag
"Update issues"
,
class:
"btn update_selected_issues btn-save"
-
if
@label
-
if
@label
s
.gray-content-block.second-block
.gray-content-block.second-block
.filtered-labels
=
render
"shared/label_row"
,
label
:
@label
=
render
"shared/label_row"
,
label
s:
@labels
:javascript
:javascript
new
UsersSelect
();
new
UsersSelect
();
...
...
app/views/shared/issuable/_label_dropdown.html.haml
View file @
42e0625d
-
if
params
[
:label_name
].
present?
-
if
params
[
:label_name
].
present?
=
hidden_field_tag
(
:label_name
,
params
[
:label_name
])
-
if
params
[
:label_name
].
respond_to?
(
'any?'
)
-
params
[
:label_name
].
each
do
|
label
|
=
hidden_field_tag
"label_name[]"
,
label
,
id:
nil
.dropdown
.dropdown
%button
.dropdown-menu-toggle.js-label-select.js-filter-submit.js-extra-options
{
type:
"button"
,
data:
{
toggle:
"dropdown"
,
field_name:
"label_name"
,
show_no:
"true"
,
show_any:
"true"
,
selected:
params
[
:label_name
],
project_id:
@project
.
try
(
:id
),
labels:
labels_filter_path
,
default_label:
"Label"
}}
%button
.dropdown-menu-toggle.js-label-select.js-filter-submit.js-extra-options
{
type:
"button"
,
data:
{
toggle:
"dropdown"
,
field_name:
"label_name"
,
show_no:
"true"
,
show_any:
"true"
,
selected:
params
[
:label_name
],
project_id:
@project
.
try
(
:id
),
labels:
labels_filter_path
,
default_label:
"Label"
}}
%button
.dropdown-menu-toggle.js-label-select.js-filter-submit.js-multiselect.js-extra-options
{
type:
"button"
,
data:
{
toggle:
"dropdown"
,
field_name:
"label_name[]"
,
show_no:
"true"
,
show_any:
"true"
,
selected:
params
[
:label_name
],
project_id:
@project
.
try
(
:id
),
labels:
labels_filter_path
,
default_label:
"Label"
}}
%button
.dropdown-menu-toggle.js-label-select.js-filter-submit.js-multiselect.js-extra-options
{
type:
"button"
,
data:
{
toggle:
"dropdown"
,
field_name:
"label_name[]"
,
show_no:
"true"
,
show_any:
"true"
,
selected:
params
[
:label_name
],
project_id:
@project
.
try
(
:id
),
labels:
labels_filter_path
,
default_label:
"Label"
}}
...
...
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