Class: Para::Component::Base
Class Method Summary
collapse
Instance Method Summary
collapse
with_belongs_to_optional_option_if_needed
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, _options = {})
store_accessor(:configuration, key)
end
|
.model_name ⇒ Object
60
61
62
|
# File 'app/models/para/component/base.rb', line 60
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
64
65
66
|
# File 'app/models/para/component/base.rb', line 64
def default_form_actions
%i[submit submit_and_edit submit_and_add_another cancel]
end
|
#exportable? ⇒ Boolean
48
49
50
|
# File 'app/models/para/component/base.rb', line 48
def exportable?
false
end
|
#history? ⇒ Boolean
56
57
58
|
# File 'app/models/para/component/base.rb', line 56
def history?
false
end
|
#main_navigation_name ⇒ Object
41
42
43
44
45
46
|
# File 'app/models/para/component/base.rb', line 41
def main_navigation_name
::I18n.t(
"components.main_navigation.#{identifier}",
default: name
)
end
|
#name ⇒ Object
34
35
36
37
38
39
|
# File 'app/models/para/component/base.rb', line 34
def name
read_attribute(:name) || ::I18n.t(
"components.component.#{identifier}",
default: identifier.humanize
)
end
|
#subclassable? ⇒ Boolean
52
53
54
|
# File 'app/models/para/component/base.rb', line 52
def subclassable?
false
end
|
#to_param ⇒ Object
68
69
70
|
# File 'app/models/para/component/base.rb', line 68
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
78
79
80
|
# File 'app/models/para/component/base.rb', line 78
def update_with(attributes)
assign_attributes(attributes)
end
|