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
iv
gitlab-ce
Commits
4ab6bfce
Commit
4ab6bfce
authored
Apr 26, 2016
by
Alfredo Sumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set indeterminated items
parent
243e5132
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
58 additions
and
6 deletions
+58
-6
app/assets/javascripts/gl_dropdown.js.coffee
app/assets/javascripts/gl_dropdown.js.coffee
+13
-1
app/assets/javascripts/labels_select.js.coffee
app/assets/javascripts/labels_select.js.coffee
+30
-2
app/assets/stylesheets/framework/dropdowns.scss
app/assets/stylesheets/framework/dropdowns.scss
+9
-2
app/helpers/issuables_helper.rb
app/helpers/issuables_helper.rb
+5
-0
app/views/projects/issues/_issue.html.haml
app/views/projects/issues/_issue.html.haml
+1
-1
No files found.
app/assets/javascripts/gl_dropdown.js.coffee
View file @
4ab6bfce
...
@@ -11,6 +11,8 @@ class GitLabDropdownFilter
...
@@ -11,6 +11,8 @@ class GitLabDropdownFilter
$inputContainer
=
@
input
.
parent
()
$inputContainer
=
@
input
.
parent
()
$clearButton
=
$inputContainer
.
find
(
'.js-dropdown-input-clear'
)
$clearButton
=
$inputContainer
.
find
(
'.js-dropdown-input-clear'
)
@
indeterminatedIds
=
[]
# Clear click
# Clear click
$clearButton
.
on
'click'
,
(
e
)
=>
$clearButton
.
on
'click'
,
(
e
)
=>
e
.
preventDefault
()
e
.
preventDefault
()
...
@@ -298,6 +300,13 @@ class GitLabDropdown
...
@@ -298,6 +300,13 @@ class GitLabDropdown
opened
:
=>
opened
:
=>
@
addArrowKeyEvent
()
@
addArrowKeyEvent
()
if
@
options
.
setIndeterminatedIds
@
options
.
setIndeterminatedIds
.
call
(
@
)
# Makes indeterminated items effective
if
@
fullData
and
@
dropdown
.
find
(
'.dropdown-menu-toggle'
).
hasClass
(
'js-filter-bulk-update'
)
@
parseData
@
fullData
contentHtml
=
$
(
'.dropdown-content'
,
@
dropdown
).
html
()
contentHtml
=
$
(
'.dropdown-content'
,
@
dropdown
).
html
()
if
@
remote
&&
contentHtml
is
""
if
@
remote
&&
contentHtml
is
""
@
remote
.
execute
()
@
remote
.
execute
()
...
@@ -309,6 +318,9 @@ class GitLabDropdown
...
@@ -309,6 +318,9 @@ class GitLabDropdown
hidden
:
(
e
)
=>
hidden
:
(
e
)
=>
@
removeArrayKeyEvent
()
@
removeArrayKeyEvent
()
return
if
@
dropdown
.
find
(
'.dropdown-menu-toggle'
).
hasClass
(
'js-filter-bulk-update'
)
if
@
options
.
filterable
if
@
options
.
filterable
@
dropdown
@
dropdown
.
find
(
".dropdown-input-field"
)
.
find
(
".dropdown-input-field"
)
...
@@ -358,7 +370,7 @@ class GitLabDropdown
...
@@ -358,7 +370,7 @@ class GitLabDropdown
if
@
options
.
renderRow
if
@
options
.
renderRow
# Call the render function
# Call the render function
html
=
@
options
.
renderRow
(
data
)
html
=
@
options
.
renderRow
.
call
(
@
options
,
data
,
@
)
else
else
if
not
selected
if
not
selected
value
=
if
@
options
.
id
then
@
options
.
id
(
data
)
else
data
.
id
value
=
if
@
options
.
id
then
@
options
.
id
(
data
)
else
data
.
id
...
...
app/assets/javascripts/labels_select.js.coffee
View file @
4ab6bfce
class
@
LabelsSelect
class
@
LabelsSelect
constructor
:
->
constructor
:
->
_this
=
@
$
(
'.js-label-select'
).
each
(
i
,
dropdown
)
->
$
(
'.js-label-select'
).
each
(
i
,
dropdown
)
->
$dropdown
=
$
(
dropdown
)
$dropdown
=
$
(
dropdown
)
projectId
=
$dropdown
.
data
(
'project-id'
)
projectId
=
$dropdown
.
data
(
'project-id'
)
...
@@ -196,15 +198,25 @@ class @LabelsSelect
...
@@ -196,15 +198,25 @@ class @LabelsSelect
callback
data
callback
data
renderRow
:
(
label
)
->
renderRow
:
(
label
,
instance
)
->
selectedClass
=
[]
removesAll
=
label
.
id
is
0
or
not
label
.
id
?
removesAll
=
label
.
id
is
0
or
not
label
.
id
?
selectedClass
=
[]
if
$dropdown
.
hasClass
(
'js-filter-bulk-update'
)
indeterminated
=
instance
.
indeterminatedIds
if
indeterminated
.
indexOf
(
label
.
id
)
isnt
-
1
selectedClass
.
push
'indeterminated'
if
$form
.
find
(
"input[type='hidden']
\
if
$form
.
find
(
"input[type='hidden']
\
[name='
#{
$dropdown
.
data
(
'fieldName'
)
}
']
\
[name='
#{
$dropdown
.
data
(
'fieldName'
)
}
']
\
[value='
#{
this
.
id
(
label
)
}
']"
).
length
[value='
#{
this
.
id
(
label
)
}
']"
).
length
selectedClass
.
push
'is-active'
selectedClass
.
push
'is-active'
index
=
selectedClass
.
indexOf
(
'indeterminated'
)
if
index
isnt
-
1
selectedClass
.
splice
(
index
,
1
)
if
$dropdown
.
hasClass
(
'js-multiselect'
)
and
removesAll
if
$dropdown
.
hasClass
(
'js-multiselect'
)
and
removesAll
selectedClass
.
push
'dropdown-clear-active'
selectedClass
.
push
'dropdown-clear-active'
...
@@ -264,6 +276,8 @@ class @LabelsSelect
...
@@ -264,6 +276,8 @@ class @LabelsSelect
label
.
id
label
.
id
hidden
:
->
hidden
:
->
return
if
$dropdown
.
hasClass
(
'js-filter-bulk-update'
)
page
=
$
(
'body'
).
data
'page'
page
=
$
(
'body'
).
data
'page'
isIssueIndex
=
page
is
'projects:issues:index'
isIssueIndex
=
page
is
'projects:issues:index'
isMRIndex
=
page
is
'projects:merge_requests:index'
isMRIndex
=
page
is
'projects:merge_requests:index'
...
@@ -301,4 +315,18 @@ class @LabelsSelect
...
@@ -301,4 +315,18 @@ class @LabelsSelect
return
return
else
else
saveLabelData
()
saveLabelData
()
setIndeterminatedIds
:
->
if
@
dropdown
.
find
(
'.dropdown-menu-toggle'
).
hasClass
(
'js-filter-bulk-update'
)
console
.
log
'options.setIndeterminatedIds'
@
indeterminatedIds
=
_this
.
getIndeterminatedIds
()
)
)
getIndeterminatedIds
:
->
label_ids
=
[]
$
(
'.selected_issue:checked'
).
each
(
i
,
el
)
->
issue_id
=
$
(
el
).
data
(
'id'
)
label_ids
.
push
$
(
"#issue_
#{
issue_id
}
"
).
data
(
'labels'
)
_
.
flatten
(
label_ids
)
app/assets/stylesheets/framework/dropdowns.scss
View file @
4ab6bfce
...
@@ -232,9 +232,8 @@
...
@@ -232,9 +232,8 @@
a
{
a
{
padding-left
:
25px
;
padding-left
:
25px
;
&
.i
s-active
{
&
.i
ndeterminated
,
&
.is-active
{
&
:
:
before
{
&
:
:
before
{
content
:
"\f00c"
;
position
:
absolute
;
position
:
absolute
;
left
:
5px
;
left
:
5px
;
top
:
50%
;
top
:
50%
;
...
@@ -246,6 +245,14 @@
...
@@ -246,6 +245,14 @@
-moz-osx-font-smoothing
:
grayscale
;
-moz-osx-font-smoothing
:
grayscale
;
}
}
}
}
&.
indeterminated
:
:
before
{
content
:
"\f068"
;
}
&.
is-active
:
:
before
{
content
:
"\f00c"
;
}
}
}
}
}
...
...
app/helpers/issuables_helper.rb
View file @
4ab6bfce
...
@@ -97,4 +97,9 @@ module IssuablesHelper
...
@@ -97,4 +97,9 @@ module IssuablesHelper
end
end
end
end
def
label_ids
(
issuable
)
return
nil
if
!
issuable
.
labels
.
any?
issuable
.
labels
.
pluck
:id
end
end
end
app/views/projects/issues/_issue.html.haml
View file @
4ab6bfce
%li
{
id:
dom_id
(
issue
),
class:
issue_css_classes
(
issue
),
url:
issue_path
(
issue
)
}
%li
{
id:
dom_id
(
issue
),
class:
issue_css_classes
(
issue
),
url:
issue_path
(
issue
)
,
:'data-labels'
=>
label_ids
(
issue
)
}
-
if
controller
.
controller_name
==
'issues'
&&
can?
(
current_user
,
:admin_issue
,
@project
)
-
if
controller
.
controller_name
==
'issues'
&&
can?
(
current_user
,
:admin_issue
,
@project
)
.issue-check
.issue-check
=
check_box_tag
dom_id
(
issue
,
"selected"
),
nil
,
false
,
'data-id'
=>
issue
.
id
,
class:
"selected_issue"
=
check_box_tag
dom_id
(
issue
,
"selected"
),
nil
,
false
,
'data-id'
=>
issue
.
id
,
class:
"selected_issue"
...
...
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