diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-10 03:07:56 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-10 03:07:56 +0300 |
commit | 775816e676aae53509d7b6f364945f2720636f72 (patch) | |
tree | 0baa821597f08edce720b236b0c07a6d13893f85 /app/helpers | |
parent | e98d69bc8b8b926a727d36e37d2ee30c9fa28907 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/broadcast_messages_helper.rb | 24 | ||||
-rw-r--r-- | app/helpers/user_callouts_helper.rb | 2 |
2 files changed, 20 insertions, 6 deletions
diff --git a/app/helpers/broadcast_messages_helper.rb b/app/helpers/broadcast_messages_helper.rb index 21e57a8d391..b95fd8800c0 100644 --- a/app/helpers/broadcast_messages_helper.rb +++ b/app/helpers/broadcast_messages_helper.rb @@ -1,19 +1,29 @@ # frozen_string_literal: true module BroadcastMessagesHelper - def current_broadcast_messages - BroadcastMessage.current(request.path) + def current_broadcast_banner_messages + BroadcastMessage.current_banner_messages(request.path) end - def broadcast_message(message) + def current_broadcast_notification_message + BroadcastMessage.current_notification_messages(request.path).last + end + + def broadcast_message(message, opts = {}) return unless message.present? - content_tag :div, dir: 'auto', class: 'broadcast-message', style: broadcast_message_style(message) do - sprite_icon('bullhorn', size: 16, css_class: 'vertical-align-text-top mr-2') << ' ' << render_broadcast_message(message) + classes = "broadcast-#{message.broadcast_type}-message #{opts[:preview] && 'preview'}" + + content_tag :div, dir: 'auto', class: classes, style: broadcast_message_style(message) do + concat sprite_icon('bullhorn', size: 16, css_class: 'vertical-align-text-top') + concat ' ' + concat render_broadcast_message(message) end end def broadcast_message_style(broadcast_message) + return '' if broadcast_message.notification? + style = [] if broadcast_message.color.present? @@ -40,4 +50,8 @@ module BroadcastMessagesHelper def render_broadcast_message(broadcast_message) Banzai.render_field(broadcast_message, :message).html_safe end + + def broadcast_type_options + BroadcastMessage.broadcast_types.keys.map { |w| [w.humanize, w] } + end end diff --git a/app/helpers/user_callouts_helper.rb b/app/helpers/user_callouts_helper.rb index 11b78b8fd59..b3eee25674b 100644 --- a/app/helpers/user_callouts_helper.rb +++ b/app/helpers/user_callouts_helper.rb @@ -27,7 +27,7 @@ module UserCalloutsHelper end def show_tabs_feature_highlight? - !user_dismissed?(TABS_POSITION_HIGHLIGHT) && !Rails.env.test? + current_user && !user_dismissed?(TABS_POSITION_HIGHLIGHT) && !Rails.env.test? end private |