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?, #enabled_in_preview?, #insert_point, #render_head_fragment, #render_head_fragment_with_configuration, #render_with_configuration

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

.classic_loading_spinnerObject



55
56
57
58
59
60
# File 'lib/pageflow/built_in_widget_type.rb', line 55

def self.classic_loading_spinner
  Pageflow::React.create_widget_type('classic_loading_spinner',
                                     'loading_spinner',
                                     insert_point: :before_entry,
                                     server_rendering: true)
end

.classic_player_controlsObject



27
28
29
# File 'lib/pageflow/built_in_widget_type.rb', line 27

def self.classic_player_controls
  new('classic_player_controls', ['player_controls'], 'pageflow/widgets/placeholder')
end


47
48
49
# File 'lib/pageflow/built_in_widget_type.rb', line 47

def self.consent_bar
  Pageflow::React.create_widget_type('consent_bar', 'cookie_notice')
end


43
44
45
# File 'lib/pageflow/built_in_widget_type.rb', line 43

def self.cookie_notice_bar
  Pageflow::React.create_widget_type('cookie_notice_bar', 'cookie_notice')
end

.default_slideshow_modeObject



35
36
37
# File 'lib/pageflow/built_in_widget_type.rb', line 35

def self.default_slideshow_mode
  new('default_slideshow_mode', ['slideshow_mode'], 'pageflow/widgets/placeholder')
end

.media_loading_spinnerObject



69
70
71
72
73
74
# File 'lib/pageflow/built_in_widget_type.rb', line 69

def self.media_loading_spinner
  Pageflow::React.create_widget_type('media_loading_spinner',
                                     'loading_spinner',
                                     insert_point: :before_entry,
                                     server_rendering: true)
end

.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

.phone_horizontal_slideshow_modeObject



39
40
41
# File 'lib/pageflow/built_in_widget_type.rb', line 39

def self.phone_horizontal_slideshow_mode
  new('phone_horizontal_slideshow_mode', ['slideshow_mode'], 'pageflow/widgets/placeholder')
end

.slim_player_controlsObject



31
32
33
# File 'lib/pageflow/built_in_widget_type.rb', line 31

def self.slim_player_controls
  new('slim_player_controls', ['player_controls'], 'pageflow/widgets/placeholder')
end

.title_loading_spinnerObject



62
63
64
65
66
67
# File 'lib/pageflow/built_in_widget_type.rb', line 62

def self.title_loading_spinner
  Pageflow::React.create_widget_type('title_loading_spinner',
                                     'loading_spinner',
                                     insert_point: :before_entry,
                                     server_rendering: true)
end

.unmute_buttonObject



51
52
53
# File 'lib/pageflow/built_in_widget_type.rb', line 51

def self.unmute_button
  Pageflow::React.create_widget_type('unmute_button', 'background_media_control')
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, widget_type_name: name)
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