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
dce43b4b
Commit
dce43b4b
authored
Mar 15, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pre-selects values on issue and merge request dropdown
Closes #14290
parent
374037b8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
4 deletions
+32
-4
app/helpers/issuables_helper.rb
app/helpers/issuables_helper.rb
+28
-0
app/views/shared/issuable/_filter.html.haml
app/views/shared/issuable/_filter.html.haml
+4
-4
No files found.
app/helpers/issuables_helper.rb
View file @
dce43b4b
...
...
@@ -20,6 +20,34 @@ module IssuablesHelper
base_issuable_scope
(
issuable
).
where
(
'iid < ?'
,
issuable
.
iid
).
first
end
def
user_dropdown_label
(
user_id
,
default_label
)
return
"Unassigned"
if
user_id
==
"0"
user
=
@project
.
team
.
users
.
find_by
(
id:
user_id
)
if
user
user
.
name
else
default_label
end
end
def
labels_dropdown_label
(
label_name
)
if
!
label_name
"Label"
else
label_name
end
end
def
milestone_dropdown_label
(
milestone_name
)
if
!
milestone_name
"Milestone"
else
milestone_name
end
end
private
def
sidebar_gutter_collapsed?
...
...
app/views/shared/issuable/_filter.html.haml
View file @
dce43b4b
...
...
@@ -9,19 +9,19 @@
.filter-item.inline
-
if
params
[
:author_id
]
=
hidden_field_tag
(
:author_id
,
params
[
:author_id
])
=
dropdown_tag
(
"Author"
,
options:
{
toggle_class:
"js-user-search js-filter-submit js-author-search"
,
title:
"Filter by author"
,
filter:
true
,
dropdown_class:
"dropdown-menu-user dropdown-menu-selectable dropdown-menu-author"
,
=
dropdown_tag
(
user_dropdown_label
(
params
[
:author_id
],
"Author"
)
,
options:
{
toggle_class:
"js-user-search js-filter-submit js-author-search"
,
title:
"Filter by author"
,
filter:
true
,
dropdown_class:
"dropdown-menu-user dropdown-menu-selectable dropdown-menu-author"
,
placeholder:
"Search authors"
,
data:
{
any_user:
"Any Author"
,
first_user:
(
current_user
.
username
if
current_user
),
current_user:
true
,
project_id:
(
@project
.
id
if
@project
),
selected:
params
[
:author_id
],
field_name:
"author_id"
}
})
.filter-item.inline
-
if
params
[
:assignee_id
]
=
hidden_field_tag
(
:assignee_id
,
params
[
:assignee_id
])
=
dropdown_tag
(
"Assignee"
,
options:
{
toggle_class:
"js-user-search js-filter-submit js-assignee-search"
,
title:
"Filter by assignee"
,
filter:
true
,
dropdown_class:
"dropdown-menu-user dropdown-menu-selectable dropdown-menu-assignee"
,
=
dropdown_tag
(
user_dropdown_label
(
params
[
:assignee_id
],
"Assignee"
)
,
options:
{
toggle_class:
"js-user-search js-filter-submit js-assignee-search"
,
title:
"Filter by assignee"
,
filter:
true
,
dropdown_class:
"dropdown-menu-user dropdown-menu-selectable dropdown-menu-assignee"
,
placeholder:
"Search assignee"
,
data:
{
any_user:
"Any Assignee"
,
first_user:
(
current_user
.
username
if
current_user
),
null_user:
true
,
current_user:
true
,
project_id:
(
@project
.
id
if
@project
),
selected:
params
[
:assignee_id
],
field_name:
"assignee_id"
}
})
.filter-item.inline.milestone-filter
-
if
params
[
:milestone_title
]
=
hidden_field_tag
(
:milestone_title
,
params
[
:milestone_title
])
=
dropdown_tag
(
"Milestone"
,
options:
{
title:
"Filter by milestone"
,
toggle_class:
'js-milestone-select js-filter-submit'
,
filter:
true
,
dropdown_class:
"dropdown-menu-selectable"
,
=
dropdown_tag
(
milestone_dropdown_label
(
params
[
:milestone_title
])
,
options:
{
title:
"Filter by milestone"
,
toggle_class:
'js-milestone-select js-filter-submit'
,
filter:
true
,
dropdown_class:
"dropdown-menu-selectable"
,
placeholder:
"Search milestones"
,
footer_content:
true
,
data:
{
show_no:
true
,
show_any:
true
,
field_name:
"milestone_title"
,
selected:
params
[
:milestone_title
],
project_id:
(
@project
.
id
if
@project
),
milestones:
(
namespace_project_milestones_path
(
@project
.
namespace
,
@project
,
:js
)
if
@project
)
}
})
do
-
if
@project
%ul
.dropdown-footer-list
...
...
@@ -42,7 +42,7 @@
.dropdown
%button
.dropdown-menu-toggle.js-label-select.js-filter-submit
{
type:
"button"
,
data:
{
toggle:
"dropdown"
,
field_name:
"label_name"
,
show_no:
"true"
,
show_any:
"true"
,
selected:
params
[
:label_name
],
project_id:
(
@project
.
id
if
@project
),
labels:
(
namespace_project_labels_path
(
@project
.
namespace
,
@project
,
:js
)
if
@project
)}}
%span
.dropdown-toggle-text
Label
=
labels_dropdown_label
(
params
[
:label_name
])
=
icon
(
'chevron-down'
)
.dropdown-menu.dropdown-select.dropdown-menu-paging.dropdown-menu-labels.dropdown-menu-selectable
.dropdown-page-one
...
...
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