Tidy tooltip_title and fix dropdown open left

This commit is contained in:
Luke Bennett 2018-05-29 10:35:26 +01:00
parent 5e5828a41a
commit 4a1d19a61d
No known key found for this signature in database
GPG key ID: A738E9C68D3BF31A
2 changed files with 8 additions and 10 deletions

View file

@ -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

View file

@ -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) } }