Sha256: ddbe607077a3b28cee3f900611829ddbeac1fbdef1881504d2ab1cff9d08e20a

Contents?: true

Size: 841 Bytes

Versions: 17

Compression:

Stored size: 841 Bytes

Contents

require "administrate/view_generator"

module Administrate
  module Generators
    module Views
      class FieldGenerator < Administrate::ViewGenerator
        def self.template_source_path
          File.expand_path(
            "../../../../../app/views/fields/",
            __FILE__,
          )
        end

        source_root template_source_path

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

        private

        def copy_field_partial(partial_name)
          resource_path = args.first.try(:underscore)
          template_file = "#{resource_path}/_#{partial_name}.html.erb"

          copy_file(
            template_file,
            "app/views/fields/#{template_file}",
          )
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
administrate-0.8.1 lib/generators/administrate/views/field_generator.rb
administrate-0.8.0 lib/generators/administrate/views/field_generator.rb
administrate-0.7.0 lib/generators/administrate/views/field_generator.rb
administrate-0.6.0 lib/generators/administrate/views/field_generator.rb
administrate-0.5.0 lib/generators/administrate/views/field_generator.rb
administrate-0.4.0 lib/generators/administrate/views/field_generator.rb
administrate-0.3.0 lib/generators/administrate/views/field_generator.rb
administrate-0.2.2 lib/generators/administrate/views/field_generator.rb
administrate-0.2.1 lib/generators/administrate/views/field_generator.rb
administrate-0.2.0 lib/generators/administrate/views/field_generator.rb
administrate-0.2.0.rc1 lib/generators/administrate/views/field_generator.rb
administrate-0.1.5 lib/generators/administrate/views/field_generator.rb
administrate-0.1.4 lib/generators/administrate/views/field_generator.rb
administrate-0.1.3 lib/generators/administrate/views/field_generator.rb
administrate-0.1.2 lib/generators/administrate/views/field_generator.rb
administrate-0.1.1 lib/generators/administrate/views/field_generator.rb
administrate-0.1.0 lib/generators/administrate/views/field_generator.rb