Tidy tooltip_title and fix for signed out user

This commit is contained in:
Luke Bennett 2018-05-29 10:25:45 +01:00
parent c9e4c1760d
commit 5e5828a41a
No known key found for this signature in database
GPG key ID: A738E9C68D3BF31A
2 changed files with 11 additions and 1 deletions

View file

@ -211,6 +211,16 @@ module LabelsHelper
end
end
def label_status_tooltip(status)
return '' unless status
if status.unsubscribed?
"Subscribe at #{label.is_a?(ProjectLabel) ? 'project' : 'group'} level"
else
"Unsubscribe at #{status.sub('-', ' ')}"
end
end
# Required for Banzai::Filter::LabelReferenceFilter
module_function :render_colored_label, :text_color_for_bg, :escape_once
end

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 = status.unsubscribed? ? "Subscribe at #{label.is_a?(ProjectLabel) ? 'project' : 'group'} level" : "Unsubscribe at #{status.sub('-', ' ')}"
- tooltip_title = label_status_tooltip(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