Sha256: de6df02d5068f32b4d6e2f9be0688bbc451ace16dc57406f3aeaa6b27f83026a

Contents?: true

Size: 815 Bytes

Versions: 7

Compression:

Stored size: 815 Bytes

Contents

require File.join(__FILE__, '../../base')

module Alchemy
  module Generators
    class PageLayoutsGenerator < Base
      desc "This generator generates your page_layouts view partials."
      source_root File.expand_path('templates', File.dirname(__FILE__))

      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

      private

      def page_layouts_dir
        @_page_layouts_dir ||= "app/views/alchemy/page_layouts"
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
alchemy_cms-3.5.0 lib/rails/generators/alchemy/page_layouts/page_layouts_generator.rb
alchemy_cms-3.4.2 lib/rails/generators/alchemy/page_layouts/page_layouts_generator.rb
alchemy_cms-3.5.0.rc2 lib/rails/generators/alchemy/page_layouts/page_layouts_generator.rb
alchemy_cms-3.5.0.rc1 lib/rails/generators/alchemy/page_layouts/page_layouts_generator.rb
alchemy_cms-3.4.1 lib/rails/generators/alchemy/page_layouts/page_layouts_generator.rb
alchemy_cms-3.4.0 lib/rails/generators/alchemy/page_layouts/page_layouts_generator.rb
alchemy_cms-3.4.0.rc1 lib/rails/generators/alchemy/page_layouts/page_layouts_generator.rb