Commit c5257df0ef198bee316bb715434517141358062d
1 parent
0c5034f4
Exists in
master
and in
29 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 | 22 | @no_design_blocks = true |
23 | 23 | @display_confirmation_tips = !user.present? && !environment.enabled?(:skip_new_user_email_confirmation) |
24 | 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 | 25 | end |
27 | 26 | |
28 | 27 | end | ... | ... |
app/views/home/welcome.html.erb
... | ... | @@ -16,8 +16,5 @@ |
16 | 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 | 17 | <p><%= _("Start exploring and have fun!") %></p> |
18 | 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 | 20 | </div> | ... | ... |
test/functional/home_controller_test.rb
... | ... | @@ -137,18 +137,17 @@ class HomeControllerTest < ActionController::TestCase |
137 | 137 | template.welcome_page = welcome_page |
138 | 138 | template.save! |
139 | 139 | get :welcome, :template_id => template.id |
140 | - assert_equal welcome_page.body, assigns(:template_welcome_page) | |
141 | 140 | assert_match /#{welcome_page.body}/, @response.body |
142 | 141 | end |
143 | 142 | |
144 | 143 | should 'not display template welcome page if it is not published' do |
145 | 144 | template = create_user('template').person |
146 | 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 | 147 | template.welcome_page = welcome_page |
149 | 148 | template.save! |
150 | 149 | get :welcome, :template_id => template.id |
151 | - assert_nil assigns(:template_welcome_page) | |
150 | + assert_no_match /#{welcome_page.body}/, @response.body | |
152 | 151 | end |
153 | 152 | |
154 | 153 | should 'not crash template doess not have a welcome page' do | ... | ... |