Sha256: b070fc6c4c4e11731051dee63326011ac3d3085bb4c4dadbafb6b0bf7e4334f7

Contents?: true

Size: 804 Bytes

Versions: 30

Compression:

Stored size: 804 Bytes

Contents

require_relative '../base'

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

      def create_partials
        @page_layouts = load_alchemy_yaml('page_layouts.yml')
        return unless @page_layouts
        @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
      end

      private

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

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
alchemy_cms-4.6.7 lib/rails/generators/alchemy/page_layouts/page_layouts_generator.rb
alchemy_cms-4.6.6 lib/rails/generators/alchemy/page_layouts/page_layouts_generator.rb
alchemy_cms-4.6.5 lib/rails/generators/alchemy/page_layouts/page_layouts_generator.rb
alchemy_cms-4.5.1 lib/rails/generators/alchemy/page_layouts/page_layouts_generator.rb
alchemy_cms-4.4.5 lib/rails/generators/alchemy/page_layouts/page_layouts_generator.rb
alchemy_cms-4.6.4 lib/rails/generators/alchemy/page_layouts/page_layouts_generator.rb
alchemy_cms-4.6.3 lib/rails/generators/alchemy/page_layouts/page_layouts_generator.rb
alchemy_cms-4.6.2 lib/rails/generators/alchemy/page_layouts/page_layouts_generator.rb
alchemy_cms-4.6.1 lib/rails/generators/alchemy/page_layouts/page_layouts_generator.rb
alchemy_cms-4.6.0 lib/rails/generators/alchemy/page_layouts/page_layouts_generator.rb
alchemy_cms-4.5.0 lib/rails/generators/alchemy/page_layouts/page_layouts_generator.rb
alchemy_cms-4.4.4 lib/rails/generators/alchemy/page_layouts/page_layouts_generator.rb
alchemy_cms-4.4.3 lib/rails/generators/alchemy/page_layouts/page_layouts_generator.rb
alchemy_cms-4.4.2 lib/rails/generators/alchemy/page_layouts/page_layouts_generator.rb
alchemy_cms-4.4.1 lib/rails/generators/alchemy/page_layouts/page_layouts_generator.rb
alchemy_cms-4.4.0 lib/rails/generators/alchemy/page_layouts/page_layouts_generator.rb
alchemy_cms-4.3.2 lib/rails/generators/alchemy/page_layouts/page_layouts_generator.rb
alchemy_cms-4.2.4 lib/rails/generators/alchemy/page_layouts/page_layouts_generator.rb
alchemy_cms-4.3.1 lib/rails/generators/alchemy/page_layouts/page_layouts_generator.rb
alchemy_cms-4.2.3 lib/rails/generators/alchemy/page_layouts/page_layouts_generator.rb