- display_issuable_type = issuable_display_type(issuable)
- button_action = issuable.closed? ? 'reopen' : 'close'
- display_button_action = button_action.capitalize
- button_responsive_class = 'hidden-xs hidden-sm'
- button_class = "#{button_responsive_class} btn btn-grouped js-issuable-close-button issuable-close-button"
- toggle_class = "#{button_responsive_class} btn btn-nr dropdown-toggle js-issuable-close-toggle"
- button_method = issuable_close_reopen_button_method(issuable)

.pull-left.btn-group.prepend-left-10.issuable-close-dropdown.droplab-dropdown.js-issuable-close-dropdown
  = link_to "#{display_button_action} #{display_issuable_type}", close_reopen_issuable_url(issuable),
            method: button_method, class: "#{button_class} btn-#{button_action}", title: "#{display_button_action} #{display_issuable_type}"

  = button_tag type: 'button', class: "#{toggle_class} btn-#{button_action}-color",
               data: { 'dropdown-trigger' => '#issuable-close-menu' }, 'aria-label' => 'Toggle dropdown' do
    = icon('caret-down', class: 'toggle-icon icon')

  %ul#issuable-close-menu.js-issuable-close-menu.dropdown-menu{ class: button_responsive_class, data: { dropdown: true } }
    %li.close-item{ class: "#{issuable_button_visibility(issuable, true) || 'droplab-item-selected'}",
                    data: { text: "Close #{display_issuable_type}", url: close_issuable_url(issuable),
                    button_class: "#{button_class} btn-close", toggle_class: "#{toggle_class} btn-close-color", method: button_method } }
      %button.btn.btn-transparent
        = icon('check', class: 'icon')
        .description
          %strong.title
            Close
            = display_issuable_type

    %li.reopen-item{ class: "#{issuable_button_visibility(issuable, false) || 'droplab-item-selected'}",
                     data: { text: "Reopen #{display_issuable_type}", url: reopen_issuable_url(issuable),
                     button_class: "#{button_class} btn-reopen", toggle_class: "#{toggle_class} btn-reopen-color", method: button_method } }
      %button.btn.btn-transparent
        = icon('check', class: 'icon')
        .description
          %strong.title
            Reopen
            = display_issuable_type

      %li.divider.droplab-item-ignore

      / TODO: remove condition #36860
      - if issuable.author
        %li.report-item{ data: { text: 'Report abuse', url: new_abuse_report_path(user_id: issuable.author.id, ref_url: issuable_url(issuable)),
                         button_class: "#{button_class} btn-close-color", toggle_class: "#{toggle_class} btn-close-color", method: '' } }
          %button.btn.btn-transparent
            = icon('check', class: 'icon')
            .description
              %strong.title Report abuse
              %p.text
                Report
                = display_issuable_type.pluralize
                that are abusive, inappropriate or spam.
