Sha256: 0b2155e7351bc6ddbd5d6806403d3409748d92c14536c6136f3528790db54455
Contents?: true
Size: 1.01 KB
Versions: 9
Compression:
Stored size: 1.01 KB
Contents
require 'rails/generators/migration' class Spud::Cms::LayoutGenerator < ::Rails::Generators::Base desc "This generator creates a new spud cms layout file" argument :template_name, :type => :string argument :attributes, :type => :array, :default => [], :banner => "content_block content_block" source_root File.expand_path('../templates', __FILE__) def create_layout template "layout.html.erb", "app/views/layouts/#{template_name.downcase.underscore}.html.erb" end def create_layout_action concern_path = 'app/controllers/concerns/spud_cms_layout_actions.rb' if !File.exist?(File.join(Rails.root, concern_path)) template 'layout_actions.rb', 'app/controllers/concerns/spud_cms_layout_actions.rb' end inject_into_file concern_path, :after => "extend ActiveSupport::Concern\n" do <<-HEREDOC def #{template_name.downcase.underscore}_action(method) # this action is called when the #{template_name} cms layout is used end HEREDOC end end private def concern_content end end
Version data entries
9 entries across 9 versions & 1 rubygems