genkiwow-nitro-generator 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +20 -0
- data/README.rdoc +15 -0
- data/Rakefile +56 -0
- data/VERSION.yml +4 -0
- data/generators/nitro_layout/USAGE +3 -0
- data/generators/nitro_layout/nitro_layout_generator.rb +66 -0
- data/generators/nitro_layout/templates/admin/admin_controller.rb +4 -0
- data/generators/nitro_layout/templates/admin/view_layout_administration.html.erb +59 -0
- data/generators/nitro_layout/templates/admin/view_layout_sign.html.erb +17 -0
- data/generators/nitro_layout/templates/admin/view_sidebar.html.erb +13 -0
- data/generators/nitro_layout/templates/admin/view_signin.html.erb +39 -0
- data/generators/nitro_layout/templates/admin/view_signup.html.erb +56 -0
- data/generators/nitro_layout/templates/app_helper.rb +42 -0
- data/generators/nitro_layout/templates/javascripts/application.js +42 -0
- data/generators/nitro_layout/templates/javascripts/jquery-1.3.min.js +19 -0
- data/generators/nitro_layout/templates/layout.html.erb +47 -0
- data/generators/nitro_layout/templates/stylesheets/base.css +336 -0
- data/generators/nitro_layout/templates/stylesheets/themes/bec-green/style.css +290 -0
- data/generators/nitro_layout/templates/stylesheets/themes/bec/style.css +301 -0
- data/generators/nitro_layout/templates/stylesheets/themes/blue/style.css +280 -0
- data/generators/nitro_layout/templates/stylesheets/themes/default/style.css +267 -0
- data/generators/nitro_layout/templates/stylesheets/themes/djime-cerulean/style.css +298 -0
- data/generators/nitro_layout/templates/stylesheets/themes/kathleene/style.css +272 -0
- data/generators/nitro_layout/templates/stylesheets/themes/orange/style.css +263 -0
- data/generators/nitro_layout/templates/stylesheets/themes/reidb-greenish/style.css +301 -0
- data/generators/nitro_layout/templates/view_sidebar.html.erb +13 -0
- data/generators/nitro_scaffold/USAGE +3 -0
- data/generators/nitro_scaffold/nitro_scaffold_generator.rb +186 -0
- data/generators/nitro_scaffold/templates/admin/controller.rb +101 -0
- data/generators/nitro_scaffold/templates/admin/view_destroy.js.erb +2 -0
- data/generators/nitro_scaffold/templates/admin/view_edit.html.erb +19 -0
- data/generators/nitro_scaffold/templates/admin/view_form.html.erb +19 -0
- data/generators/nitro_scaffold/templates/admin/view_index.html.erb +56 -0
- data/generators/nitro_scaffold/templates/admin/view_new.html.erb +20 -0
- data/generators/nitro_scaffold/templates/admin/view_show.html.erb +31 -0
- data/generators/nitro_scaffold/templates/admin/view_sidebar.html.erb +13 -0
- data/generators/nitro_scaffold/templates/controller.rb +85 -0
- data/generators/nitro_scaffold/templates/functional_test.rb +45 -0
- data/generators/nitro_scaffold/templates/helper.rb +2 -0
- data/generators/nitro_scaffold/templates/helper_test.rb +4 -0
- data/generators/nitro_scaffold/templates/layout.html.erb +47 -0
- data/generators/nitro_scaffold/templates/view_edit.html.erb +19 -0
- data/generators/nitro_scaffold/templates/view_form.html.erb +19 -0
- data/generators/nitro_scaffold/templates/view_index.html.erb +56 -0
- data/generators/nitro_scaffold/templates/view_new.html.erb +20 -0
- data/generators/nitro_scaffold/templates/view_show.html.erb +32 -0
- data/generators/nitro_scaffold/templates/view_sidebar.html.erb +13 -0
- data/lib/nitro_generator.rb +3 -0
- data/test/nitro_generator_test.rb +7 -0
- data/test/test_helper.rb +10 -0
- metadata +104 -0
@@ -0,0 +1,301 @@
|
|
1
|
+
.small { font-size:11px; }
|
2
|
+
.gray { color:#a2b0b6; }
|
3
|
+
.hightlight { background-color:#d6e7c7; }
|
4
|
+
|
5
|
+
a:link, a:visited, a:hover, a:active { color: #81B953; }
|
6
|
+
h1, h2, h3 { color: #3B5526; }
|
7
|
+
a { -moz-outline: none; }
|
8
|
+
|
9
|
+
body {
|
10
|
+
color: #222;
|
11
|
+
background: #e4ebe4;
|
12
|
+
font-family: helvetica, arial, sans-serif;
|
13
|
+
}
|
14
|
+
|
15
|
+
hr {
|
16
|
+
background: #f0f0ee;
|
17
|
+
color: #f0f0ee;
|
18
|
+
}
|
19
|
+
|
20
|
+
#header {
|
21
|
+
background: #c9deb7;
|
22
|
+
|
23
|
+
}
|
24
|
+
|
25
|
+
#header h1{
|
26
|
+
padding: 20px 0;
|
27
|
+
font-weight: bold;
|
28
|
+
|
29
|
+
}
|
30
|
+
|
31
|
+
#header h1 a:link, #header h1 a:active,
|
32
|
+
#header h1 a:hover, #header h1 a:visited {
|
33
|
+
color: #3B5526;
|
34
|
+
}
|
35
|
+
|
36
|
+
#main .block .content {
|
37
|
+
background: #FFF;
|
38
|
+
padding-top: 1px;
|
39
|
+
}
|
40
|
+
|
41
|
+
#main .block .content h2 {
|
42
|
+
margin-left: 15px;
|
43
|
+
}
|
44
|
+
|
45
|
+
#main .content { border: 1px solid #81B953;}
|
46
|
+
|
47
|
+
#sidebar .block {
|
48
|
+
background: #FFF;
|
49
|
+
border: none;
|
50
|
+
}
|
51
|
+
|
52
|
+
#sidebar h3 {
|
53
|
+
padding: 8px 12px;
|
54
|
+
background: #3B5526;
|
55
|
+
color: #FFF;
|
56
|
+
font-weight: bold;
|
57
|
+
border-bottom: 5px solid #81B953;
|
58
|
+
}
|
59
|
+
|
60
|
+
|
61
|
+
#sidebar ul li a:link,
|
62
|
+
#sidebar ul li a:visited {
|
63
|
+
background: #FFF;
|
64
|
+
border-bottom: 1px solid #F0F0EE;
|
65
|
+
text-decoration: none;
|
66
|
+
}
|
67
|
+
|
68
|
+
#sidebar ul li a:hover,
|
69
|
+
#sidebar ul li a:active {
|
70
|
+
background: #D3E8C1;
|
71
|
+
color: #FFF;
|
72
|
+
}
|
73
|
+
|
74
|
+
#main-navigation {
|
75
|
+
background: #44721e;
|
76
|
+
margin-right: 20px;
|
77
|
+
padding: 7px 7px 0 7px;
|
78
|
+
}
|
79
|
+
|
80
|
+
#main-navigation ul li {
|
81
|
+
background: #91B96F;
|
82
|
+
margin-right: 7px;
|
83
|
+
}
|
84
|
+
|
85
|
+
#main-navigation ul li a {
|
86
|
+
padding: 10px 10px 5px 10px;
|
87
|
+
}
|
88
|
+
|
89
|
+
#main-navigation ul li.active {
|
90
|
+
background: #e4ebe4;
|
91
|
+
border: 1px solid #91B96F;
|
92
|
+
border-bottom: none;
|
93
|
+
font-weight: bold;
|
94
|
+
}
|
95
|
+
|
96
|
+
#main-navigation ul li a:hover,
|
97
|
+
#main-navigation ul li a:link,
|
98
|
+
#main-navigation ul li a:visited,
|
99
|
+
#main-navigation ul li a:active,
|
100
|
+
.secondary-navigation ul li a:link, .secondary-navigation ul li a:visited,
|
101
|
+
.secondary-navigation ul li a:hover, .secondary-navigation ul li a:active {
|
102
|
+
text-decoration: none;
|
103
|
+
color: #FFF;
|
104
|
+
}
|
105
|
+
|
106
|
+
#user-navigation ul li a:link,
|
107
|
+
#user-navigation ul li a:visited,
|
108
|
+
#user-navigation ul li a:active {
|
109
|
+
color: #3B5526;
|
110
|
+
}
|
111
|
+
|
112
|
+
#user-navigation ul li a:hover { color: #fff; }
|
113
|
+
|
114
|
+
#main-navigation ul li.active a:link,
|
115
|
+
#main-navigation ul li.active a:visited,
|
116
|
+
#main-navigation ul li.active a:hover,
|
117
|
+
#main-navigation ul li.active a:active {
|
118
|
+
color: #262626;
|
119
|
+
}
|
120
|
+
|
121
|
+
.secondary-navigation {
|
122
|
+
background: #3B5526;
|
123
|
+
border-bottom: 5px solid #81b953;
|
124
|
+
}
|
125
|
+
|
126
|
+
.secondary-navigation ul li a {
|
127
|
+
display:block;
|
128
|
+
padding: 8px 12px;
|
129
|
+
}
|
130
|
+
|
131
|
+
.secondary-navigation ul li.active {background: #81b953; font-weight: bold;}
|
132
|
+
.secondary-navigation ul li.active a:hover {
|
133
|
+
background-color: #81B953;
|
134
|
+
}
|
135
|
+
|
136
|
+
.secondary-navigation li a:hover {
|
137
|
+
background: #81B953;
|
138
|
+
}
|
139
|
+
|
140
|
+
#footer .block {
|
141
|
+
color: #FFF;
|
142
|
+
background: #3B5526;
|
143
|
+
}
|
144
|
+
|
145
|
+
#footer .block p {
|
146
|
+
margin: 0;
|
147
|
+
padding: 5px;
|
148
|
+
}
|
149
|
+
|
150
|
+
/* pagination */
|
151
|
+
|
152
|
+
.pagination span.current {
|
153
|
+
background: #262626;
|
154
|
+
color: #FFF;
|
155
|
+
border-color: #262626;
|
156
|
+
}
|
157
|
+
|
158
|
+
.pagination a {
|
159
|
+
color: #262626;
|
160
|
+
border-color: #262626;
|
161
|
+
}
|
162
|
+
|
163
|
+
.pagination a:hover {
|
164
|
+
color: #FFF;
|
165
|
+
background: #262626;
|
166
|
+
}
|
167
|
+
|
168
|
+
/* tables */
|
169
|
+
|
170
|
+
|
171
|
+
.table th {
|
172
|
+
background: #253618;
|
173
|
+
color: #FFF;
|
174
|
+
}
|
175
|
+
|
176
|
+
.table tr th { padding: 5px; }
|
177
|
+
|
178
|
+
.table td {
|
179
|
+
border-bottom:1px solid #F0F0EE;
|
180
|
+
}
|
181
|
+
.table tr.odd {background: #ebfadf;}
|
182
|
+
.table tr.even {background: #d3e8c1;}
|
183
|
+
|
184
|
+
|
185
|
+
/* forms */
|
186
|
+
|
187
|
+
.form input.text_field, .form textarea.text_area {
|
188
|
+
width: 100%;
|
189
|
+
border: 1px solid #262626;
|
190
|
+
}
|
191
|
+
|
192
|
+
.form input.button {
|
193
|
+
background: #EEE;
|
194
|
+
color: #262626;
|
195
|
+
padding: 2px 5px;
|
196
|
+
border: 1px solid #262626;
|
197
|
+
cursor: pointer;
|
198
|
+
}
|
199
|
+
|
200
|
+
.form .description {
|
201
|
+
font-style: italic;
|
202
|
+
color: #8C8C8C;
|
203
|
+
font-size: .9em;
|
204
|
+
}
|
205
|
+
|
206
|
+
/* flash-messages */
|
207
|
+
.flash .message {
|
208
|
+
-moz-border-radius: 3px;
|
209
|
+
-webkit-border-radius: 3px;
|
210
|
+
text-align:center;
|
211
|
+
margin: 0 auto 15px;
|
212
|
+
|
213
|
+
}
|
214
|
+
|
215
|
+
.flash .message p {
|
216
|
+
margin:8px;
|
217
|
+
}
|
218
|
+
.flash .error {
|
219
|
+
border: 1px solid #fbb;
|
220
|
+
background-color: #fdd;
|
221
|
+
}
|
222
|
+
.flash .warning {
|
223
|
+
border: 1px solid #fffaaa;
|
224
|
+
background-color: #ffffcc;
|
225
|
+
}
|
226
|
+
.flash .notice {
|
227
|
+
border: 1px solid #1FDF00;
|
228
|
+
background-color: #BBFFB6;
|
229
|
+
}
|
230
|
+
|
231
|
+
/* lists */
|
232
|
+
|
233
|
+
ul.list li {
|
234
|
+
border-bottom-color: #F0F0EE;
|
235
|
+
border-bottom-width: 1px;
|
236
|
+
border-bottom-style: solid;
|
237
|
+
}
|
238
|
+
|
239
|
+
ul.list li .item .avatar {
|
240
|
+
border-color: #F0F0EE;
|
241
|
+
border-width: 1px;
|
242
|
+
border-style: solid;
|
243
|
+
padding: 2px;
|
244
|
+
}
|
245
|
+
|
246
|
+
/* box */
|
247
|
+
|
248
|
+
#box .block {
|
249
|
+
background: #FFF;
|
250
|
+
}
|
251
|
+
|
252
|
+
#box .block h2 {
|
253
|
+
color: #fff;
|
254
|
+
background: #3B5526;
|
255
|
+
border-bottom: 5px solid #81b953;
|
256
|
+
}
|
257
|
+
|
258
|
+
#box .block .content { border: 1px solid #81b953; border}
|
259
|
+
|
260
|
+
/* login */
|
261
|
+
|
262
|
+
#block-login { }
|
263
|
+
#block-login h2 { background: #3B5526;border-bottom: 5px solid #81b953;}
|
264
|
+
|
265
|
+
/* rounded borders */
|
266
|
+
|
267
|
+
#main, #main-navigation, #main-navigation li,
|
268
|
+
.secondary-navigation, #main .block, #sidebar .block,
|
269
|
+
#sidebar h3, ul.list li, #footer .block,
|
270
|
+
.form input.button, #box .block, #box .block h2 {
|
271
|
+
-moz-border-radius-topleft: 4px;
|
272
|
+
-webkit-border-top-left-radius: 4px;
|
273
|
+
-moz-border-radius-topright: 4px;
|
274
|
+
-webkit-border-top-right-radius: 4px;
|
275
|
+
}
|
276
|
+
|
277
|
+
.secondary-navigation li.first a,
|
278
|
+
.secondary-navigation ul li.first,
|
279
|
+
.table th.first, .table th.first {
|
280
|
+
-moz-border-radius-topleft: 4px;
|
281
|
+
-webkit-border-top-left-radius: 4px;
|
282
|
+
}
|
283
|
+
|
284
|
+
.table th.last {
|
285
|
+
-moz-border-radius-topright: 4px;
|
286
|
+
-webkit-border-top-right-radius: 4px;
|
287
|
+
}
|
288
|
+
|
289
|
+
.secondary-navigation ul li.first {
|
290
|
+
-moz-border-radius-topleft: 4px;
|
291
|
+
-webkit-border-top-left-radius: 4px;
|
292
|
+
}
|
293
|
+
|
294
|
+
#sidebar, #sidebar .block, #main .block,
|
295
|
+
#sidebar ul.navigation, ul.list li,
|
296
|
+
#footer .block, .form input.button, #box .block {
|
297
|
+
-moz-border-radius-bottomleft: 4px;
|
298
|
+
-webkit-border-bottom-left-radius: 4px;
|
299
|
+
-moz-border-radius-bottomright: 4px;
|
300
|
+
-webkit-border-bottom-right-radius: 4px;
|
301
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<div class="block">
|
2
|
+
<h3>Simple Block</h3>
|
3
|
+
<div class="content">
|
4
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
|
5
|
+
</div>
|
6
|
+
</div>
|
7
|
+
<div class="block">
|
8
|
+
<h3>Links</h3>
|
9
|
+
<ul class="navigation">
|
10
|
+
<li><a href="#">Link 1</a></li>
|
11
|
+
<li><a href="#">Link 2</a></li>
|
12
|
+
</ul>
|
13
|
+
</div>
|
@@ -0,0 +1,186 @@
|
|
1
|
+
class NitroScaffoldGenerator < Rails::Generator::NamedBase
|
2
|
+
default_options :skip_timestamps => false, :skip_migration => false, :force_plural => false, :without_public => false,
|
3
|
+
:themed_type => "admin_crud", :app_name => 'Web App', :theme => :default
|
4
|
+
|
5
|
+
attr_reader :controller_name,
|
6
|
+
:controller_class_path,
|
7
|
+
:controller_file_path,
|
8
|
+
:controller_class_nesting,
|
9
|
+
:controller_class_nesting_depth,
|
10
|
+
:controller_class_name,
|
11
|
+
:controller_underscore_name,
|
12
|
+
:controller_singular_name,
|
13
|
+
:controller_plural_name
|
14
|
+
|
15
|
+
attr_reader :columns
|
16
|
+
|
17
|
+
alias_method :controller_file_name, :controller_underscore_name
|
18
|
+
alias_method :controller_table_name, :controller_plural_name
|
19
|
+
|
20
|
+
def initialize(runtime_args, runtime_options = {})
|
21
|
+
super
|
22
|
+
|
23
|
+
if @name == @name.pluralize && !options[:force_plural]
|
24
|
+
logger.warning "Plural version of the model detected, using singularized version. Override with --force-plural."
|
25
|
+
@name = @name.singularize
|
26
|
+
end
|
27
|
+
|
28
|
+
@controller_name = @name.pluralize
|
29
|
+
|
30
|
+
base_name, @controller_class_path, @controller_file_path, @controller_class_nesting, @controller_class_nesting_depth = extract_modules(@controller_name)
|
31
|
+
@controller_class_name_without_nesting, @controller_underscore_name, @controller_plural_name = inflect_names(base_name)
|
32
|
+
@controller_singular_name=base_name.singularize
|
33
|
+
if @controller_class_nesting.empty?
|
34
|
+
@controller_class_name = @controller_class_name_without_nesting
|
35
|
+
else
|
36
|
+
@controller_class_name = "#{@controller_class_nesting}::#{@controller_class_name_without_nesting}"
|
37
|
+
end
|
38
|
+
|
39
|
+
@columns = if options[:without_public]
|
40
|
+
get_columns
|
41
|
+
else
|
42
|
+
attributes
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
def manifest
|
49
|
+
|
50
|
+
#generate the controllers and views inside the admin area
|
51
|
+
manifest_method = "manifest_for_#{options[:themed_type]}"
|
52
|
+
|
53
|
+
record do |m|
|
54
|
+
if !options[:without_public]
|
55
|
+
# Check for class naming collisions.
|
56
|
+
m.class_collisions("#{controller_class_name}Controller", "#{controller_class_name}Helper")
|
57
|
+
m.class_collisions(class_name)
|
58
|
+
|
59
|
+
# Controller, helper, views, test and stylesheets directories.
|
60
|
+
m.directory(File.join('app/models', class_path))
|
61
|
+
m.directory(File.join('app/controllers', controller_class_path))
|
62
|
+
m.directory(File.join('app/helpers', controller_class_path))
|
63
|
+
m.directory(File.join('app/views', controller_class_path, controller_file_name))
|
64
|
+
m.directory(File.join('app/views/layouts', controller_class_path))
|
65
|
+
m.directory(File.join('test/functional', controller_class_path))
|
66
|
+
m.directory(File.join('test/unit', class_path))
|
67
|
+
m.directory(File.join('test/unit/helpers', class_path))
|
68
|
+
m.directory(File.join('public/stylesheets', class_path))
|
69
|
+
|
70
|
+
m.directory("app/views/admin/shared")
|
71
|
+
m.directory("app/views/shared")
|
72
|
+
m.directory("public/javascripts/admin")
|
73
|
+
|
74
|
+
#adding layout
|
75
|
+
|
76
|
+
#adding public views
|
77
|
+
for action in scaffold_views
|
78
|
+
m.template(
|
79
|
+
"view_#{action}.html.erb",
|
80
|
+
File.join('app/views', controller_class_path, controller_file_name, "#{action}.html.erb")
|
81
|
+
)
|
82
|
+
end
|
83
|
+
|
84
|
+
# Layout and stylesheet.
|
85
|
+
m.template('layout.html.erb', File.join('app/views/layouts', controller_class_path, "#{controller_file_name}.html.erb"))
|
86
|
+
|
87
|
+
|
88
|
+
m.template(
|
89
|
+
'controller.rb', File.join('app/controllers', controller_class_path, "#{controller_file_name}_controller.rb")
|
90
|
+
)
|
91
|
+
m.template('view_form.html.erb', File.join("app/views", controller_class_path, controller_file_name, "_form.html.erb"))
|
92
|
+
m.template('view_sidebar.html.erb', File.join("app/views", controller_class_path, controller_file_name, "_sidebar.html.erb"))
|
93
|
+
|
94
|
+
|
95
|
+
m.template('functional_test.rb', File.join('test/functional', controller_class_path, "#{controller_file_name}_controller_test.rb"))
|
96
|
+
m.template('helper.rb', File.join('app/helpers', controller_class_path, "#{controller_file_name}_helper.rb"))
|
97
|
+
m.template('helper_test.rb', File.join('test/unit/helpers', controller_class_path, "#{controller_file_name}_helper_test.rb"))
|
98
|
+
|
99
|
+
m.route_resources controller_file_name
|
100
|
+
|
101
|
+
m.dependency 'model', [name] + @args, :collision => :skip
|
102
|
+
end
|
103
|
+
|
104
|
+
send(manifest_method, m) if respond_to?(manifest_method)
|
105
|
+
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
protected
|
110
|
+
|
111
|
+
def manifest_for_admin_crud(m)
|
112
|
+
|
113
|
+
m.directory(File.join('app/views/admin', controller_class_path, controller_file_name))
|
114
|
+
m.directory(File.join('app/controllers/admin', controller_class_path))
|
115
|
+
m.directory(File.join('app/helpers/admin', controller_class_path))
|
116
|
+
|
117
|
+
# m.template(
|
118
|
+
# 'admin/admin_controller.rb', File.join('app/controllers/admin', controller_class_path, "admin_controller.rb")
|
119
|
+
# )
|
120
|
+
|
121
|
+
m.template(
|
122
|
+
'admin/controller.rb', File.join('app/controllers/admin', controller_class_path, "#{controller_file_name}_controller.rb")
|
123
|
+
)
|
124
|
+
|
125
|
+
m.template('admin/view_destroy.js.erb', File.join('app/views/admin', controller_class_path, controller_file_name, "destroy.js.erb"))
|
126
|
+
for action in scaffold_views
|
127
|
+
m.template(
|
128
|
+
"admin/view_#{action}.html.erb",
|
129
|
+
File.join('app/views/admin', controller_class_path, controller_file_name, "#{action}.html.erb")
|
130
|
+
)
|
131
|
+
end
|
132
|
+
|
133
|
+
m.template('admin/view_form.html.erb', File.join("app/views/admin", controller_class_path, controller_file_name, "_form.html.erb"))
|
134
|
+
m.template('admin/view_sidebar.html.erb', File.join("app/views/admin", controller_class_path, controller_file_name, "_sidebar.html.erb"))
|
135
|
+
|
136
|
+
|
137
|
+
end
|
138
|
+
|
139
|
+
def manifest_for_restful_authentication(m)
|
140
|
+
signup_controller_path = @controller_file_path
|
141
|
+
signin_controller_path = class_name.downcase # just here I use the second argument as a controller path
|
142
|
+
@resource_name = @controller_path.singularize
|
143
|
+
|
144
|
+
m.template('admin/view_signup.html.erb', File.join("app/views", signup_controller_path, "new.html.erb"))
|
145
|
+
m.template('admin/view_signin.html.erb', File.join("app/views", signin_controller_path, "new.html.erb"))
|
146
|
+
|
147
|
+
m.directory(File.join('app/views/admin', controller_class_path, controller_file_name))
|
148
|
+
m.template('admin/view_signup.html.erb', File.join("app/views/admin", signup_controller_path, "new.html.erb"))
|
149
|
+
m.template('admin/view_signin.html.erb', File.join("app/views/admin", signin_controller_path, "new.html.erb"))
|
150
|
+
end
|
151
|
+
|
152
|
+
# Override with your own usage banner.
|
153
|
+
def banner
|
154
|
+
"Usage: #{$0} nitro_scaffold ModelName [field:type, field:type]"
|
155
|
+
end
|
156
|
+
|
157
|
+
def add_options!(opt)
|
158
|
+
opt.separator ''
|
159
|
+
opt.separator 'Options:'
|
160
|
+
opt.on("--skip-timestamps",
|
161
|
+
"Don't add timestamps to the migration file for this model") { |v| options[:skip_timestamps] = v }
|
162
|
+
opt.on("--skip-migration",
|
163
|
+
"Don't generate a migration file for this model") { |v| options[:skip_migration] = v }
|
164
|
+
opt.on("--force-plural",
|
165
|
+
"Forces the generation of a plural ModelName") { |v| options[:force_plural] = v }
|
166
|
+
opt.on("--without-public",
|
167
|
+
"Only generate the admin area controller and views") { |v| options[:without_public] = v }
|
168
|
+
opt.on("--type=themed_type", String, "") { |v| options[:themed_type] = v }
|
169
|
+
opt.on("--app_name=app_name", String, "") { |v| options[:app_name] = v }
|
170
|
+
opt.on("--theme=theme", String, "Specify the theme") { |v| options[:theme] = v }
|
171
|
+
|
172
|
+
end
|
173
|
+
|
174
|
+
def scaffold_views
|
175
|
+
%w[ index show new edit ]
|
176
|
+
end
|
177
|
+
|
178
|
+
def model_name
|
179
|
+
class_name.demodulize
|
180
|
+
end
|
181
|
+
|
182
|
+
def get_columns
|
183
|
+
excluded_column_names = %w[id created_at updated_at]
|
184
|
+
Kernel.const_get(class_name).columns.reject{|c| excluded_column_names.include?(c.name) }.collect{|c| Rails::Generator::GeneratedAttribute.new(c.name, c.type)}
|
185
|
+
end
|
186
|
+
end
|