2016-11-03 12:29:30 +05:30
|
|
|
- project = @target_project || @project
|
2019-10-12 21:52:04 +05:30
|
|
|
- edit_context = local_assigns.fetch(:edit_context, nil) || project
|
2016-06-16 23:09:34 +05:30
|
|
|
- show_create = local_assigns.fetch(:show_create, true)
|
|
|
|
- extra_options = local_assigns.fetch(:extra_options, true)
|
|
|
|
- filter_submit = local_assigns.fetch(:filter_submit, true)
|
|
|
|
- show_footer = local_assigns.fetch(:show_footer, true)
|
2016-11-03 12:29:30 +05:30
|
|
|
- use_id = local_assigns.fetch(:use_id, true)
|
2016-06-16 23:09:34 +05:30
|
|
|
- data_options = local_assigns.fetch(:data_options, {})
|
|
|
|
- classes = local_assigns.fetch(:classes, [])
|
2016-11-03 12:29:30 +05:30
|
|
|
- selected = local_assigns.fetch(:selected, nil)
|
2020-05-24 23:13:21 +05:30
|
|
|
- dropdown_title = local_assigns.fetch(:dropdown_title, _('Filter by label'))
|
|
|
|
- dropdown_data = label_dropdown_data(edit_context, labels: labels_filter_path_with_defaults(only_group_labels: edit_context.is_a?(Group)), default_label: _('Labels'))
|
|
|
|
|
2022-08-27 11:52:29 +05:30
|
|
|
- dropdown_data.merge!(data_options, qa_selector: "issuable_label_dropdown")
|
2020-05-24 23:13:21 +05:30
|
|
|
- label_name = local_assigns.fetch(:label_name, _('Labels'))
|
2017-09-10 17:25:29 +05:30
|
|
|
- no_default_styles = local_assigns.fetch(:no_default_styles, false)
|
2016-06-16 23:09:34 +05:30
|
|
|
- classes << 'js-extra-options' if extra_options
|
|
|
|
- classes << 'js-filter-submit' if filter_submit
|
|
|
|
|
2016-11-03 12:29:30 +05:30
|
|
|
- if selected
|
|
|
|
- selected.each do |label|
|
|
|
|
= hidden_field_tag data_options[:field_name], use_id ? label.try(:id) : label.try(:title), id: nil
|
|
|
|
|
2016-06-02 11:05:42 +05:30
|
|
|
.dropdown
|
2022-08-27 11:52:29 +05:30
|
|
|
%button.dropdown-menu-toggle.js-label-select.js-multiselect{ class: classes.join(' '), type: "button", data: dropdown_data }
|
2017-09-10 17:25:29 +05:30
|
|
|
- apply_is_default_styles = (selected.nil? || selected.empty?) && !no_default_styles
|
|
|
|
%span.dropdown-toggle-text{ class: ("is-default" if apply_is_default_styles) }
|
|
|
|
= multi_label_name(selected, label_name)
|
2023-05-27 22:25:52 +05:30
|
|
|
= sprite_icon('chevron-down', css_class: "dropdown-menu-toggle-icon")
|
2019-09-04 21:01:54 +05:30
|
|
|
.dropdown-menu.dropdown-select.dropdown-menu-paging.dropdown-menu-labels.dropdown-menu-selectable.dropdown-extended-height
|
2016-11-03 12:29:30 +05:30
|
|
|
= render partial: "shared/issuable/label_page_default", locals: { title: dropdown_title, show_footer: show_footer, show_create: show_create }
|
|
|
|
- if show_create && project && can?(current_user, :admin_label, project)
|
2016-06-02 11:05:42 +05:30
|
|
|
= render partial: "shared/issuable/label_page_create"
|
|
|
|
= dropdown_loading
|