Commit 38643752abd32b742ef4ec3b811daddf8f81e87c

Authored by Antonio Terceiro
Committed by Paulo Meireles
1 parent 95d3259f

Drop temporary plugin view_paths integration

app/controllers/my_profile/cms_controller.rb
@@ -79,7 +79,6 @@ class CmsController < MyProfileController @@ -79,7 +79,6 @@ class CmsController < MyProfileController
79 end 79 end
80 80
81 def edit 81 def edit
82 - plugins_prepend_view_paths  
83 @article = profile.articles.find(params[:id]) 82 @article = profile.articles.find(params[:id])
84 @parent_id = params[:parent_id] 83 @parent_id = params[:parent_id]
85 @type = params[:type] || @article.class.to_s 84 @type = params[:type] || @article.class.to_s
@@ -103,7 +102,6 @@ class CmsController < MyProfileController @@ -103,7 +102,6 @@ class CmsController < MyProfileController
103 end 102 end
104 103
105 def new 104 def new
106 - plugins_prepend_view_paths  
107 # FIXME this method should share some logic wirh edit !!! 105 # FIXME this method should share some logic wirh edit !!!
108 106
109 # user must choose an article type first 107 # user must choose an article type first
@@ -355,12 +353,6 @@ class CmsController < MyProfileController @@ -355,12 +353,6 @@ class CmsController < MyProfileController
355 end.to_json 353 end.to_json
356 end 354 end
357 355
358 - def plugins_prepend_view_paths  
359 - @plugins.map(:view_path).each do |view_path|  
360 - prepend_view_path(view_path)  
361 - end  
362 - end  
363 -  
364 def content_editor? 356 def content_editor?
365 true 357 true
366 end 358 end
app/controllers/public/content_viewer_controller.rb
@@ -6,7 +6,6 @@ class ContentViewerController < ApplicationController @@ -6,7 +6,6 @@ class ContentViewerController < ApplicationController
6 helper TagsHelper 6 helper TagsHelper
7 7
8 def view_page 8 def view_page
9 - plugins_prepend_view_paths  
10 path = params[:page].join('/') 9 path = params[:page].join('/')
11 10
12 if path.blank? 11 if path.blank?
@@ -152,12 +151,5 @@ class ContentViewerController < ApplicationController @@ -152,12 +151,5 @@ class ContentViewerController < ApplicationController
152 end 151 end
153 end 152 end
154 end 153 end
155 -  
156 - # FIXME duplicated  
157 - def plugins_prepend_view_paths  
158 - @plugins.map(:view_path).each do |view_path|  
159 - prepend_view_path(view_path)  
160 - end  
161 - end  
162 154
163 end 155 end
lib/noosfero/plugin.rb
@@ -111,12 +111,6 @@ class Noosfero::Plugin @@ -111,12 +111,6 @@ class Noosfero::Plugin
111 nil 111 nil
112 end 112 end
113 113
114 - # -> Can be used to add plugin-specific view paths to controllers  
115 - # returns = { plugins' view paths }  
116 - def view_path  
117 - nil  
118 - end  
119 -  
120 # -> Adds content to calalog item 114 # -> Adds content to calalog item
121 # returns = lambda block that creates a html code 115 # returns = lambda block that creates a html code
122 def catalog_item_extras(item) 116 def catalog_item_extras(item)
plugins/mezuro/lib/mezuro_plugin.rb
@@ -12,10 +12,6 @@ class MezuroPlugin < Noosfero::Plugin @@ -12,10 +12,6 @@ class MezuroPlugin < Noosfero::Plugin
12 MezuroPlugin::ProjectContent 12 MezuroPlugin::ProjectContent
13 end 13 end
14 14
15 - def view_path  
16 - File.join(RAILS_ROOT, "plugins", "mezuro", "views")  
17 - end  
18 -  
19 def stylesheet? 15 def stylesheet?
20 true 16 true
21 end 17 end
@@ -24,4 +20,4 @@ class MezuroPlugin < Noosfero::Plugin @@ -24,4 +20,4 @@ class MezuroPlugin < Noosfero::Plugin
24 'javascripts/collapsable.js' 20 'javascripts/collapsable.js'
25 end 21 end
26 22
27 -end  
28 \ No newline at end of file 23 \ No newline at end of file
  24 +end
test/functional/cms_controller_test.rb
@@ -1514,25 +1514,14 @@ class CmsControllerTest < ActionController::TestCase @@ -1514,25 +1514,14 @@ class CmsControllerTest < ActionController::TestCase
1514 plugins = mock() 1514 plugins = mock()
1515 plugins.stubs(:map).with(:content_types).returns(types) 1515 plugins.stubs(:map).with(:content_types).returns(types)
1516 plugins.stubs(:map).with(:body_beginning).returns([]) 1516 plugins.stubs(:map).with(:body_beginning).returns([])
  1517 + plugins.stubs(:map).with(:head_ending).returns([])
1517 plugins.stubs(:enabled_plugins).returns([]) 1518 plugins.stubs(:enabled_plugins).returns([])
1518 - Noosfero::Plugin::Manager.expects(:new).returns(plugins) 1519 + Noosfero::Plugin::Manager.expects(:new).returns(plugins)
1519 1520
1520 get :index, :profile => profile.identifier 1521 get :index, :profile => profile.identifier
1521 1522
1522 assert_includes @controller.special_article_types, Integer 1523 assert_includes @controller.special_article_types, Integer
1523 - assert_includes @controller.special_article_types, Float  
1524 - end  
1525 -  
1526 - should 'include plugins view paths on partial search' do  
1527 - view_path = '/example/view_path'  
1528 - plugins = mock()  
1529 - plugins.stubs(:map).with(:view_path).returns(view_path)  
1530 - plugins.stubs(:enabled_plugins).returns([])  
1531 - Noosfero::Plugin::Manager.expects(:new).returns(plugins)  
1532 -  
1533 - get :new, :profile => profile.identifier  
1534 -  
1535 - assert_equal view_path, @controller.view_paths[0] 1524 + assert_includes @controller.special_article_types, Float
1536 end 1525 end
1537 1526
1538 end 1527 end