_label.html.haml 3.07 KB
Newer Older
1
- label_css_id = dom_id(label)
2 3
- open_issues_count = label.open_issues_count(current_user)
- open_merge_requests_count = label.open_merge_requests_count(current_user)
4
- subject = local_assigns[:subject]
5

Alfredo Sumaran's avatar
Typo  
Alfredo Sumaran committed
6
%li{id: label_css_id, data: { id: label.id } }
Tap's avatar
Tap committed
7
  = render "shared/label_row", label: label
8

Phil Hughes's avatar
Phil Hughes committed
9 10 11
  .visible-xs.visible-sm-inline-block.visible-md-inline-block.dropdown
    %button.btn.btn-default.label-options-toggle{ data: { toggle: "dropdown" } }
      Options
12
      = icon('caret-down')
Phil Hughes's avatar
Phil Hughes committed
13 14 15
    .dropdown-menu.dropdown-menu-align-right
      %ul
        %li
16
          = link_to_label(label, subject: subject, type: :merge_request) do
17
            = pluralize open_merge_requests_count, 'merge request'
Phil Hughes's avatar
Phil Hughes committed
18
        %li
19
          = link_to_label(label, subject: subject) do
20
            = pluralize open_issues_count, 'open issue'
21
        - if current_user && defined?(@project)
22 23
          %li.label-subscription
            %a.js-subscribe-button.label-subscribe-button.subscription-status{ role: "button", href: "#", data: { toggle: "tooltip", status: label_subscription_status(label, @project), url: toggle_subscription_namespace_project_label_path(@project.namespace, @project, label) } }
24
              %span= label_subscription_toggle_button_text(label, @project)
25
        - if can?(current_user, :admin_label, label)
Phil Hughes's avatar
Phil Hughes committed
26
          %li
27
            = link_to 'Edit', edit_label_path(label)
Phil Hughes's avatar
Phil Hughes committed
28
          %li
29
            = link_to 'Delete', destroy_label_path(label), title: 'Delete', method: :delete, remote: true, data: {confirm: 'Remove this label? Are you sure?'}
Tap's avatar
Tap committed
30

Phil Hughes's avatar
Phil Hughes committed
31
  .pull-right.hidden-xs.hidden-sm.hidden-md
32
    = link_to_label(label, subject: subject, type: :merge_request, css_class: 'btn btn-transparent btn-action') do
33
      = pluralize open_merge_requests_count, 'merge request'
34
    = link_to_label(label, subject: subject, css_class: 'btn btn-transparent btn-action') do
35
      = pluralize open_issues_count, 'open issue'
36

37
    - if current_user && defined?(@project)
38 39 40
      .label-subscription.inline
        %button.js-subscribe-button.label-subscribe-button.btn.btn-default.btn-action.subscription-status{ type: "button", title: label_subscription_toggle_button_text(label, @project), data: { toggle: "tooltip", status: label_subscription_status(label, @project), url: toggle_subscription_namespace_project_label_path(@project.namespace, @project, label) } }
          %span= label_subscription_toggle_button_text(label, @project)
Phil Hughes's avatar
Phil Hughes committed
41
          = icon('spinner spin', class: 'label-subscribe-button-loading')
42

43
    - if can?(current_user, :admin_label, label)
44
      = link_to edit_label_path(label), title: "Edit", class: 'btn btn-transparent btn-action', data: {toggle: "tooltip"} do
Phil Hughes's avatar
Phil Hughes committed
45
        %span.sr-only Edit
Phil Hughes's avatar
Phil Hughes committed
46
        = icon('pencil-square-o')
47
      = link_to destroy_label_path(label), title: "Delete", class: 'btn btn-transparent btn-action remove-row', method: :delete, remote: true, data: {confirm: label_deletion_confirm_text(label), toggle: "tooltip"} do
Phil Hughes's avatar
Phil Hughes committed
48
        %span.sr-only Delete
Phil Hughes's avatar
Phil Hughes committed
49
        = icon('trash-o')
50

51
  - if current_user && defined?(@project)
Phil Hughes's avatar
Phil Hughes committed
52
    :javascript
53
      new gl.LabelSubscription('##{dom_id(label)} .label-subscription');