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
1617d1e0
Commit
1617d1e0
authored
Apr 08, 2016
by
Jacob Schatz
Committed by
Jacob Schatz
Apr 13, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move functionality to label[]
parent
e684480e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
45 deletions
+16
-45
app/assets/javascripts/issues.js.coffee
app/assets/javascripts/issues.js.coffee
+2
-39
app/helpers/issuables_helper.rb
app/helpers/issuables_helper.rb
+14
-6
No files found.
app/assets/javascripts/issues.js.coffee
View file @
1617d1e0
...
@@ -50,45 +50,8 @@
...
@@ -50,45 +50,8 @@
,
500
)
,
500
)
filterResults
:
(
form
)
=>
filterResults
:
(
form
)
=>
# Assume for now there is only 1 multi select field
# Find the hidden inputs with square brackets
formData
=
form
.
serialize
()
$multiInputs
=
form
.
find
(
'input[name$="[]"]'
)
if
$multiInputs
.
length
# get the name of one of them
multiInputName
=
$multiInputs
.
first
()
.
attr
(
'name'
)
# get the singular name by
# removing the square brackets from the name
singularName
=
multiInputName
.
replace
(
'[]'
,
''
)
# clone the form so we can mess around with it.
$clonedForm
=
form
.
clone
()
# get those inputs from the cloned form
$inputs
=
$clonedForm
.
find
(
"input[name='
#{
multiInputName
}
']"
)
# make a comma seperated list of labels
commaSeperated
=
$inputs
.
map
(
->
$
(
this
).
val
())
.
get
()
.
join
(
','
)
# append on a hidden input with the comma
# seperated values in it
$clonedForm
.
append
(
$
(
'<input />'
)
.
attr
(
'type'
,
'hidden'
)
.
attr
(
'name'
,
singularName
)
.
val
(
commaSeperated
)
)
# remove the multi inputs from the
# cloned form so they don't get serialized
$inputs
.
remove
()
# serialize the cloned form
formData
=
$clonedForm
.
serialize
()
else
formData
=
form
.
serialize
()
$
(
'.issues-holder, .merge-requests-holder'
).
css
(
"opacity"
,
'0.5'
)
$
(
'.issues-holder, .merge-requests-holder'
).
css
(
"opacity"
,
'0.5'
)
formAction
=
form
.
attr
(
'action'
)
formAction
=
form
.
attr
(
'action'
)
...
...
app/helpers/issuables_helper.rb
View file @
1617d1e0
...
@@ -17,15 +17,23 @@ module IssuablesHelper
...
@@ -17,15 +17,23 @@ module IssuablesHelper
end
end
def
multi_label_name
(
current_labels
,
default_label
)
def
multi_label_name
(
current_labels
,
default_label
)
if
current_labels
.
presence
# current_labels may be a string from before
if
current_labels
.
include?
','
if
current_labels
.
respond_to?
(
'any?'
)
labels
=
current_labels
.
split
(
','
)
if
current_labels
.
any?
"
#{
labels
[
0
]
}
+
#{
labels
.
count
-
1
}
more"
if
current_labels
.
count
>
1
"
#{
current_labels
[
0
]
}
+
#{
current_labels
.
count
-
1
}
more"
else
current_labels
[
0
]
end
else
else
current_labels
default_label
end
end
else
else
default_label
if
current_labels
.
nil?
default_label
else
current_labels
end
end
end
end
end
...
...
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