Commit c5257df0ef198bee316bb715434517141358062d
1 parent
0c5034f4
Exists in
staging
and in
42 other branches
[template-welcome-page] Refactor person template welcome page
Showing
4 changed files
with
7 additions
and
8 deletions
Show diff stats
app/controllers/public/home_controller.rb
@@ -22,7 +22,6 @@ class HomeController < PublicController | @@ -22,7 +22,6 @@ class HomeController < PublicController | ||
22 | @no_design_blocks = true | 22 | @no_design_blocks = true |
23 | @display_confirmation_tips = !user.present? && !environment.enabled?(:skip_new_user_email_confirmation) | 23 | @display_confirmation_tips = !user.present? && !environment.enabled?(:skip_new_user_email_confirmation) |
24 | @person_template = user && user.template || params[:template_id] && Person.find(params[:template_id]) | 24 | @person_template = user && user.template || params[:template_id] && Person.find(params[:template_id]) |
25 | - @template_welcome_page = @person_template && @person_template.welcome_page && @person_template.welcome_page.published ? @person_template.welcome_page.body : nil | ||
26 | end | 25 | end |
27 | 26 | ||
28 | end | 27 | end |
app/views/home/welcome.html.erb
@@ -16,8 +16,5 @@ | @@ -16,8 +16,5 @@ | ||
16 | <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><%= _("%s your Gmail, Yahoo and Hotmail contacts!") % link_to(_('Invite and find'), {:controller => 'doc', :section => 'user', :topic => 'invite-contacts'}, :target => '_blank') %></p> |
17 | <p><%= _("Start exploring and have fun!") %></p> | 17 | <p><%= _("Start exploring and have fun!") %></p> |
18 | <% end %> | 18 | <% end %> |
19 | - <% if @template_welcome_page.present? %> | ||
20 | - <h1><%= _("What can I do as a %s?") % @person_template.name %></h1> | ||
21 | - <%= @template_welcome_page.html_safe %> | ||
22 | - <% end %> | 19 | + <%= render :partial => 'shared/template_welcome_page', :locals => {:template => @person_template, :header => _("What can I do as a %s?") % @person_template.name}%> |
23 | </div> | 20 | </div> |
test/functional/home_controller_test.rb
@@ -137,18 +137,17 @@ class HomeControllerTest < ActionController::TestCase | @@ -137,18 +137,17 @@ class HomeControllerTest < ActionController::TestCase | ||
137 | template.welcome_page = welcome_page | 137 | template.welcome_page = welcome_page |
138 | template.save! | 138 | template.save! |
139 | get :welcome, :template_id => template.id | 139 | get :welcome, :template_id => template.id |
140 | - assert_equal welcome_page.body, assigns(:template_welcome_page) | ||
141 | assert_match /#{welcome_page.body}/, @response.body | 140 | assert_match /#{welcome_page.body}/, @response.body |
142 | end | 141 | end |
143 | 142 | ||
144 | should 'not display template welcome page if it is not published' do | 143 | should 'not display template welcome page if it is not published' do |
145 | template = create_user('template').person | 144 | template = create_user('template').person |
146 | template.is_template = true | 145 | template.is_template = true |
147 | - welcome_page = TinyMceArticle.create!(:name => 'Welcome page', :profile => template, :published => false) | 146 | + welcome_page = TinyMceArticle.create!(:name => 'Welcome page', :profile => template, :published => false, :body => 'Template welcome page') |
148 | template.welcome_page = welcome_page | 147 | template.welcome_page = welcome_page |
149 | template.save! | 148 | template.save! |
150 | get :welcome, :template_id => template.id | 149 | get :welcome, :template_id => template.id |
151 | - assert_nil assigns(:template_welcome_page) | 150 | + assert_no_match /#{welcome_page.body}/, @response.body |
152 | end | 151 | end |
153 | 152 | ||
154 | should 'not crash template doess not have a welcome page' do | 153 | should 'not crash template doess not have a welcome page' do |