Class: Para::Component::Base
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Para::Component::Base
- Defined in:
- app/models/para/component/base.rb
Class Method Summary collapse
- .configurable_on(key, options = {}) ⇒ Object
- .model_name ⇒ Object
- .register(name, component) ⇒ Object
Instance Method Summary collapse
- #default_form_actions ⇒ Object
- #exportable? ⇒ Boolean
- #history? ⇒ Boolean
- #name ⇒ Object
- #subclassable? ⇒ Boolean
- #to_param ⇒ Object
-
#update_with(attributes) ⇒ Object
This method is used by the components configuration system to assign updated attributes from the config file to the component.
Class Method Details
.configurable_on(key, options = {}) ⇒ Object
13 14 15 |
# File 'app/models/para/component/base.rb', line 13 def self.configurable_on(key, = {}) store_accessor(:configuration, key) end |
.model_name ⇒ Object
46 47 48 |
# File 'app/models/para/component/base.rb', line 46 def self.model_name @model_name ||= ModelName.new(self) end |
.register(name, component) ⇒ Object
8 9 10 11 |
# File 'app/models/para/component/base.rb', line 8 def self.register(name, component) self.component_name = name Para::Component.registered_components[name] = component end |
Instance Method Details
#default_form_actions ⇒ Object
50 51 52 |
# File 'app/models/para/component/base.rb', line 50 def default_form_actions [:submit, :submit_and_edit, :submit_and_add_another, :cancel] end |
#exportable? ⇒ Boolean
34 35 36 |
# File 'app/models/para/component/base.rb', line 34 def exportable? false end |
#history? ⇒ Boolean
42 43 44 |
# File 'app/models/para/component/base.rb', line 42 def history? false end |
#name ⇒ Object
27 28 29 30 31 32 |
# File 'app/models/para/component/base.rb', line 27 def name read_attribute(:name) || ::I18n.t( "components.component.#{ identifier }", default: identifier.humanize ) end |
#subclassable? ⇒ Boolean
38 39 40 |
# File 'app/models/para/component/base.rb', line 38 def subclassable? false end |
#to_param ⇒ Object
54 55 56 |
# File 'app/models/para/component/base.rb', line 54 def to_param slug end |
#update_with(attributes) ⇒ Object
This method is used by the components configuration system to assign updated attributes from the config file to the component.
This is meant to be overriden by components that have to define specific behavior, like for the Crud component
64 65 66 |
# File 'app/models/para/component/base.rb', line 64 def update_with(attributes) assign_attributes(attributes) end |