Commit 4a1d19a6 authored by Luke Bennett's avatar Luke Bennett

Tidy tooltip_title and fix dropdown open left

parent 5e5828a4
......@@ -211,14 +211,12 @@ module LabelsHelper
end
end
def label_status_tooltip(status)
return '' unless status
def label_status_tooltip(label, status)
type = label.is_a?(ProjectLabel) ? 'project' : 'group'
level = status.unsubscribed? ? type : status.sub('-level', '')
action = status.unsubscribed? ? 'Subscribe' : 'Unsubscribe'
if status.unsubscribed?
"Subscribe at #{label.is_a?(ProjectLabel) ? 'project' : 'group'} level"
else
"Unsubscribe at #{status.sub('-', ' ')}"
end
"#{action} at #{level} level"
end
# Required for Banzai::Filter::LabelReferenceFilter
......
......@@ -6,7 +6,7 @@
- toggle_subscription_path = toggle_subscription_label_path(label, @project) if current_user
- show_label_merge_requests_link = show_label_issuables_link?(label, :merge_requests, project: @project)
- show_label_issues_link = show_label_issuables_link?(label, :issues, project: @project)
- tooltip_title = label_status_tooltip(status)
- tooltip_title = label_status_tooltip(label, status) if status
%li.label-list-item{ id: label_css_id, data: { id: label.id } }
= render "shared/label_row", label: label, subject: subject, force_priority: force_priority
......@@ -29,7 +29,7 @@
.dropdown
%button{ type: 'button', class: 'btn btn-transparent js-label-options-dropdown label-action', data: { toggle: 'dropdown' } }
= sprite_icon('ellipsis_v')
.dropdown-menu.dropdown-menu-align-right
.dropdown-menu.dropdown-open-left
%ul
- if label.is_a?(ProjectLabel) && label.project.group && can?(current_user, :admin_label, label.project.group)
%li
......@@ -55,7 +55,7 @@
%span
= _('Subscribe')
= sprite_icon('chevron-down')
.dropdown-menu.dropdown-menu-align-right
.dropdown-menu.dropdown-open-left
%ul
%li
%button.js-subscribe-button.label-subscribe-button.btn.btn-default{ class: ('hidden' unless status.unsubscribed?), data: { status: status, url: toggle_subscription_project_label_path(@project, label) } }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment