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,13 +4,17 @@ class ContentViewerController < ApplicationController | ||
4 | 4 | ||
5 | inverse_captcha :field => 'e_mail' | 5 | inverse_captcha :field => 'e_mail' |
6 | 6 | ||
7 | + helper ProfileHelper | ||
8 | + helper TagsHelper | ||
9 | + | ||
7 | def view_page | 10 | def view_page |
8 | path = params[:page].join('/') | 11 | path = params[:page].join('/') |
9 | 12 | ||
10 | if path.blank? | 13 | if path.blank? |
11 | @page = profile.home_page | 14 | @page = profile.home_page |
12 | if @page.nil? | 15 | if @page.nil? |
13 | - render :action => 'no_home_page' | 16 | + @tags = profile.tags |
17 | + render :template => 'profile/index' | ||
14 | return | 18 | return |
15 | end | 19 | end |
16 | else | 20 | else |
app/views/content_viewer/no_home_page.rhtml
@@ -1,11 +0,0 @@ | @@ -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,7 +4,7 @@ | ||
4 | <%= display_field(_('Name:'), profile, :name) { |name| link_to name, profile.url } %> | 4 | <%= display_field(_('Name:'), profile, :name) { |name| link_to name, profile.url } %> |
5 | <tr> | 5 | <tr> |
6 | <td colspan='2'> | 6 | <td colspan='2'> |
7 | - <%= link_to _('Members'), :action => 'members' %></li> | 7 | + <%= link_to _('Members'), :controller => 'profile', :action => 'members' %></li> |
8 | </td> | 8 | </td> |
9 | </tr> | 9 | </tr> |
10 | <% if profile.kind_of?(Enterprise) && !profile.environment.enabled?('disable_products_for_enterprises') %> | 10 | <% if profile.kind_of?(Enterprise) && !profile.environment.enabled?('disable_products_for_enterprises') %> |
app/views/profile/_person.rhtml
@@ -28,10 +28,12 @@ | @@ -28,10 +28,12 @@ | ||
28 | </tr> | 28 | </tr> |
29 | <tr> | 29 | <tr> |
30 | <td colspan='2'> | 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 | <% if !environment.enabled?('disable_asset_enterprises') %> | 35 | <% if !environment.enabled?('disable_asset_enterprises') %> |
34 | - — <%= link_to __('Enterprises'), :action => 'enterprises' %> | 36 | + — <%= link_to __('Enterprises'), :controller => 'profile', :action => 'enterprises' %> |
35 | <% end %> | 37 | <% end %> |
36 | </td> | 38 | </td> |
37 | </tr> | 39 | </tr> |
app/views/profile/index.rhtml
@@ -18,7 +18,7 @@ | @@ -18,7 +18,7 @@ | ||
18 | <%= _('Content published:') %> | 18 | <%= _('Content published:') %> |
19 | </td> | 19 | </td> |
20 | <td> | 20 | <td> |
21 | - <%= link_to _('Site map'), :action => 'sitemap' %> | 21 | + <%= link_to _('Site map'), :controller => 'profile', :action => 'sitemap' %> |
22 | </td> | 22 | </td> |
23 | </tr> | 23 | </tr> |
24 | <tr> | 24 | <tr> |
test/functional/content_viewer_controller_test.rb
@@ -51,15 +51,6 @@ class ContentViewerControllerTest < Test::Unit::TestCase | @@ -51,15 +51,6 @@ class ContentViewerControllerTest < Test::Unit::TestCase | ||
51 | assert_equal a, assigns(:page) | 51 | assert_equal a, assigns(:page) |
52 | end | 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 | def test_should_get_not_found_error_for_unexisting_page | 54 | def test_should_get_not_found_error_for_unexisting_page |
64 | uses_host 'anhetegua.net' | 55 | uses_host 'anhetegua.net' |
65 | get :view_page, :profile => 'aprofile', :page => ['some_unexisting_page'] | 56 | get :view_page, :profile => 'aprofile', :page => ['some_unexisting_page'] |
@@ -707,14 +698,6 @@ class ContentViewerControllerTest < Test::Unit::TestCase | @@ -707,14 +698,6 @@ class ContentViewerControllerTest < Test::Unit::TestCase | ||
707 | assert_tag :tag => 'link', :attributes => { :rel => 'alternate', :type => 'application/rss+xml', :title => 'feed', :href => "http://#{environment.default_hostname}/testinguser/blog/feed" } | 698 | assert_tag :tag => 'link', :attributes => { :rel => 'alternate', :type => 'application/rss+xml', :title => 'feed', :href => "http://#{environment.default_hostname}/testinguser/blog/feed" } |
708 | end | 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 | should 'hit the article when viewed' do | 701 | should 'hit the article when viewed' do |
719 | a = profile.articles.create!(:name => 'test article') | 702 | a = profile.articles.create!(:name => 'test article') |
720 | get :view_page, :profile => profile.identifier, :page => [a.path] | 703 | get :view_page, :profile => profile.identifier, :page => [a.path] |
@@ -800,4 +783,10 @@ class ContentViewerControllerTest < Test::Unit::TestCase | @@ -800,4 +783,10 @@ class ContentViewerControllerTest < Test::Unit::TestCase | ||
800 | assert_no_tag :tag => 'div', :attributes => { :id => 'article-source' } | 783 | assert_no_tag :tag => 'div', :attributes => { :id => 'article-source' } |
801 | end | 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 | end | 792 | end |