schofield 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
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.last[:underscored] %>.<%= sco_underscored_plural %>
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.last[:underscored] %>.<%= sco_underscored_plural %>.build
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.last[:underscored] %>.<%= sco_underscored_plural %>.build(params[:<%= sco_underscored %>])
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.reverse_each do |parent| -%>
99
- add_breadcrumb '<%= parent[:titleized_plural] %>', admin_<%= parent[:underscored_plural] %>_path
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].each do |parent|
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
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{schofield}
8
- s.version = "0.1.4"
8
+ s.version = "0.1.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Marc Tauber"]
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 4
9
- version: 0.1.4
8
+ - 5
9
+ version: 0.1.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Marc Tauber