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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
97622a82
Commit
97622a82
authored
May 02, 2017
by
Clement Ho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[skip ci] Refactor into issue_dropdown_options
parent
9aa21e8b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
12 deletions
+34
-12
app/helpers/form_helper.rb
app/helpers/form_helper.rb
+33
-0
app/views/shared/issuable/form/_metadata.html.haml
app/views/shared/issuable/form/_metadata.html.haml
+1
-12
No files found.
app/helpers/form_helper.rb
View file @
97622a82
...
...
@@ -15,4 +15,37 @@ module FormHelper
end
end
end
def
issue_dropdown_options
(
issuable
,
has_multiple_assignees
=
true
)
options
=
{
toggle_class:
'js-user-search js-assignee-search'
,
title:
'Select assignee'
,
filter:
true
,
dropdown_class:
'dropdown-menu-user dropdown-menu-selectable dropdown-menu-assignee'
,
placeholder:
'Search users'
,
data:
{
first_user:
(
current_user
.
username
if
current_user
),
null_user:
true
,
current_user:
true
,
project_id:
issuable
.
project
.
try
(
:id
),
field_name:
"
#{
issuable
.
class
.
model_name
.
param_key
}
[assignee_ids][]"
,
default_label:
'Assignee'
,
'max-select'
:
1
,
'dropdown-header'
:
'Assignee'
,
}
}
if
has_multiple_assignees
options
[
:toggle_class
]
+=
' js-multiselect js-save-user-data'
options
[
:title
]
=
'Select assignee(s)'
options
[
:data
][
:multi_select
]
=
true
options
[
:data
][
:'input-meta'
]
=
'name'
options
[
:data
][
:'always-show-selectbox'
]
=
true
options
[
:data
][
:current_user_info
]
=
current_user
.
to_json
(
only:
[
:id
,
:name
])
options
[
:data
][
:'dropdown-header'
]
=
'Assignee(s)'
options
[
:data
].
delete
(
:'max-select'
)
end
options
end
end
app/views/shared/issuable/form/_metadata.html.haml
View file @
97622a82
...
...
@@ -17,18 +17,7 @@
-
issuable
.
assignees
.
each
do
|
assignee
|
=
hidden_field_tag
"
#{
issuable
.
to_ability_name
}
[assignee_ids][]"
,
assignee
.
id
,
id:
nil
,
data:
{
meta:
assignee
.
name
}
-
options
=
{
toggle_class:
"js-user-search js-assignee-search"
,
title:
'Select assignee'
,
filter:
true
,
dropdown_class:
"dropdown-menu-user dropdown-menu-selectable dropdown-menu-assignee"
,
placeholder:
"Search users"
,
data:
{
first_user:
(
current_user
.
username
if
current_user
),
null_user:
true
,
current_user:
true
,
project_id:
issuable
.
project
.
try
(
:id
),
field_name:
"
#{
issuable
.
class
.
model_name
.
param_key
}
[assignee_ids][]"
,
default_label:
"Assignee"
}
}
-
options
[
:toggle_class
]
+=
' js-multiselect js-save-user-data'
-
options
[
:title
]
=
'Select assignee(s)'
-
options
[
:data
][
:multi_select
]
=
true
-
options
[
:data
][
'input-meta'
]
=
'name'
-
options
[
:data
][
'dropdown-header'
]
=
'Assignee(s)'
-
options
[
:data
][
'always-show-selectbox'
]
=
true
-
options
[
:data
][
:current_user_info
]
=
current_user
.
to_json
(
only:
[
:id
,
:name
])
=
dropdown_tag
(
users_dropdown_label
(
issuable
.
assignees
),
options:
options
)
=
dropdown_tag
(
users_dropdown_label
(
issuable
.
assignees
),
options:
issue_dropdown_options
(
issuable
,
true
))
=
link_to
'Assign to me'
,
'#'
,
class:
"assign-to-me-link
#{
'hide'
if
issuable
.
assignees
.
include?
(
current_user
)
}
"
-
else
=
form
.
label
:assignee_id
,
"Assignee"
,
class:
"control-label
#{
"col-lg-4"
if
has_due_date
}
"
...
...
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