Sha256: b89606a590000f97a1e2e16f2e7b883732e29d3a878eef288627a27301f30b23

Contents?: true

Size: 1.03 KB

Versions: 3

Compression:

Stored size: 1.03 KB

Contents

module NoCms
  module Blocks
    class LayoutGenerator < Rails::Generators::Base

      source_root File.expand_path("../templates/", __FILE__)

      argument :name, required: true, banner: '<layout name>', desc: 'Name for the block layout'

      def generate_stylesheets
        template "app/assets/stylesheets/no_cms/blocks/layout.scss.erb", File.join(destination_root, "app/assets/stylesheets/no_cms/blocks", "_#{name}.scss")
      end

      def generate_views
        template "app/views/no_cms/blocks/blocks/layout.html.erb", File.join(destination_root, "app/views/no_cms/blocks/blocks", "_#{name}.html.erb")
        template "app/views/no_cms/admin/blocks/blocks/layout.html.erb", File.join(destination_root, "app/views/no_cms/admin/blocks/blocks", "_#{name}.html.erb")
      end

      def generate_initializer
        template "config/initializers/nocms/blocks/layout.rb", File.join(destination_root, "config/initializers/nocms/blocks", "#{name}.rb")
      end

      def self.namespace
        "nocms:blocks:layout"
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nocms-blocks-1.1.3 lib/generators/nocms/blocks/layout_generator.rb
nocms-blocks-1.1.2 lib/generators/nocms/blocks/layout_generator.rb
nocms-blocks-1.1.1 lib/generators/nocms/blocks/layout_generator.rb