Commit e94c9d62 authored by Tiago Botelho's avatar Tiago Botelho Committed by André Luís

Renames appearance background and font color to message_background_color and message_font_color

parent e0636673
...@@ -43,8 +43,8 @@ ActiveRecord::Schema.define(version: 20180327101207) do ...@@ -43,8 +43,8 @@ ActiveRecord::Schema.define(version: 20180327101207) do
t.text "header_message_html" t.text "header_message_html"
t.text "footer_message" t.text "footer_message"
t.text "footer_message_html" t.text "footer_message_html"
t.text "background_color" t.text "message_background_color"
t.text "font_color" t.text "message_font_color"
end end
create_table "application_settings", force: :cascade do |t| create_table "application_settings", force: :cascade do |t|
......
...@@ -5,8 +5,8 @@ module EE ...@@ -5,8 +5,8 @@ module EE
super + %i[ super + %i[
header_message header_message
footer_message footer_message
background_color message_background_color
font_color message_font_color
] ]
end end
end end
......
...@@ -21,14 +21,14 @@ module EE ...@@ -21,14 +21,14 @@ module EE
class_names << field_sym.to_s.dasherize class_names << field_sym.to_s.dasherize
content_tag :div, class: class_names, style: message_style do content_tag :div, class: class_names, style: message_style do
::Banzai.render_field(current_appearance, field_sym).html_safe markdown_field(current_appearance, field_sym)
end end
end end
def message_style def message_style
style = '' style = ''
style << "background-color: #{current_appearance.background_color};" style << "background-color: #{current_appearance.message_background_color};"
style << "color: #{current_appearance.font_color}" style << "color: #{current_appearance.message_font_color}"
style style
end end
end end
......
...@@ -3,14 +3,14 @@ module EE ...@@ -3,14 +3,14 @@ module EE
extend ActiveSupport::Concern extend ActiveSupport::Concern
prepended do prepended do
cache_markdown_field :header_message cache_markdown_field :header_message, pipeline: :broadcast_message
cache_markdown_field :footer_message cache_markdown_field :footer_message, pipeline: :broadcast_message
validates :background_color, allow_blank: true, color: true validates :message_background_color, allow_blank: true, color: true
validates :font_color, allow_blank: true, color: true validates :message_font_color, allow_blank: true, color: true
default_value_for :background_color, '#E75E40' default_value_for :message_background_color, '#E75E40'
default_value_for :font_color, '#FFFFFF' default_value_for :message_font_color, '#FFFFFF'
end end
def show_header? def show_header?
......
...@@ -8,17 +8,17 @@ ...@@ -8,17 +8,17 @@
.col-sm-10 .col-sm-10
= form.text_area :header_message, placeholder: _('State your message to activate'), class: "form-control js-autosize" = form.text_area :header_message, placeholder: _('State your message to activate'), class: "form-control js-autosize"
.form-group .form-group
= form.label :footer_message, 'Footer message', class: 'control-label' = form.label :footer_message, _('Footer message'), class: 'control-label'
.col-sm-10 .col-sm-10
= form.text_area :footer_message, placeholder: _('State your message to activate'), class: "form-control js-autosize" = form.text_area :footer_message, placeholder: _('State your message to activate'), class: "form-control js-autosize"
.form-group.js-toggle-colors-container .form-group.js-toggle-colors-container
.col-sm-10.col-sm-offset-2 .col-sm-10.col-sm-offset-2
= link_to 'Customize colors', '#', class: 'js-toggle-colors-link' = link_to _('Customize colors'), '#', class: 'js-toggle-colors-link'
.form-group.js-toggle-colors-container.hide .form-group.js-toggle-colors-container.hide
= form.label :background_color, _('Background Color'), class: 'control-label' = form.label :message_background_color, _('Background Color'), class: 'control-label'
.col-sm-10 .col-sm-10
= form.color_field :background_color, class: "form-control" = form.color_field :message_background_color, class: "form-control"
.form-group.js-toggle-colors-container.hide .form-group.js-toggle-colors-container.hide
= form.label :font_color, _('Font Color'), class: 'control-label' = form.label :message_font_color, _('Font Color'), class: 'control-label'
.col-sm-10 .col-sm-10
= form.color_field :font_color, class: "form-control" = form.color_field :message_font_color, class: "form-control"
...@@ -10,7 +10,7 @@ class AddHeaderAndFooterBannersToAppearancesTable < ActiveRecord::Migration ...@@ -10,7 +10,7 @@ class AddHeaderAndFooterBannersToAppearancesTable < ActiveRecord::Migration
add_column :appearances, :footer_message, :text add_column :appearances, :footer_message, :text
add_column :appearances, :footer_message_html, :text add_column :appearances, :footer_message_html, :text
add_column :appearances, :background_color, :text add_column :appearances, :message_background_color, :text
add_column :appearances, :font_color, :text add_column :appearances, :message_font_color, :text
end end
end end
...@@ -7,14 +7,14 @@ describe Appearance do ...@@ -7,14 +7,14 @@ describe Appearance do
let(:triplet) { '#000' } let(:triplet) { '#000' }
let(:hex) { '#AABBCC' } let(:hex) { '#AABBCC' }
it { is_expected.to allow_value(nil).for(:background_color) } it { is_expected.to allow_value(nil).for(:message_background_color) }
it { is_expected.to allow_value(triplet).for(:background_color) } it { is_expected.to allow_value(triplet).for(:message_background_color) }
it { is_expected.to allow_value(hex).for(:background_color) } it { is_expected.to allow_value(hex).for(:message_background_color) }
it { is_expected.not_to allow_value('000').for(:background_color) } it { is_expected.not_to allow_value('000').for(:message_background_color) }
it { is_expected.to allow_value(nil).for(:font_color) } it { is_expected.to allow_value(nil).for(:message_font_color) }
it { is_expected.to allow_value(triplet).for(:font_color) } it { is_expected.to allow_value(triplet).for(:message_font_color) }
it { is_expected.to allow_value(hex).for(:font_color) } it { is_expected.to allow_value(hex).for(:message_font_color) }
it { is_expected.not_to allow_value('000').for(:font_color) } it { is_expected.not_to allow_value('000').for(:message_font_color) }
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment