BigW Consortium Gitlab

_label_dropdown.html.haml 1.8 KB
Newer Older
1
- project = @target_project || @project
2
- show_create = local_assigns.fetch(:show_create, true)
3
- extra_options = local_assigns.fetch(:extra_options, true)
4
- filter_submit = local_assigns.fetch(:filter_submit, true)
5
- show_footer = local_assigns.fetch(:show_footer, true)
6
- use_id = local_assigns.fetch(:use_id, true)
7
- data_options = local_assigns.fetch(:data_options, {})
Alfredo Sumaran committed
8
- classes = local_assigns.fetch(:classes, [])
9 10
- selected = local_assigns.fetch(:selected, nil)
- selected_toggle = local_assigns.fetch(:selected_toggle, nil)
11
- dropdown_title = local_assigns.fetch(:dropdown_title, "Filter by label")
12
- 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"}
13
- dropdown_data.merge!(data_options)
Alfredo Sumaran committed
14 15
- classes << 'js-extra-options' if extra_options
- classes << 'js-filter-submit' if filter_submit
16

17
- if selected
18
  - selected.each do |label|
Phil Hughes committed
19
    = hidden_field_tag data_options[:field_name], use_id ? label.try(:id) : label.try(:title), id: nil
20

21
.dropdown
22
  %button.dropdown-menu-toggle.js-label-select.js-multiselect{ class: classes.join(' '), type: "button", data: dropdown_data }
23
    %span.dropdown-toggle-text{ class: ("is-default" if selected.nil? || selected.empty?) }
24
      = multi_label_name(selected, "Labels")
25
    = icon('chevron-down')
26
  .dropdown-menu.dropdown-select.dropdown-menu-paging.dropdown-menu-labels.dropdown-menu-selectable
27
    = render partial: "shared/issuable/label_page_default", locals: { title: dropdown_title, show_footer: show_footer, show_create: show_create }
28
    - if show_create && project && can?(current_user, :admin_label, project)
29
      = render partial: "shared/issuable/label_page_create"
30
    = dropdown_loading