Sha256: fec8e500ad56a4e699bcee3bbd44a6c8dd390184ee96a7d7cc64e0cc4cd1b161

Contents?: true

Size: 863 Bytes

Versions: 6

Compression:

Stored size: 863 Bytes

Contents

module Cms
  module Generators
    class WidgetGenerator < ::Rails::Generators::NamedBase
      include ::Rails::Generators::Migration

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

      def self.next_migration_number(dirname)
        max = current_migration_number(dirname)
        Scrivito::Migration.next_migration_number(max)
      end

      def generate_model
        template('model.erb', "app/models/#{file_name}.rb")
      end

      def generate_views
        path = "app/views/#{file_name}"

        template('show.html.erb', "#{path}/show.html.erb")
        template('details.html.erb', "#{path}/details.html.erb")
        template('thumbnail.html.erb', "#{path}/thumbnail.html.erb")
      end

      def generate_migration
        migration_template('migration.erb', "cms/migrate/create_#{file_name}.rb")
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
scrivito_sdk-0.18.1 lib/generators/cms/widget/widget_generator.rb
scrivito_sdk-0.18.0 lib/generators/cms/widget/widget_generator.rb
scrivito_sdk-0.17.0 lib/generators/cms/widget/widget_generator.rb
scrivito_sdk-0.16.0 lib/generators/cms/widget/widget_generator.rb
scrivito_sdk-0.15.0 lib/generators/cms/widget/widget_generator.rb
scrivito_sdk-0.14.0 lib/generators/cms/widget/widget_generator.rb