schofield 0.1.4 → 0.1.5
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/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.5
|
@@ -10,7 +10,7 @@ class <%= class_name %>Controller < Admin::AdminController
|
|
10
10
|
<% if actions.include?('index') -%>
|
11
11
|
|
12
12
|
def index
|
13
|
-
@<%= sco_underscored_plural %> = @<%= sco_parents.
|
13
|
+
@<%= sco_underscored_plural %> = @<%= sco_parents.first[:underscored] %>.<%= sco_underscored_plural %>
|
14
14
|
end
|
15
15
|
|
16
16
|
<% end -%>
|
@@ -23,7 +23,7 @@ class <%= class_name %>Controller < Admin::AdminController
|
|
23
23
|
<% if actions.include?('new') -%>
|
24
24
|
|
25
25
|
def new
|
26
|
-
@<%= sco_underscored %> = @<%= sco_parents.
|
26
|
+
@<%= sco_underscored %> = @<%= sco_parents.first[:underscored] %>.<%= sco_underscored_plural %>.build
|
27
27
|
end
|
28
28
|
|
29
29
|
<% end -%>
|
@@ -36,7 +36,7 @@ class <%= class_name %>Controller < Admin::AdminController
|
|
36
36
|
<% if actions.include?('create') -%>
|
37
37
|
|
38
38
|
def create
|
39
|
-
@<%= sco_underscored %> = @<%= sco_parents.
|
39
|
+
@<%= sco_underscored %> = @<%= sco_parents.first[:underscored] %>.<%= sco_underscored_plural %>.build(params[:<%= sco_underscored %>])
|
40
40
|
if @<%= sco_underscored %>.save
|
41
41
|
flash[:notice] = '<%= sco_humanized_uc %> was successfully created.'
|
42
42
|
redirect_to_form_referer
|
@@ -95,8 +95,8 @@ class <%= class_name %>Controller < Admin::AdminController
|
|
95
95
|
end
|
96
96
|
|
97
97
|
def titles
|
98
|
-
<%- sco_parents.
|
99
|
-
add_breadcrumb '<%= parent[:titleized_plural] %>',
|
98
|
+
<%- sco_parents.reverse.each_with_index do |parent, index| -%>
|
99
|
+
add_breadcrumb '<%= parent[:titleized_plural] %>', admin<%= index > 0 ? "_#{sco_parents.reverse[index-1][:underscored]}" : '' %>_<%= parent[:underscored_plural] %>_path<%= index > 0 ? "(@#{sco_parents.reverse[index-1][:underscored]})" : '' %>
|
100
100
|
add_breadcrumb @<%= parent[:underscored] %>
|
101
101
|
<%- end -%>
|
102
102
|
add_breadcrumb '<%= sco_titleized_plural %>'
|
@@ -13,9 +13,7 @@ class SchofieldFormGenerator < FormGenerator
|
|
13
13
|
def form_model type='new'
|
14
14
|
array = [':admin']
|
15
15
|
if type == 'new' && options[:parents].present?
|
16
|
-
options[:parents].
|
17
|
-
array << "@#{parent}"
|
18
|
-
end
|
16
|
+
array << "@#{options[:parents].first}"
|
19
17
|
end
|
20
18
|
array << "@#{singular_name.singularize}"
|
21
19
|
"[#{array.join(', ')}]"
|
data/schofield.gemspec
CHANGED