Commit 02ce5fba authored by Alfredo Sumaran's avatar Alfredo Sumaran Committed by Phil Hughes

Fixes preselected label

parent ee2cfded
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
= render "shared/issuable/milestone_dropdown", selected: params[:milestone_title], name: :milestone_title, show_any: true, show_upcoming: true = render "shared/issuable/milestone_dropdown", selected: params[:milestone_title], name: :milestone_title, show_any: true, show_upcoming: true
.filter-item.inline.labels-filter .filter-item.inline.labels-filter
= render "shared/issuable/label_dropdown", selected: params[:label_name], data_options: { field_name: "label_name[]" } = render "shared/issuable/label_dropdown", selected_toggle: params[:label_name], data_options: { field_name: "label_name[]" }
.pull-right .pull-right
= render 'shared/sort_dropdown' = render 'shared/sort_dropdown'
......
...@@ -13,16 +13,20 @@ ...@@ -13,16 +13,20 @@
- classes << 'js-filter-submit' if filter_submit - classes << 'js-filter-submit' if filter_submit
- if selected.present? - if selected.present?
- if selected.respond_to?('any?') - labelQuery = { id: selected }
- selected = project.labels.where(id: selected) || selected - useId = true
- if selected_toggle.present?
- labelQuery = { title: selected_toggle }
- if labelQuery
- selected = project.labels.where(labelQuery)
- selected.each do |label| - selected.each do |label|
- id = label.try(:id) || label - id = label.try(:id) || label
- title = label.try(:title) || label - title = label.try(:title) || label
= hidden_field_tag data_options[:field_name], id, id: nil, data: { title: title } = hidden_field_tag data_options[:field_name], useId ? id : title, id: nil, data: { title: title }
.dropdown .dropdown
%button.dropdown-menu-toggle.js-label-select.js-multiselect{class: classes.join(' '), type: "button", data: dropdown_data} %button.dropdown-menu-toggle.js-label-select.js-multiselect{class: classes.join(' '), type: "button", data: dropdown_data}
%span.dropdown-toggle-text{ class: ("is-default" if selected.nil?) } %span.dropdown-toggle-text{ class: ("is-default" if selected.nil?) }
= h(multi_label_name(selected_toggle || selected, "Label")) = h(multi_label_name(selected.to_a, "Label"))
= icon('chevron-down') = icon('chevron-down')
.dropdown-menu.dropdown-select.dropdown-menu-paging.dropdown-menu-labels.dropdown-menu-selectable .dropdown-menu.dropdown-select.dropdown-menu-paging.dropdown-menu-labels.dropdown-menu-selectable
= render partial: "shared/issuable/label_page_default", locals: { title: "Filter by label", show_footer: show_footer, show_create: show_create } = render partial: "shared/issuable/label_page_default", locals: { title: "Filter by label", show_footer: show_footer, show_create: show_create }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment