Module: PagesCore::Templates

Defined in:
lib/pages_core/templates.rb,
lib/pages_core/templates/configuration.rb,
lib/pages_core/templates/controller_actions.rb,
lib/pages_core/templates/block_configuration.rb,
lib/pages_core/templates/configuration_proxy.rb,
lib/pages_core/templates/configuration_handler.rb,
lib/pages_core/templates/template_configuration.rb

Defined Under Namespace

Modules: ControllerActions Classes: BlockConfiguration, Configuration, ConfigurationHandler, ConfigurationProxy, TemplateConfiguration

Class Method Summary collapse

Class Method Details

.allObject



13
14
15
# File 'lib/pages_core/templates.rb', line 13

def all
  names.map { |n| PagesCore::Templates::TemplateConfiguration.new(n) }
end

.configurationObject Also known as: config



139
140
141
142
# File 'lib/pages_core/templates/template_configuration.rb', line 139

def configuration
  load_default_configuration unless defined? @configuration
  @configuration
end

.configure(options = {}) {|configuration| ... } ⇒ Object

Yields:



119
120
121
122
123
124
125
126
127
# File 'lib/pages_core/templates/template_configuration.rb', line 119

def configure(options = {}, &)
  case options[:reset]
  when :defaults
    load_default_configuration
  when true
    @configuration = PagesCore::Templates::Configuration.new
  end
  yield configuration if block_given?
end

.load_default_configurationObject



129
130
131
132
133
134
135
136
137
# File 'lib/pages_core/templates/template_configuration.rb', line 129

def load_default_configuration
  @configuration = PagesCore::Templates::Configuration.new

  # Default template options
  config.default do |default|
    default_configuration(default)
    default_block_configuration(default)
  end
end

.metadata_block_namesObject



145
146
147
148
149
150
# File 'lib/pages_core/templates/template_configuration.rb', line 145

def 
  %i[meta_title
     meta_description
     open_graph_title
     open_graph_description]
end

.namesObject



17
18
19
# File 'lib/pages_core/templates.rb', line 17

def names
  @names ||= find_all_templates
end