11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/generators/cms/admin_area_generator.rb', line 11
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.haml", "app/views/cms/#{@name.collection}/#{view}.html.haml"
end
end
end
|