Class: Pageflow::BuiltInWidgetType
- Inherits:
-
WidgetType
- Object
- WidgetType
- Pageflow::BuiltInWidgetType
- Defined in:
- lib/pageflow/built_in_widget_type.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#partial_path ⇒ Object
readonly
Returns the value of attribute partial_path.
-
#roles ⇒ Object
readonly
Returns the value of attribute roles.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, roles, partial_path) ⇒ BuiltInWidgetType
constructor
A new instance of BuiltInWidgetType.
- #render(template, entry) ⇒ Object
- #translation_key ⇒ Object
Methods inherited from WidgetType
#enabled_in_editor?, #enabled_in_preview?, #render_head_fragment
Constructor Details
#initialize(name, roles, partial_path) ⇒ BuiltInWidgetType
Returns a new instance of BuiltInWidgetType.
5 6 7 8 9 |
# File 'lib/pageflow/built_in_widget_type.rb', line 5 def initialize(name, roles, partial_path) @name = name @roles = roles @partial_path = partial_path end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/pageflow/built_in_widget_type.rb', line 3 def name @name end |
#partial_path ⇒ Object (readonly)
Returns the value of attribute partial_path.
3 4 5 |
# File 'lib/pageflow/built_in_widget_type.rb', line 3 def partial_path @partial_path end |
#roles ⇒ Object (readonly)
Returns the value of attribute roles.
3 4 5 |
# File 'lib/pageflow/built_in_widget_type.rb', line 3 def roles @roles end |
Class Method Details
.mobile_navigation ⇒ Object
23 24 25 |
# File 'lib/pageflow/built_in_widget_type.rb', line 23 def self. new('default_mobile_navigation', ['mobile_navigation'], 'pageflow/entries/mobile_navigation') end |
.navigation ⇒ Object
19 20 21 |
# File 'lib/pageflow/built_in_widget_type.rb', line 19 def self. new('default_navigation', ['navigation'], 'pageflow/entries/navigation') end |
Instance Method Details
#render(template, entry) ⇒ Object
15 16 17 |
# File 'lib/pageflow/built_in_widget_type.rb', line 15 def render(template, entry) template.render(partial_path, entry: entry) end |
#translation_key ⇒ Object
11 12 13 |
# File 'lib/pageflow/built_in_widget_type.rb', line 11 def translation_key "pageflow.widgets.type_names.#{name}" end |