Sha256: c04859985ad02996cc788c8731eb688997e9ac95936a71de25412a979d3f3210
Contents?: true
Size: 1.05 KB
Versions: 1
Compression:
Stored size: 1.05 KB
Contents
require 'generators/cms/content_types' module CMS module Generators class AdminAreaGenerator < ContentTypes source_root File.expand_path('../templates', __FILE__) class_option :controller, type: :boolean, default: false, desc: 'generate the controller' def copy_controller_file template 'cms_base_controller.rb', 'app/controllers/cms/base_controller.rb' if options[:controller] empty_directory 'app/controllers/cms' empty_directory 'app/models/cms' CMS::Configuration.scoped_types(options).each do |type| @name = (@type = type).model_name template 'type_controller.rb', "app/controllers/cms/#{@name.collection}_controller.rb" if @type.options[:model] template 'type_model.rb', "app/models/cms/#{@name.element}.rb" end %w(index new show edit _fields).each do |view| template "views/#{view}.html.slim", "app/views/cms/#{@name.collection}/#{view}.html.slim" end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
honey-cms-0.5.1 | lib/generators/cms/admin_area_generator.rb |