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 79 end
80 80  
81 81 def edit
82   - plugins_prepend_view_paths
83 82 @article = profile.articles.find(params[:id])
84 83 @parent_id = params[:parent_id]
85 84 @type = params[:type] || @article.class.to_s
... ... @@ -103,7 +102,6 @@ class CmsController < MyProfileController
103 102 end
104 103  
105 104 def new
106   - plugins_prepend_view_paths
107 105 # FIXME this method should share some logic wirh edit !!!
108 106  
109 107 # user must choose an article type first
... ... @@ -355,12 +353,6 @@ class CmsController < MyProfileController
355 353 end.to_json
356 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 356 def content_editor?
365 357 true
366 358 end
... ...
app/controllers/public/content_viewer_controller.rb
... ... @@ -6,7 +6,6 @@ class ContentViewerController < ApplicationController
6 6 helper TagsHelper
7 7  
8 8 def view_page
9   - plugins_prepend_view_paths
10 9 path = params[:page].join('/')
11 10  
12 11 if path.blank?
... ... @@ -152,12 +151,5 @@ class ContentViewerController < ApplicationController
152 151 end
153 152 end
154 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 155 end
... ...
lib/noosfero/plugin.rb
... ... @@ -111,12 +111,6 @@ class Noosfero::Plugin
111 111 nil
112 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 114 # -> Adds content to calalog item
121 115 # returns = lambda block that creates a html code
122 116 def catalog_item_extras(item)
... ...
plugins/mezuro/lib/mezuro_plugin.rb
... ... @@ -12,10 +12,6 @@ class MezuroPlugin < Noosfero::Plugin
12 12 MezuroPlugin::ProjectContent
13 13 end
14 14  
15   - def view_path
16   - File.join(RAILS_ROOT, "plugins", "mezuro", "views")
17   - end
18   -
19 15 def stylesheet?
20 16 true
21 17 end
... ... @@ -24,4 +20,4 @@ class MezuroPlugin < Noosfero::Plugin
24 20 'javascripts/collapsable.js'
25 21 end
26 22  
27   -end
28 23 \ No newline at end of file
  24 +end
... ...
test/functional/cms_controller_test.rb
... ... @@ -1514,25 +1514,14 @@ class CmsControllerTest < ActionController::TestCase
1514 1514 plugins = mock()
1515 1515 plugins.stubs(:map).with(:content_types).returns(types)
1516 1516 plugins.stubs(:map).with(:body_beginning).returns([])
  1517 + plugins.stubs(:map).with(:head_ending).returns([])
1517 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 1521 get :index, :profile => profile.identifier
1521 1522  
1522 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 1525 end
1537 1526  
1538 1527 end
... ...