Sha256: 905312d0e9e59e5e8c47c0f2573ce13efc6967d55fb8c56ea95e91193365b2b3
Contents?: true
Size: 996 Bytes
Versions: 3
Compression:
Stored size: 996 Bytes
Contents
require "rails/generators/base" require "administrate/generator_helpers" require "administrate/namespace" module Administrate class ViewGenerator < Rails::Generators::Base include Administrate::GeneratorHelpers class_option( :namespace, type: :string, desc: "Namespace where the admin dashboards live", default: "admin", ) def self.template_source_path File.expand_path( "../../../app/views/administrate/application", __FILE__, ) end private def namespace options[:namespace] end def copy_resource_template(template_name) template_file = "#{template_name}.html.erb" copy_file( template_file, "app/views/#{namespace}/#{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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
administrate-0.20.1 | lib/administrate/view_generator.rb |
administrate-0.20.0 | lib/administrate/view_generator.rb |
administrate-0.19.0 | lib/administrate/view_generator.rb |