Class: Alchemy::Generators::PageLayoutsGenerator

Inherits:
Base
  • Object
show all
Defined in:
lib/rails/generators/alchemy/page_layouts/page_layouts_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_directoryObject



9
10
11
12
# File 'lib/rails/generators/alchemy/page_layouts/page_layouts_generator.rb', line 9

def create_directory
  @page_layouts_dir = "#{Rails.root}/app/views/alchemy/page_layouts"
  empty_directory @page_layouts_dir
end

#create_partialsObject



14
15
16
17
18
19
20
21
# File 'lib/rails/generators/alchemy/page_layouts/page_layouts_generator.rb', line 14

def create_partials
  @page_layouts = load_alchemy_yaml('page_layouts.yml')
  @page_layouts.each do |page_layout|
    next if page_layout['redirects_to_external']
    @page_layout_name = page_layout["name"].underscore
    conditional_template "layout.html.#{template_engine}", "#{@page_layouts_dir}/_#{@page_layout_name}.html.#{template_engine}"
  end if @page_layouts
end