Commit c48acf16d9c8b69a5a70a44a6d9151b58964c356
1 parent
ae069d09
Exists in
master
and in
28 other branches
ActionItem1044: displaying profile screen if profile has no homepage
Showing
8 changed files
with
20 additions
and
34 deletions
Show diff stats
app/controllers/public/content_viewer_controller.rb
... | ... | @@ -4,13 +4,17 @@ class ContentViewerController < ApplicationController |
4 | 4 | |
5 | 5 | inverse_captcha :field => 'e_mail' |
6 | 6 | |
7 | + helper ProfileHelper | |
8 | + helper TagsHelper | |
9 | + | |
7 | 10 | def view_page |
8 | 11 | path = params[:page].join('/') |
9 | 12 | |
10 | 13 | if path.blank? |
11 | 14 | @page = profile.home_page |
12 | 15 | if @page.nil? |
13 | - render :action => 'no_home_page' | |
16 | + @tags = profile.tags | |
17 | + render :template => 'profile/index' | |
14 | 18 | return |
15 | 19 | end |
16 | 20 | else | ... | ... |
app/views/content_viewer/no_home_page.rhtml
... | ... | @@ -1,11 +0,0 @@ |
1 | -<h1 class="block-title"><%= _("Missing home page") %></h1> | |
2 | - | |
3 | -<p> | |
4 | -<%= _('%s did not choose an article for homepage yet.') % profile.name %> | |
5 | -</p> | |
6 | - | |
7 | -<% if user == profile %> | |
8 | -<p> | |
9 | -<%= link_to _('Click here to set your homepage now!'), :controller => 'cms' %> | |
10 | -</p> | |
11 | -<% end %> |
app/views/profile/_organization.rhtml
... | ... | @@ -4,7 +4,7 @@ |
4 | 4 | <%= display_field(_('Name:'), profile, :name) { |name| link_to name, profile.url } %> |
5 | 5 | <tr> |
6 | 6 | <td colspan='2'> |
7 | - <%= link_to _('Members'), :action => 'members' %></li> | |
7 | + <%= link_to _('Members'), :controller => 'profile', :action => 'members' %></li> | |
8 | 8 | </td> |
9 | 9 | </tr> |
10 | 10 | <% if profile.kind_of?(Enterprise) && !profile.environment.enabled?('disable_products_for_enterprises') %> | ... | ... |
app/views/profile/_person.rhtml
... | ... | @@ -28,10 +28,12 @@ |
28 | 28 | </tr> |
29 | 29 | <tr> |
30 | 30 | <td colspan='2'> |
31 | - <%= link_to __('Friends'), :action => 'friends' %> | |
32 | - — <%= link_to __('Communities'), :action => 'communities' %> | |
31 | + <%= link_to __('Friends'), :controller => 'profile', :action => 'friends' %> | |
32 | + | |
33 | + — <%= link_to __('Communities'), :controller => "profile", :action => 'communities' %> | |
34 | + | |
33 | 35 | <% if !environment.enabled?('disable_asset_enterprises') %> |
34 | - — <%= link_to __('Enterprises'), :action => 'enterprises' %> | |
36 | + — <%= link_to __('Enterprises'), :controller => 'profile', :action => 'enterprises' %> | |
35 | 37 | <% end %> |
36 | 38 | </td> |
37 | 39 | </tr> | ... | ... |
app/views/profile/index.rhtml
test/functional/content_viewer_controller_test.rb
... | ... | @@ -51,15 +51,6 @@ class ContentViewerControllerTest < Test::Unit::TestCase |
51 | 51 | assert_equal a, assigns(:page) |
52 | 52 | end |
53 | 53 | |
54 | - def test_should_display_something_else_for_empty_homepage | |
55 | - profile.articles.destroy_all | |
56 | - | |
57 | - get :view_page, :profile => profile.identifier, :page => [] | |
58 | - | |
59 | - assert_response :success | |
60 | - assert_template 'no_home_page' | |
61 | - end | |
62 | - | |
63 | 54 | def test_should_get_not_found_error_for_unexisting_page |
64 | 55 | uses_host 'anhetegua.net' |
65 | 56 | get :view_page, :profile => 'aprofile', :page => ['some_unexisting_page'] |
... | ... | @@ -707,14 +698,6 @@ class ContentViewerControllerTest < Test::Unit::TestCase |
707 | 698 | assert_tag :tag => 'link', :attributes => { :rel => 'alternate', :type => 'application/rss+xml', :title => 'feed', :href => "http://#{environment.default_hostname}/testinguser/blog/feed" } |
708 | 699 | end |
709 | 700 | |
710 | - should 'link to post with comment form opened' do | |
711 | - login_as(profile.identifier) | |
712 | - a = Blog.create!(:name => 'article folder', :profile => profile) | |
713 | - t = TextileArticle.create!(:name => 'first post', :parent => a, :profile => profile) | |
714 | - get :view_page, :profile => profile.identifier, :page => [a.path] | |
715 | - assert_tag :tag => 'div', :attributes => { :id => "post-#{t.id}" }, :descendant => { :tag => 'a', :content => 'No comments yet', :attributes => { :href => /#{profile.identifier}\/blog\/first-post\?form=opened#comments_list/ } } | |
716 | - end | |
717 | - | |
718 | 701 | should 'hit the article when viewed' do |
719 | 702 | a = profile.articles.create!(:name => 'test article') |
720 | 703 | get :view_page, :profile => profile.identifier, :page => [a.path] |
... | ... | @@ -800,4 +783,10 @@ class ContentViewerControllerTest < Test::Unit::TestCase |
800 | 783 | assert_no_tag :tag => 'div', :attributes => { :id => 'article-source' } |
801 | 784 | end |
802 | 785 | |
786 | + should 'render profile screen when there is no homepage' do | |
787 | + profile.home_page.destroy | |
788 | + get :view_page, :profile => profile.identifier, :page => [] | |
789 | + assert_template 'profile/index' | |
790 | + end | |
791 | + | |
803 | 792 | end | ... | ... |