schofield 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -11,7 +11,7 @@ begin
11
11
  gem.homepage = "http://github.com/sauberia/schofield"
12
12
  gem.authors = ["Marc Tauber"]
13
13
  gem.add_development_dependency "rspec", ">= 1.2.9"
14
- gem.add_development_dependency "formtastic", "= 0.9.5"
14
+ gem.add_development_dependency "formtastic", ">= 0.9.8"
15
15
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
16
16
  end
17
17
  Jeweler::GemcutterTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.8
1
+ 0.0.9
@@ -18,15 +18,17 @@ class SchofieldControllerGenerator < Rails::Generator::NamedBase
18
18
  template_directory = has_parent? ? 'nested' : 'unnested'
19
19
 
20
20
  sco_class = class_name.gsub('Admin::', '').singularize
21
- sco_humanized_uc = sco_class.underscore.humanize
22
- sco_underscored = @singular_name.singularize
21
+ sco_humanized_uc = sco_underscored.humanize
22
+ sco_underscored = sco_class.underscore
23
23
  sco_underscored_plural = sco_underscored.pluralize
24
- sco_titleized_plural = sco_underscored.pluralize.titleize
24
+ sco_titleized_plural = sco_underscored_plural.titleize
25
25
  sco_humanized = sco_humanized_uc.downcase
26
+
26
27
  sco_parent_class = has_parent? ? options[:parent].classify : ''
27
28
  sco_parent_underscored = sco_parent_class.underscore.downcase
28
29
  sco_parent_underscored_plural = sco_parent_underscored.pluralize
29
30
  sco_parent_titleized_plural = sco_parent_underscored.titleize.pluralize
31
+
30
32
  sco_child_class = has_child? ? options[:child].classify : ''
31
33
  sco_child_underscored = sco_child_class.underscore.downcase
32
34
  sco_child_underscored_plural = sco_child_underscored.pluralize
@@ -2,6 +2,7 @@ class <%= class_name %>Controller < Admin::AdminController
2
2
 
3
3
  before_filter :find_<%= sco_underscored %>, :only => [<%= filter_actions %w( show edit update destroy) %>]
4
4
  before_filter :find_<%= sco_parent_underscored %>, :only => [<%= filter_actions %w( index new create) %>]
5
+ before_filter :titles, :except => [<%= filter_actions %w( destroy sort ) %>]
5
6
 
6
7
 
7
8
  <% if actions.include?('index') -%>
@@ -66,7 +67,7 @@ class <%= class_name %>Controller < Admin::AdminController
66
67
  <% if actions.include?('sort') -%>
67
68
 
68
69
  def sort
69
- params[:<%= sco_underscored %>].each_with_index do |id, index|
70
+ params[:<%= sco_underscored_plural %>].each_with_index do |id, index|
70
71
  <%= sco_class %>.update_all(['position=?', index+1], ['id=?', id])
71
72
  end
72
73
  render :nothing => true
@@ -89,5 +90,12 @@ class <%= class_name %>Controller < Admin::AdminController
89
90
  def find_<%= sco_underscored %>
90
91
  @<%= sco_underscored %> = <%= sco_class %>.find(params[:id])
91
92
  end
93
+
94
+ def titles
95
+ add_breadcrumb '<%= sco_parent_titleized_plural %>', admin_<%= sco_parent_underscored_plural %>_path
96
+ add_breadcrumb @<%= sco_parent_underscored %>
97
+ add_breadcrumb '<%= sco_titleized_plural %>'
98
+ add_breadcrumb @<%= sco_underscored %>
99
+ end
92
100
 
93
101
  end
@@ -1,5 +1,3 @@
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
-
3
1
  - toggle_show_edit 'Show', :admin, @<%= sco_underscored %>
4
2
 
5
3
  = render :partial => 'form', :object => @<%= sco_underscored %>
@@ -1,5 +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 %>)), '<%= sco_titleized_plural %>'
2
-
3
1
  %p= link_to('Add new <%= sco_humanized %>', new_admin_<%= sco_parent_underscored %>_<%= sco_underscored %>_path)
4
2
 
5
3
  = render :partial => 'shared/<%= sco_underscored_plural %>', :object => @<%= sco_underscored_plural %>
@@ -1,3 +1 @@
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
-
3
1
  = render :partial => 'form', :object => @<%= sco_underscored %>
@@ -1,3 +1 @@
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 %>
2
-
3
1
  - toggle_show_edit 'Edit', :admin, @<%= sco_underscored %>
@@ -1,6 +1,7 @@
1
1
  class <%= class_name %>Controller < Admin::AdminController
2
2
 
3
3
  before_filter :find_<%= sco_underscored %>, :only => [<%= filter_actions %w( show edit update destroy) %>]
4
+ before_filter :titles, :except => [<%= filter_actions %w( destroy sort ) %>]
4
5
 
5
6
 
6
7
  <% if actions.include?('index') -%>
@@ -65,7 +66,7 @@ class <%= class_name %>Controller < Admin::AdminController
65
66
  <% if actions.include?('sort') -%>
66
67
 
67
68
  def sort
68
- params[:<%= sco_underscored %>].each_with_index do |id, index|
69
+ params[:<%= sco_underscored_plural %>].each_with_index do |id, index|
69
70
  <%= sco_class %>.update_all(['position=?', index+1], ['id=?', id])
70
71
  end
71
72
  render :nothing => true
@@ -84,5 +85,10 @@ class <%= class_name %>Controller < Admin::AdminController
84
85
  def find_<%= sco_underscored %>
85
86
  @<%= sco_underscored %> = <%= sco_class %>.find(params[:id])
86
87
  end
88
+
89
+ def titles
90
+ add_breadcrumb '<%= sco_titleized_plural %>', admin_<%= sco_underscored_plural %>_path
91
+ add_breadcrumb @<%= sco_underscored %>
92
+ end
87
93
 
88
94
  end
@@ -1,5 +1,3 @@
1
- - titles link_to('<%= sco_titleized_plural %>', admin_<%= sco_underscored_plural %>_path), link_to(@<%= sco_underscored %>, admin_<%= sco_underscored %>_path(@<%= sco_underscored %>)), 'Edit'
2
-
3
1
  - toggle_show_edit 'Show', :admin, @<%= sco_underscored %>
4
2
 
5
3
  = render :partial => 'form', :object => @<%= sco_underscored %>
@@ -1,5 +1,3 @@
1
- - titles '<%= sco_titleized_plural %>'
2
-
3
1
  %p= link_to('Add new <%= sco_humanized %>', new_admin_<%= sco_underscored %>_path)
4
2
 
5
3
  = render :partial => 'shared/<%= sco_underscored_plural %>', :object => @<%= sco_underscored_plural %>
@@ -1,3 +1 @@
1
- - titles link_to('<%= sco_titleized_plural %>', admin_<%= sco_underscored_plural %>_path), 'New'
2
-
3
1
  = render :partial => 'form', :object => @<%= sco_underscored %>
@@ -1,5 +1,3 @@
1
- - titles link_to('<%= sco_titleized_plural %>', admin_<%= sco_underscored_plural %>_path), @<%= sco_underscored %>
2
-
3
1
  - toggle_show_edit 'Edit', :admin, @<%= sco_underscored %>
4
2
  <% if has_child? -%>
5
3
 
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.8"
8
+ s.version = "0.0.9"
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-06}
12
+ s.date = %q{2010-05-06}
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 = [
@@ -51,7 +51,7 @@ Gem::Specification.new do |s|
51
51
  s.homepage = %q{http://github.com/sauberia/schofield}
52
52
  s.rdoc_options = ["--charset=UTF-8"]
53
53
  s.require_paths = ["lib"]
54
- s.rubygems_version = %q{1.3.5}
54
+ s.rubygems_version = %q{1.3.6}
55
55
  s.summary = %q{Creates views and controller from defined routes and respective models}
56
56
  s.test_files = [
57
57
  "spec/schofield_spec.rb",
@@ -64,14 +64,14 @@ Gem::Specification.new do |s|
64
64
 
65
65
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
66
66
  s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
67
- s.add_development_dependency(%q<formtastic>, ["= 0.9.5"])
67
+ s.add_development_dependency(%q<formtastic>, [">= 0.9.8"])
68
68
  else
69
69
  s.add_dependency(%q<rspec>, [">= 1.2.9"])
70
- s.add_dependency(%q<formtastic>, ["= 0.9.5"])
70
+ s.add_dependency(%q<formtastic>, [">= 0.9.8"])
71
71
  end
72
72
  else
73
73
  s.add_dependency(%q<rspec>, [">= 1.2.9"])
74
- s.add_dependency(%q<formtastic>, ["= 0.9.5"])
74
+ s.add_dependency(%q<formtastic>, [">= 0.9.8"])
75
75
  end
76
76
  end
77
77
 
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: schofield
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 9
9
+ version: 0.0.9
5
10
  platform: ruby
6
11
  authors:
7
12
  - Marc Tauber
@@ -9,29 +14,37 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2009-12-06 00:00:00 +00:00
17
+ date: 2010-05-06 00:00:00 +01:00
13
18
  default_executable:
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: rspec
17
- type: :development
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
20
24
  requirements:
21
25
  - - ">="
22
26
  - !ruby/object:Gem::Version
27
+ segments:
28
+ - 1
29
+ - 2
30
+ - 9
23
31
  version: 1.2.9
24
- version:
32
+ type: :development
33
+ version_requirements: *id001
25
34
  - !ruby/object:Gem::Dependency
26
35
  name: formtastic
27
- type: :development
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
30
38
  requirements:
31
- - - "="
39
+ - - ">="
32
40
  - !ruby/object:Gem::Version
33
- version: 0.9.5
34
- version:
41
+ segments:
42
+ - 0
43
+ - 9
44
+ - 8
45
+ version: 0.9.8
46
+ type: :development
47
+ version_requirements: *id002
35
48
  description: Create views and controllers from routes defined in admin namespace. Very, very basic and very specific to my needs.'
36
49
  email: marc@marctauber.com
37
50
  executables: []
@@ -85,18 +98,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
85
98
  requirements:
86
99
  - - ">="
87
100
  - !ruby/object:Gem::Version
101
+ segments:
102
+ - 0
88
103
  version: "0"
89
- version:
90
104
  required_rubygems_version: !ruby/object:Gem::Requirement
91
105
  requirements:
92
106
  - - ">="
93
107
  - !ruby/object:Gem::Version
108
+ segments:
109
+ - 0
94
110
  version: "0"
95
- version:
96
111
  requirements: []
97
112
 
98
113
  rubyforge_project:
99
- rubygems_version: 1.3.5
114
+ rubygems_version: 1.3.6
100
115
  signing_key:
101
116
  specification_version: 3
102
117
  summary: Creates views and controller from defined routes and respective models