summaryrefslogtreecommitdiff
path: root/app/views/shared/issuable/_filter.html.haml
blob: 094d6636c665e91c4d87b12b5293d89eb0b48090 (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
.issues-filters
  .issues-details-filters.row-content-block.second-block
    = form_tag page_filter_path(without: [:assignee_id, :author_id, :milestone_title, :label_name, :issue_search]), method: :get, class: 'filter-form js-filter-form' do
      - if params[:issue_search].present?
        = hidden_field_tag :issue_search, params[:issue_search]
      - if controller.controller_name == 'issues' && can?(current_user, :admin_issue, @project)
        .check-all-holder
          = check_box_tag "check_all_issues", nil, false,
            class: "check_all_issues left"
      .issues-other-filters
        .filter-item.inline
          - if params[:author_id].present?
            = hidden_field_tag(:author_id, params[:author_id])
          = dropdown_tag(user_dropdown_label(params[:author_id], "Author"), options: { toggle_class: "js-user-search js-filter-submit js-author-search", title: "Filter by author", filter: true, dropdown_class: "dropdown-menu-user dropdown-menu-selectable dropdown-menu-author js-filter-submit",
            placeholder: "Search authors", data: { any_user: "Any Author", first_user: (current_user.username if current_user), current_user: true, project_id: (@project.id if @project), selected: params[:author_id], field_name: "author_id", default_label: "Author" } })

        .filter-item.inline
          - if params[:assignee_id].present?
            = hidden_field_tag(:assignee_id, params[:assignee_id])
          = dropdown_tag(user_dropdown_label(params[:assignee_id], "Assignee"), options: { toggle_class: "js-user-search js-filter-submit js-assignee-search", title: "Filter by assignee", filter: true, dropdown_class: "dropdown-menu-user dropdown-menu-selectable dropdown-menu-assignee js-filter-submit",
            placeholder: "Search assignee", data: { any_user: "Any Assignee", first_user: (current_user.username if current_user), null_user: true, current_user: true, project_id: (@project.id if @project), selected: params[:assignee_id], field_name: "assignee_id", default_label: "Assignee" } })

        .filter-item.inline.milestone-filter
          = render "shared/issuable/milestone_dropdown"

        .filter-item.inline.labels-filter
          = render "shared/issuable/label_dropdown"

        .pull-right
          = render 'shared/sort_dropdown'

    - if controller.controller_name == 'issues'
      .issues_bulk_update.hide
        = form_tag bulk_update_namespace_project_issues_path(@project.namespace, @project), method: :post, class: 'bulk-update'  do
          .filter-item.inline
            = dropdown_tag("Status", options: { toggle_class: "js-issue-status", title: "Change status", dropdown_class: "dropdown-menu-status dropdown-menu-selectable", data: { field_name: "update[state_event]" } } ) do
              %ul
                %li
                  %a{href: "#", data: {id: "reopen"}} Open
                %li
                  %a{href: "#", data: {id: "close"}} Closed
          .filter-item.inline
            = dropdown_tag("Assignee", options: { toggle_class: "js-user-search js-update-assignee js-filter-submit js-filter-bulk-update", title: "Assign to", filter: true, dropdown_class: "dropdown-menu-user dropdown-menu-selectable",
              placeholder: "Search authors", data: { first_user: (current_user.username if current_user), null_user: true, current_user: true, project_id: @project.id, field_name: "update[assignee_id]" } })
          .filter-item.inline
            = dropdown_tag("Milestone", options: { title: "Assign milestone", toggle_class: 'js-milestone-select js-extra-options js-filter-submit js-filter-bulk-update', filter: true, dropdown_class: "dropdown-menu-selectable dropdown-menu-milestone", placeholder: "Search milestones", data: { show_no: true, field_name: "update[milestone_id]", project_id: @project.id, milestones: namespace_project_milestones_path(@project.namespace, @project, :json), use_id: true } })

          .filter-item.inline.labels-filter
            = render "shared/issuable/label_dropdown", classes: ['js-filter-bulk-update', 'js-multiselect'], show_create: false, show_footer: false, extra_options: false, filter_submit: false, show_footer: false, data_options: { persist_when_hide: "true", field_name: "update[label_ids][]", show_no: false, show_any: false, use_id: true }

          = hidden_field_tag 'update[issues_ids]', []
          = hidden_field_tag :state_event, params[:state_event]
          .filter-item.inline
            = button_tag "Update issues", class: "btn update_selected_issues btn-save"

  - if !@labels.nil?
    .row-content-block.second-block.filtered-labels{ class: ("hidden" if !@labels.any?) }
      - if @labels.any?
        = render "shared/labels_row", labels: @labels

:javascript
  new UsersSelect();
  new LabelsSelect();
  new MilestoneSelect();
  new IssueStatusSelect();
  $('form.filter-form').on('submit', function (event) {
    event.preventDefault();
    Turbolinks.visit(this.action + '&' + $(this).serialize());
  });