Class: KirguduBase::DynamicPages::PageElement
- Defined in:
- app/models/kirgudu_base/dynamic_pages/page_element.rb
Direct Known Subclasses
Entry, Form, FormTab, Group, List, ListCell, MenuItem, MenuSection, PageTab, Property, Widget
Instance Attribute Summary collapse
-
#enabled ⇒ Object
Returns the value of attribute enabled.
-
#html_options ⇒ Object
Returns the value of attribute html_options.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#use_i18n ⇒ Object
Returns the value of attribute use_i18n.
-
#visible ⇒ Object
Returns the value of attribute visible.
Attributes inherited from Element
Instance Method Summary collapse
- #i18n_data_as_string(method) ⇒ Object
-
#initialize(options = {}) ⇒ PageElement
constructor
A new instance of PageElement.
- #to_external_hash(options = {}) ⇒ Object
Methods inherited from Element
#as_json, #fix_parent_entry, #kontroller_klass
Methods included from Models::MergeableElements::ClassMethods
#get_mergeable_attributes, #mergeable_attributes
Methods included from Models::FixableElements::ClassMethods
#fixable_attributes, #get_kb_fixable_attributes
Methods included from Models::FixableElements::InstanceMethods
Methods included from Models::MergeableElements::InstanceMethods
Constructor Details
#initialize(options = {}) ⇒ PageElement
Returns a new instance of PageElement.
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/models/kirgudu_base/dynamic_pages/page_element.rb', line 12 def initialize( = {}) self.name = nil self.id = nil self.= {} self.enabled = :true self.visible = :true self.use_i18n = :true super() end |
Instance Attribute Details
#enabled ⇒ Object
Returns the value of attribute enabled.
29 30 31 |
# File 'app/models/kirgudu_base/dynamic_pages/page_element.rb', line 29 def enabled @enabled end |
#html_options ⇒ Object
Returns the value of attribute html_options.
27 28 29 |
# File 'app/models/kirgudu_base/dynamic_pages/page_element.rb', line 27 def end |
#id ⇒ Object
Returns the value of attribute id.
26 27 28 |
# File 'app/models/kirgudu_base/dynamic_pages/page_element.rb', line 26 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
25 26 27 |
# File 'app/models/kirgudu_base/dynamic_pages/page_element.rb', line 25 def name @name end |
#use_i18n ⇒ Object
Returns the value of attribute use_i18n.
30 31 32 |
# File 'app/models/kirgudu_base/dynamic_pages/page_element.rb', line 30 def use_i18n @use_i18n end |
#visible ⇒ Object
Returns the value of attribute visible.
28 29 30 |
# File 'app/models/kirgudu_base/dynamic_pages/page_element.rb', line 28 def visible @visible end |
Instance Method Details
#i18n_data_as_string(method) ⇒ Object
46 47 48 49 50 51 52 |
# File 'app/models/kirgudu_base/dynamic_pages/page_element.rb', line 46 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 |
#to_external_hash(options = {}) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/models/kirgudu_base/dynamic_pages/page_element.rb', line 34 def to_external_hash( = {}) ||= {} .merge!({ name: self.name, id: self.id, html_options: self., visible: self.visible == :true, enabled: self.enabled == :true }) super() end |