Commit ee205bd5dcc835f90a8a673a542245e10245fec7

Authored by Victor Costa
2 parents 9168ef76 1a36a52c

Merge branch 'rails3' into rails3_stable

Conflicts:
	app/models/environment.rb
app/controllers/admin/admin_panel_controller.rb
... ... @@ -7,6 +7,7 @@ class AdminPanelController < AdminController
7 7 end
8 8  
9 9 def site_info
  10 + @no_design_blocks = true
10 11 if request.post?
11 12 if params[:environment][:languages]
12 13 params[:environment][:languages] = params[:environment][:languages].map {|lang, value| lang if value=='true'}.compact
... ...
app/controllers/public/account_controller.rb
... ... @@ -17,6 +17,8 @@ class AccountController < ApplicationController
17 17 @user = User.find_by_activation_code(params[:activation_code]) if params[:activation_code]
18 18 if @user and @user.activate
19 19 @message = _("Your account has been activated, now you can log in!")
  20 + check_redirection
  21 + session[:join] = params[:join] unless params[:join].blank?
20 22 render :action => 'login', :userlogin => @user.login
21 23 else
22 24 session[:notice] = _("It looks like you're trying to activate an account. Perhaps have already activated this account?")
... ... @@ -35,6 +37,7 @@ class AccountController < ApplicationController
35 37 self.current_user ||= User.authenticate(params[:user][:login], params[:user][:password], environment) if params[:user]
36 38  
37 39 if logged_in?
  40 + check_join_in_community(self.current_user)
38 41 if params[:remember_me] == "1"
39 42 self.current_user.remember_me
40 43 cookies[:auth_token] = { :value => self.current_user.remember_token , :expires => self.current_user.remember_token_expires_at }
... ... @@ -91,6 +94,7 @@ class AccountController < ApplicationController
91 94 if session[:may_be_a_bot]
92 95 return false unless verify_recaptcha :model=>@user, :message=>_('Captcha (the human test)')
93 96 end
  97 + @user.community_to_join = session[:join]
94 98 @user.signup!
95 99 owner_role = Role.find_by_name('owner')
96 100 @user.person.affiliate(@user.person, [owner_role]) if owner_role
... ... @@ -101,6 +105,7 @@ class AccountController < ApplicationController
101 105 end
102 106 if @user.activated?
103 107 self.current_user = @user
  108 + check_join_in_community(@user)
104 109 go_to_signup_initial_page
105 110 else
106 111 @register_pending = true
... ... @@ -388,12 +393,6 @@ class AccountController < ApplicationController
388 393 end
389 394  
390 395 def go_to_initial_page
391   - if params[:redirection]
392   - session[:return_to] = @user.return_to
393   - @user.return_to = nil
394   - @user.save
395   - end
396   -
397 396 if params[:return_to]
398 397 redirect_to params[:return_to]
399 398 elsif environment.enabled?('allow_change_of_redirection_after_login')
... ... @@ -444,4 +443,19 @@ class AccountController < ApplicationController
444 443 redirect_back_or_default(default)
445 444 end
446 445 end
  446 +
  447 + def check_redirection
  448 + unless params[:redirection].blank?
  449 + session[:return_to] = @user.return_to
  450 + @user.update_attributes(:return_to => nil)
  451 + end
  452 + end
  453 +
  454 + def check_join_in_community(user)
  455 + profile_to_join = session[:join]
  456 + unless profile_to_join.blank?
  457 + environment.profiles.find_by_identifier(profile_to_join).add_member(user.person)
  458 + session.delete(:join)
  459 + end
  460 + end
447 461 end
... ...
app/controllers/public/profile_controller.rb
... ... @@ -3,7 +3,7 @@ class ProfileController < PublicController
3 3 needs_profile
4 4 before_filter :check_access_to_profile, :except => [:join, :join_not_logged, :index, :add]
5 5 before_filter :store_location, :only => [:join, :join_not_logged, :report_abuse, :send_mail]
6   - before_filter :login_required, :only => [:add, :join, :join_not_logged, :leave, :unblock, :leave_scrap, :remove_scrap, :remove_activity, :view_more_activities, :view_more_network_activities, :report_abuse, :register_report, :leave_comment_on_activity, :send_mail]
  6 + before_filter :login_required, :only => [:add, :join, :leave, :unblock, :leave_scrap, :remove_scrap, :remove_activity, :view_more_activities, :view_more_network_activities, :report_abuse, :register_report, :leave_comment_on_activity, :send_mail]
7 7  
8 8 helper TagsHelper
9 9  
... ... @@ -97,21 +97,12 @@ class ProfileController < PublicController
97 97 end
98 98  
99 99 def join_not_logged
100   - if request.post?
101   - profile.add_member(user)
102   - session[:notice] = _('%s administrator still needs to accept you as member.') % profile.name if profile.closed?
103   - redirect_to_previous_location
  100 + session[:join] = profile.identifier
  101 +
  102 + if user
  103 + redirect_to :controller => 'profile', :action => 'join'
104 104 else
105   - if user.memberships.include?(profile)
106   - session[:notice] = _('You are already a member of %s.') % profile.name
107   - redirect_to profile.url
108   - return
109   - end
110   - if request.xhr?
111   - render :layout => false
112   - else
113   - redirect_to profile.url
114   - end
  105 + redirect_to :controller => '/account', :action => 'login'
115 106 end
116 107 end
117 108  
... ...
app/models/categories_block.rb
... ... @@ -8,6 +8,8 @@ class CategoriesBlock < Block
8 8  
9 9 settings_items :category_types, :type => Array, :default => []
10 10  
  11 + attr_accessible :category_types
  12 +
11 13 def self.description
12 14 _("Categories Menu")
13 15 end
... ...
app/models/environment.rb
... ... @@ -3,7 +3,7 @@
3 3 # domains.
4 4 class Environment < ActiveRecord::Base
5 5  
6   - attr_accessible :name, :is_default, :signup_welcome_text_subject, :signup_welcome_text_body, :terms_of_use, :message_for_disabled_enterprise, :news_amount_by_folder, :default_language, :languages, :description, :organization_approval_method, :enabled_plugins, :enabled_features, :enabled_blocks, :redirection_after_login, :redirection_after_signup, :contact_email, :theme, :reports_lower_bound
  6 + attr_accessible :name, :is_default, :signup_welcome_text_subject, :signup_welcome_text_body, :terms_of_use, :message_for_disabled_enterprise, :news_amount_by_folder, :default_language, :languages, :description, :organization_approval_method, :enabled_plugins, :enabled_features, :enabled_blocks, :redirection_after_login, :redirection_after_signup, :contact_email, :theme, :reports_lower_bound, :noreply_email, :signup_welcome_screen_body
7 7  
8 8 has_many :users
9 9  
... ... @@ -300,6 +300,12 @@ class Environment &lt; ActiveRecord::Base
300 300 settings_items :access_control_allow_origin, :type => Array, :default => []
301 301 settings_items :access_control_allow_methods, :type => String
302 302  
  303 + settings_items :signup_welcome_screen_body, :type => String
  304 +
  305 + def has_custom_welcome_screen?
  306 + settings[:signup_welcome_screen_body].present?
  307 + end
  308 +
303 309 def news_amount_by_folder=(amount)
304 310 settings[:news_amount_by_folder] = amount.to_i
305 311 end
... ...
app/models/user.rb
... ... @@ -64,6 +64,9 @@ class User &lt; ActiveRecord::Base
64 64 self.person.preferred_domain && self.person.preferred_domain.name || self.environment.default_hostname(true)
65 65 end
66 66  
  67 + # virtual attribute used to stash which community to join on signup or login
  68 + attr_accessor :community_to_join
  69 +
67 70 class Mailer < ActionMailer::Base
68 71 def activation_email_notify(user)
69 72 user_email = "#{user.login}@#{user.email_domain}"
... ... @@ -86,7 +89,8 @@ class User &lt; ActiveRecord::Base
86 89 :activation_code => user.activation_code,
87 90 :environment => user.environment.name,
88 91 :url => user.environment.top_url,
89   - :redirection => (true if user.return_to)
  92 + :redirection => (true if user.return_to),
  93 + :join => (user.community_to_join if user.community_to_join)
90 94 end
91 95  
92 96 def signup_welcome_email(user)
... ...
app/views/account/signup.html.erb
1 1 <% if @register_pending %>
2   -<div id='thanks-for-signing'>
3   - <h1><%= _("Welcome to %s!") % environment.name %></h1>
4   - <h3><%= _("Thanks for signing up, we're thrilled to have you on our social network!") %></h3>
5   - <p><%= _("Firstly, some tips for getting started:") %></p>
6   - <h4><%= _("Confirm your account!") %></h4>
7   - <p><%= _("You should receive a welcome email from us shortly. Please take a second to follow the link within to confirm your account.") %></p>
8   - <p><%= _("You won't appear as %s until your account is confirmed.") % link_to(_('user'), {:controller => :search, :action => :people, :filter => 'more_recent'}, :target => '_blank') %></p>
9   - <h4><%= _("What to do next?") %></h4>
10   - <p><%= _("%s. Upload an avatar and let your friends find you easily :)") % link_to(_('Customize your profile'), {:controller => 'doc', :section => 'user', :topic => 'editing-person-info'}, :target => '_blank') %></p>
11   - <p><%= _("Learn the guidelines. Read the %s for more details on how to use this social network!") % link_to(_('Documentation'), {:controller => 'doc'}, :target => '_blank') %></p>
12   - <p><%= _("%s your Gmail, Yahoo and Hotmail contacts!") % link_to(_('Invite and find'), {:controller => 'doc', :section => 'user', :topic => 'invite-contacts'}, :target => '_blank') %></p>
13   - <p><%= _("Start exploring and have fun!") %></p>
14   -</div>
  2 + <div id='thanks-for-signing'>
  3 + <% if environment.has_custom_welcome_screen? %>
  4 + <%= environment.settings[:signup_welcome_screen_body].html_safe %>
  5 + <% else %>
  6 + <h1><%= _("Welcome to %s!") % environment.name %></h1>
  7 + <h3><%= _("Thanks for signing up, we're thrilled to have you on our social network!") %></h3>
  8 + <p><%= _("Firstly, some tips for getting started:") %></p>
  9 + <h4><%= _("Confirm your account!") %></h4>
  10 + <p><%= _("You should receive a welcome email from us shortly. Please take a second to follow the link within to confirm your account.") %></p>
  11 + <p><%= _("You won't appear as %s until your account is confirmed.") % link_to(_('user'), {:controller => :search, :action => :people, :filter => 'more_recent'}, :target => '_blank') %></p>
  12 + <h4><%= _("What to do next?") %></h4>
  13 + <p><%= _("%s. Upload an avatar and let your friends find you easily :)") % link_to(_('Customize your profile'), {:controller => 'doc', :section => 'user', :topic => 'editing-person-info'}, :target => '_blank') %></p>
  14 + <p><%= _("Learn the guidelines. Read the %s for more details on how to use this social network!") % link_to(_('Documentation'), {:controller => 'doc'}, :target => '_blank') %></p>
  15 + <p><%= _("%s your Gmail, Yahoo and Hotmail contacts!") % link_to(_('Invite and find'), {:controller => 'doc', :section => 'user', :topic => 'invite-contacts'}, :target => '_blank') %></p>
  16 + <p><%= _("Start exploring and have fun!") %></p>
  17 + <% end %>
  18 + </div>
15 19 <% else %>
16 20 <h1><%= _('Sign up for %s!') % environment.name %></h1>
17 21 <%= render :partial => 'signup_form' %>
... ...
app/views/admin_panel/_signup_welcome_screen.html.erb 0 → 100644
... ... @@ -0,0 +1,5 @@
  1 +<div class='description'>
  2 + <%= _('This text will be showed as a welcome message to users after signup') %><br/><br/>
  3 +</div>
  4 +
  5 +<%= labelled_form_field(_('Body'), text_area(:environment, :signup_welcome_screen_body, :cols => 40, :style => 'width: 100%', :class => 'mceEditor')) %>
... ...
app/views/admin_panel/site_info.html.erb
... ... @@ -12,6 +12,8 @@
12 12 :content => (render :partial => 'terms_of_use', :locals => {:f => f})} %>
13 13 <% tabs << {:title => _('Signup welcome text'), :id => 'signup-welcome-text',
14 14 :content => (render :partial => 'signup_welcome_text', :locals => {:f => f})} %>
  15 + <% tabs << {:title => _('Signup welcome message'), :id => 'signup-welcome-message',
  16 + :content => (render :partial => 'signup_welcome_screen', :locals => {:f => f}) }%>
15 17 <%= render_tabs(tabs) %>
16 18 <% button_bar do %>
17 19 <%= submit_button(:save, _('Save'), :cancel => {:action => 'index'}) %>
... ...
app/views/content_viewer/_article_toolbar.html.erb
... ... @@ -10,7 +10,7 @@
10 10  
11 11 <% if @page != profile.home_page && !@page.has_posts? && @page.allow_delete?(user) && !remove_content_button(:delete)%>
12 12 <% content = content_tag( 'span', _('Delete') ) %>
13   - <% url = profile.admin_url.merge({ :controller => 'cms', :action => 'destroy', :id => @page}) %>
  13 + <% url = profile.admin_url.merge({ :controller => 'cms', :action => 'destroy', :id => @page.id}) %>
14 14 <% options = {:method => :post, :confirm => delete_article_message(@page)} %>
15 15 <%= expirable_button @page, :delete, content, url, options %>
16 16 <% end %>
... ... @@ -19,9 +19,9 @@
19 19 <% content = content_tag( 'span', _('Spread this') ) %>
20 20 <% url = nil %>
21 21 <% if profile.kind_of?(Person) %>
22   - <% url = profile.admin_url.merge({ :controller => 'cms', :action => 'publish', :id => @page }) %>
  22 + <% url = profile.admin_url.merge({ :controller => 'cms', :action => 'publish', :id => @page.id }) %>
23 23 <% elsif profile.kind_of?(Community) && environment.portal_community %>
24   - <% url = profile.admin_url.merge({ :controller => 'cms', :action => 'publish_on_portal_community', :id => @page }) %>
  24 + <% url = profile.admin_url.merge({ :controller => 'cms', :action => 'publish_on_portal_community', :id => @page.id }) %>
25 25 <% end %>
26 26 <%= expirable_button @page, :spread, content, url if url %>
27 27 <% end %>
... ...
app/views/user/mailer/activation_code.html.erb
1 1 <%= _('Hi, %{recipient}!') % { :recipient => @recipient } %>
2 2  
3   -<%= word_wrap(_('Welcome to %{environment}! To activate your account, follow the link: %{activation_url}') % { :environment => @environment, :activation_url => @url + url_for(:controller => :account, :action => :activate, :activation_code => @activation_code, :redirection => @redirection) }) %>
  3 +<%= word_wrap(_('Welcome to %{environment}! To activate your account, follow the link: %{activation_url}') % { :environment => @environment, :activation_url => @url + url_for(:controller => :account, :action => :activate, :activation_code => @activation_code, :redirection => @redirection, :join => @join) }) %>
4 4  
5 5 <%= _("Greetings,") %>
6 6  
... ...
features/categories_block.feature
... ... @@ -28,7 +28,8 @@ Feature: categories_block
28 28  
29 29 @selenium
30 30 Scenario: List just product categories
31   - Given I follow "Edit" within ".categories-block"
  31 + Given display ".button-bar"
  32 + And I follow "Edit" within ".categories-block"
32 33 And I check "Product"
33 34 When I press "Save"
34 35 Then I should see "Food"
... ... @@ -39,7 +40,8 @@ Feature: categories_block
39 40  
40 41 @selenium
41 42 Scenario: Show submenu if it exists
42   - Given I follow "Edit" within ".categories-block"
  43 + Given display ".button-bar"
  44 + And I follow "Edit" within ".categories-block"
43 45 And I check "Product"
44 46 And I press "Save"
45 47 Then I should see "Food"
... ... @@ -56,7 +58,8 @@ Feature: categories_block
56 58  
57 59 @selenium
58 60 Scenario: Show only one submenu per time
59   - Given I follow "Edit" within ".categories-block"
  61 + Given display ".button-bar"
  62 + And I follow "Edit" within ".categories-block"
60 63 And I check "Product"
61 64 And I press "Save"
62 65 Then I should see "Book"
... ... @@ -66,14 +69,16 @@ Feature: categories_block
66 69  
67 70 @selenium
68 71 Scenario: List just general categories
69   - Given I follow "Edit" within ".categories-block"
  72 + Given display ".button-bar"
  73 + And I follow "Edit" within ".categories-block"
70 74 And I check "Generic category"
71 75 When I press "Save"
72 76 Then I should see "Wood"
73 77  
74 78 @selenium
75 79 Scenario: List just regions
76   - Given I follow "Edit" within ".categories-block"
  80 + Given display ".button-bar"
  81 + And I follow "Edit" within ".categories-block"
77 82 And I check "Region"
78 83 When I press "Save"
79 84 Then I should see "Bahia"
... ...
features/edit_profile.feature
... ... @@ -12,7 +12,7 @@ Feature: edit profile
12 12 | birth_date |
13 13 When I go to joao's control panel
14 14 And I follow "Edit Profile"
15   - And I select "1980-11-15" from "profile_data_birth_date"
  15 + And I fill in "Birth date" with "1980-11-15"
16 16 And I press "Save"
17 17 Then I should not see "Birth date is invalid"
18 18 And I should not see "Birth date is mandatory"
... ... @@ -23,7 +23,7 @@ Feature: edit profile
23 23 | birth_date |
24 24 When I go to joao's control panel
25 25 And I follow "Edit Profile"
26   - And I select "1980-11-15" from "profile_data_birth_date"
  26 + And I fill in "Birth date" with "1980-11-15"
27 27 And I press "Save"
28 28 Then I should not see "Birth date is invalid"
29 29 And I should not see "Birth date is mandatory"
... ...
features/login.feature
... ... @@ -207,3 +207,18 @@ Feature: login
207 207 | Password | 123456 |
208 208 When I press "Log in"
209 209 Then I should be on joaosilva's control panel
  210 +
  211 + Scenario: join community on login
  212 + Given the following users
  213 + | login | name |
  214 + | mariasilva | Maria Silva |
  215 + And the following communities
  216 + | name | identifier | owner |
  217 + | Free Software | freesoftware | mariasilva |
  218 + And I am on /freesoftware
  219 + When I follow "Join"
  220 + And I fill in the following:
  221 + | Username / Email | joaosilva |
  222 + | Password | 123456 |
  223 + And I press "Log in"
  224 + Then "Joao Silva" should be a member of "Free Software"
... ...
features/profile_domain.feature
... ... @@ -9,11 +9,11 @@ Feature: domain for profile
9 9 | joaosilva | Joao Silva |
10 10 And the following communities
11 11 | identifier | name | domain |
12   - | sample-community | Sample Community | localhost |
  12 + | sample-community | Sample Community | 127.0.0.1 |
13 13 And the following blocks
14 14 | owner | type |
15 15 | joaosilva | ProfileInfoBlock |
16   - And the environment domain is "127.0.0.1"
  16 + And the environment domain is "localhost"
17 17 And "Joao Silva" is environment admin
18 18 And "Joao Silva" is admin of "Sample Community"
19 19  
... ... @@ -29,8 +29,7 @@ Feature: domain for profile
29 29 @selenium
30 30 Scenario: access user control panel
31 31 Given I am logged in as "joaosilva"
32   - When I go to the homepage
33   - And I follow "joaosilva"
  32 + When I follow "joaosilva"
34 33 And I go to sample-community's homepage
35 34 And I follow "Login"
36 35 And I fill in "joaosilva" for "Username"
... ... @@ -39,18 +38,13 @@ Feature: domain for profile
39 38 And I follow "Control panel" within "div#user"
40 39 Then I should see "Joao Silva" within "span.control-panel-title"
41 40  
42   - # Looking for page title is problematic on selenium since it considers the
43   - # title to be invibible. Checkout some information about this:
44   - # * https://github.com/jnicklas/capybara/issues/863
45   - # * https://github.com/jnicklas/capybara/pull/953
46 41 @selenium
47 42 Scenario: access user page
48 43 Given I am logged in as "joaosilva"
49   - When I go to the homepage
50   - And I follow "joaosilva"
  44 + When I follow "joaosilva"
51 45 Then I should be on joaosilva's profile
52 46 And I should see "Joao Silva" within any "h1"
53   - #And the page title should be "Joao Silva"
  47 + And the page title should be "Joao Silva"
54 48  
55 49 Scenario: access community by domain
56 50 Given I go to the search communities page
... ... @@ -64,7 +58,7 @@ Feature: domain for profile
64 58 Given I am on sample-community's homepage
65 59 When I go to /something-that-does-not-exist
66 60 And I follow "Go to the home page"
67   - Then the page title should be "Sample Community - Colivre.net"
  61 + Then the page title should be "Sample Community"
68 62  
69 63 Scenario: Go to environment homepage after clicking on home button on not found page
70 64 Given I am on the homepage
... ... @@ -72,8 +66,3 @@ Feature: domain for profile
72 66 And I follow "Go to the home page"
73 67 Then I should be on the homepage
74 68 And the page title should be "Colivre.net"
75   -
76   - @selenium
77   - Scenario: Compose link to administration with environment domain
78   - Given I am logged in as "joaosilva"
79   - Then I should see "Administration" linking to "http://127.0.0.1.*/admin"
... ...
features/publish_article.feature
... ... @@ -56,6 +56,7 @@ Feature: publish article
56 56 And I am on mariasilva's control panel
57 57 And I follow "Manage Content"
58 58 And I follow "New content"
  59 + And I should see "Text article with Textile markup language"
59 60 And I follow "Text article with Textile markup language"
60 61 And I fill in the following:
61 62 | Title | Sample Article |
... ...
features/signup.feature
... ... @@ -250,3 +250,51 @@ Feature: signup
250 250 And I fill in "Password" with "secret"
251 251 And I press "Log in"
252 252 Then I should be on the homepage
  253 +
  254 + @selenium
  255 + Scenario: join community on signup
  256 + Given the following users
  257 + | login | name |
  258 + | mariasilva | Maria Silva |
  259 + And the following communities
  260 + | name | identifier | owner |
  261 + | Free Software | freesoftware | mariasilva |
  262 + And feature "skip_new_user_email_confirmation" is disabled on environment
  263 + And I am on /freesoftware
  264 + When I follow "Join"
  265 + And I follow "New user"
  266 + And I fill in the following within ".no-boxes":
  267 + | e-Mail | josesilva@example.com |
  268 + | Username | josesilva |
  269 + | Password | secret |
  270 + | Password confirmation | secret |
  271 + | Full name | José da Silva |
  272 + And wait for the captcha signup time
  273 + And I press "Create my account"
  274 + And I go to josesilva's confirmation URL
  275 + And I fill in "Username" with "josesilva"
  276 + And I fill in "Password" with "secret"
  277 + And I press "Log in"
  278 + Then "José da Silva" should be a member of "Free Software"
  279 +
  280 + @selenium
  281 + Scenario: join community on direct signup
  282 + Given the following users
  283 + | login | name |
  284 + | mariasilva | Maria Silva |
  285 + And the following communities
  286 + | name | identifier | owner |
  287 + | Free Software | freesoftware | mariasilva |
  288 + And feature "skip_new_user_email_confirmation" is enabled on environment
  289 + And I am on /freesoftware
  290 + When I follow "Join"
  291 + And I follow "New user"
  292 + And I fill in the following within ".no-boxes":
  293 + | e-Mail | josesilva@example.com |
  294 + | Username | josesilva |
  295 + | Password | secret |
  296 + | Password confirmation | secret |
  297 + | Full name | José da Silva |
  298 + And wait for the captcha signup time
  299 + And I press "Create my account"
  300 + Then "José da Silva" should be a member of "Free Software"
... ...
features/step_definitions/web_steps.rb
... ... @@ -118,9 +118,9 @@ end
118 118  
119 119 Then /^(?:|I )should see "([^"]*)" within any "([^"]*)"?$/ do |text, selector|
120 120 if page.respond_to? :should
121   - page.should have_css(selector, :content => text)
  121 + page.should have_css(selector, :text => text)
122 122 else
123   - assert page.has_css?(selector, :content => text)
  123 + assert page.has_css?(selector, :text => text)
124 124 end
125 125 end
126 126  
... ...
lib/noosfero/plugin.rb.orig
... ... @@ -1,639 +0,0 @@
1   -require 'noosfero'
2   -
3   -class Noosfero::Plugin
4   -
5   - attr_accessor :context
6   -
7   - def initialize(context=nil)
8   - self.context = context
9   - end
10   -
11   - class << self
12   -
13   - attr_writer :should_load
14   -
15   - def should_load
16   - @should_load.nil? && true || @boot
17   - end
18   -
19   -<<<<<<< HEAD
20   - def initialize!
21   - return if !should_load
22   - enabled.each do |plugin_dir|
23   - plugin_name = File.basename(plugin_dir)
24   - plugin = load_plugin(plugin_name)
25   - load_plugin_extensions(plugin_dir)
26   - load_plugin_filters(plugin)
27   - end
28   - end
29   -
30   - def setup(config)
31   - return if !should_load
32   - enabled.each do |dir|
33   - setup_plugin(dir, config)
34   -=======
35   - def init_system
36   - available_plugins.each do |dir|
37   - load_plugin dir
38   ->>>>>>> rails235
39   - end
40   - end
41   -
42   - def setup_plugin(dir, config)
43   - plugin_name = File.basename(dir)
44   -
45   - plugin_dependencies_ok = true
46   - plugin_dependencies_file = File.join(dir, 'dependencies.rb')
47   - if File.exists?(plugin_dependencies_file)
48   - begin
49   - require plugin_dependencies_file
50   - rescue LoadError => ex
51   - plugin_dependencies_ok = false
52   - $stderr.puts "W: Noosfero plugin #{plugin_name} failed to load (#{ex})"
53   - end
54   - end
55   -
56   - if plugin_dependencies_ok
57   - %w[
58   - controllers
59   - controllers/public
60   - controllers/profile
61   - controllers/myprofile
62   - controllers/admin
63   - ].each do |folder|
64   - config.autoload_paths << File.join(dir, folder)
65   - end
66   - [ config.autoload_paths, $:].each do |path|
67   - path << File.join(dir, 'models')
68   - path << File.join(dir, 'lib')
69   - # load vendor/plugins
70   - Dir.glob(File.join(dir, '/vendor/plugins/*')).each do |vendor_plugin|
71   - path << "#{vendor_plugin}/lib"
72   - init = "#{vendor_plugin}/init.rb"
73   - require init.gsub(/.rb$/, '') if File.file? init
74   - end
75   - end
76   -
77   - # add view path
78   - ActionController::Base.view_paths.unshift(File.join(dir, 'views'))
79   - end
80   - end
81   -
82   - def load_plugin(plugin_name)
83   - (plugin_name.to_s.camelize + 'Plugin').constantize
84   - end
85   -
86   - # This is a generic method that initialize any possible filter defined by a
87   - # plugin to a specific controller
88   - def load_plugin_filters(plugin)
89   - plugin_methods = plugin.instance_methods.select {|m| m.to_s.end_with?('_filters')}
90   - plugin_methods.each do |plugin_method|
91   - controller_class = plugin_method.to_s.gsub('_filters', '').camelize.constantize
92   - filters = plugin.new.send(plugin_method)
93   - filters = [filters] if !filters.kind_of?(Array)
94   -
95   - filters.each do |plugin_filter|
96   - filter_method = (plugin.name.underscore.gsub('/','_') + '_' + plugin_filter[:method_name]).to_sym
97   - controller_class.send(plugin_filter[:type], filter_method, (plugin_filter[:options] || {}))
98   - controller_class.send(:define_method, filter_method) do
99   - instance_eval(&plugin_filter[:block]) if environment.plugin_enabled?(plugin)
100   - end
101   - end
102   - end
103   - end
104   -
105   - def load_plugin_extensions(dir)
106   - Rails.configuration.to_prepare do
107   - Dir[File.join(dir, 'lib', 'ext', '*.rb')].each {|file| require_dependency file }
108   - end
109   - end
110   -
111   - def enabled
112   - @enabled ||=
113   - begin
114   - plugins = Dir.glob(Rails.root.join('config', 'plugins', '*'))
115   - if Rails.env.test? && !plugins.include?(Rails.root.join('config', 'plugins', 'foo'))
116   - plugins << Rails.root.join('plugins', 'foo')
117   - end
118   - plugins.select do |entry|
119   - File.directory?(entry)
120   - end
121   - end
122   - end
123   -
124   -<<<<<<< HEAD
125   -
126   - def all
127   - @all ||= []
128   -=======
129   - def available_plugins
130   - unless @available_plugins
131   - path = File.join(Rails.root, 'config', 'plugins', '*')
132   - @available_plugins = Dir.glob(path).select{ |i| File.directory?(i) }
133   - if Rails.env.test? && !@available_plugins.include?(File.join(Rails.root, 'config', 'plugins', 'foo'))
134   - @available_plugins << File.join(Rails.root, 'plugins', 'foo')
135   - end
136   - end
137   - @available_plugins
138   ->>>>>>> rails235
139   - end
140   -
141   - def all
142   - @all ||= available_plugins.map{ |dir| (File.basename(dir) + "_plugin").camelize }
143   - end
144   -
145   - def public_name
146   - self.name.underscore.gsub('_plugin','')
147   - end
148   -
149   - def public_path(file = '')
150   - File.join('/plugins', public_name, file)
151   - end
152   -
153   - def root_path
154   - Rails.root.join('plugins', public_name)
155   - end
156   -
157   - def view_path
158   - File.join(root_path,'views')
159   - end
160   -
161   - # Here the developer should specify the meta-informations that the plugin can
162   - # inform.
163   - def plugin_name
164   - self.name.underscore.humanize
165   - end
166   - def plugin_description
167   - _("No description informed.")
168   - end
169   -
170   - def admin_url
171   - {:controller => "#{name.underscore}_admin", :action => 'index'}
172   - end
173   -
174   - def has_admin_url?
175   - File.exists?(File.join(root_path, 'controllers', "#{name.underscore}_admin_controller.rb"))
176   - end
177   - end
178   -
179   - def expanded_template(file_path, locals = {})
180   - views_path = Rails.root.join('plugins', "#{self.class.public_name}", 'views')
181   - ERB.new(File.read("#{views_path}/#{file_path}")).result(binding)
182   - end
183   -
184   - def extra_blocks(params = {})
185   - return [] if self.class.extra_blocks.nil?
186   - blocks = self.class.extra_blocks.map do |block, options|
187   - type = options[:type]
188   - type = type.is_a?(Array) ? type : [type].compact
189   - type = type.map do |x|
190   - x.is_a?(String) ? x.capitalize.constantize : x
191   - end
192   - raise "This is not a valid type" if !type.empty? && ![Person, Community, Enterprise, Environment].detect{|m| type.include?(m)}
193   -
194   - position = options[:position]
195   - position = position.is_a?(Array) ? position : [position].compact
196   - position = position.map{|p| p.to_i}
197   - raise "This is not a valid position" if !position.empty? && ![1,2,3].detect{|m| position.include?(m)}
198   -
199   - if !type.empty? && (params[:type] != :all)
200   - block = type.include?(params[:type]) ? block : nil
201   - end
202   -
203   - if !position.empty? && !params[:position].nil?
204   - block = position.detect{ |p| [params[:position]].flatten.include?(p)} ? block : nil
205   - end
206   -
207   - block
208   - end
209   - blocks.compact!
210   - blocks || []
211   - end
212   -
213   - def macros
214   - self.class.constants.map do |constant_name|
215   - self.class.const_get(constant_name)
216   - end.select {|const| const.is_a?(Class) && const < Noosfero::Plugin::Macro}
217   - end
218   -
219   - # Here the developer may specify the events to which the plugins can
220   - # register and must return true or false. The default value must be false.
221   - # Must also explicitly define its returning variables.
222   -
223   - # -> If true, noosfero will include plugin_dir/public/style.css into
224   - # application
225   - def stylesheet?
226   - false
227   - end
228   -
229   - # -> Adds buttons to the control panel
230   - # returns = { :title => title, :icon => icon, :url => url }
231   - # title = name that will be displayed.
232   - # icon = css class name (for customized icons include them in a css file).
233   - # url = url or route to which the button will redirect.
234   - def control_panel_buttons
235   - nil
236   - end
237   -
238   - # -> Customize profile block design and behavior
239   - # (overwrites profile_image_link function)
240   - # returns = lambda block that creates html code.
241   - def profile_image_link(profile, size, tag, extra_info)
242   - nil
243   - end
244   -
245   - # -> Adds tabs to the profile
246   - # returns = { :title => title, :id => id, :content => content, :start => start }
247   - # title = name that will be displayed.
248   - # id = div id.
249   - # content = lambda block that creates html code.
250   - # start = boolean that specifies if the tab must come before noosfero tabs (optional).
251   - def profile_tabs
252   - nil
253   - end
254   -
255   - # -> Adds plugin-specific content types to CMS
256   - # returns = [ContentClass1, ContentClass2, ...]
257   - def content_types
258   - nil
259   - end
260   -
261   - # -> Adds content to calalog item
262   - # returns = lambda block that creates html code
263   - def catalog_item_extras(item)
264   - nil
265   - end
266   -
267   - # -> Adds content to profile editor info and settings
268   - # returns = lambda block that creates html code or raw rhtml/html.erb
269   - def profile_editor_extras
270   - nil
271   - end
272   -
273   - # -> Adds content to calalog list item
274   - # returns = lambda block that creates html code
275   - def catalog_list_item_extras(item)
276   - nil
277   - end
278   -
279   - # -> Adds content to products info
280   - # returns = lambda block that creates html code
281   - def product_info_extras(product)
282   - nil
283   - end
284   -
285   - # -> Adds content to products on asset list
286   - # returns = lambda block that creates html code
287   - def asset_product_extras(product)
288   - nil
289   - end
290   -
291   - # -> Adds a property to the product on asset products
292   - # returns = {:name => name, :content => content}
293   - # name = Name of the property
294   - # content = lambda block that creates an html
295   - def asset_product_properties(product)
296   - nil
297   - end
298   -
299   - # -> Adds content to the beginning of the page
300   - # returns = lambda block that creates html code or raw rhtml/html.erb
301   - def body_beginning
302   - nil
303   - end
304   -
305   - # -> Adds content to the ending of the page head
306   - # returns = lambda block that creates html code or raw rhtml/html.erb
307   - def head_ending
308   - nil
309   - end
310   -
311   - # -> Adds plugins' javascript files to application
312   - # returns = ['example1.js', 'javascripts/example2.js', 'example3.js']
313   - def js_files
314   - []
315   - end
316   -
317   - # -> Adds stuff in user data hash
318   - # returns = { :some_data => some_value, :another_data => another_value }
319   - def user_data_extras
320   - {}
321   - end
322   -
323   - # -> Parse and possibly make changes of content (article, block, etc) during HTML rendering
324   - # returns = content as string after parser and changes
325   - def parse_content(html, source)
326   - [html, source]
327   - end
328   -
329   - # -> Adds links to the admin panel
330   - # returns = {:title => title, :url => url}
331   - # title = name that will be displayed in the link
332   - # url = url or route to which the link will redirect to.
333   - def admin_panel_links
334   - nil
335   - end
336   -
337   - # -> Adds buttons to manage members page
338   - # returns = { :title => title, :icon => icon, :url => url }
339   - # title = name that will be displayed.
340   - # icon = css class name (for customized icons include them in a css file).
341   - # url = url or route to which the button will redirect.
342   - def manage_members_extra_buttons
343   - nil
344   - end
345   -
346   - # This method will be called just before a comment is saved to the database.
347   - #
348   - # It can modify the comment in several ways. In special, a plugin can call
349   - # reject! on the comment and that will cause the comment to not be saved.
350   - #
351   - # example:
352   - #
353   - # def filter_comment(comment)
354   - # if user_not_logged_in
355   - # comment.reject!
356   - # end
357   - # end
358   - #
359   - def filter_comment(comment)
360   - end
361   -
362   - # Define custom logic to filter loaded comments.
363   - #
364   - # Example:
365   - #
366   - # def unavailable_comments(scope)
367   - # scope.without_spams
368   - # end
369   - #
370   - def unavailable_comments(scope)
371   - scope
372   - end
373   -
374   - # -> Allows plugins to check weather object is a spam
375   - def check_for_spam(object)
376   - end
377   -
378   - # -> Allows plugins to know when an object is marked as a spam
379   - def marked_as_spam(object)
380   - end
381   -
382   - # -> Allows plugins to know when an object is marked as a ham
383   - def marked_as_ham(object)
384   - end
385   -
386   - # Adds extra actions for comments
387   - # returns = list of hashes or lambda block that creates a list of hashes
388   - # example:
389   - #
390   - # def comment_actions(comment)
391   - # [{:link => link_to_function(...)}]
392   - # end
393   - #
394   - def comment_actions(comment)
395   - nil
396   - end
397   -
398   - # This method is called when the user click on comment actions menu.
399   - # returns = list or lambda block that return ids of enabled menu items for comments
400   - # example:
401   - #
402   - # def check_comment_actions(comment)
403   - # ['#action1', '#action2']
404   - # end
405   - #
406   - def check_comment_actions(comment)
407   - []
408   - end
409   -
410   - # -> Adds adicional content to article
411   - # returns = lambda block that creates html code
412   - def article_extra_contents(article)
413   - nil
414   - end
415   -
416   - # -> Adds fields to the signup form
417   - # returns = lambda block that creates html code
418   - def signup_extra_contents
419   - nil
420   - end
421   -
422   - # -> Adds adicional content to profile info
423   - # returns = lambda block that creates html code
424   - def profile_info_extra_contents
425   - nil
426   - end
427   -
428   - # -> Removes the invite friend button from the friends controller
429   - # returns = boolean
430   - def remove_invite_friends_button
431   - nil
432   - end
433   -
434   - # -> Extends organization list of members
435   - # returns = An instance of ActiveRecord::NamedScope::Scope retrieved through
436   - # Person.members_of method.
437   - def organization_members(organization)
438   - nil
439   - end
440   -
441   - # -> Extends person memberships list
442   - # returns = An instance of ActiveRecord::NamedScope::Scope retrived through
443   - # Person.memberships_of method.
444   - def person_memberships(person)
445   - nil
446   - end
447   -
448   - # -> Extends person permission access
449   - # returns = boolean
450   - def has_permission?(person, permission, target)
451   - nil
452   - end
453   -
454   - # -> Adds hidden_fields to the new community view
455   - # returns = {key => value}
456   - def new_community_hidden_fields
457   - nil
458   - end
459   -
460   - # -> Adds hidden_fields to the enterprise registration view
461   - # returns = {key => value}
462   - def enterprise_registration_hidden_fields
463   - nil
464   - end
465   -
466   - # -> Add an alternative authentication method.
467   - # Your plugin have to make the access control and return the logged user.
468   - # returns = User
469   - def alternative_authentication
470   - nil
471   - end
472   -
473   - # -> Adds adicional link to make the user authentication
474   - # returns = lambda block that creates html code
475   - def alternative_authentication_link
476   - nil
477   - end
478   -
479   - # -> Allow or not user registration
480   - # returns = boolean
481   - def allow_user_registration
482   - true
483   - end
484   -
485   - # -> Allow or not password recovery by users
486   - # returns = boolean
487   - def allow_password_recovery
488   - true
489   - end
490   -
491   - # -> Adds fields to the login form
492   - # returns = lambda block that creates html code
493   - def login_extra_contents
494   - nil
495   - end
496   -
497   - # -> Adds adicional content to comment form
498   - # returns = lambda block that creates html code
499   - def comment_form_extra_contents(args)
500   - nil
501   - end
502   -
503   - # -> Adds adicional content to article header
504   - # returns = lambda block that creates html code
505   - def article_header_extra_contents(article)
506   - nil
507   - end
508   -
509   - # -> Adds adittional content to comment visualization
510   - # returns = lambda block that creates html code
511   - def comment_extra_contents(args)
512   - nil
513   - end
514   -
515   - # This method is called when the user clicks to send a comment.
516   - # A plugin can add new content to comment form and this method can process the params sent to avoid creating field on core tables.
517   - # returns = params after processed by plugins
518   - # example:
519   - #
520   - # def process_extra_comment_params(params)
521   - # params.delete(:extra_field)
522   - # end
523   - #
524   - def process_extra_comment_params(params)
525   - params
526   - end
527   -
528   - # -> Finds objects by their contents
529   - # returns = {:results => [a, b, c, ...], ...}
530   - # P.S.: The plugin might add other informations on the return hash for its
531   - # own use in specific views
532   - def find_by_contents(asset, scope, query, paginate_options={}, options={})
533   - end
534   -
535   - # -> Adds aditional fields for change_password
536   - # returns = [{:field => 'field1', :name => 'field 1 name', :model => 'person'}, {...}]
537   - def change_password_fields
538   - nil
539   - end
540   -
541   - # -> Adds additional blocks to profiles and environments.
542   - # Your plugin must implements a class method called 'extra_blocks'
543   - # that returns a hash with the following syntax.
544   - # {
545   - # 'block_name' =>
546   - # {
547   - # :type => 'for which holder the block will be available',
548   - # :position => 'where the block could be displayed'
549   - # }
550   - # }
551   - #
552   - # Where:
553   - #
554   - # - block_name: Name of the new block added to the blocks list
555   - # - type: Might have some of the values
556   - # - 'environment' or Environment: If the block is available only for Environment models
557   - # - 'community' or Community: If the block is available only for Community models
558   - # - 'enterprise' or Enterprise: If the block is available only for Enterprise models
559   - # - 'person' or Person: If the block is available only for Person models
560   - # - nil: If no type parameter is passed the block will be available for all types
561   - # - position: Is the layout position of the block. It should be:
562   - # - '1' or 1: Area 1 of layout
563   - # - '2' or 2: Area 2 of layout
564   - # - '3' or 3: Area 3 of layout
565   - # - nil: If no position parameter is passed the block will be available for all positions
566   - #
567   - # OBS: Area 1 is where stay the main content of layout. Areas 2 and 3 are the sides of layout.
568   - #
569   - # examples:
570   - #
571   - # def self.extra_blocks(params)
572   - # {
573   - # #Display 'CustomBlock1' only for 'Person' on position '1'
574   - # CustomBlock1 => {:type => 'person', :position => '1' },
575   - #
576   - # #Display 'CustomBlock2' only for 'Community' on position '2'
577   - # CustomBlock2 => {:type => Community, :position => '2' },
578   - #
579   - # #Display 'CustomBlock3' only for 'Enterprise' on position '3'
580   - # CustomBlock3 => {:type => 'enterprise', :position => 3 },
581   - #
582   - # #Display 'CustomBlock2' for 'Environment' and 'Person' on positions '1' and '3'
583   - # CustomBlock4 => {:type => ['environment', Person], :position => ['1','3'] },
584   - #
585   - # #Display 'CustomBlock5' for all types and all positions
586   - # CustomBlock5 => {},
587   - # }
588   - # end
589   - #
590   - # OBS: The default value is a empty hash.
591   - def self.extra_blocks
592   - {}
593   - end
594   -
595   - def method_missing(method, *args, &block)
596   - # This is a generic hotspot for all controllers on Noosfero.
597   - # If any plugin wants to define filters to run on any controller, the name of
598   - # the hotspot must be in the following form: <underscored_controller_name>_filters.
599   - # Example: for ProfileController the hotspot is profile_controller_filters
600   - #
601   - # -> Adds a filter to a controller
602   - # returns = { :type => type,
603   - # :method_name => method_name,
604   - # :options => {:opt1 => opt1, :opt2 => opt2},
605   - # :block => Proc or lambda block}
606   - # type = 'before_filter' or 'after_filter'
607   - # method_name = The name of the filter
608   - # option = Filter options, like :only or :except
609   - # block = Block that the filter will call
610   - if method.to_s =~ /^(.+)_controller_filters$/
611   - []
612   - # -> Removes the action button from the content
613   - # returns = boolean
614   - elsif method.to_s =~ /^content_remove_(#{content_actions.join('|')})$/
615   - nil
616   - # -> Expire the action button from the content
617   - # returns = string with reason of expiration
618   - elsif method.to_s =~ /^content_expire_(#{content_actions.join('|')})$/
619   - nil
620   - else
621   - super
622   - end
623   - end
624   -
625   - private
626   -
627   - def content_actions
628   - #FIXME 'new' and 'upload' only works for content_remove. It should work for
629   - #content_expire too.
630   - %w[edit delete spread locale suggest home new upload]
631   - end
632   -
633   -end
634   -
635   -require 'noosfero/plugin/hot_spot'
636   -require 'noosfero/plugin/manager'
637   -require 'noosfero/plugin/active_record'
638   -require 'noosfero/plugin/mailer_base'
639   -require 'noosfero/plugin/settings'
plugins/comment_group/lib/comment_group_plugin/macros/allow_comment.rb
... ... @@ -16,6 +16,9 @@ class CommentGroupPlugin::AllowComment &lt; Noosfero::Plugin::Macro
16 16 article = source
17 17 count = article.group_comments.without_spam.in_group(group_id).count
18 18  
19   - proc {render :partial => 'comment_group_plugin_profile/comment_group', :locals => {:group_id => group_id, :article_id => article.id, :inner_html => inner_html, :count => count, :profile_identifier => article.profile.identifier }}
  19 + proc {
  20 + render :partial => 'comment_group_plugin_profile/comment_group',
  21 + :locals => {:group_id => group_id, :article_id => article.id, :inner_html => inner_html, :count => count, :profile_identifier => article.profile.identifier }
  22 + }
20 23 end
21 24 end
... ...
plugins/comment_group/views/comment_group_plugin_profile/_comment_group.html.erb
... ... @@ -3,7 +3,6 @@
3 3 <div style="float: left">
4 4 <%= link_to_remote(image_tag("/plugins/comment_group/images/comments.gif"),
5 5 :url => { :profile => profile_identifier, :controller => 'comment_group_plugin_profile', :action => 'view_comments', :group_id => group_id, :article_id => article_id},
6   - :loaded => j(visual_effect(:highlight, "comments_list_group_#{group_id}")),
7 6 :method => :post,
8 7 :condition => "!toggleGroup(#{group_id})",
9 8 :complete => "loadCompleted(#{group_id})")%>
... ...
plugins/video/lib/video_block.rb
1 1 class VideoBlock < Block
2 2  
  3 + attr_accessible :url, :width, :height
  4 +
3 5 settings_items :url, :type => :string, :default => ""
4 6 settings_items :width, :type => :integer, :default => 400
5 7 settings_items :height, :type => :integer, :default => 315
... ...
test/functional/admin_panel_controller_test.rb
... ... @@ -73,6 +73,7 @@ class AdminPanelControllerTest &lt; ActionController::TestCase
73 73 assert_tag :tag => 'textarea', :attributes => { :name => 'environment[terms_of_use]'}
74 74 assert_tag :tag => 'input', :attributes => { :name => 'environment[signup_welcome_text_subject]'}
75 75 assert_tag :tag => 'textarea', :attributes => { :name => 'environment[signup_welcome_text_body]'}
  76 + assert_tag :tag => 'textarea', :attributes => { :name => 'environment[signup_welcome_screen_body]'}
76 77 end
77 78  
78 79 should 'display form for editing message for disabled enterprise' do
... ... @@ -381,4 +382,13 @@ class AdminPanelControllerTest &lt; ActionController::TestCase
381 382 assert_not_includes environment.languages, 'en'
382 383 end
383 384  
  385 + should 'save body of signup welcome screen' do
  386 + body = "This is my welcome body"
  387 + post :site_info, :environment => { :signup_welcome_screen_body => body }
  388 + assert_redirected_to :action => 'index'
  389 +
  390 + assert_equal body, Environment.default.signup_welcome_screen_body
  391 + assert !Environment.default.signup_welcome_screen_body.blank?
  392 + end
  393 +
384 394 end
... ...
test/functional/profile_controller_test.rb
... ... @@ -474,17 +474,23 @@ class ProfileControllerTest &lt; ActionController::TestCase
474 474 assert_equal "/profile/#{community.identifier}", @request.session[:previous_location]
475 475 end
476 476  
477   - should 'redirect to location before login after join community' do
  477 + should 'redirect to login after user not logged asks to join a community' do
478 478 community = Community.create!(:name => 'my test community')
479 479  
480   - @request.expects(:referer).returns("/profile/#{community.identifier}/to_go")
481   - login_as(profile.identifier)
  480 + get :join_not_logged, :profile => community.identifier
482 481  
483   - post :join_not_logged, :profile => community.identifier
  482 + assert_equal community.identifier, @request.session[:join]
  483 + assert_redirected_to :controller => :account, :action => :login
  484 + end
484 485  
485   - assert_redirected_to "/profile/#{community.identifier}/to_go"
  486 + should 'redirect to join after user logged asks to join_not_logged a community' do
  487 + community = Community.create!(:name => 'my test community')
  488 +
  489 + login_as(profile.identifier)
  490 + get :join_not_logged, :profile => community.identifier
486 491  
487   - assert_nil @request.session[:previous_location]
  492 + assert_equal community.identifier, @request.session[:join]
  493 + assert_redirected_to :controller => :profile, :action => :join
488 494 end
489 495  
490 496 should 'show number of published events in index' do
... ... @@ -1186,7 +1192,7 @@ class ProfileControllerTest &lt; ActionController::TestCase
1186 1192 20.times {comment = fast_create(Comment, :source_id => article, :title => 'a comment', :body => 'lalala', :created_at => Time.now)}
1187 1193 article.reload
1188 1194 get :index, :profile => profile.identifier
1189   - assert_tag 'ul', :attributes => {:class => 'profile-wall-activities-comments'}, :children => {:count => 0 }
  1195 + assert_tag 'ul', :attributes => {:class => 'profile-wall-activities-comments'}, :children => {:count => 0 }
1190 1196 end
1191 1197  
1192 1198 should "view more comments paginated" do
... ... @@ -1212,7 +1218,7 @@ class ProfileControllerTest &lt; ActionController::TestCase
1212 1218 20.times {fast_create(Scrap, :sender_id => profile.id, :receiver_id => profile.id, :scrap_id => scrap.id)}
1213 1219 profile.reload
1214 1220 get :index, :profile => profile.identifier
1215   - assert_tag 'ul', :attributes => {:class => 'profile-wall-activities-comments scrap-replies'}, :children => {:count => 0 }
  1221 + assert_tag 'ul', :attributes => {:class => 'profile-wall-activities-comments scrap-replies'}, :children => {:count => 0 }
1216 1222 end
1217 1223  
1218 1224 should "view more replies paginated" do
... ... @@ -1269,15 +1275,6 @@ class ProfileControllerTest &lt; ActionController::TestCase
1269 1275 assert_tag :tag => 'div', :content => /#{instance_eval(&plugin2.profile_tabs[:content])}/, :attributes => {:id => /#{plugin2.profile_tabs[:id]}/}
1270 1276 end
1271 1277  
1272   - should 'redirect to profile page when try to request join_not_logged via GET method' do
1273   - community = Community.create!(:name => 'my test community')
1274   - login_as(profile.identifier)
1275   - get :join_not_logged, :profile => community.identifier
1276   - assert_nothing_raised do
1277   - assert_redirected_to community.url
1278   - end
1279   - end
1280   -
1281 1278 should 'check different profile from the domain profile' do
1282 1279 default = Environment.default
1283 1280 default.domains.create!(:name => 'environment.com')
... ...
test/unit/environment_test.rb
... ... @@ -1382,4 +1382,32 @@ class EnvironmentTest &lt; ActiveSupport::TestCase
1382 1382 environment.save!
1383 1383 assert_equal ['en', 'pt'], environment.available_locales
1384 1384 end
  1385 +
  1386 + should 'not consider custom welcome screen text if not defined' do
  1387 + env = Environment.default
  1388 + assert !env.has_custom_welcome_screen?
  1389 + end
  1390 +
  1391 + should 'not consider custom welcome screen text if nil' do
  1392 + env = Environment.default
  1393 +
  1394 + env.signup_welcome_screen_body = nil
  1395 + assert !env.has_custom_welcome_screen?
  1396 + end
  1397 +
  1398 + should 'consider signup welcome screen if body is defined' do
  1399 + env = Environment.default
  1400 + env.signup_welcome_screen_body = 'Welcome to the environment'
  1401 + assert env.has_custom_welcome_screen?
  1402 + end
  1403 +
  1404 + should 'store custom welcome screen body' do
  1405 + environment = Environment.default
  1406 +
  1407 + environment.signup_welcome_screen_body = 'Welcome to the environment'
  1408 + environment.save
  1409 + environment.reload
  1410 +
  1411 + assert_equal 'Welcome to the environment', environment.signup_welcome_screen_body
  1412 + end
1385 1413 end
... ...