mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-11 21:56:19 +10:00
Update broadcast_message helper
Now it returns the fully-formatted message so we can be consistent about how it's shown.
This commit is contained in:
@@ -181,10 +181,6 @@ module ApplicationHelper
|
||||
end
|
||||
end
|
||||
|
||||
def broadcast_message
|
||||
BroadcastMessage.current
|
||||
end
|
||||
|
||||
# Render a `time` element with Javascript-based relative date and tooltip
|
||||
#
|
||||
# time - Time object
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,4 +1 @@
|
||||
- if broadcast_message.present?
|
||||
.broadcast-message{ style: broadcast_styling(broadcast_message) }
|
||||
= icon('bullhorn')
|
||||
= broadcast_message.message
|
||||
= broadcast_message
|
||||
|
||||
Reference in New Issue
Block a user