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
Jérome Perrin
gitlab-ce
Commits
8c1e3c77
Commit
8c1e3c77
authored
Mar 17, 2016
by
Jacob Schatz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add multi select stay open functionality
parent
22aef628
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
31 deletions
+58
-31
app/assets/javascripts/gl_dropdown.js.coffee
app/assets/javascripts/gl_dropdown.js.coffee
+7
-2
app/assets/javascripts/labels_select.js.coffee
app/assets/javascripts/labels_select.js.coffee
+50
-27
app/assets/javascripts/users_select.js.coffee
app/assets/javascripts/users_select.js.coffee
+0
-1
app/helpers/dropdowns_helper.rb
app/helpers/dropdowns_helper.rb
+1
-1
No files found.
app/assets/javascripts/gl_dropdown.js.coffee
View file @
8c1e3c77
...
...
@@ -129,7 +129,7 @@ class GitLabDropdown
@
dropdown
.
on
"shown.bs.dropdown"
,
@
opened
@
dropdown
.
on
"hidden.bs.dropdown"
,
@
hidden
@
dropdown
.
on
"click"
,
".dropdown-menu"
,
@
shouldPropagate
@
dropdown
.
on
"click"
,
".dropdown-menu
, .dropdown-menu-close
"
,
@
shouldPropagate
if
@
dropdown
.
find
(
".dropdown-toggle-page"
).
length
@
dropdown
.
find
(
".dropdown-toggle-page, .dropdown-menu-back"
).
on
"click"
,
(
e
)
=>
...
...
@@ -181,7 +181,12 @@ class GitLabDropdown
shouldPropagate
:
(
e
)
=>
if
@
options
.
multiSelect
$target
=
$
(
e
.
target
)
if
not
$target
.
hasClass
(
'dropdown-menu-close'
)
and
not
$target
.
hasClass
(
'dropdown-menu-close-icon'
)
e
.
stopPropagation
()
return
false
else
return
true
opened
:
=>
contentHtml
=
$
(
'.dropdown-content'
,
@
dropdown
).
html
()
...
...
app/assets/javascripts/labels_select.js.coffee
View file @
8c1e3c77
...
...
@@ -82,6 +82,23 @@ class @LabelsSelect
# This allows us to enable the button when ready
enableLabelCreateButton
=
->
if
newLabelField
.
val
()
isnt
''
and
newColorField
.
val
()
isnt
''
$newLabelError
.
hide
()
$
(
'.js-new-label-btn'
).
disable
()
# Create new label with API
Api
.
newLabel
projectId
,
{
name
:
newLabelField
.
val
()
color
:
newColorField
.
val
()
},
(
label
)
->
$
(
'.js-new-label-btn'
).
enable
()
if
label
.
message
?
$newLabelError
.
text
label
.
message
.
show
()
else
$
(
'.dropdown-menu-back'
,
$dropdown
.
parent
()).
trigger
'click'
$newLabelCreateButton
.
enable
()
else
$newLabelCreateButton
.
disable
()
...
...
@@ -115,6 +132,35 @@ class @LabelsSelect
else
$
(
'.dropdown-menu-back'
,
$dropdown
.
parent
()).
trigger
'click'
saveLabelData
=
->
selected
=
$dropdown
.
closest
(
'.selectbox'
)
.
find
(
"input[name='
#{
$dropdown
.
data
(
'field-name'
)
}
']"
)
.
map
(
->
@
value
).
get
()
data
=
{}
data
[
abilityName
]
=
{}
data
[
abilityName
].
label_ids
=
selected
if
not
selected
.
length
data
[
abilityName
].
label_ids
=
[
''
]
$loading
.
fadeIn
()
$
.
ajax
(
type
:
'PUT'
url
:
issueURL
data
:
data
).
done
(
data
)
->
$loading
.
fadeOut
()
$selectbox
.
hide
()
if
not
data
.
labels
.
length
template
=
labelNoneHTMLTemplate
()
else
template
=
labelHTMLTemplate
(
data
)
href
=
$value
.
show
()
.
html
(
template
)
>>>>>>>
Add
multi
select
stay
open
functionality
$dropdown
.
glDropdown
(
data
:
(
term
,
callback
)
->
$
.
ajax
(
...
...
@@ -190,31 +236,8 @@ class @LabelsSelect
else
if
$dropdown
.
hasClass
'js-filter-submit'
$dropdown
.
closest
(
'form'
).
submit
()
else
selected
=
$dropdown
.
closest
(
'.selectbox'
)
.
find
(
"input[name='
#{
$dropdown
.
data
(
'field-name'
)
}
']"
)
.
map
(
->
@
value
).
get
()
console
.
log
'selected'
,
selected
data
=
{}
data
[
abilityName
]
=
{}
data
[
abilityName
].
label_ids
=
selected
if
not
selected
.
length
data
[
abilityName
].
label_ids
=
[
''
]
$loading
.
fadeIn
()
$
.
ajax
(
type
:
'PUT'
url
:
issueURL
data
:
data
).
done
(
data
)
->
$loading
.
fadeOut
()
$selectbox
.
hide
()
if
not
data
.
labels
.
length
template
=
labelNoneHTMLTemplate
()
if
$dropdown
.
hasClass
'js-multiselect'
return
else
template
=
labelHTMLTemplate
(
data
)
href
=
$value
.
show
()
.
html
(
template
)
saveLabelData
()
)
app/assets/javascripts/users_select.js.coffee
View file @
8c1e3c77
...
...
@@ -90,7 +90,6 @@ class @UsersSelect
data
=
{}
data
[
abilityName
]
=
{}
data
[
abilityName
].
assignee_id
=
selected
console
.
log
'data'
,
data
$loading
.
fadeIn
()
$
.
ajax
(
...
...
app/helpers/dropdowns_helper.rb
View file @
8c1e3c77
...
...
@@ -60,7 +60,7 @@ module DropdownsHelper
title_output
<<
content_tag
(
:span
,
title
)
title_output
<<
content_tag
(
:button
,
class:
"dropdown-title-button dropdown-menu-close"
,
aria:
{
label:
"Close"
},
type:
"button"
)
do
icon
(
'times'
)
icon
(
'times'
,
class:
'dropdown-menu-close-icon'
)
end
title_output
.
html_safe
...
...
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