honey-cms 0.3.10 → 0.3.11
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cms/type.rb +2 -1
- data/lib/generators/cms/admin_area_generator.rb +4 -1
- metadata +1 -1
data/lib/cms/type.rb
CHANGED
@@ -6,7 +6,8 @@ class CMS::Type
|
|
6
6
|
def initialize name, attributes, options = {}
|
7
7
|
@name = name
|
8
8
|
@attributes = attributes
|
9
|
-
@options = options.symbolize_keys.merge(timestamps: true, indexes: true)
|
9
|
+
@options = options.symbolize_keys.merge(timestamps: true, indexes: true, model: true)
|
10
|
+
@options.merge!(@options.delete(:options).symbolize_keys) if @options[:options].present?
|
10
11
|
@references = []
|
11
12
|
end
|
12
13
|
|
@@ -17,7 +17,10 @@ module CMS
|
|
17
17
|
CMS::Configuration.scoped_types(options).each do |type|
|
18
18
|
@name = (@type = type).model_name
|
19
19
|
template 'type_controller.rb', "app/controllers/cms/#{@name.collection}_controller.rb"
|
20
|
-
|
20
|
+
|
21
|
+
if @type.options[:model]
|
22
|
+
template 'type_model.rb', "app/models/cms/#{@name.element}.rb"
|
23
|
+
end
|
21
24
|
|
22
25
|
%w(index new show edit _fields).each do |view|
|
23
26
|
template "views/#{view}.html.haml", "app/views/cms/#{@name.collection}/#{view}.html.haml"
|