diff --git a/app/controllers/public/home_controller.rb b/app/controllers/public/home_controller.rb
index bf3b988..746eb14 100644
--- a/app/controllers/public/home_controller.rb
+++ b/app/controllers/public/home_controller.rb
@@ -22,7 +22,6 @@ class HomeController < PublicController
@no_design_blocks = true
@display_confirmation_tips = !user.present? && !environment.enabled?(:skip_new_user_email_confirmation)
@person_template = user && user.template || params[:template_id] && Person.find(params[:template_id])
- @template_welcome_page = @person_template && @person_template.welcome_page && @person_template.welcome_page.published ? @person_template.welcome_page.body : nil
end
end
diff --git a/app/views/home/welcome.html.erb b/app/views/home/welcome.html.erb
index 9bb55c4..d8a86e0 100644
--- a/app/views/home/welcome.html.erb
+++ b/app/views/home/welcome.html.erb
@@ -16,8 +16,5 @@
<%= _("%s your Gmail, Yahoo and Hotmail contacts!") % link_to(_('Invite and find'), {:controller => 'doc', :section => 'user', :topic => 'invite-contacts'}, :target => '_blank') %>
<%= _("Start exploring and have fun!") %>
<% end %>
- <% if @template_welcome_page.present? %>
- <%= _("What can I do as a %s?") % @person_template.name %>
- <%= @template_welcome_page.html_safe %>
- <% end %>
+ <%= render :partial => 'shared/template_welcome_page', :locals => {:template => @person_template, :header => _("What can I do as a %s?") % @person_template.name}%>
diff --git a/app/views/shared/_template_welcome_page.html.erb b/app/views/shared/_template_welcome_page.html.erb
new file mode 100644
index 0000000..1a390f3
--- /dev/null
+++ b/app/views/shared/_template_welcome_page.html.erb
@@ -0,0 +1,4 @@
+<% if template.welcome_page_content.present? %>
+ <%= header %>
+ <%= template.welcome_page_content.html_safe %>
+<% end %>
diff --git a/test/functional/home_controller_test.rb b/test/functional/home_controller_test.rb
index e2e80bb..719173e 100644
--- a/test/functional/home_controller_test.rb
+++ b/test/functional/home_controller_test.rb
@@ -137,18 +137,17 @@ class HomeControllerTest < ActionController::TestCase
template.welcome_page = welcome_page
template.save!
get :welcome, :template_id => template.id
- assert_equal welcome_page.body, assigns(:template_welcome_page)
assert_match /#{welcome_page.body}/, @response.body
end
should 'not display template welcome page if it is not published' do
template = create_user('template').person
template.is_template = true
- welcome_page = TinyMceArticle.create!(:name => 'Welcome page', :profile => template, :published => false)
+ welcome_page = TinyMceArticle.create!(:name => 'Welcome page', :profile => template, :published => false, :body => 'Template welcome page')
template.welcome_page = welcome_page
template.save!
get :welcome, :template_id => template.id
- assert_nil assigns(:template_welcome_page)
+ assert_no_match /#{welcome_page.body}/, @response.body
end
should 'not crash template doess not have a welcome page' do
--
libgit2 0.21.2