Sha256: 3a932981fc3c7995acece6483dd4bb7d58035afcabd06ca1b6e8fce1f4647b42

Contents?: true

Size: 663 Bytes

Versions: 40

Compression:

Stored size: 663 Bytes

Contents

module Administrate
  module Generators
    class FieldGenerator < Rails::Generators::NamedBase
      source_root File.expand_path("../templates", __FILE__)

      def template_field_object
        template(
          "field_object.rb.erb",
          "app/fields/#{file_name}_field.rb",
        )
      end

      def copy_partials
        copy_partial(:show)
        copy_partial(:index)
        copy_partial(:form)
      end

      private

      def copy_partial(partial_name)
        partial = "_#{partial_name}.html.erb"

        copy_file(
          partial,
          "app/views/fields/#{file_name}_field/#{partial}",
        )
      end
    end
  end
end

Version data entries

40 entries across 40 versions & 3 rubygems

Version Path
administrate-0.20.1 lib/generators/administrate/field/field_generator.rb
administrate-0.20.0 lib/generators/administrate/field/field_generator.rb
administrate-0.19.0 lib/generators/administrate/field/field_generator.rb
administrate-0.18.0 lib/generators/administrate/field/field_generator.rb
administrate-0.17.0 lib/generators/administrate/field/field_generator.rb
administrate-0.16.0 lib/generators/administrate/field/field_generator.rb
administrate-0.15.0 lib/generators/administrate/field/field_generator.rb
administrate-0.14.0 lib/generators/administrate/field/field_generator.rb
viniBaxterDesk-22.0.0 lib/generators/administrate/field/field_generator.rb
viniBaxterDesk-0.21.0 lib/generators/administrate/field/field_generator.rb
viniBaxterDesk-0.20.0 lib/generators/administrate/field/field_generator.rb
viniBaxterDesk-0.14.0 lib/generators/administrate/field/field_generator.rb
viniBaxterDesk-0.13.2 lib/generators/administrate/field/field_generator.rb
viniBaxterDesk-0.13.1 lib/generators/administrate/field/field_generator.rb
administrate-0.13.0 lib/generators/administrate/field/field_generator.rb
administrate-0.12.0 lib/generators/administrate/field/field_generator.rb
administrate-0.11.0 lib/generators/administrate/field/field_generator.rb
semantic-administrate-0.10.1 lib/generators/administrate/field/field_generator.rb
semantic-administrate-0.10.0 lib/generators/administrate/field/field_generator.rb
administrate-0.10.0 lib/generators/administrate/field/field_generator.rb