summaryrefslogtreecommitdiff
path: root/app/views/shared/issuable/_label_dropdown.html.haml
blob: 24a1a616919ac845b78b85aa5385aca1abfbcf41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
- 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)
- data_options = local_assigns.fetch(:data_options, {})
- classes = local_assigns.fetch(:classes, [])
- dropdown_data = {toggle: 'dropdown', field_name: 'label_name[]', show_no: "true", show_any: "true", selected: params[:label_name], project_id: @project.try(:id), labels: labels_filter_path, default_label: "Label"}
- dropdown_data.merge!(data_options)
- classes << 'js-extra-options' if extra_options
- classes << 'js-filter-submit' if filter_submit

- if params[:label_name].present?
  - if params[:label_name].respond_to?('any?')
    - params[:label_name].each do |label|
      = hidden_field_tag "label_name[]", u(label), id: nil
.dropdown
  %button.dropdown-menu-toggle.js-label-select.js-multiselect{class: classes.join(' '), type: "button", data: dropdown_data}
    %span.dropdown-toggle-text
      = h(multi_label_name(params[:label_name], "Label"))
    = icon('chevron-down')
  .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 }
    - if show_create and @project and can?(current_user, :admin_label, @project)
      = render partial: "shared/issuable/label_page_create"
    = dropdown_loading