infopark_rails_connector 6.8.0.beta.200.621.4c8e1b0 → 6.8.0.beta.200.650.7c93155

Sign up to get free protection for your applications and to get access to all the features.
@@ -227,7 +227,7 @@ module RailsConnector
227
227
  # <%= marker_menu do %>
228
228
  # <%= iconlist do %>
229
229
  # <%= edit_item("edit title", "css_class", @obj, :image) %>
230
- # <%= action_item("edit image", "css_class", @obj, :editImage) %>
230
+ # <%= action_item("edit image", "css_class", [@obj], :editImage) %>
231
231
  # <% end %>
232
232
  # <% end %>
233
233
  def iconlist(&block)
@@ -250,7 +250,7 @@ module RailsConnector
250
250
  #
251
251
  # [title] the title which will be displayed.
252
252
  # [css_class] the css-class can be used to display a different icon.
253
- # [objs] the objects for which the action dialog will be generated.
253
+ # [objs] the array of objects for which the action dialog will be generated.
254
254
  # [action] the action for which the action dialog will be generated.
255
255
  # [options] options that will be delegated to the +action_marker+ helper.
256
256
  def action_item(title, css_class, objs, action, options = {})
@@ -6,6 +6,6 @@ xml.rss :version => '2.0' do
6
6
  xml.link cms_url(@obj)
7
7
  xml.description strip_tags(display_value(@obj.rss_description))
8
8
 
9
- xml << (render :partial => 'item.rss', :collection => table_of_contents(@obj)).to_s
9
+ xml << (render(:partial => "item", :collection => table_of_contents(@obj))).to_s
10
10
  end
11
11
  end
@@ -15,7 +15,7 @@ module RailsConnector
15
15
  def load_object # :nodoc:
16
16
  CmsEnv.new(request.env).load
17
17
  loaded_obj = request.env[CmsEnv::OBJ_ENV_KEY]
18
- raise loaded_obj if loaded_obj.is_a?(RailsConnector::ResourceNotFound)
18
+ raise loaded_obj if loaded_obj.is_a?(StandardError)
19
19
  @obj = loaded_obj
20
20
  end
21
21
 
@@ -36,7 +36,7 @@ module RailsConnector
36
36
  end
37
37
 
38
38
  def obj_not_found?
39
- loaded_obj.is_a?(RailsConnector::ResourceNotFound)
39
+ loaded_obj.is_a?(StandardError)
40
40
  end
41
41
 
42
42
  def default_controller
@@ -22,7 +22,7 @@ module RailsConnector
22
22
  env[OBJ_ENV_KEY] =
23
23
  begin
24
24
  find_obj
25
- rescue RailsConnector::ResourceNotFound => e
25
+ rescue StandardError => e
26
26
  e
27
27
  end
28
28
  end
@@ -35,7 +35,17 @@ module RailsConnector
35
35
  permalink = params[:permalink].to_a.join("/")
36
36
  Obj.find_by_permalink!(permalink)
37
37
  else
38
- Obj.homepage
38
+ if callback = RailsConnector::Configuration.choose_homepage_callback
39
+ callback_result = callback.call(env)
40
+ if callback_result.is_a?(Obj)
41
+ callback_result
42
+ else
43
+ raise "choose_homepage callback did not return an Obj. "\
44
+ "Instead saw #{callback_result.class}."
45
+ end
46
+ else
47
+ Obj.homepage
48
+ end
39
49
  end
40
50
 
41
51
  if found_obj.suppressed?
@@ -3,21 +3,6 @@ module RailsConnector
3
3
  def for_cms_object(test_obj=nil)
4
4
  # prepare the env as if the given obj was loaded by CmsEnv
5
5
  env[RailsConnector::CmsEnv::OBJ_ENV_KEY] = test_obj if test_obj
6
- class << self
7
- # This special behaviour is necessary for testing controllers that descend from DefaultCmsController.
8
- # These controllers do not have explicit routes by default.
9
- # Instead, they are reached via the CmsDispatchController.
10
- # The TestRequest must therefore use CmsDispatchController as a fallback route.
11
- def assign_parameters(routes, controller_path, action, parameters = {})
12
- super(routes, controller_path, action, parameters)
13
- rescue ActionController::RoutingError=> e
14
- begin
15
- super(routes, "rails_connector/cms_dispatch", action, parameters)
16
- rescue ActionController::RoutingError
17
- raise e
18
- end
19
- end
20
- end
21
6
  end
22
7
  end
23
8
  end
@@ -133,6 +133,16 @@ module RailsConnector
133
133
  end
134
134
  end
135
135
 
136
+ attr_accessor :choose_homepage_callback #:nodoc:
137
+
138
+ # Configure a callback to be invoked when the rails connector delivers the homepage.
139
+ # The given callback will receive the rack env
140
+ # and must return an Obj to be used as the homepage.
141
+ # If no callback is configured, Obj.homepage will be used as the default.
142
+ def choose_homepage(&block)
143
+ self.choose_homepage_callback = block
144
+ end
145
+
136
146
  def license #:nodoc:
137
147
  license_file.read
138
148
  end
@@ -11,6 +11,9 @@ module ::RailsConnector
11
11
  config.to_prepare { RailsConnector::Configuration.to_prepare }
12
12
  config.after_initialize { RailsConnector::Configuration.after_initialize }
13
13
 
14
+ # make sure our exceptions cause an adequate error page and http status code
15
+ config.action_dispatch.rescue_responses.merge!("RailsConnector::ResourceNotFound" => :not_found)
16
+
14
17
  initializer "rails_connector.add_cms_routing_paths", :after => :add_routing_paths do |app|
15
18
  cms_route = File.expand_path("cms_routes.rb", paths['config'].to_a.first)
16
19
  app.routes_reloader.paths.push(cms_route)
@@ -33,12 +36,6 @@ module ::RailsConnector
33
36
  end
34
37
  end
35
38
 
36
- # make sure our exceptions cause an adequate error page and http status code
37
- initializer "rails_connector.register_exceptions" do |app|
38
- responses = ActionDispatch::ShowExceptions.rescue_responses
39
- responses["RailsConnector::ResourceNotFound"] = :not_found
40
- end
41
-
42
39
  initializer "rails_connector.configure_database" do |app|
43
40
  RailsConnector::Configuration.configure_cms_database
44
41
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: infopark_rails_connector
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15922107031
4
+ hash: -1017909884
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 6
@@ -9,15 +9,11 @@ version: !ruby/object:Gem::Version
9
9
  - 0
10
10
  - beta
11
11
  - 200
12
- - 621
13
- - 4
12
+ - 650
13
+ - 7
14
14
  - c
15
- - 8
16
- - e
17
- - 1
18
- - b
19
- - 0
20
- version: 6.8.0.beta.200.621.4c8e1b0
15
+ - 93155
16
+ version: 6.8.0.beta.200.650.7c93155
21
17
  platform: ruby
22
18
  authors:
23
19
  - Infopark AG
@@ -25,43 +21,46 @@ autorequire:
25
21
  bindir: bin
26
22
  cert_chain: []
27
23
 
28
- date: 2012-04-18 00:00:00 +02:00
24
+ date: 2012-06-01 00:00:00 +02:00
29
25
  default_executable:
30
26
  dependencies:
31
27
  - !ruby/object:Gem::Dependency
32
- requirement: &id001 !ruby/object:Gem::Requirement
28
+ name: rails
29
+ prerelease: false
30
+ version_requirements: &id001 !ruby/object:Gem::Requirement
33
31
  none: false
34
32
  requirements:
35
33
  - - ~>
36
34
  - !ruby/object:Gem::Version
37
- hash: 5
35
+ hash: 13
38
36
  segments:
39
37
  - 3
38
+ - 2
40
39
  - 1
41
- - 3
42
- version: 3.1.3
43
- prerelease: false
40
+ version: 3.2.1
41
+ requirement: *id001
44
42
  type: :runtime
45
- name: rails
46
- version_requirements: *id001
47
43
  - !ruby/object:Gem::Dependency
48
- requirement: &id002 !ruby/object:Gem::Requirement
44
+ name: rake
45
+ prerelease: false
46
+ version_requirements: &id002 !ruby/object:Gem::Requirement
49
47
  none: false
50
48
  requirements:
51
49
  - - ">="
52
50
  - !ruby/object:Gem::Version
53
- hash: 49
51
+ hash: 11
54
52
  segments:
55
53
  - 0
56
- - 8
57
- - 7
58
- version: 0.8.7
59
- prerelease: false
54
+ - 9
55
+ - 2
56
+ - 2
57
+ version: 0.9.2.2
58
+ requirement: *id002
60
59
  type: :runtime
61
- name: rake
62
- version_requirements: *id002
63
60
  - !ruby/object:Gem::Dependency
64
- requirement: &id003 !ruby/object:Gem::Requirement
61
+ name: json
62
+ prerelease: false
63
+ version_requirements: &id003 !ruby/object:Gem::Requirement
65
64
  none: false
66
65
  requirements:
67
66
  - - ">="
@@ -72,12 +71,12 @@ dependencies:
72
71
  - 5
73
72
  - 1
74
73
  version: 1.5.1
75
- prerelease: false
74
+ requirement: *id003
76
75
  type: :runtime
77
- name: json
78
- version_requirements: *id003
79
76
  - !ruby/object:Gem::Dependency
80
- requirement: &id004 !ruby/object:Gem::Requirement
77
+ name: maruku
78
+ prerelease: false
79
+ version_requirements: &id004 !ruby/object:Gem::Requirement
81
80
  none: false
82
81
  requirements:
83
82
  - - ~>
@@ -88,12 +87,12 @@ dependencies:
88
87
  - 6
89
88
  - 0
90
89
  version: 0.6.0
91
- prerelease: false
90
+ requirement: *id004
92
91
  type: :runtime
93
- name: maruku
94
- version_requirements: *id004
95
92
  - !ruby/object:Gem::Dependency
96
- requirement: &id005 !ruby/object:Gem::Requirement
93
+ name: liquid
94
+ prerelease: false
95
+ version_requirements: &id005 !ruby/object:Gem::Requirement
97
96
  none: false
98
97
  requirements:
99
98
  - - ~>
@@ -104,12 +103,12 @@ dependencies:
104
103
  - 0
105
104
  - 0
106
105
  version: 2.0.0
107
- prerelease: false
106
+ requirement: *id005
108
107
  type: :runtime
109
- name: liquid
110
- version_requirements: *id005
111
108
  - !ruby/object:Gem::Dependency
112
- requirement: &id006 !ruby/object:Gem::Requirement
109
+ name: will_paginate
110
+ prerelease: false
111
+ version_requirements: &id006 !ruby/object:Gem::Requirement
113
112
  none: false
114
113
  requirements:
115
114
  - - ~>
@@ -120,12 +119,12 @@ dependencies:
120
119
  - 0
121
120
  - 2
122
121
  version: 3.0.2
123
- prerelease: false
122
+ requirement: *id006
124
123
  type: :runtime
125
- name: will_paginate
126
- version_requirements: *id006
127
124
  - !ruby/object:Gem::Dependency
128
- requirement: &id007 !ruby/object:Gem::Requirement
125
+ name: ruby-recaptcha
126
+ prerelease: false
127
+ version_requirements: &id007 !ruby/object:Gem::Requirement
129
128
  none: false
130
129
  requirements:
131
130
  - - ~>
@@ -136,12 +135,12 @@ dependencies:
136
135
  - 0
137
136
  - 5
138
137
  version: 1.0.5
139
- prerelease: false
138
+ requirement: *id007
140
139
  type: :runtime
141
- name: ruby-recaptcha
142
- version_requirements: *id007
143
140
  - !ruby/object:Gem::Dependency
144
- requirement: &id008 !ruby/object:Gem::Requirement
141
+ name: infopark_crm_connector
142
+ prerelease: false
143
+ version_requirements: &id008 !ruby/object:Gem::Requirement
145
144
  none: false
146
145
  requirements:
147
146
  - - ~>
@@ -152,12 +151,12 @@ dependencies:
152
151
  - 9
153
152
  - 2
154
153
  version: 0.9.2
155
- prerelease: false
154
+ requirement: *id008
156
155
  type: :runtime
157
- name: infopark_crm_connector
158
- version_requirements: *id008
159
156
  - !ruby/object:Gem::Dependency
160
- requirement: &id009 !ruby/object:Gem::Requirement
157
+ name: tidy
158
+ prerelease: false
159
+ version_requirements: &id009 !ruby/object:Gem::Requirement
161
160
  none: false
162
161
  requirements:
163
162
  - - ~>
@@ -168,12 +167,12 @@ dependencies:
168
167
  - 1
169
168
  - 2
170
169
  version: 1.1.2
171
- prerelease: false
170
+ requirement: *id009
172
171
  type: :runtime
173
- name: tidy
174
- version_requirements: *id009
175
172
  - !ruby/object:Gem::Dependency
176
- requirement: &id010 !ruby/object:Gem::Requirement
173
+ name: jquery-rails
174
+ prerelease: false
175
+ version_requirements: &id010 !ruby/object:Gem::Requirement
177
176
  none: false
178
177
  requirements:
179
178
  - - ~>
@@ -184,12 +183,12 @@ dependencies:
184
183
  - 0
185
184
  - 19
186
185
  version: 1.0.19
187
- prerelease: false
186
+ requirement: *id010
188
187
  type: :runtime
189
- name: jquery-rails
190
- version_requirements: *id010
191
188
  - !ruby/object:Gem::Dependency
192
- requirement: &id011 !ruby/object:Gem::Requirement
189
+ name: helpful_configuration
190
+ prerelease: false
191
+ version_requirements: &id011 !ruby/object:Gem::Requirement
193
192
  none: false
194
193
  requirements:
195
194
  - - ~>
@@ -200,10 +199,8 @@ dependencies:
200
199
  - 1
201
200
  - 0
202
201
  version: 0.1.0
203
- prerelease: false
202
+ requirement: *id011
204
203
  type: :runtime
205
- name: helpful_configuration
206
- version_requirements: *id011
207
204
  description: The Rails Connector for Infopark CMS Fiona enables you to develop modern, dynamic Web 2.0 applications using Ruby on Rails and at the same time display CMS managed content.
208
205
  email: info@infopark.de
209
206
  executables: []
@@ -211,55 +208,55 @@ executables: []
211
208
  extensions: []
212
209
 
213
210
  extra_rdoc_files:
214
- - app/controllers/cms_controller.rb
211
+ - app/mailers/confirmation_mailer.rb
212
+ - app/models/rails_connector/default_comment.rb
213
+ - app/models/rails_connector/default_rating.rb
214
+ - app/models/rails_connector/link_list.rb
215
+ - app/models/crm_form.rb
216
+ - app/models/named_link.rb
217
+ - app/models/obj.rb
215
218
  - app/controllers/comments_controller.rb
216
- - app/controllers/crm_form_controller.rb
217
- - app/controllers/pdf_controller.rb
218
- - app/controllers/rails_connector/default_cms_controller.rb
219
+ - app/controllers/cms_controller.rb
220
+ - app/controllers/user_controller.rb
221
+ - app/controllers/rails_connector/time_machine_controller.rb
222
+ - app/controllers/rails_connector/pdf_external_controller.rb
219
223
  - app/controllers/rails_connector/default_comments_controller.rb
220
224
  - app/controllers/rails_connector/default_crm_form_controller.rb
221
- - app/controllers/rails_connector/default_pdf_controller.rb
222
- - app/controllers/rails_connector/default_ratings_controller.rb
225
+ - app/controllers/rails_connector/default_user_controller.rb
223
226
  - app/controllers/rails_connector/default_rss_controller.rb
227
+ - app/controllers/rails_connector/default_pdf_controller.rb
224
228
  - app/controllers/rails_connector/default_search_controller.rb
225
- - app/controllers/rails_connector/default_user_controller.rb
226
- - app/controllers/rails_connector/pdf_external_controller.rb
227
- - app/controllers/rails_connector/time_machine_controller.rb
228
- - app/controllers/ratings_controller.rb
229
+ - app/controllers/rails_connector/default_cms_controller.rb
230
+ - app/controllers/rails_connector/default_ratings_controller.rb
229
231
  - app/controllers/rss_controller.rb
230
232
  - app/controllers/search_controller.rb
233
+ - app/controllers/pdf_controller.rb
234
+ - app/controllers/crm_form_controller.rb
231
235
  - app/controllers/seo_sitemap_controller.rb
232
- - app/controllers/user_controller.rb
233
- - app/helpers/cms_helper.rb
234
- - app/helpers/cms_routing_helper.rb
236
+ - app/controllers/ratings_controller.rb
237
+ - app/helpers/user_helper.rb
235
238
  - app/helpers/crm_form_helper.rb
236
- - app/helpers/rails_connector/cms_asset_helper.rb
239
+ - app/helpers/rails_connector/layout_helper.rb
240
+ - app/helpers/rails_connector/display_helper.rb
237
241
  - app/helpers/rails_connector/default_cms_helper.rb
238
- - app/helpers/rails_connector/default_cms_routing_helper.rb
239
- - app/helpers/rails_connector/default_crm_form_helper.rb
242
+ - app/helpers/rails_connector/time_machine_helper.rb
243
+ - app/helpers/rails_connector/mandatory_label_helper.rb
240
244
  - app/helpers/rails_connector/default_ratings_helper.rb
241
- - app/helpers/rails_connector/default_user_helper.rb
242
- - app/helpers/rails_connector/display_helper.rb
243
- - app/helpers/rails_connector/error_messages_helper.rb
244
- - app/helpers/rails_connector/layout_helper.rb
245
+ - app/helpers/rails_connector/table_of_contents_helper.rb
245
246
  - app/helpers/rails_connector/link_helper.rb
246
- - app/helpers/rails_connector/mandatory_label_helper.rb
247
+ - app/helpers/rails_connector/default_cms_routing_helper.rb
248
+ - app/helpers/rails_connector/default_user_helper.rb
249
+ - app/helpers/rails_connector/micronav_helper.rb
247
250
  - app/helpers/rails_connector/marker_helper.rb
248
251
  - app/helpers/rails_connector/menu_helper.rb
249
- - app/helpers/rails_connector/micronav_helper.rb
252
+ - app/helpers/rails_connector/error_messages_helper.rb
253
+ - app/helpers/rails_connector/cms_asset_helper.rb
250
254
  - app/helpers/rails_connector/seo_helper.rb
251
- - app/helpers/rails_connector/table_of_contents_helper.rb
252
- - app/helpers/rails_connector/time_machine_helper.rb
255
+ - app/helpers/rails_connector/default_crm_form_helper.rb
253
256
  - app/helpers/rails_connector/tracking_helper.rb
257
+ - app/helpers/cms_routing_helper.rb
258
+ - app/helpers/cms_helper.rb
254
259
  - app/helpers/ratings_helper.rb
255
- - app/helpers/user_helper.rb
256
- - app/mailers/confirmation_mailer.rb
257
- - app/models/crm_form.rb
258
- - app/models/named_link.rb
259
- - app/models/obj.rb
260
- - app/models/rails_connector/default_comment.rb
261
- - app/models/rails_connector/default_rating.rb
262
- - app/models/rails_connector/link_list.rb
263
260
  - README
264
261
  files:
265
262
  - app/assets/images/admin/minus.gif
@@ -481,7 +478,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
481
478
  requirements: []
482
479
 
483
480
  rubyforge_project:
484
- rubygems_version: 1.6.2
481
+ rubygems_version: 1.4.2
485
482
  signing_key:
486
483
  specification_version: 3
487
484
  summary: Infopark Rails Connector