Sha256: 4852d7ee7a3c444425cc76c02815f19268cad0177a92e01af9cbe3e369e96956

Contents?: true

Size: 759 Bytes

Versions: 14

Compression:

Stored size: 759 Bytes

Contents

require "rails/generators/base"
require "administrate/generator_helpers"

module Administrate
  class ViewGenerator < Rails::Generators::Base
    include Administrate::GeneratorHelpers

    private

    def self.template_source_path
      File.expand_path(
        "../../../app/views/administrate/application",
        __FILE__,
      )
    end

    def copy_resource_template(template_name)
      template_file = "#{template_name}.html.erb"

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

    def resource_path
      args.first.try(:underscore).try(:pluralize) || BaseResourcePath.new
    end

    class BaseResourcePath
      def to_s
        "application"
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
administrate-0.12.0 lib/administrate/view_generator.rb
administrate-0.11.0 lib/administrate/view_generator.rb
semantic-administrate-0.10.1 lib/administrate/view_generator.rb
semantic-administrate-0.10.0 lib/administrate/view_generator.rb
administrate-0.10.0 lib/administrate/view_generator.rb
semantic-administrate-0.1.1 lib/administrate/view_generator.rb
administrate-0.9.0 lib/administrate/view_generator.rb
semantic-administrate-0.1.0 lib/administrate/view_generator.rb
administrate-0.8.1 lib/administrate/view_generator.rb
administrate-0.8.0 lib/administrate/view_generator.rb
administrate-0.7.0 lib/administrate/view_generator.rb
administrate-0.6.0 lib/administrate/view_generator.rb
administrate-0.5.0 lib/administrate/view_generator.rb
administrate-0.4.0 lib/administrate/view_generator.rb