schofield 0.0.4 → 0.0.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.0.4
1
+ 0.0.5
@@ -1,4 +1,4 @@
1
- - titles link_to('<%= sco_parent_titleized_plural %>', admin_<%= sco_parent_underscored_plural %>_path), link_to(@<%= sco_underscored %>.<%= sco_parent_underscored %>, admin_<%= sco_parent_underscored %>_path(@<%= sco_underscored %>.<%= sco_parent_underscored %>)), 'Edit <%= sco_humanized %>'
1
+ - titles link_to(@<%= sco_underscored %>.<%= sco_parent_underscored %>, admin_<%= sco_parent_underscored %>_path(@<%= sco_underscored %>.<%= sco_parent_underscored %>)), link_to('<%= sco_titleized_plural %>', admin_<%= sco_parent_underscored %>_<%= sco_underscored_plural %>_path(@<%= sco_underscored %>.<%= sco_parent_underscored %>)), "Edit #{@<%= sco_underscored %>}"
2
2
 
3
3
  - toggle_show_edit 'Show', :admin, @<%= sco_underscored %>
4
4
 
@@ -1,4 +1,4 @@
1
- - titles link_to('<%= sco_parent_titleized_plural %>', admin_<%= sco_parent_underscored_plural %>_path), '<%= sco_titleized_plural %>'
1
+ - titles link_to('<%= sco_parent_titleized_plural %>', admin_<%= sco_parent_underscored_plural %>_path), link_to(@<%= sco_parent_underscored %>, admin_<%= sco_parent_underscored %>_path(@<%= sco_parent_underscored %>)), '<%= sco_titleized_plural %>'
2
2
 
3
3
  %p= link_to('Add new <%= sco_humanized %>', new_admin_<%= sco_parent_underscored %>_<%= sco_underscored %>_path)
4
4
 
@@ -1,3 +1,3 @@
1
- - titles link_to('<%= sco_parent_titleized_plural %>', admin_<%= sco_parent_underscored_plural %>_path), link_to(@<%= sco_parent_underscored %>, admin_<%= sco_parent_underscored %>_path(@<%= sco_parent_underscored %>)), 'New <%= sco_humanized %>'
1
+ - titles link_to(@<%= sco_underscored %>.<%= sco_parent_underscored %>, admin_<%= sco_parent_underscored %>_path(@<%= sco_underscored %>.<%= sco_parent_underscored %>)), link_to('<%= sco_titleized_plural %>', admin_<%= sco_parent_underscored %>_<%= sco_underscored_plural %>_path(@<%= sco_underscored %>.<%= sco_parent_underscored %>)), 'New'
2
2
 
3
3
  = render :partial => 'form', :locals => { :object => @<%= sco_underscored %> }
@@ -1,7 +1,4 @@
1
- - titles link_to('<%= sco_titleized_plural %>', admin_<%= sco_underscored_plural %>_path), @<%= sco_underscored %>
2
-
3
-
4
- - titles link_to('<%= sco_parent_titleized_plural %>', admin_<%= sco_parent_underscored_plural %>_path), link_to('<%= sco_titleized_plural %>', admin_<%= sco_underscored_plural %>_path), @<%= sco_underscored %>
1
+ - titles link_to(@<%= sco_underscored %>.<%= sco_parent_underscored %>, admin_<%= sco_parent_underscored %>_path(@<%= sco_underscored %>.<%= sco_parent_underscored %>)), link_to('<%= sco_titleized_plural %>', admin_<%= sco_parent_underscored %>_<%= sco_underscored_plural %>_path(@<%= sco_underscored %>.<%= sco_parent_underscored %>)), @<%= sco_underscored %>
5
2
 
6
3
 
7
4
  - toggle_show_edit 'Edit', :admin, @<%= sco_underscored %>
@@ -1,2 +1,20 @@
1
1
  class SchofieldFormGenerator < FormGenerator
2
+
3
+ protected
4
+
5
+ def add_options!(opt)
6
+ super
7
+ opt.on('--parent PARENT_PATH',
8
+ "Specify the parent for the specified model.") do |v|
9
+ options[:parent] = v if v.present?
10
+ end
11
+ end
12
+
13
+ def form_model
14
+ array = [':admin']
15
+ array << "@#{options[:parent]}" unless options[:parent].nil?
16
+ array << "@#{singular_name.singularize}"
17
+ "[#{array.join(', ')}]"
18
+ end
19
+
2
20
  end
@@ -1,6 +1,6 @@
1
1
  = error_messages_for '<%= singular_name.singularize %>', :object => object
2
2
 
3
- - semantic_form_for [:admin, @<%= singular_name.singularize %>], :html => { :multipart => true } do |f|
3
+ - semantic_form_for <%= form_model %>, :html => { :multipart => true } do |f|
4
4
 
5
5
  - f.inputs do
6
6
 
data/lib/schofield.rb CHANGED
@@ -75,7 +75,7 @@ module Schofield
75
75
  require 'rails_generator/scripts/generate'
76
76
  @controller_infos.each do |index, info|
77
77
  Rails::Generator::Scripts::Generate.new.run(['schofield_controller', info.controller_path, *info.actions ], :parent => info.parent)
78
- Rails::Generator::Scripts::Generate.new.run(['schofield_form', info.model_name], :partial => true, :haml => true, :controller => info.controller_path)
78
+ Rails::Generator::Scripts::Generate.new.run(['schofield_form', info.model_name], :partial => true, :haml => true, :controller => info.controller_path, :parent => info.parent)
79
79
  end
80
80
  end
81
81
 
data/schofield.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{schofield}
8
- s.version = "0.0.4"
8
+ s.version = "0.0.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"]
12
- s.date = %q{2009-12-02}
12
+ s.date = %q{2009-12-05}
13
13
  s.description = %q{Create views and controllers from routes defined in admin namespace. Very, very basic and very specific to my needs.'}
14
14
  s.email = %q{marc@marctauber.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: schofield
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marc Tauber
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-02 00:00:00 +00:00
12
+ date: 2009-12-05 00:00:00 +00:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency