gitlab-org--gitlab-foss/app/views/shared/issuable/_label_dropdown.html.haml

29 lines
1.7 KiB
Text
Raw Normal View History

- project = @target_project || @project
- show_create = local_assigns.fetch(:show_create, true)
- extra_options = local_assigns.fetch(:extra_options, true)
2016-04-25 18:11:17 -04:00
- filter_submit = local_assigns.fetch(:filter_submit, true)
- show_footer = local_assigns.fetch(:show_footer, true)
- use_id = local_assigns.fetch(:use_id, true)
- data_options = local_assigns.fetch(:data_options, {})
2016-05-31 17:11:46 -04:00
- classes = local_assigns.fetch(:classes, [])
- selected = local_assigns.fetch(:selected, nil)
- selected_toggle = local_assigns.fetch(:selected_toggle, nil)
- dropdown_data = {toggle: 'dropdown', field_name: "label_name[]", show_no: "true", show_any: "true", project_id: project.try(:id), labels: labels_filter_path, default_label: "Labels"}
- 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
- if selected
2016-07-17 03:34:46 -04:00
- selected.each do |label|
= hidden_field_tag data_options[:field_name], use_id ? label.try(:id) : u(label.try(:title)), id: nil
.dropdown
2016-05-31 17:11:46 -04:00
%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? || selected.empty?) }
= multi_label_name(selected, "Labels")
= icon('chevron-down')
.dropdown-menu.dropdown-select.dropdown-menu-paging.dropdown-menu-labels.dropdown-menu-selectable
2016-05-31 17:11:46 -04:00
= render partial: "shared/issuable/label_page_default", locals: { title: "Filter by label", show_footer: show_footer, show_create: show_create }
- 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"
= dropdown_loading