class Formulary::HtmlForm::Fields::ColorInput
Public Class Methods
compatible_type()
click to toggle source
# File lib/formulary/html_form/fields/color_input.rb, line 3 def self.compatible_type "color" end
Public Instance Methods
error()
click to toggle source
Calls superclass method
# File lib/formulary/html_form/fields/color_input.rb, line 11 def error return super if super.present? return "'#{label}' is not a valid color hex value" unless color_correct? end
valid?()
click to toggle source
Calls superclass method
# File lib/formulary/html_form/fields/color_input.rb, line 7 def valid? super && color_correct? end
Protected Instance Methods
color_correct?()
click to toggle source
# File lib/formulary/html_form/fields/color_input.rb, line 18 def color_correct? return true if @value.blank? return true if @value.match(/\A#[0-9A-F]{6}\z/) false end