Commit 64fd315ba638ab4e20e1a00cd57f4e72300ff762

Authored by Rodrigo Souto
2 parents d8c8e9cf 57ae66f8

Merge branch 'stoa' of gitlab.com:colivre/noosfero into stoa

app/helpers/search_term_helper.rb
@@ -12,6 +12,7 @@ module SearchTermHelper @@ -12,6 +12,7 @@ module SearchTermHelper
12 12
13 #TODO Think smarter criteria to normalize search terms properly 13 #TODO Think smarter criteria to normalize search terms properly
14 def normalize_term(search_term) 14 def normalize_term(search_term)
  15 + search_term ||= ''
15 search_term.downcase 16 search_term.downcase
16 end 17 end
17 end 18 end
app/views/home/welcome.html.erb
@@ -17,8 +17,11 @@ @@ -17,8 +17,11 @@
17 <p><%= _("You won't appear as %s until your account is approved.") % link_to(_('user'), {:controller => :search, :action => :people, :filter => 'more_recent'}, :target => '_blank') %></p> 17 <p><%= _("You won't appear as %s until your account is approved.") % link_to(_('user'), {:controller => :search, :action => :people, :filter => 'more_recent'}, :target => '_blank') %></p>
18 <% end %> 18 <% end %>
19 <h4><%= _("What to do next?") %></h4> 19 <h4><%= _("What to do next?") %></h4>
20 - <p><%= _("Access your %s and see your face on the network!") % link_to(_('Profile'), {:controller => 'profile', :profile => user.identifier}, :target => '_blank') %></p>  
21 - <p><%= _("Explore your %s to customize your profile. Here are some %s on what you can do there.") % [link_to(_('Control Panel'), {:controller => 'profile_editor', :profile => user.identifier}, :target => '_blank'), link_to(_('tips'), {:controller => 'doc', :action => 'topic', :section => 'user', :topic => 'editing-person-info'}, :target => '_blank')] %></p> 20 + <p><%= _("Access your %s and see your face on the network!") %
  21 + (user.present? ? link_to(_('Profile'), {:controller => 'profile', :profile => user.identifier}, :target => '_blank') : 'Profile') %>
  22 + <%= _("You can also explore your %s to customize your profile. Here are some %s on what you can do there.") %
  23 + [user.present? ? link_to(_('Control Panel'), {:controller => 'profile_editor', :profile => user.identifier}, :target => '_blank') : 'Control Panel',
  24 + link_to(_('tips'), {:controller => 'doc', :action => 'topic', :section => 'user', :topic => 'editing-person-info'}, :target => '_blank')] %></p>
22 <p><%= _("%s your Gmail, Yahoo and Hotmail contacts!") % link_to(_('Invite and find'), {:controller => 'doc', :action => 'topic', :section => 'user', :topic => 'invite-contacts'}, :target => '_blank') %></p> 25 <p><%= _("%s your Gmail, Yahoo and Hotmail contacts!") % link_to(_('Invite and find'), {:controller => 'doc', :action => 'topic', :section => 'user', :topic => 'invite-contacts'}, :target => '_blank') %></p>
23 <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> 26 <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>
24 <p><%= _("Start exploring and have fun!") %></p> 27 <p><%= _("Start exploring and have fun!") %></p>
test/functional/enterprise_registration_controller_test.rb
@@ -66,7 +66,7 @@ class EnterpriseRegistrationControllerTest &lt; ActionController::TestCase @@ -66,7 +66,7 @@ class EnterpriseRegistrationControllerTest &lt; ActionController::TestCase
66 template.welcome_page = welcome_page 66 template.welcome_page = welcome_page
67 template.save! 67 template.save!
68 68
69 - data = { :name => 'My new enterprise', :identifier => 'mynew', :region => region, :template_id => template.id } 69 + data = { :name => 'My new enterprise', :identifier => 'mynew', :region_id => region.id, :template_id => template.id }
70 create_enterprise = CreateEnterprise.new(data) 70 create_enterprise = CreateEnterprise.new(data)
71 71
72 post :index, :create_enterprise => data 72 post :index, :create_enterprise => data
test/functional/profile_editor_controller_test.rb
@@ -880,14 +880,14 @@ class ProfileEditorControllerTest &lt; ActionController::TestCase @@ -880,14 +880,14 @@ class ProfileEditorControllerTest &lt; ActionController::TestCase
880 end 880 end
881 end 881 end
882 882
883 - should 'have welcome_page only for person template' do 883 + should 'have welcome_page only for template' do
884 organization = fast_create(Organization, :is_template => false) 884 organization = fast_create(Organization, :is_template => false)
885 @controller.stubs(:profile).returns(organization) 885 @controller.stubs(:profile).returns(organization)
886 assert !@controller.send(:has_welcome_page) 886 assert !@controller.send(:has_welcome_page)
887 887
888 organization = fast_create(Organization, :is_template => true) 888 organization = fast_create(Organization, :is_template => true)
889 @controller.stubs(:profile).returns(organization) 889 @controller.stubs(:profile).returns(organization)
890 - assert !@controller.send(:has_welcome_page) 890 + assert @controller.send(:has_welcome_page)
891 891
892 person = fast_create(Person, :is_template => false) 892 person = fast_create(Person, :is_template => false)
893 @controller.stubs(:profile).returns(person) 893 @controller.stubs(:profile).returns(person)
@@ -901,11 +901,11 @@ class ProfileEditorControllerTest &lt; ActionController::TestCase @@ -901,11 +901,11 @@ class ProfileEditorControllerTest &lt; ActionController::TestCase
901 should 'display welcome_page button only if profile has_welcome_page' do 901 should 'display welcome_page button only if profile has_welcome_page' do
902 @controller.stubs(:has_welcome_page).returns(true) 902 @controller.stubs(:has_welcome_page).returns(true)
903 get :index, :profile => fast_create(Profile).identifier 903 get :index, :profile => fast_create(Profile).identifier
904 - assert_tag :tag => 'a', :content => 'Edit Welcome Page' 904 + assert_tag :tag => 'a', :content => 'Edit welcome page'
905 905
906 @controller.stubs(:has_welcome_page).returns(false) 906 @controller.stubs(:has_welcome_page).returns(false)
907 get :index, :profile => fast_create(Profile).identifier 907 get :index, :profile => fast_create(Profile).identifier
908 - assert_no_tag :tag => 'a', :content => 'Edit Welcome Page' 908 + assert_no_tag :tag => 'a', :content => 'Edit welcome page'
909 end 909 end
910 910
911 should 'not be able to access welcome_page if profile does not has_welcome_page' do 911 should 'not be able to access welcome_page if profile does not has_welcome_page' do
@@ -920,11 +920,14 @@ class ProfileEditorControllerTest &lt; ActionController::TestCase @@ -920,11 +920,14 @@ class ProfileEditorControllerTest &lt; ActionController::TestCase
920 end 920 end
921 921
922 should 'update welcome page and redirect to index' do 922 should 'update welcome page and redirect to index' do
923 - welcome_page = fast_create(TinyMceArticle, :body => 'Initial welcome page')  
924 person_template = create_user('person_template').person 923 person_template = create_user('person_template').person
925 person_template.is_template = true 924 person_template.is_template = true
  925 +
  926 + welcome_page = fast_create(TinyMceArticle, :body => 'Initial welcome page')
926 person_template.welcome_page = welcome_page 927 person_template.welcome_page = welcome_page
927 person_template.save! 928 person_template.save!
  929 + welcome_page.profile = person_template
  930 + welcome_page.save!
928 new_content = 'New welcome page' 931 new_content = 'New welcome page'
929 932
930 post :welcome_page, :profile => person_template.identifier, :welcome_page => {:body => new_content} 933 post :welcome_page, :profile => person_template.identifier, :welcome_page => {:body => new_content}