Commit 1ea8caaf308bd49bd81f541762a325b128fed274
1 parent
74da6b9d
Exists in
master
and in
29 other branches
ActionItem62: reverting unwanted change to routing _and_ controller discovery
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@920 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
2 changed files
with
9 additions
and
14 deletions
Show diff stats
config/routes.rb
... | ... | @@ -36,10 +36,8 @@ ActionController::Routing::Routes.draw do |map| |
36 | 36 | map.connect 'cat', :controller => 'category', :action => 'index' |
37 | 37 | map.category 'cat/*path', :controller => 'category', :action => 'view' |
38 | 38 | |
39 | - ## controllers for blocks | |
40 | - # FIXME this path didn't works Leandro comments this line and the reference to the controller path on | |
41 | - # /lib/noosfero.rg file. | |
42 | - #map.controllers 'block/:controller/:action/:id', :controller => Noosfero.pattern_for_controllers_from_design_blocks | |
39 | + # controllers for blocks | |
40 | + map.controllers 'block/:controller/:action/:id', :controller => Noosfero.pattern_for_controllers_from_design_blocks | |
43 | 41 | |
44 | 42 | ###################################################### |
45 | 43 | ## Controllers that are profile-specific (for profile admins ) | ... | ... |
lib/noosfero.rb
... | ... | @@ -9,21 +9,18 @@ module Noosfero |
9 | 9 | Regexp.new(pattern) |
10 | 10 | end |
11 | 11 | |
12 | -# FIXME This path is not working. I put a line deteach on the 'controllers_in_directory' method to meka the blocks | |
13 | -# works | |
14 | -# def self.pattern_for_controllers_from_design_blocks | |
15 | -# items = Dir.glob(File.join(RAILS_ROOT, 'app', 'design_blocks', '*', 'controllers', '*_controller.rb')).map do |item| | |
16 | -# item.gsub(/^.*\/([^\/]+)_controller.rb$/, '\1') | |
17 | -# end.join('|') | |
18 | -# Regexp.new(items.blank? ? '' : ('(' + items + ')')) | |
19 | -# end | |
12 | + def self.pattern_for_controllers_from_design_blocks | |
13 | + items = Dir.glob(File.join(RAILS_ROOT, 'app', 'design_blocks', '*', 'controllers', '*_controller.rb')).map do |item| | |
14 | + item.gsub(/^.*\/([^\/]+)_controller.rb$/, '\1') | |
15 | + end.join('|') | |
16 | + Regexp.new(items.blank? ? '' : ('(' + items + ')')) | |
17 | + end | |
20 | 18 | |
21 | 19 | private |
22 | 20 | |
23 | 21 | def self.controllers_in_directory(dir) |
24 | 22 | app_controller_path = Dir.glob(File.join(RAILS_ROOT, 'app', 'controllers', dir, '*_controller.rb')) |
25 | - items = Dir.glob(File.join(RAILS_ROOT, 'app', 'design_blocks', '*', 'controllers', '*_controller.rb')) # FIXME line added to blocks works | |
26 | - (app_controller_path + items).map do |item| | |
23 | + app_controller_path.map do |item| | |
27 | 24 | item.gsub(/^.*\/([^\/]+)_controller.rb$/, '\1') |
28 | 25 | end |
29 | 26 | end | ... | ... |