Sha256: baea216127da951544b339d2e986617e428578c5a66f39ca6b9d5ed02beb185f
Contents?: true
Size: 1.31 KB
Versions: 3
Compression:
Stored size: 1.31 KB
Contents
module KirguduBase class DynamicPages::PageElement < ::KirguduBase::DynamicPages::Element mergeable_attributes :name, :id, :html_options, :enabled, :visible, :use_i18n validates_inclusion_of :enabled, in: [:true, :false], allow_nil: true validates_inclusion_of :visible, in: [:true, :false], allow_nil: true validates_inclusion_of :use_i18n, in: [:true, :false], allow_nil: true def initialize(options = {}) self.name = nil self.id = nil self.html_options= {} self.enabled = :true self.visible = :true self.use_i18n = :true self.css_class = nil super(options) end attr_accessor :name attr_accessor :id attr_accessor :html_options attr_accessor :visible attr_accessor :enabled attr_accessor :use_i18n attr_accessor :css_class def to_external_hash(options = {}) options ||= {} options.merge!({ name: self.name, id: self.id, html_options: self.html_options, visible: self.visible == :true, enabled: self.enabled == :true }) super(options) end def i18n_data_as_string(method) if method == nil raise "I18N for Page Element: Method supplied is nil" end data = self.send(method) self.use_i18n == :true ? ::I18n.t(data) : data end end end
Version data entries
3 entries across 3 versions & 1 rubygems