Commit 2454d82ef480907cfc1ca2160991b33f9b1c9b3b

Authored by Daniela Feitosa
2 parents 6f93cb79 2545cee1

Merge branch 'stable'

app/helpers/application_helper.rb
@@ -538,7 +538,7 @@ module ApplicationHelper @@ -538,7 +538,7 @@ module ApplicationHelper
538 {_('Members') => {:href => url_for(:controller => :profile, :action => :members, :profile => profile.identifier)}}, 538 {_('Members') => {:href => url_for(:controller => :profile, :action => :members, :profile => profile.identifier)}},
539 {_('Agenda') => {:href => url_for(:controller => :profile, :action => :events, :profile => profile.identifier)}}, 539 {_('Agenda') => {:href => url_for(:controller => :profile, :action => :events, :profile => profile.identifier)}},
540 {_('Join') => {:href => url_for(profile.join_url), :class => 'join-community', :style => 'display: none'}}, 540 {_('Join') => {:href => url_for(profile.join_url), :class => 'join-community', :style => 'display: none'}},
541 - {_('Leave') => {:href => url_for(profile.leave_url), :class => 'leave-community', :style => 'display: none'}}, 541 + {_('Leave community') => {:href => url_for(profile.leave_url), :class => 'leave-community', :style => 'display: none'}},
542 {_('Send an e-mail') => {:href => url_for(:profile => profile.identifier, :controller => 'contact', :action => 'new'), :class => 'send-an-email', :style => 'display: none'}} 542 {_('Send an e-mail') => {:href => url_for(:profile => profile.identifier, :controller => 'contact', :action => 'new'), :class => 'send-an-email', :style => 'display: none'}}
543 ] 543 ]
544 elsif profile.kind_of?(Enterprise) 544 elsif profile.kind_of?(Enterprise)
app/views/manage_products/index.rhtml
@@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
16 <td><strong><%= link_to product.name, :action => 'show', :id => product %></strong></td> 16 <td><strong><%= link_to product.name, :action => 'show', :id => product %></strong></td>
17 <td><%= product.price %></td> 17 <td><%= product.price %></td>
18 <td> 18 <td>
19 - <%= button :delete, _('Destroy'), :action => 'destroy', :id => product %> 19 + <%= button :delete, _('Remove'), {:action => 'destroy', :id => product}, :confirm => _('Are you sure you want to remove this product?') %>
20 </td> 20 </td>
21 </tr> 21 </tr>
22 <% end %> 22 <% end %>
app/views/memberships/index.rhtml
@@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
23 <%= _('Created at: %s') % show_date(membership.created_at) unless membership.enterprise? %> <br/> 23 <%= _('Created at: %s') % show_date(membership.created_at) unless membership.enterprise? %> <br/>
24 <% button_bar do %> 24 <% button_bar do %>
25 <%= button 'menu-ctrl-panel', _('Control panel of this group'), membership.admin_url %> 25 <%= button 'menu-ctrl-panel', _('Control panel of this group'), membership.admin_url %>
26 - <%= button 'menu-logout', _('Leave'), membership.leave_url(true), :class => 'leave-community' %> 26 + <%= button 'menu-logout', _('Leave community'), membership.leave_url(true), :class => 'leave-community' %>
27 <% if (membership.community? && user.has_permission?(:destroy_profile, membership)) %> 27 <% if (membership.community? && user.has_permission?(:destroy_profile, membership)) %>
28 <%= button 'delete', _('Remove'), { :controller => 'profile_editor', :action => 'destroy_profile', :profile => membership.identifier } %> 28 <%= button 'delete', _('Remove'), { :controller => 'profile_editor', :action => 'destroy_profile', :profile => membership.identifier } %>
29 <% end %> 29 <% end %>
app/views/profile_editor/edit.rhtml
@@ -73,13 +73,19 @@ @@ -73,13 +73,19 @@
73 </table> 73 </table>
74 <% end %> 74 <% end %>
75 75
76 - <h2><%= _('Other options') %></h2> 76 + <%= select_categories(:profile_data, _('Select the categories of your interest'), 2) %>
  77 +
  78 + <h2><%= _('Translations') %></h2>
77 <%= labelled_check_box( 79 <%= labelled_check_box(
78 _('Automatic redirect the visitor to the translated article of him language'), 80 _('Automatic redirect the visitor to the translated article of him language'),
79 'profile_data[redirect_l10n]', true, @profile.redirect_l10n 81 'profile_data[redirect_l10n]', true, @profile.redirect_l10n
80 )%> 82 )%>
81 83
82 - <%= select_categories(:profile_data, _('Select the categories of your interest'), 2) %> 84 + <%=
  85 + @plugins.map(:profile_editor_extras).each do |content|
  86 + content.respond_to?(:call) ? content.call : content
  87 + end.join("\n")
  88 + %>
83 89
84 <%= 90 <%=
85 @plugins.map(:profile_editor_extras).each do |content| 91 @plugins.map(:profile_editor_extras).each do |content|
plugins/bsc/controllers/bsc_plugin_myprofile_controller.rb
@@ -8,7 +8,7 @@ class BscPluginMyprofileController &lt; MyProfileController @@ -8,7 +8,7 @@ class BscPluginMyprofileController &lt; MyProfileController
8 end 8 end
9 9
10 def search_enterprise 10 def search_enterprise
11 - render :text => environment.enterprises.find(:all, :conditions => ["type <> 'BscPlugin::Bsc' AND (LOWER(name) LIKE ? OR LOWER(identifier) LIKE ?)", "%#{params[:q]}%", "%#{params[:q]}%"]). 11 + render :text => environment.enterprises.find(:all, :conditions => ["type <> 'BscPlugin::Bsc' AND (LOWER(name) LIKE ? OR LOWER(identifier) LIKE ?) AND (identifier NOT LIKE ?)", "%#{params[:q]}%", "%#{params[:q]}%", "%_template"]).
12 select { |enterprise| enterprise.bsc.nil? && !profile.already_requested?(enterprise)}. 12 select { |enterprise| enterprise.bsc.nil? && !profile.already_requested?(enterprise)}.
13 map {|enterprise| {:id => enterprise.id, :name => enterprise.name} }. 13 map {|enterprise| {:id => enterprise.id, :name => enterprise.name} }.
14 to_json 14 to_json
plugins/bsc/lib/bsc_plugin/bsc_helper.rb
1 module BscPlugin::BscHelper 1 module BscPlugin::BscHelper
2 include ActionView::Helpers::FormTagHelper 2 include ActionView::Helpers::FormTagHelper
  3 + include ActionView::Helpers::TextHelper
3 4
4 def token_input_field_tag(name, element_id, search_action, options = {}, text_field_options = {}, html_options = {}) 5 def token_input_field_tag(name, element_id, search_action, options = {}, text_field_options = {}, html_options = {})
5 options[:min_chars] ||= 3 6 options[:min_chars] ||= 3
plugins/bsc/test/functional/bsc_plugin_myprofile_controller_test.rb
@@ -50,6 +50,18 @@ class BscPluginMyprofileControllerTest &lt; Test::Unit::TestCase @@ -50,6 +50,18 @@ class BscPluginMyprofileControllerTest &lt; Test::Unit::TestCase
50 assert_match /#{e6.name}/, @response.body 50 assert_match /#{e6.name}/, @response.body
51 end 51 end
52 52
  53 + should 'do not list profiles template on search' do
  54 + e1 = Enterprise.create!(:name => 'Sample Enterprise 1', :identifier => 'sample-enterprise-1')
  55 + e2 = Enterprise.create!(:name => 'Sample Enterprise 2', :identifier => 'sample-enterprise-2')
  56 + t1 = Enterprise.create!(:name => 'Enterprise template', :identifier => 'enterprise_template')
  57 + t2 = Enterprise.create!(:name => 'Inactive enterprise template', :identifier => 'inactive_enterprise_template')
  58 +
  59 + get :search_enterprise, :profile => bsc.identifier, :q => 'ent'
  60 +
  61 + assert_no_match /#{t1.name}/, @response.body
  62 + assert_no_match /#{t2.name}/, @response.body
  63 + end
  64 +
53 should 'save associations' do 65 should 'save associations' do
54 e1 = fast_create(Enterprise, :enabled => false) 66 e1 = fast_create(Enterprise, :enabled => false)
55 e2 = fast_create(Enterprise, :enabled => false) 67 e2 = fast_create(Enterprise, :enabled => false)
po/es/noosfero.po
@@ -4621,14 +4621,14 @@ msgstr[1] &quot;&quot; @@ -4621,14 +4621,14 @@ msgstr[1] &quot;&quot;
4621 #: app/views/blocks/profile_info_actions/community.rhtml:19 4621 #: app/views/blocks/profile_info_actions/community.rhtml:19
4622 #, fuzzy 4622 #, fuzzy
4623 msgid "Leave community" 4623 msgid "Leave community"
4624 -msgstr "Una comunidad" 4624 +msgstr "Salir de la comunidad"
4625 4625
4626 #: app/views/blocks/profile_info_actions/community.rhtml:11 4626 #: app/views/blocks/profile_info_actions/community.rhtml:11
4627 #: app/views/blocks/profile_info_actions/community.rhtml:23 4627 #: app/views/blocks/profile_info_actions/community.rhtml:23
4628 #: app/views/profile/_private_profile.rhtml:10 4628 #: app/views/profile/_private_profile.rhtml:10
4629 #, fuzzy 4629 #, fuzzy
4630 msgid "Join community" 4630 msgid "Join community"
4631 -msgstr "Una comunidad" 4631 +msgstr "Unirse a la comunidad"
4632 4632
4633 #: app/views/blocks/profile_info_actions/community.rhtml:46 4633 #: app/views/blocks/profile_info_actions/community.rhtml:46
4634 msgid "Join this community" 4634 msgid "Join this community"
po/pt/noosfero.po
@@ -4431,11 +4431,11 @@ msgstr &quot;Sair da comunidade&quot; @@ -4431,11 +4431,11 @@ msgstr &quot;Sair da comunidade&quot;
4431 #: app/views/blocks/profile_info_actions/community.rhtml:23 4431 #: app/views/blocks/profile_info_actions/community.rhtml:23
4432 #: app/views/profile/_private_profile.rhtml:10 4432 #: app/views/profile/_private_profile.rhtml:10
4433 msgid "Join community" 4433 msgid "Join community"
4434 -msgstr "Entrar em comunidade" 4434 +msgstr "Entrar na comunidade"
4435 4435
4436 #: app/views/blocks/profile_info_actions/community.rhtml:46 4436 #: app/views/blocks/profile_info_actions/community.rhtml:46
4437 msgid "Join this community" 4437 msgid "Join this community"
4438 -msgstr "Entrar nessa comunidade" 4438 +msgstr "Entrar nesta comunidade"
4439 4439
4440 #: app/views/blocks/profile_info_actions/enterprise.rhtml:4 4440 #: app/views/blocks/profile_info_actions/enterprise.rhtml:4
4441 msgid "Add as favorite" 4441 msgid "Add as favorite"
test/functional/memberships_controller_test.rb
@@ -99,7 +99,7 @@ class MembershipsControllerTest &lt; Test::Unit::TestCase @@ -99,7 +99,7 @@ class MembershipsControllerTest &lt; Test::Unit::TestCase
99 community = Community.create!(:name => 'my test community', :description => 'description test') 99 community = Community.create!(:name => 'my test community', :description => 'description test')
100 community.add_member(profile) 100 community.add_member(profile)
101 get :index, :profile => profile.identifier 101 get :index, :profile => profile.identifier
102 - assert_tag :tag => 'a', :attributes => { :href => "/profile/#{community.identifier}/leave?reload=true" }, :content => 'Leave' 102 + assert_tag :tag => 'a', :attributes => { :href => "/profile/#{community.identifier}/leave?reload=true" }, :content => 'Leave community'
103 end 103 end
104 104
105 should 'current user is added as admin after create new community' do 105 should 'current user is added as admin after create new community' do
test/unit/application_helper_test.rb
@@ -546,7 +546,7 @@ class ApplicationHelperTest &lt; Test::Unit::TestCase @@ -546,7 +546,7 @@ class ApplicationHelperTest &lt; Test::Unit::TestCase
546 community.stubs(:url).returns('url for community') 546 community.stubs(:url).returns('url for community')
547 community.stubs(:public_profile_url).returns('url for community') 547 community.stubs(:public_profile_url).returns('url for community')
548 links = links_for_balloon(community) 548 links = links_for_balloon(community)
549 - assert_equal ['Wall', 'Members', 'Agenda', 'Join', 'Leave', 'Send an e-mail'], links.map{|i| i.keys.first} 549 + assert_equal ['Wall', 'Members', 'Agenda', 'Join', 'Leave community', 'Send an e-mail'], links.map{|i| i.keys.first}
550 end 550 end
551 551
552 should 'return ordered list of links to balloon to Enterprise' do 552 should 'return ordered list of links to balloon to Enterprise' do