summaryrefslogtreecommitdiff
path: root/app/helpers/broadcast_messages_helper.rb
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2015-12-31 16:42:56 -0500
committerRobert Speicher <rspeicher@gmail.com>2016-01-13 11:34:58 -0500
commit5a1706791e46fd69a67fcdebfc384a702b00a7ff (patch)
treeafc7d4f071946e3b4c5a0c066bd2a65407b059d4 /app/helpers/broadcast_messages_helper.rb
parent8086b2bd2ecb0ff647da766c436eda47b7434599 (diff)
downloadgitlab-ce-5a1706791e46fd69a67fcdebfc384a702b00a7ff.tar.gz
Update broadcast_message helper
Now it returns the fully-formatted message so we can be consistent about how it's shown.
Diffstat (limited to 'app/helpers/broadcast_messages_helper.rb')
-rw-r--r--app/helpers/broadcast_messages_helper.rb20
1 files changed, 14 insertions, 6 deletions
diff --git a/app/helpers/broadcast_messages_helper.rb b/app/helpers/broadcast_messages_helper.rb
index 6484dca6b55..44bb09b74f4 100644
--- a/app/helpers/broadcast_messages_helper.rb
+++ b/app/helpers/broadcast_messages_helper.rb
@@ -1,16 +1,24 @@
module BroadcastMessagesHelper
- def broadcast_styling(broadcast_message)
- styling = ''
+ def broadcast_message(message = BroadcastMessage.current)
+ return unless message.present?
+
+ content_tag :div, class: 'broadcast-message', style: broadcast_message_style(message) do
+ icon('bullhorn') << ' ' << message.message
+ end
+ end
+
+ def broadcast_message_style(broadcast_message)
+ style = ''
if broadcast_message.color.present?
- styling << "background-color: #{broadcast_message.color}"
- styling << '; ' if broadcast_message.font.present?
+ style << "background-color: #{broadcast_message.color}"
+ style << '; ' if broadcast_message.font.present?
end
if broadcast_message.font.present?
- styling << "color: #{broadcast_message.font}"
+ style << "color: #{broadcast_message.font}"
end
- styling
+ style
end
end