Commit de6ebf564b6073e6345aa21fa763040a3b946501

Authored by Junior Silva
2 parents dc3912f8 fe738430

Merge branch 'stable' of https://gitlab.com/noosfero/noosfero into change-password

app/controllers/application_controller.rb
@@ -65,6 +65,7 @@ class ApplicationController < ActionController::Base @@ -65,6 +65,7 @@ class ApplicationController < ActionController::Base
65 FastGettext.default_locale = environment.default_locale 65 FastGettext.default_locale = environment.default_locale
66 FastGettext.locale = (params[:lang] || session[:lang] || environment.default_locale || request.env['HTTP_ACCEPT_LANGUAGE'] || 'en') 66 FastGettext.locale = (params[:lang] || session[:lang] || environment.default_locale || request.env['HTTP_ACCEPT_LANGUAGE'] || 'en')
67 I18n.locale = FastGettext.locale 67 I18n.locale = FastGettext.locale
  68 + I18n.default_locale = FastGettext.default_locale
68 if params[:lang] 69 if params[:lang]
69 session[:lang] = params[:lang] 70 session[:lang] = params[:lang]
70 end 71 end
app/controllers/public/events_controller.rb
@@ -21,7 +21,7 @@ class EventsController < PublicController @@ -21,7 +21,7 @@ class EventsController < PublicController
21 21
22 def events_by_day 22 def events_by_day
23 @date = build_date(params[:year], params[:month], params[:day]) 23 @date = build_date(params[:year], params[:month], params[:day])
24 - @events = profile.events.by_day(@date) 24 + @events = profile.events.by_day(@date).paginate(:per_page => per_page, :page => params[:page])
25 render :partial => 'events' 25 render :partial => 'events'
26 end 26 end
27 27
app/helpers/layout_helper.rb
@@ -86,7 +86,7 @@ module LayoutHelper @@ -86,7 +86,7 @@ module LayoutHelper
86 86
87 def addthis_javascript 87 def addthis_javascript
88 if NOOSFERO_CONF['addthis_enabled'] 88 if NOOSFERO_CONF['addthis_enabled']
89 - '<script src="http://s7.addthis.com/js/152/addthis_widget.js"></script>' 89 + '<script src="https://s7.addthis.com/js/152/addthis_widget.js"></script>'
90 end 90 end
91 end 91 end
92 92
app/models/community.rb
1 class Community < Organization 1 class Community < Organization
2 2
  3 + after_destroy :check_invite_member_for_destroy
  4 +
3 def self.type_name 5 def self.type_name
4 _('Community') 6 _('Community')
5 end 7 end
@@ -17,6 +19,10 @@ class Community &lt; Organization @@ -17,6 +19,10 @@ class Community &lt; Organization
17 community.moderated_articles = true if community.environment.enabled?('organizations_are_moderated_by_default') 19 community.moderated_articles = true if community.environment.enabled?('organizations_are_moderated_by_default')
18 end 20 end
19 21
  22 + def check_invite_member_for_destroy
  23 + InviteMember.pending.select { |task| task.community_id == self.id }.map(&:destroy)
  24 + end
  25 +
20 def self.create_after_moderation(requestor, attributes = {}) 26 def self.create_after_moderation(requestor, attributes = {})
21 community = Community.new(attributes) 27 community = Community.new(attributes)
22 if community.environment.enabled?('admin_must_approve_new_communities') 28 if community.environment.enabled?('admin_must_approve_new_communities')
app/models/enterprise.rb
@@ -96,14 +96,18 @@ class Enterprise &lt; Organization @@ -96,14 +96,18 @@ class Enterprise &lt; Organization
96 save 96 save
97 end 97 end
98 98
  99 + def activation_task
  100 + self.tasks.where(:type => 'EnterpriseActivation').first
  101 + end
  102 +
99 def enable(owner) 103 def enable(owner)
100 return if enabled 104 return if enabled
101 - affiliate(owner, Profile::Roles.all_roles(environment.id))  
102 - update_attribute(:enabled,true)  
103 - if environment.replace_enterprise_template_when_enable  
104 - apply_template(template)  
105 - end  
106 - save_without_validation! 105 + # must be set first for the following to work
  106 + self.enabled = true
  107 + self.affiliate owner, Profile::Roles.all_roles(self.environment.id) if owner
  108 + self.apply_template template if self.environment.replace_enterprise_template_when_enable
  109 + self.activation_task.update_attribute :status, Task::Status::FINISHED rescue nil
  110 + self.save_without_validation!
107 end 111 end
108 112
109 def question 113 def question
app/models/enterprise_activation.rb
1 class EnterpriseActivation < Task 1 class EnterpriseActivation < Task
2 2
3 - class RequestorRequired < Exception; end 3 + alias :person :requestor
  4 + alias :person= :requestor=
4 5
5 - settings_items :enterprise_id, :integer 6 + alias :enterprise :target
  7 + alias :enterprise= :target=
6 8
7 - validates_presence_of :enterprise_id  
8 -  
9 - def enterprise  
10 - Enterprise.find(enterprise_id)  
11 - end  
12 -  
13 - def enterprise=(ent)  
14 - self.enterprise_id = ent.id  
15 - end 9 + validates_presence_of :enterprise
16 10
17 def perform 11 def perform
18 - raise EnterpriseActivation::RequestorRequired if requestor.nil?  
19 - self.enterprise.enable(requestor) 12 + self.enterprise.enable self.requestor
20 end 13 end
21 14
22 def title 15 def title
@@ -28,15 +21,27 @@ class EnterpriseActivation &lt; Task @@ -28,15 +21,27 @@ class EnterpriseActivation &lt; Task
28 end 21 end
29 22
30 def information 23 def information
31 - {:message => _('%{requestor} wants to activate enterprise %{linked_subject}.')} 24 + if self.requestor
  25 + {:message => _('%{requestor} wants to activate enterprise %{linked_subject}.')}
  26 + else
  27 + {:message => _('Pending activation of enterprise %{linked_subject}.')}
  28 + end
32 end 29 end
33 30
34 def icon 31 def icon
35 - {:type => :profile_image, :profile => requestor, :url => requestor.url} 32 + if self.requestor
  33 + {:type => :profile_image, :profile => self.requestor, :url => self.requestor.url}
  34 + else
  35 + {:type => :profile_image, :profile => self.enterprise, :url => self.enterprise.url}
  36 + end
36 end 37 end
37 38
38 def target_notification_description 39 def target_notification_description
39 - _('%{requestor} wants to activate enterprise %{enterprise}.') % {:requestor => requestor.name, :enterprise => enterprise.name} 40 + if self.requestor
  41 + _('%{requestor} wants to activate enterprise %{enterprise}.') % {:requestor => self.requestor.name, :enterprise => self.enterprise.name}
  42 + else
  43 + _('Pending activation of enterprise %{enterprise}.') % {:enterprise => self.enterprise.name}
  44 + end
40 end 45 end
41 46
42 end 47 end
app/models/enterprise_homepage.rb
@@ -26,6 +26,11 @@ class EnterpriseHomepage &lt; Article @@ -26,6 +26,11 @@ class EnterpriseHomepage &lt; Article
26 end 26 end
27 end 27 end
28 28
  29 + # disable cache because of products
  30 + def cache_key params = {}, the_profile = nil, language = 'en'
  31 + rand
  32 + end
  33 +
29 def can_display_hits? 34 def can_display_hits?
30 false 35 false
31 end 36 end
app/models/environment.rb
@@ -337,19 +337,22 @@ class Environment &lt; ActiveRecord::Base @@ -337,19 +337,22 @@ class Environment &lt; ActiveRecord::Base
337 features.delete_if{ |k, v| !self.enabled?(k) } 337 features.delete_if{ |k, v| !self.enabled?(k) }
338 end 338 end
339 339
  340 + DEFAULT_FEATURES = %w(
  341 + disable_asset_products
  342 + disable_gender_icon
  343 + products_for_enterprises
  344 + disable_select_city_for_contact
  345 + enterprise_registration
  346 + media_panel
  347 + organizations_are_moderated_by_default
  348 + show_balloon_with_profile_links_when_clicked
  349 + show_zoom_button_on_article_images
  350 + use_portal_community
  351 + )
  352 +
340 before_create :enable_default_features 353 before_create :enable_default_features
341 def enable_default_features 354 def enable_default_features
342 - %w(  
343 - disable_asset_products  
344 - disable_gender_icon  
345 - products_for_enterprises  
346 - disable_select_city_for_contact  
347 - enterprise_registration  
348 - media_panel  
349 - organizations_are_moderated_by_default  
350 - show_balloon_with_profile_links_when_clicked  
351 - use_portal_community  
352 - ).each do |feature| 355 + DEFAULT_FEATURES.each do |feature|
353 enable(feature, false) 356 enable(feature, false)
354 end 357 end
355 end 358 end
app/views/box_organizer/_link_list_block.rhtml
1 <strong><%= _('Links') %></strong> 1 <strong><%= _('Links') %></strong>
2 -<div id='edit-link-list-block' style='width:450px'> 2 +<div id='edit-link-list-block'>
3 <table id='links' class='noborder'> 3 <table id='links' class='noborder'>
4 <tr><th><%= _('Icon') %></th><th><%= _('Name') %></th><th><%= _('Address') %></th><th><%= _('Target') %></th></tr> 4 <tr><th><%= _('Icon') %></th><th><%= _('Name') %></th><th><%= _('Address') %></th><th><%= _('Target') %></th></tr>
5 <% for link in @block.links do %> 5 <% for link in @block.links do %>
app/views/cms/_enterprise_homepage.rhtml
1 <%= render :file => 'shared/tiny_mce' %> 1 <%= render :file => 'shared/tiny_mce' %>
2 2
3 -<%= labelled_form_field(_('Text'), text_area(:article, 'body', :cols => 40, :style => 'width:99%')) %> 3 +<%= labelled_form_field(_('Text'), text_area(:article, 'body', :cols => 40, :style => 'width:99%', :class => 'mceEditor')) %>
4 4
app/views/content_viewer/view_page.rhtml
@@ -66,7 +66,7 @@ @@ -66,7 +66,7 @@
66 }; 66 };
67 addthis_options = '<%= escape_javascript( NOOSFERO_CONF['addthis_options'] ) %>'; 67 addthis_options = '<%= escape_javascript( NOOSFERO_CONF['addthis_options'] ) %>';
68 </script> 68 </script>
69 -<a href="http://www.addthis.com/bookmark.php" id="bt_addThis" target="_blank" onmouseover="return addthis_open(this, '', '[URL]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"><%= addthis_image_tag %></a> 69 +<a href="https://www.addthis.com/bookmark.php" id="bt_addThis" target="_blank" onmouseover="return addthis_open(this, '', '[URL]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"><%= addthis_image_tag %></a>
70 </div> 70 </div>
71 <% end %> 71 <% end %>
72 72
app/views/manage_products/_display_inputs.rhtml
@@ -20,7 +20,7 @@ @@ -20,7 +20,7 @@
20 20
21 <div id='display-product-inputs'> 21 <div id='display-product-inputs'>
22 <ul class='input-list'> 22 <ul class='input-list'>
23 - <%= render :partial => 'input', :collection => @inputs %> 23 + <%= render :partial => 'manage_products/input', :collection => @inputs %>
24 </ul> 24 </ul>
25 <%= edit_link(_('Order inputs'), {:action => 'order_inputs', :id => @product.id}, :class => "order-inputs", :style => 'display:none') %> 25 <%= edit_link(_('Order inputs'), {:action => 'order_inputs', :id => @product.id}, :class => "order-inputs", :style => 'display:none') %>
26 </div> 26 </div>
app/views/manage_products/_input.rhtml
1 <li class='input-item' id="input-<%= input.id %>"> 1 <li class='input-item' id="input-<%= input.id %>">
2 -<%= render :partial => 'display_input', :locals =>{:input => input} %> 2 +<%= render :partial => 'manage_products/display_input', :locals =>{:input => input} %>
3 </li> 3 </li>
app/views/manage_products/_manage_product_details.rhtml
1 <div id='price-composition-bar'> 1 <div id='price-composition-bar'>
2 - <%= render :partial => 'price_composition_bar' %> 2 + <%= render :partial => 'manage_products/price_composition_bar' %>
3 </div> 3 </div>
4 4
5 <% form_tag({:action => 'manage_product_details'}, :method => 'post', :id => 'manage-product-details-form') do %> 5 <% form_tag({:action => 'manage_product_details'}, :method => 'post', :id => 'manage-product-details-form') do %>
@@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
14 <small><%= _('This value is composed by the total value of registered inputs') %></small> 14 <small><%= _('This value is composed by the total value of registered inputs') %></small>
15 </td> 15 </td>
16 </tr> 16 </tr>
17 - <%= render :partial => 'edit_price_details', :locals => {:price_details => @product.price_details} %> 17 + <%= render :partial => 'manage_products/edit_price_details', :locals => {:price_details => @product.price_details} %>
18 </table> 18 </table>
19 </div> 19 </div>
20 20
app/views/manage_products/edit.rhtml
1 <h2> <%= _('Editing') %> <%= @product.name %> </h2> 1 <h2> <%= _('Editing') %> <%= @product.name %> </h2>
2 2
3 -<%= render :partial => 'form', :locals => {:mode => 'edit'} %> 3 +<%= render :partial => 'manage_products/form', :locals => {:mode => 'edit'} %>
app/views/profile_editor/index.rhtml
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 <span class='control-panel-sep'>&#150;</span> 5 <span class='control-panel-sep'>&#150;</span>
6 <span class='control-panel-subtitle'><%= _('Control Panel') %></span> 6 <span class='control-panel-subtitle'><%= _('Control Panel') %></span>
7 </h1> 7 </h1>
8 - 8 +
9 <%= render :partial => 'pending_tasks' %> 9 <%= render :partial => 'pending_tasks' %>
10 10
11 <% control_panel do %> 11 <% control_panel do %>
@@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
23 <%= control_panel_button(_('Edit sideboxes'), 'blocks', :controller => 'profile_design', :action => 'index') %> 23 <%= control_panel_button(_('Edit sideboxes'), 'blocks', :controller => 'profile_design', :action => 'index') %>
24 24
25 <%= control_panel_button(_('Edit Appearance'), 'design-editor', :controller => 'themes', :action => 'index') %> 25 <%= control_panel_button(_('Edit Appearance'), 'design-editor', :controller => 'themes', :action => 'index') %>
26 - 26 +
27 <%= control_panel_button(_('Edit Header and Footer'), 'header-and-footer', :controller => 'profile_editor', :action => 'header_footer') unless profile.enterprise? && environment.enabled?('disable_header_and_footer') && !user.is_admin?(environment) %> 27 <%= control_panel_button(_('Edit Header and Footer'), 'header-and-footer', :controller => 'profile_editor', :action => 'header_footer') unless profile.enterprise? && environment.enabled?('disable_header_and_footer') && !user.is_admin?(environment) %>
28 28
29 <%= control_panel_button(_('Manage Content'), 'cms', :controller => 'cms') %> 29 <%= control_panel_button(_('Manage Content'), 'cms', :controller => 'cms') %>
@@ -45,7 +45,7 @@ @@ -45,7 +45,7 @@
45 45
46 <%= control_panel_button(_('Manage Members'), 'members', :controller => 'profile_members') if profile.organization? && user.has_permission?(:manage_memberships, profile) %> 46 <%= control_panel_button(_('Manage Members'), 'members', :controller => 'profile_members') if profile.organization? && user.has_permission?(:manage_memberships, profile) %>
47 47
48 - <%= control_panel_button(_('Manage Products and Services'), 'products', :controller => 'manage_products') if profile.enterprise? && environment.enabled?('products_for_enterprises') %> 48 + <%= control_panel_button(_('Manage Products/Services'), 'products', :controller => 'manage_products') if profile.enterprise? && environment.enabled?('products_for_enterprises') %>
49 49
50 <% if !environment.enabled?('disable_asset_enterprises') %> 50 <% if !environment.enabled?('disable_asset_enterprises') %>
51 <% if profile.is_validation_entity? %> 51 <% if profile.is_validation_entity? %>
config/initializers/i18n.rb 0 → 100644
@@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@
  1 +# necessary for I18n.default_locale to work
  2 +require 'i18n/backend/fallbacks'
  3 +I18n.backend.class.send :include, I18n::Backend::Fallbacks
  4 +
db/migrate/20140318225328_set_target_for_enterprise_activation.rb 0 → 100644
@@ -0,0 +1,13 @@ @@ -0,0 +1,13 @@
  1 +class SetTargetForEnterpriseActivation < ActiveRecord::Migration
  2 + def self.up
  3 + EnterpriseActivation.find_each do |enterprise_activation|
  4 + enterprise_activation.target = enterprise_activation.enterprise
  5 + enterprise_activation.data.delete :enterprise_id
  6 + enterprise_activation.save
  7 + end
  8 + end
  9 +
  10 + def self.down
  11 + say "this migration can't be reverted"
  12 + end
  13 +end
db/migrate/20140318233831_finish_enterprise_activation_for_enabled_enterprises.rb 0 → 100644
@@ -0,0 +1,13 @@ @@ -0,0 +1,13 @@
  1 +class FinishEnterpriseActivationForEnabledEnterprises < ActiveRecord::Migration
  2 + def self.up
  3 + EnterpriseActivation.find_each do |enterprise_activation|
  4 + enterprise = enterprise_activation.enterprise
  5 + next unless enterprise.enabled
  6 + enterprise_activation.update_attribute :status, Task::Status::FINISHED
  7 + end
  8 + end
  9 +
  10 + def self.down
  11 + say "this migration can't be reverted"
  12 + end
  13 +end
db/migrate/20140408172149_enable_show_zoom_button_on_article_images.rb 0 → 100644
@@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
  1 +class EnableShowZoomButtonOnArticleImages < ActiveRecord::Migration
  2 + def self.up
  3 + Environment.find_each do |environment|
  4 + environment.enable(:show_zoom_button_on_article_images)
  5 + end
  6 + end
  7 +
  8 + def self.down
  9 + say("This migration is irreversible.")
  10 + end
  11 +end
features/manage_products.feature
@@ -14,7 +14,7 @@ Feature: manage products @@ -14,7 +14,7 @@ Feature: manage products
14 Scenario: display "create new product" button 14 Scenario: display "create new product" button
15 Given I am logged in as "joaosilva" 15 Given I am logged in as "joaosilva"
16 And I am on redemoinho's control panel 16 And I am on redemoinho's control panel
17 - When I follow "Manage Products and Services" 17 + When I follow "Manage Products/Services"
18 Then I should see "New product or service" 18 Then I should see "New product or service"
19 19
20 Scenario: paginate public listing products and services 20 Scenario: paginate public listing products and services
@@ -53,13 +53,13 @@ Feature: manage products @@ -53,13 +53,13 @@ Feature: manage products
53 Scenario: listing products and services 53 Scenario: listing products and services
54 Given I am logged in as "joaosilva" 54 Given I am logged in as "joaosilva"
55 And I am on redemoinho's control panel 55 And I am on redemoinho's control panel
56 - And I follow "Manage Products and Services" 56 + And I follow "Manage Products/Services"
57 Then I should see "Listing products and services" 57 Then I should see "Listing products and services"
58 58
59 Scenario: see button to back in categories hierarchy 59 Scenario: see button to back in categories hierarchy
60 Given I am logged in as "joaosilva" 60 Given I am logged in as "joaosilva"
61 And I am on redemoinho's control panel 61 And I am on redemoinho's control panel
62 - And I follow "Manage Products and Services" 62 + And I follow "Manage Products/Services"
63 When I follow "New product or service" 63 When I follow "New product or service"
64 Then I should see "Back to the product listing" link 64 Then I should see "Back to the product listing" link
65 65
plugins/bsc/features/bsc.feature
@@ -67,7 +67,7 @@ Feature: bsc @@ -67,7 +67,7 @@ Feature: bsc
67 And feature "disable_products_for_enterprises" is disabled on environment 67 And feature "disable_products_for_enterprises" is disabled on environment
68 And I am logged in as "pedro-silva" 68 And I am logged in as "pedro-silva"
69 And I am on Bsc Test's control panel 69 And I am on Bsc Test's control panel
70 - When I follow "Manage Products and Services" 70 + When I follow "Manage Products/Services"
71 Then I should not see "New product or service" 71 Then I should not see "New product or service"
72 72
73 Scenario: display bsc's enterprises' products name on the bsc catalog 73 Scenario: display bsc's enterprises' products name on the bsc catalog
po/de/noosfero.po
@@ -6663,7 +6663,7 @@ msgid &quot;Manage Members&quot; @@ -6663,7 +6663,7 @@ msgid &quot;Manage Members&quot;
6663 msgstr "Mitglieder verwalten" 6663 msgstr "Mitglieder verwalten"
6664 6664
6665 #: app/views/profile_editor/index.rhtml:48 6665 #: app/views/profile_editor/index.rhtml:48
6666 -msgid "Manage Products and Services" 6666 +msgid "Manage Products/Services"
6667 msgstr "Produkte und Services verwalten" 6667 msgstr "Produkte und Services verwalten"
6668 6668
6669 #: app/views/profile_editor/index.rhtml:52 6669 #: app/views/profile_editor/index.rhtml:52
po/eo/noosfero.po
@@ -6406,7 +6406,7 @@ msgid &quot;Manage Members&quot; @@ -6406,7 +6406,7 @@ msgid &quot;Manage Members&quot;
6406 msgstr "" 6406 msgstr ""
6407 6407
6408 #: app/views/profile_editor/index.rhtml:48 6408 #: app/views/profile_editor/index.rhtml:48
6409 -msgid "Manage Products and Services" 6409 +msgid "Manage Products/Services"
6410 msgstr "" 6410 msgstr ""
6411 6411
6412 #: app/views/profile_editor/index.rhtml:52 6412 #: app/views/profile_editor/index.rhtml:52
po/es/noosfero.po
@@ -6730,7 +6730,7 @@ msgid &quot;Manage Members&quot; @@ -6730,7 +6730,7 @@ msgid &quot;Manage Members&quot;
6730 msgstr "Administrar miembros" 6730 msgstr "Administrar miembros"
6731 6731
6732 #: app/views/profile_editor/index.rhtml:48 6732 #: app/views/profile_editor/index.rhtml:48
6733 -msgid "Manage Products and Services" 6733 +msgid "Manage Products/Services"
6734 msgstr "Administrar productos y servicios" 6734 msgstr "Administrar productos y servicios"
6735 6735
6736 #: app/views/profile_editor/index.rhtml:52 6736 #: app/views/profile_editor/index.rhtml:52
po/fr/noosfero.po
@@ -7054,7 +7054,7 @@ msgid &quot;Manage Members&quot; @@ -7054,7 +7054,7 @@ msgid &quot;Manage Members&quot;
7054 msgstr "Gérer les membres" 7054 msgstr "Gérer les membres"
7055 7055
7056 #: app/views/profile_editor/index.rhtml:48 7056 #: app/views/profile_editor/index.rhtml:48
7057 -msgid "Manage Products and Services" 7057 +msgid "Manage Products/Services"
7058 msgstr "Gérer les produits et services" 7058 msgstr "Gérer les produits et services"
7059 7059
7060 #: app/views/profile_editor/index.rhtml:52 7060 #: app/views/profile_editor/index.rhtml:52
po/hy/noosfero.po
@@ -6911,7 +6911,7 @@ msgid &quot;Manage Members&quot; @@ -6911,7 +6911,7 @@ msgid &quot;Manage Members&quot;
6911 msgstr "Կառավարել անդամներին" 6911 msgstr "Կառավարել անդամներին"
6912 6912
6913 #: app/views/profile_editor/index.rhtml:48 6913 #: app/views/profile_editor/index.rhtml:48
6914 -msgid "Manage Products and Services" 6914 +msgid "Manage Products/Services"
6915 msgstr "Կառավարել արտադրանքն ու ծառայությունները" 6915 msgstr "Կառավարել արտադրանքն ու ծառայությունները"
6916 6916
6917 #: app/views/profile_editor/index.rhtml:52 6917 #: app/views/profile_editor/index.rhtml:52
po/it/noosfero.po
@@ -6386,7 +6386,7 @@ msgid &quot;Manage Members&quot; @@ -6386,7 +6386,7 @@ msgid &quot;Manage Members&quot;
6386 msgstr "" 6386 msgstr ""
6387 6387
6388 #: app/views/profile_editor/index.rhtml:48 6388 #: app/views/profile_editor/index.rhtml:48
6389 -msgid "Manage Products and Services" 6389 +msgid "Manage Products/Services"
6390 msgstr "" 6390 msgstr ""
6391 6391
6392 #: app/views/profile_editor/index.rhtml:52 6392 #: app/views/profile_editor/index.rhtml:52
po/noosfero.pot
@@ -6386,7 +6386,7 @@ msgid &quot;Manage Members&quot; @@ -6386,7 +6386,7 @@ msgid &quot;Manage Members&quot;
6386 msgstr "" 6386 msgstr ""
6387 6387
6388 #: app/views/profile_editor/index.rhtml:48 6388 #: app/views/profile_editor/index.rhtml:48
6389 -msgid "Manage Products and Services" 6389 +msgid "Manage Products/Services"
6390 msgstr "" 6390 msgstr ""
6391 6391
6392 #: app/views/profile_editor/index.rhtml:52 6392 #: app/views/profile_editor/index.rhtml:52
po/pt/noosfero.po
@@ -2815,6 +2815,14 @@ msgstr &quot;%{requestor} quer ativar o empreendimento %{linked_subject}.&quot; @@ -2815,6 +2815,14 @@ msgstr &quot;%{requestor} quer ativar o empreendimento %{linked_subject}.&quot;
2815 msgid "%{requestor} wants to activate enterprise %{enterprise}." 2815 msgid "%{requestor} wants to activate enterprise %{enterprise}."
2816 msgstr "%{requestor} quer ativar o empreendimento %{enterprise}." 2816 msgstr "%{requestor} quer ativar o empreendimento %{enterprise}."
2817 2817
  2818 +#: app/models/enterprise_activation.rb:31
  2819 +msgid "Pending activation of enterprise %{linked_subject}."
  2820 +msgstr "Ativação pendente para o empreendimento %{linked_subject}."
  2821 +
  2822 +#: app/models/enterprise_activation.rb:39
  2823 +msgid "Pending activation of enterprise %{enterprise}."
  2824 +msgstr "Ativação pendente para o empreendimento %{enterprise}."
  2825 +
2818 #: app/models/contact.rb:- app/views/friends/index.rhtml:33 2826 #: app/models/contact.rb:- app/views/friends/index.rhtml:33
2819 #: app/views/friends/index.rhtml:36 2827 #: app/views/friends/index.rhtml:36
2820 msgid "contact" 2828 msgid "contact"
@@ -6573,8 +6581,8 @@ msgid &quot;Manage Members&quot; @@ -6573,8 +6581,8 @@ msgid &quot;Manage Members&quot;
6573 msgstr "Gerenciar Integrantes" 6581 msgstr "Gerenciar Integrantes"
6574 6582
6575 #: app/views/profile_editor/index.rhtml:48 6583 #: app/views/profile_editor/index.rhtml:48
6576 -msgid "Manage Products and Services"  
6577 -msgstr "Gerenciar Produtos e Serviços" 6584 +msgid "Manage Products/Services"
  6585 +msgstr "Gerenciar Produtos/Serviços"
6578 6586
6579 #: app/views/profile_editor/index.rhtml:52 6587 #: app/views/profile_editor/index.rhtml:52
6580 msgid "Enterprise Validation" 6588 msgid "Enterprise Validation"
test/functional/events_controller_test.rb
@@ -46,4 +46,12 @@ class EventsControllerTest &lt; ActionController::TestCase @@ -46,4 +46,12 @@ class EventsControllerTest &lt; ActionController::TestCase
46 assert_equal 20, assigns(:events).count 46 assert_equal 20, assigns(:events).count
47 end 47 end
48 48
  49 + should 'show events of specific day' do
  50 + profile.events << Event.new(:name => 'Joao Birthday', :start_date => Date.new(2009, 10, 28))
  51 +
  52 + get :events_by_day, :profile => profile.identifier, :year => 2009, :month => 10, :day => 28
  53 +
  54 + assert_tag :tag => 'a', :content => /Joao Birthday/
  55 + end
  56 +
49 end 57 end
test/unit/enterprise_activation_test.rb
@@ -9,24 +9,24 @@ class EnterpriseActivationTest &lt; ActiveSupport::TestCase @@ -9,24 +9,24 @@ class EnterpriseActivationTest &lt; ActiveSupport::TestCase
9 end 9 end
10 10
11 should 'keep enterprise_id' do 11 should 'keep enterprise_id' do
12 - assert_nil EnterpriseActivation.new.enterprise_id 12 + assert_nil EnterpriseActivation.new.target_id
13 end 13 end
14 14
15 should 'have an enteprise through enterprise_id' do 15 should 'have an enteprise through enterprise_id' do
16 ent = Enterprise.create!(:name => 'my enterprise', :identifier => 'myent') 16 ent = Enterprise.create!(:name => 'my enterprise', :identifier => 'myent')
17 17
18 - assert_equal ent, EnterpriseActivation.new(:enterprise_id => ent.id).enterprise 18 + assert_equal ent, EnterpriseActivation.new(:target => ent).enterprise
19 end 19 end
20 20
21 should 'require an enterprise' do 21 should 'require an enterprise' do
22 t = EnterpriseActivation.new 22 t = EnterpriseActivation.new
23 t.valid? 23 t.valid?
24 - assert t.errors.invalid?(:enterprise_id), "enterprise must be required" 24 + assert t.errors.invalid?(:enterprise), "enterprise must be required"
25 25
26 ent = Enterprise.create!(:name => 'my enterprise', :identifier => 'myent') 26 ent = Enterprise.create!(:name => 'my enterprise', :identifier => 'myent')
27 t.enterprise = ent 27 t.enterprise = ent
28 t.valid? 28 t.valid?
29 - assert !t.errors.invalid?(:enterprise_id), "must validate after enterprise is set" 29 + assert !t.errors.invalid?(:target_id), "must validate after enterprise is set"
30 end 30 end
31 31
32 should 'activate enterprise when finished' do 32 should 'activate enterprise when finished' do
@@ -40,15 +40,6 @@ class EnterpriseActivationTest &lt; ActiveSupport::TestCase @@ -40,15 +40,6 @@ class EnterpriseActivationTest &lt; ActiveSupport::TestCase
40 assert ent.enabled, "finishing task should left enterprise enabled" 40 assert ent.enabled, "finishing task should left enterprise enabled"
41 end 41 end
42 42
43 - should 'require requestor to finish' do  
44 - ent = Enterprise.create!(:name => 'my enterprise', :identifier => 'myent', :enabled => false)  
45 - t = EnterpriseActivation.create!(:enterprise => ent)  
46 -  
47 - assert_raise EnterpriseActivation::RequestorRequired do  
48 - t.finish  
49 - end  
50 - end  
51 -  
52 should 'put requestor as enterprise owner when finishing' do 43 should 'put requestor as enterprise owner when finishing' do
53 ent = Enterprise.create!(:name => 'my enterprise', :identifier => 'myent', :enabled => false) 44 ent = Enterprise.create!(:name => 'my enterprise', :identifier => 'myent', :enabled => false)
54 t = EnterpriseActivation.create!(:enterprise => ent) 45 t = EnterpriseActivation.create!(:enterprise => ent)
test/unit/environment_test.rb
@@ -53,6 +53,13 @@ class EnvironmentTest &lt; ActiveSupport::TestCase @@ -53,6 +53,13 @@ class EnvironmentTest &lt; ActiveSupport::TestCase
53 assert !v.enabled?('feature1') && !v.enabled?('feature2') && !v.enabled?('feature3') 53 assert !v.enabled?('feature1') && !v.enabled?('feature2') && !v.enabled?('feature3')
54 end 54 end
55 55
  56 + def test_default_enabled_features_are_enabled
  57 + environment = Environment.create(:name => 'Testing')
  58 + Environment::DEFAULT_FEATURES.each do |features|
  59 + assert environment.enabled?(features)
  60 + end
  61 + end
  62 +
56 def test_name_is_mandatory 63 def test_name_is_mandatory
57 v = Environment.new 64 v = Environment.new
58 v.valid? 65 v.valid?
test/unit/invite_member_test.rb
@@ -115,5 +115,19 @@ class InviteMemberTest &lt; ActiveSupport::TestCase @@ -115,5 +115,19 @@ class InviteMemberTest &lt; ActiveSupport::TestCase
115 assert_match(/#{task.requestor.name} invited you to join #{community.name}/, email.subject) 115 assert_match(/#{task.requestor.name} invited you to join #{community.name}/, email.subject)
116 end 116 end
117 117
  118 + should 'destroy InviteMember task when the community is destroyed' do
  119 + p1 = create_user('testuser1').person
  120 + p2 = create_user('testuser2').person
  121 + p3 = create_user('testuser3').person
  122 + community = fast_create(Community)
  123 +
  124 + t1 = InviteMember.create!(:person => p1, :friend => p2, :community_id => community.id)
  125 + t2 = InviteMember.create!(:person => p1, :friend => p3, :community_id => community.id)
  126 + community.destroy
  127 +
  128 + assert_raise ActiveRecord::RecordNotFound do; t1.reload; end
  129 + assert_raise ActiveRecord::RecordNotFound do; t2.reload; end
  130 + end
  131 +
118 end 132 end
119 133