2016-07-20 06:20:33 -04:00
|
|
|
- project = @target_project || @project
|
2016-05-05 18:08:23 -04:00
|
|
|
- show_create = local_assigns.fetch(:show_create, true)
|
2016-04-22 17:14:28 -04:00
|
|
|
- extra_options = local_assigns.fetch(:extra_options, true)
|
2016-04-25 18:11:17 -04:00
|
|
|
- filter_submit = local_assigns.fetch(:filter_submit, true)
|
2016-04-22 17:14:28 -04:00
|
|
|
- show_footer = local_assigns.fetch(:show_footer, true)
|
2016-07-19 05:05:38 -04:00
|
|
|
- use_id = local_assigns.fetch(:use_id, true)
|
2016-04-22 17:14:28 -04:00
|
|
|
- data_options = local_assigns.fetch(:data_options, {})
|
2016-05-31 17:11:46 -04:00
|
|
|
- classes = local_assigns.fetch(:classes, [])
|
2016-07-16 03:12:12 -04:00
|
|
|
- selected = local_assigns.fetch(:selected, nil)
|
|
|
|
- selected_toggle = local_assigns.fetch(:selected_toggle, nil)
|
2016-10-14 05:49:23 -04:00
|
|
|
- dropdown_title = local_assigns.fetch(:dropdown_title, "Filter by label")
|
2016-10-06 02:33:11 -04:00
|
|
|
- dropdown_data = {toggle: 'dropdown', field_name: "label_name[]", show_no: "true", show_any: "true", namespace_path: @project.try(:namespace).try(:path), project_path: @project.try(:path), labels: labels_filter_path, default_label: "Labels"}
|
2016-04-22 17:14:28 -04:00
|
|
|
- dropdown_data.merge!(data_options)
|
2016-05-31 17:11:46 -04:00
|
|
|
- classes << 'js-extra-options' if extra_options
|
|
|
|
- classes << 'js-filter-submit' if filter_submit
|
2016-04-22 17:14:28 -04:00
|
|
|
|
2016-07-19 05:05:38 -04:00
|
|
|
- if selected
|
2016-07-17 03:34:46 -04:00
|
|
|
- selected.each do |label|
|
2016-10-03 11:24:00 -04:00
|
|
|
= hidden_field_tag data_options[:field_name], use_id ? label.try(:id) : label.try(:title), id: nil
|
2016-10-03 04:10:20 -04:00
|
|
|
|
2016-03-16 15:14:31 -04:00
|
|
|
.dropdown
|
2016-12-26 05:47:16 -05:00
|
|
|
%button.dropdown-menu-toggle.js-label-select.js-multiselect{ class: classes.join(' '), type: "button", data: dropdown_data }
|
2016-07-19 05:05:38 -04:00
|
|
|
%span.dropdown-toggle-text{ class: ("is-default" if selected.nil? || selected.empty?) }
|
2016-07-20 04:45:53 -04:00
|
|
|
= multi_label_name(selected, "Labels")
|
2016-11-18 15:19:44 -05:00
|
|
|
= icon('chevron-down')
|
2016-03-16 15:14:31 -04:00
|
|
|
.dropdown-menu.dropdown-select.dropdown-menu-paging.dropdown-menu-labels.dropdown-menu-selectable
|
2016-10-14 05:49:23 -04:00
|
|
|
= render partial: "shared/issuable/label_page_default", locals: { title: dropdown_title, show_footer: show_footer, show_create: show_create }
|
2016-07-19 05:05:38 -04:00
|
|
|
- if show_create && project && can?(current_user, :admin_label, project)
|
2016-04-12 00:19:47 -04:00
|
|
|
= render partial: "shared/issuable/label_page_create"
|
2016-03-16 15:14:31 -04:00
|
|
|
= dropdown_loading
|