Class: Pageflow::BuiltInWidgetType

Inherits:
WidgetType show all
Defined in:
lib/pageflow/built_in_widget_type.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from WidgetType

#enabled_in_editor?, #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

#nameObject (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_pathObject (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

#rolesObject (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_navigationObject


23
24
25
# File 'lib/pageflow/built_in_widget_type.rb', line 23

def self.mobile_navigation
  new('default_mobile_navigation', ['mobile_navigation'], 'pageflow/entries/mobile_navigation')
end

19
20
21
# File 'lib/pageflow/built_in_widget_type.rb', line 19

def self.navigation
  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_keyObject


11
12
13
# File 'lib/pageflow/built_in_widget_type.rb', line 11

def translation_key
  "pageflow.widgets.type_names.#{name}"
end