radiant-templates-extension 1.0.0 → 1.0.1

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.
Files changed (35) hide show
  1. data/HELP_designer.textile +3 -3
  2. data/README.textile +3 -3
  3. data/Rakefile +1 -1
  4. data/VERSION +1 -1
  5. data/app/views/admin/pages/_edit_template.html.haml +1 -2
  6. data/app/views/admin/pages/_switch_templates.html.haml +4 -4
  7. data/app/views/admin/pages/_template_chooser.html.haml +43 -0
  8. data/app/views/admin/templates/index.html.haml +0 -1
  9. data/pkg/radiant-templates-extension-1.0.0.gem +0 -0
  10. data/radiant-templates-extension.gemspec +176 -0
  11. data/templates_extension.rb +1 -1
  12. data/vendor/plugins/make_resourceful/.gitignore +1 -0
  13. data/vendor/plugins/make_resourceful/DEFAULTS +1 -1
  14. data/vendor/plugins/make_resourceful/README +7 -6
  15. data/vendor/plugins/make_resourceful/Rakefile +2 -13
  16. data/vendor/plugins/make_resourceful/VERSION +1 -1
  17. data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/functional_test.rb +1 -8
  18. data/vendor/plugins/make_resourceful/lib/resourceful/base.rb +11 -0
  19. data/vendor/plugins/make_resourceful/lib/resourceful/builder.rb +33 -2
  20. data/vendor/plugins/make_resourceful/lib/resourceful/default/accessors.rb +63 -7
  21. data/vendor/plugins/make_resourceful/lib/resourceful/default/actions.rb +15 -6
  22. data/vendor/plugins/make_resourceful/lib/resourceful/default/responses.rb +7 -7
  23. data/vendor/plugins/make_resourceful/lib/resourceful/default/urls.rb +6 -6
  24. data/vendor/plugins/make_resourceful/lib/resourceful/maker.rb +1 -0
  25. data/vendor/plugins/make_resourceful/spec/accessors_spec.rb +3 -2
  26. data/vendor/plugins/make_resourceful/spec/actions_spec.rb +33 -6
  27. data/vendor/plugins/make_resourceful/spec/integration_spec.rb +22 -22
  28. data/vendor/plugins/make_resourceful/spec/{rspec_on_rails → rspec-rails}/LICENSE +8 -6
  29. data/vendor/plugins/make_resourceful/spec/rspec-rails/redirect_to.rb +113 -0
  30. data/vendor/plugins/make_resourceful/spec/rspec-rails/render_template.rb +90 -0
  31. data/vendor/plugins/make_resourceful/spec/spec_helper.rb +62 -22
  32. data/vendor/plugins/make_resourceful/spec/urls_spec.rb +2 -0
  33. metadata +15 -11
  34. data/vendor/plugins/make_resourceful/spec/rspec_on_rails/redirect_to.rb +0 -81
  35. data/vendor/plugins/make_resourceful/spec/rspec_on_rails/render_template.rb +0 -28
@@ -56,9 +56,9 @@ h4. Creating a new page
56
56
 
57
57
  h4. Changing the template for an existing page
58
58
 
59
- * When editing the page, expand the meta drawer, by clicking 'More' underneath the Page Title.
60
- * You will see the current template bolded, and the others as links
61
- * To change to another template, simply select it, and save the page.
59
+ * When editing a page, you will see the Template Selector at the top left, just to the right of the 'Edit Page header.
60
+ * Click this to see all available templates
61
+ * To change to another template, simply select it, and then save the page (Simply selecting it will not change it -- you must save the page).
62
62
 
63
63
  WARNING: For page parts of your old template, if your new template does a page parts of the same name, then that content will be lost. This is a good reason to follow naming standards when creating templates, e.g. define a page part "main_content" for all your templates.
64
64
 
data/README.textile CHANGED
@@ -96,9 +96,9 @@ h4. Creating a new page
96
96
 
97
97
  h4. Changing the template for an existing page
98
98
 
99
- * When editing the page, expand the meta drawer, by clicking 'More' underneath the Page Title.
100
- * You will see the current template bolded, and the others as links
101
- * To change to another template, simply select it, and save the page.
99
+ * When editing a page, you will see the Template Selector at the top left, just to the right of the 'Edit Page header.
100
+ * Click this to see all available templates
101
+ * To change to another template, simply select it, and then save the page (Simply selecting it will not change it -- you must save the page).
102
102
 
103
103
  WARNING: For page parts of your old template, if your new template does a page parts of the same name, then that content will be lost. This is a good reason to follow naming standards when creating templates, e.g. define a page part "main_content" for all your templates.
104
104
 
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ begin
7
7
  gem.email = "avonderluft@avlux.net"
8
8
  gem.homepage = "https://github.com/avonderluft/radiant-templates-extension"
9
9
  gem.authors = ['Andrew vonderLuft','Sean Cribbs']
10
- gem.add_dependency 'radiant', ">=0.9.1"
10
+ gem.add_dependency 'radiant', ">=1.0.0"
11
11
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
12
12
  end
13
13
  rescue LoadError
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.0.1
@@ -19,8 +19,7 @@
19
19
  - content_for :page_css do
20
20
  :sass
21
21
  .template_part
22
- padding: 6px 0
23
- border-bottom: 1px solid #DFDCD1
22
+ padding: 4px 0
24
23
  width: 100%
25
24
  label
26
25
  textarea.textarea
@@ -10,12 +10,12 @@
10
10
 
11
11
  - content_for :page_css do
12
12
  :sass
13
+ @import "compass/utilities/lists/inline-list"
13
14
  ul#template-chooser
14
- list-style: none
15
+ +inline-list
15
16
  li, li a
16
- display: inline
17
- padding: 0.3em
18
- line-height: 2.0em
17
+ padding: 0.2em
18
+ line-height: 1.5em
19
19
  color: white
20
20
  white-space: nowrap
21
21
  &.selected
@@ -0,0 +1,43 @@
1
+ .template_chooser
2
+ %table.index
3
+ %tr
4
+ %td.label Template Selector >
5
+ %td.actions
6
+ - @content_template ||= @page.template
7
+ = link_to @page.template_name, "#template_choices", :class => "action dropdown"
8
+ %ul.menu{:id => "template_choices"}
9
+ %li= link_to "Blank Page", @page.id.nil? ? "?template=" : "?template=0"
10
+ %li.separator
11
+ - ::Template.find(:all).each do |template|
12
+ %li= link_to image('template') + ' ' + template.name.humanize.titleize, "?template=#{template.id}"
13
+ %li{:class => @content_template.blank? ? 'selected' : nil}
14
+
15
+ - content_for :page_css do
16
+ :sass
17
+ .template_chooser
18
+ float: left
19
+ background: #7E7E7E
20
+ table.index
21
+ margin: -2px 0 0 60px
22
+ border: none
23
+ tr, td.label, td.actions
24
+ border: none
25
+ padding: 0px
26
+ background: #7E7E7E
27
+ td.label
28
+ text-align: right
29
+ padding-right: 6px
30
+ td.actions
31
+ width: 178px
32
+ a.action, span.action.disabled
33
+ color: white
34
+ text-decoration: underline
35
+ margin: 0
36
+ &:hover
37
+ color: black
38
+ text-decoration: none
39
+ background: #eee image_url('admin/buttons_background.png') repeat-x
40
+ &.selected
41
+ color: black
42
+ text-decoration: none
43
+ background: #c5e0f5
@@ -42,6 +42,5 @@
42
42
  - render_region :bottom do |bottom|
43
43
  - bottom.new_button do
44
44
  #actions
45
- = pagination_for(@templates)
46
45
  %ul
47
46
  %li= link_to image('plus') + " " + t('new_template'), new_admin_template_url
@@ -0,0 +1,176 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{radiant-templates-extension}
8
+ s.version = "1.0.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Andrew vonderLuft", "Sean Cribbs"]
12
+ s.date = %q{2011-04-06}
13
+ s.description = %q{Imposes structure on pages via content templates.}
14
+ s.email = %q{avonderluft@avlux.net}
15
+ s.extra_rdoc_files = [
16
+ "README.textile"
17
+ ]
18
+ s.files = [
19
+ "HELP_designer.textile",
20
+ "README.textile",
21
+ "Rakefile",
22
+ "VERSION",
23
+ "app/controllers/admin/part_types_controller.rb",
24
+ "app/controllers/admin/templates_controller.rb",
25
+ "app/helpers/admin/part_types_helper.rb",
26
+ "app/helpers/admin/templates_helper.rb",
27
+ "app/models/part_type.rb",
28
+ "app/models/template.rb",
29
+ "app/models/template_part.rb",
30
+ "app/views/admin/pages/_edit_template.html.haml",
31
+ "app/views/admin/pages/_edit_template_part.html.haml",
32
+ "app/views/admin/pages/_switch_templates.html.haml",
33
+ "app/views/admin/pages/_template_chooser.html.haml",
34
+ "app/views/admin/pages/_template_column.html.haml",
35
+ "app/views/admin/pages/_template_column_header.html.haml",
36
+ "app/views/admin/part_types/_form.html.haml",
37
+ "app/views/admin/part_types/_list.html.haml",
38
+ "app/views/admin/part_types/edit.html.haml",
39
+ "app/views/admin/part_types/index.html.haml",
40
+ "app/views/admin/part_types/new.html.haml",
41
+ "app/views/admin/part_types/remove.html.haml",
42
+ "app/views/admin/templates/_form.html.haml",
43
+ "app/views/admin/templates/_template_part.html.haml",
44
+ "app/views/admin/templates/_templates_css.html.haml",
45
+ "app/views/admin/templates/edit.html.haml",
46
+ "app/views/admin/templates/index.html.haml",
47
+ "app/views/admin/templates/new.html.haml",
48
+ "app/views/admin/templates/remove.html.haml",
49
+ "config/initializers/radiant_config.rb",
50
+ "config/locales/en.yml",
51
+ "config/routes.rb",
52
+ "db/migrate/001_create_templates.rb",
53
+ "db/migrate/002_create_template_parts.rb",
54
+ "db/migrate/003_rename_sublayout_column.rb",
55
+ "db/migrate/004_add_position_to_templates.rb",
56
+ "db/migrate/005_create_part_types.rb",
57
+ "db/migrate/006_add_description_to_template_parts.rb",
58
+ "db/migrate/007_add_page_class_name_to_templates.rb",
59
+ "db/migrate/008_add_index_to_templates.rb",
60
+ "db/migrate/009_create_default_part_types.rb",
61
+ "db/migrate/010_update_boolean_part_type.rb",
62
+ "db/migrate/011_add_timestamps.rb",
63
+ "lib/file_system/model/part_type_extensions.rb",
64
+ "lib/file_system/model/template_extensions.rb",
65
+ "lib/tasks/templates_extension_tasks.rake",
66
+ "lib/templates/associations.rb",
67
+ "lib/templates/controller_extensions.rb",
68
+ "lib/templates/helper.rb",
69
+ "lib/templates/page_extensions.rb",
70
+ "lib/templates/tags.rb",
71
+ "pkg/radiant-templates-extension-1.0.0.gem",
72
+ "public/images/admin/menu_arrow.png",
73
+ "public/images/admin/move_higher.png",
74
+ "public/images/admin/move_lower.png",
75
+ "public/images/admin/move_to_bottom.png",
76
+ "public/images/admin/move_to_top.png",
77
+ "public/images/admin/part_type.png",
78
+ "public/images/admin/template.png",
79
+ "radiant-templates-extension.gemspec",
80
+ "spec/controllers/admin_page_controller_extensions_spec.rb",
81
+ "spec/controllers/part_types_controller_spec.rb",
82
+ "spec/controllers/templates_controller_spec.rb",
83
+ "spec/datasets/part_types_dataset.rb",
84
+ "spec/datasets/templates_dataset.rb",
85
+ "spec/helpers/templates_helper_spec.rb",
86
+ "spec/models/page_extensions_spec.rb",
87
+ "spec/models/part_type_spec.rb",
88
+ "spec/models/tags_spec.rb",
89
+ "spec/models/template_part_spec.rb",
90
+ "spec/models/template_spec.rb",
91
+ "spec/spec.opts",
92
+ "spec/spec_helper.rb",
93
+ "templates_extension.rb",
94
+ "vendor/plugins/acts_as_list/README",
95
+ "vendor/plugins/acts_as_list/init.rb",
96
+ "vendor/plugins/acts_as_list/lib/active_record/acts/list.rb",
97
+ "vendor/plugins/acts_as_list/test/list_test.rb",
98
+ "vendor/plugins/make_resourceful/.gitignore",
99
+ "vendor/plugins/make_resourceful/DEFAULTS",
100
+ "vendor/plugins/make_resourceful/LICENSE",
101
+ "vendor/plugins/make_resourceful/README",
102
+ "vendor/plugins/make_resourceful/Rakefile",
103
+ "vendor/plugins/make_resourceful/VERSION",
104
+ "vendor/plugins/make_resourceful/generators/resourceful_scaffold/resourceful_scaffold_generator.rb",
105
+ "vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/controller.rb",
106
+ "vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/fixtures.yml",
107
+ "vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/functional_test.rb",
108
+ "vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/helper.rb",
109
+ "vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/migration.rb",
110
+ "vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/model.rb",
111
+ "vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/unit_test.rb",
112
+ "vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view__form.haml",
113
+ "vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_edit.haml",
114
+ "vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_index.haml",
115
+ "vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_new.haml",
116
+ "vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_partial.haml",
117
+ "vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_show.haml",
118
+ "vendor/plugins/make_resourceful/init.rb",
119
+ "vendor/plugins/make_resourceful/lib/resourceful/base.rb",
120
+ "vendor/plugins/make_resourceful/lib/resourceful/builder.rb",
121
+ "vendor/plugins/make_resourceful/lib/resourceful/default/accessors.rb",
122
+ "vendor/plugins/make_resourceful/lib/resourceful/default/actions.rb",
123
+ "vendor/plugins/make_resourceful/lib/resourceful/default/callbacks.rb",
124
+ "vendor/plugins/make_resourceful/lib/resourceful/default/responses.rb",
125
+ "vendor/plugins/make_resourceful/lib/resourceful/default/urls.rb",
126
+ "vendor/plugins/make_resourceful/lib/resourceful/maker.rb",
127
+ "vendor/plugins/make_resourceful/lib/resourceful/response.rb",
128
+ "vendor/plugins/make_resourceful/lib/resourceful/serialize.rb",
129
+ "vendor/plugins/make_resourceful/spec/accessors_spec.rb",
130
+ "vendor/plugins/make_resourceful/spec/actions_spec.rb",
131
+ "vendor/plugins/make_resourceful/spec/base_spec.rb",
132
+ "vendor/plugins/make_resourceful/spec/builder_spec.rb",
133
+ "vendor/plugins/make_resourceful/spec/callbacks_spec.rb",
134
+ "vendor/plugins/make_resourceful/spec/integration_spec.rb",
135
+ "vendor/plugins/make_resourceful/spec/maker_spec.rb",
136
+ "vendor/plugins/make_resourceful/spec/response_spec.rb",
137
+ "vendor/plugins/make_resourceful/spec/responses_spec.rb",
138
+ "vendor/plugins/make_resourceful/spec/rspec-rails/LICENSE",
139
+ "vendor/plugins/make_resourceful/spec/rspec-rails/redirect_to.rb",
140
+ "vendor/plugins/make_resourceful/spec/rspec-rails/render_template.rb",
141
+ "vendor/plugins/make_resourceful/spec/serialize_spec.rb",
142
+ "vendor/plugins/make_resourceful/spec/spec_helper.rb",
143
+ "vendor/plugins/make_resourceful/spec/urls_spec.rb"
144
+ ]
145
+ s.homepage = %q{https://github.com/avonderluft/radiant-templates-extension}
146
+ s.require_paths = ["lib"]
147
+ s.rubygems_version = %q{1.6.2}
148
+ s.summary = %q{Templates Extension for Radiant CMS}
149
+ s.test_files = [
150
+ "spec/controllers/admin_page_controller_extensions_spec.rb",
151
+ "spec/controllers/part_types_controller_spec.rb",
152
+ "spec/controllers/templates_controller_spec.rb",
153
+ "spec/datasets/part_types_dataset.rb",
154
+ "spec/datasets/templates_dataset.rb",
155
+ "spec/helpers/templates_helper_spec.rb",
156
+ "spec/models/page_extensions_spec.rb",
157
+ "spec/models/part_type_spec.rb",
158
+ "spec/models/tags_spec.rb",
159
+ "spec/models/template_part_spec.rb",
160
+ "spec/models/template_spec.rb",
161
+ "spec/spec_helper.rb"
162
+ ]
163
+
164
+ if s.respond_to? :specification_version then
165
+ s.specification_version = 3
166
+
167
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
168
+ s.add_runtime_dependency(%q<radiant>, [">= 1.0.0"])
169
+ else
170
+ s.add_dependency(%q<radiant>, [">= 1.0.0"])
171
+ end
172
+ else
173
+ s.add_dependency(%q<radiant>, [">= 1.0.0"])
174
+ end
175
+ end
176
+
@@ -27,7 +27,7 @@ class TemplatesExtension < Radiant::Extension
27
27
  # Admin UI customization
28
28
  admin.page.index.add :node, 'template_column', :after => 'title_column'
29
29
  admin.page.index.add :sitemap_head, 'template_column_header', :after => 'title_column_header'
30
- admin.page.edit.add :extended_metadata, 'switch_templates', :after => 'breadcrumb'
30
+ admin.page.edit.add :main, "template_chooser", :before => "edit_header"
31
31
  admin.page.edit.add :form, 'edit_template', :before => 'edit_page_parts'
32
32
  admin.page.edit.form.delete 'edit_page_parts'
33
33
  admin.page.edit.parts_bottom.delete 'edit_layout_and_type'
@@ -0,0 +1 @@
1
+ testapp
@@ -15,7 +15,7 @@ indicating how to customize various bits of the controller.
15
15
  class PostsController < ApplicationController
16
16
  def index
17
17
  # Override #current_objects to change this
18
- @posts = Post.find(:all)
18
+ @posts = Post.all
19
19
 
20
20
  # Use before :index to add something here
21
21
 
@@ -18,12 +18,11 @@ while still keeping your controllers trim and readable.
18
18
 
19
19
  Rails
20
20
 
21
- $ ruby script/plugin install http://svn.hamptoncatlin.com/make_resourceful/trunk
22
- $ mv vendor/plugins/trunk vendor/plugins/make_resourceful
21
+ $ ruby script/plugin install git://github.com/hcatlin/make_resourceful.git
23
22
 
24
- Subversion
23
+ Git
25
24
 
26
- $ svn co http://svn.hamptoncatlin.com/make_resourceful/trunk make_resourceful
25
+ $ git clone git://github.com/hcatlin/make_resourceful.git
27
26
 
28
27
  == Use it!
29
28
 
@@ -69,7 +68,7 @@ Yes.
69
68
  === What about paging?
70
69
 
71
70
  def current_objects
72
- @current_object ||= current_model.find(:all,
71
+ @current_objects ||= current_model.find(:all,
73
72
  :order => "created_at DESC", :page => {:current => params[:page], :size => 10 } )
74
73
  end
75
74
 
@@ -225,7 +224,7 @@ Don't despair, there are still more resources available!
225
224
 
226
225
  ---
227
226
 
228
- Copyright 2007 Hampton Catlin, Nathan Weizenbaum, and Jeff Hardy.
227
+ Copyright 2007, 2008, 2009 Hampton Catlin, Nathan Weizenbaum, and Jeff Hardy.
229
228
 
230
229
  Contributions by:
231
230
 
@@ -237,3 +236,5 @@ Contributions by:
237
236
  * Don Petersen
238
237
  * Alex Ross
239
238
  * Tom Stuart
239
+ * Glenn Powell
240
+ * Johannes Jörg Schmidt
@@ -1,10 +1,9 @@
1
1
  require 'rake'
2
- require 'rake/testtask'
3
2
  require 'rake/rdoctask'
4
3
  require 'spec/rake/spectask'
5
4
 
6
- desc 'Default: run unit tests.'
7
- task :default => :test
5
+ desc 'Default: run specs.'
6
+ task :default => :spec
8
7
 
9
8
  spec_files = Rake::FileList["spec/**/*_spec.rb"]
10
9
 
@@ -21,16 +20,6 @@ Spec::Rake::SpecTask.new(:coverage) do |t|
21
20
  t.rcov_opts = ['--exclude', 'spec,/var/lib/gems']
22
21
  end
23
22
 
24
- desc 'Test the make_resourceful plugin.'
25
- task :test do
26
- Dir.chdir(File.dirname(__FILE__) + '/test')
27
- tests = IO.popen('rake test')
28
-
29
- while byte = tests.read(1)
30
- print byte
31
- end
32
- end
33
-
34
23
  desc 'Generate documentation for the make_resourceful plugin.'
35
24
  Rake::RDocTask.new(:rdoc) do |rdoc|
36
25
  rdoc.rdoc_dir = 'rdoc'
@@ -1 +1 @@
1
- 0.2.3.0
1
+ 0.9.9
@@ -4,14 +4,7 @@ require '<%= controller_file_path %>_controller'
4
4
  # Re-raise errors caught by the controller.
5
5
  class <%= controller_class_name %>Controller; def rescue_action(e) raise e end; end
6
6
 
7
- class <%= controller_class_name %>ControllerTest < Test::Unit::TestCase
8
- fixtures :<%= table_name %>
9
-
10
- def setup
11
- @controller = <%= controller_class_name %>Controller.new
12
- @request = ActionController::TestRequest.new
13
- @response = ActionController::TestResponse.new
14
- end
7
+ class <%= controller_class_name %>ControllerTest < ActionController::TestCase
15
8
 
16
9
  def test_should_get_index
17
10
  get :index
@@ -21,6 +21,9 @@ module Resourceful
21
21
 
22
22
  # The actions that act on just one record.
23
23
  SINGULAR_ACTIONS = ACTIONS - PLURAL_ACTIONS
24
+
25
+ # The actions that act on just one record.
26
+ SINGULAR_PRELOADED_ACTIONS = SINGULAR_ACTIONS - [:new, :create]
24
27
  end
25
28
 
26
29
  require 'resourceful/default/accessors'
@@ -49,4 +52,12 @@ module Resourceful::Base
49
52
  include Resourceful::Default::Responses
50
53
  include Resourceful::Default::Callbacks
51
54
  include Resourceful::Default::URLs
55
+
56
+ # FIXME HACK
57
+ # making methods assigned to controller private
58
+ # prevents access from dispatcher.
59
+ private *Resourceful::Default::Accessors.public_instance_methods
60
+ private *Resourceful::Default::Responses.public_instance_methods
61
+ private *Resourceful::Default::Callbacks.public_instance_methods
62
+ private *Resourceful::Default::URLs.public_instance_methods
52
63
  end
@@ -27,6 +27,8 @@ module Resourceful
27
27
  @responses = {}
28
28
  @publish = {}
29
29
  @parents = []
30
+ @custom_member_actions = []
31
+ @custom_collection_actions = []
30
32
  end
31
33
 
32
34
  # This method is only meant to be called internally.
@@ -55,7 +57,9 @@ module Resourceful
55
57
  kontroller.write_inheritable_attribute(:made_resourceful, true)
56
58
 
57
59
  kontroller.write_inheritable_attribute(:parents, @parents)
58
- kontroller.before_filter :load_parent_object, :only => @ok_actions
60
+ kontroller.before_filter :load_object, :only => (@ok_actions & SINGULAR_PRELOADED_ACTIONS) + @custom_member_actions
61
+ kontroller.before_filter :load_objects, :only => (@ok_actions & PLURAL_ACTIONS) + @custom_collection_actions
62
+ kontroller.before_filter :load_parent_object, :only => @ok_actions + @custom_member_actions + @custom_collection_actions
59
63
  end
60
64
 
61
65
  # :call-seq:
@@ -81,13 +85,40 @@ module Resourceful
81
85
  #
82
86
  # The available actions are defined in Default::Actions.
83
87
  def actions(*available_actions)
88
+ # FIXME HACK
89
+ # made all methods private, so plural?, too.
90
+ # Did not want to make an exception for that and i do not like it to
91
+ # come up on actions_methods.
92
+ # TODO: maybe we can define plural? as class_method
84
93
  if available_actions.first == :all
85
- available_actions = controller.new.plural? ? ACTIONS : SINGULAR_ACTIONS
94
+ if controller.respond_to?(:new_without_capture)
95
+ available_actions = controller.new_without_capture.send(:plural?) ? ACTIONS : SINGULAR_ACTIONS
96
+ else
97
+ available_actions = controller.new.send(:plural?) ? ACTIONS : SINGULAR_ACTIONS
98
+ end
86
99
  end
87
100
 
88
101
  available_actions.each { |action| @ok_actions << action.to_sym }
89
102
  end
90
103
  alias build actions
104
+
105
+ # :call-seq:
106
+ # member_actions(*available_actions)
107
+ #
108
+ # Registers custom member actions which will use the load_object before_filter.
109
+ # These actions are not created, but merely registered for filtering.
110
+ def member_actions(*available_actions)
111
+ available_actions.each { |action| @custom_member_actions << action.to_sym }
112
+ end
113
+
114
+ # :call-seq:
115
+ # collection_actions(*available_actions)
116
+ #
117
+ # Registers custom collection actions which will use the load_objects before_filter.
118
+ # These actions are not created, but merely registered for filtering.
119
+ def collection_actions(*available_actions)
120
+ available_actions.each { |action| @custom_collection_actions << action.to_sym }
121
+ end
91
122
 
92
123
  # :call-seq:
93
124
  # before(*events) { ... }