Commit a45fc54a63b84bc0a600e97d25d5cd64496f914c

Authored by Victor Costa
2 parents 28c2e26c 92e5a6a5

Merge branch 'staging' into staging_rails4

app/views/cms/_view_items.html.erb
@@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
13 <%= time_ago_in_words article.updated_at %> 13 <%= time_ago_in_words article.updated_at %>
14 </td> 14 </td>
15 <td class="article-controls"> 15 <td class="article-controls">
  16 + <%= @plugins.dispatch(:extra_content_actions, article).collect { |content| instance_exec(&content) }.join("") %>
16 <%= expirable_button article, :edit, _('Edit'), {:action => 'edit', :id => article.id} if !remove_content_button(:edit, article) %> 17 <%= expirable_button article, :edit, _('Edit'), {:action => 'edit', :id => article.id} if !remove_content_button(:edit, article) %>
17 <%= button_without_text :eyes, _('Public view'), article.view_url %> 18 <%= button_without_text :eyes, _('Public view'), article.view_url %>
18 <%= display_spread_button(article) unless remove_content_button(:spread, article) %> 19 <%= display_spread_button(article) unless remove_content_button(:spread, article) %>
lib/noosfero/plugin.rb
@@ -260,6 +260,13 @@ class Noosfero::Plugin @@ -260,6 +260,13 @@ class Noosfero::Plugin
260 end.select {|const| const.is_a?(Class) && const < Noosfero::Plugin::Macro} 260 end.select {|const| const.is_a?(Class) && const < Noosfero::Plugin::Macro}
261 end 261 end
262 262
  263 + # New buttons actions with icons in each article on content manager page
  264 + # returns = proc block that creates html code to custom buttons
  265 + #
  266 + def extra_content_actions(article)
  267 + nil
  268 + end
  269 +
263 # Here the developer may specify the events to which the plugins can 270 # Here the developer may specify the events to which the plugins can
264 # register and must return true or false. The default value must be false. 271 # register and must return true or false. The default value must be false.
265 # Must also explicitly define its returning variables. 272 # Must also explicitly define its returning variables.
test/unit/api/helpers_test.rb
@@ -308,20 +308,6 @@ should &#39;verify if Serpro\&#39; captcha token has been sent&#39; do @@ -308,20 +308,6 @@ should &#39;verify if Serpro\&#39; captcha token has been sent&#39; do
308 assert_equal(_("Missing Serpro's Captcha token"), r[0][:javascript_console_message]) 308 assert_equal(_("Missing Serpro's Captcha token"), r[0][:javascript_console_message])
309 end 309 end
310 310
311 -should 'captcha serpro say name or service not known' do  
312 - environment = Environment.new  
313 - environment.api_captcha_settings = {  
314 - enabled: true,  
315 - provider: 'serpro',  
316 - serpro_client_id: '0000000000000000',  
317 - verify_uri: 'http://someserverthatdoesnotexist.mycompanythatdoesnotexist.com/validate',  
318 - }  
319 - params = {}  
320 - params[:txtToken_captcha_serpro_gov_br] = '4324343'  
321 - params[:captcha_text] = '4324343'  
322 - r = test_captcha('127.0.0.1', params, environment)  
323 - assert (r[0][:javascript_console_message]).starts_with?("Serpro captcha error: getaddrinfo")  
324 -end  
325 311
326 ###### END Captcha tests ###### 312 ###### END Captcha tests ######
327 313
test/unit/api/session_test.rb
@@ -89,22 +89,6 @@ class SessionTest &lt; ActiveSupport::TestCase @@ -89,22 +89,6 @@ class SessionTest &lt; ActiveSupport::TestCase
89 json = JSON.parse(last_response.body) 89 json = JSON.parse(last_response.body)
90 end 90 end
91 91
92 - should 'detected error, Name or service not known, for Serpro captcha communication' do  
93 - environment = Environment.default  
94 - environment.api_captcha_settings = {  
95 - enabled: true,  
96 - provider: 'serpro',  
97 - serpro_client_id: '0000000000000000',  
98 - verify_uri: 'http://someserverthatdoesnotexist.mycompanythatdoesnotexist.com/validate',  
99 - }  
100 - environment.save!  
101 - params = {:login => "newuserapi", :password => "newuserapi", :password_confirmation => "newuserapi", :email => "newuserapi@email.com",  
102 - :txtToken_captcha_serpro_gov_br => '4324343', :captcha_text => '4030320'}  
103 - post "/api/v1/register?#{params.to_query}"  
104 - message = JSON.parse(last_response.body)['javascript_console_message']  
105 - assert_equal "Serpro captcha error: getaddrinfo: Name or service not known", message  
106 - end  
107 -  
108 # TODO: Add another test cases to check register situations 92 # TODO: Add another test cases to check register situations
109 should 'activate a user' do 93 should 'activate a user' do
110 params = { 94 params = {
test/unit/plugin_test.rb
@@ -567,4 +567,16 @@ class PluginTest &lt; ActiveSupport::TestCase @@ -567,4 +567,16 @@ class PluginTest &lt; ActiveSupport::TestCase
567 assert_equal [], p.article_extra_toolbar_buttons(nil) 567 assert_equal [], p.article_extra_toolbar_buttons(nil)
568 end 568 end
569 569
  570 + should 'get extra buttons actions on content manager grid' do
  571 + class Plugin1 < Noosfero::Plugin
  572 + def extra_content_actions
  573 + proc do
  574 + '<a href="#" class="icon">Btn</a>'
  575 + end
  576 + end
  577 + end
  578 + p = Plugin1.new
  579 + assert_tag_in_string p.extra_content_actions.call(), :tag => 'a', :content => 'Btn'
  580 + end
  581 +
570 end 582 end