Skip to content
Snippets Groups Projects
Verified Commit d1e84958 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Add validations to BroadcastMessage color and font

parent e78c51f7
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -20,6 +20,9 @@ class BroadcastMessage < ActiveRecord::Base
validates :starts_at, presence: true
validates :ends_at, presence: true
 
validates :color, format: { with: /\A\#[0-9A-Fa-f]{6}+\Z/ }, allow_blank: true
validates :font, format: { with: /\A\#[0-9A-Fa-f]{6}+\Z/ }, allow_blank: true
def self.current
where("ends_at > :now AND starts_at < :now", now: Time.zone.now).last
end
Loading
Loading
Loading
Loading
@@ -21,11 +21,13 @@
.control-group.js-toggle-colors-container.hide
= f.label :color, "Background Color"
.controls
= f.text_field :color
= f.text_field :color, placeholder: "#AA33EE"
.light Hex values as 3 double digit numbers, starting with a # sign.
.control-group.js-toggle-colors-container.hide
= f.label :font, "Font Color"
.controls
= f.text_field :font
= f.text_field :font, placeholder: "#224466"
.light Hex values as 3 double digit numbers, starting with a # sign.
.control-group
= f.label :starts_at
.controls.datetime-controls
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment