parent
374037b8a3
commit
dce43b4bea
2 changed files with 32 additions and 4 deletions
|
@ -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?
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue