diff --git a/app/controllers/public/content_viewer_controller.rb b/app/controllers/public/content_viewer_controller.rb index a83e608..eafc5b7 100644 --- a/app/controllers/public/content_viewer_controller.rb +++ b/app/controllers/public/content_viewer_controller.rb @@ -4,13 +4,17 @@ class ContentViewerController < ApplicationController inverse_captcha :field => 'e_mail' + helper ProfileHelper + helper TagsHelper + def view_page path = params[:page].join('/') if path.blank? @page = profile.home_page if @page.nil? - render :action => 'no_home_page' + @tags = profile.tags + render :template => 'profile/index' return end else diff --git a/app/views/content_viewer/_organization.rhtml b/app/views/content_viewer/_organization.rhtml new file mode 120000 index 0000000..4437ef8 --- /dev/null +++ b/app/views/content_viewer/_organization.rhtml @@ -0,0 +1 @@ +../profile/_organization.rhtml \ No newline at end of file diff --git a/app/views/content_viewer/_person.rhtml b/app/views/content_viewer/_person.rhtml new file mode 120000 index 0000000..1f79d54 --- /dev/null +++ b/app/views/content_viewer/_person.rhtml @@ -0,0 +1 @@ +../profile/_person.rhtml \ No newline at end of file diff --git a/app/views/content_viewer/no_home_page.rhtml b/app/views/content_viewer/no_home_page.rhtml deleted file mode 100644 index f6ae1e1..0000000 --- a/app/views/content_viewer/no_home_page.rhtml +++ /dev/null @@ -1,11 +0,0 @@ -

<%= _("Missing home page") %>

- -

-<%= _('%s did not choose an article for homepage yet.') % profile.name %> -

- -<% if user == profile %> -

-<%= link_to _('Click here to set your homepage now!'), :controller => 'cms' %> -

-<% end %> diff --git a/app/views/profile/_organization.rhtml b/app/views/profile/_organization.rhtml index cbeb29e..8deaad0 100644 --- a/app/views/profile/_organization.rhtml +++ b/app/views/profile/_organization.rhtml @@ -4,7 +4,7 @@ <%= display_field(_('Name:'), profile, :name) { |name| link_to name, profile.url } %> - <%= link_to _('Members'), :action => 'members' %> + <%= link_to _('Members'), :controller => 'profile', :action => 'members' %> <% if profile.kind_of?(Enterprise) && !profile.environment.enabled?('disable_products_for_enterprises') %> diff --git a/app/views/profile/_person.rhtml b/app/views/profile/_person.rhtml index b868823..986d6c7 100644 --- a/app/views/profile/_person.rhtml +++ b/app/views/profile/_person.rhtml @@ -28,10 +28,12 @@ - <%= link_to __('Friends'), :action => 'friends' %> - — <%= link_to __('Communities'), :action => 'communities' %> + <%= link_to __('Friends'), :controller => 'profile', :action => 'friends' %> + + — <%= link_to __('Communities'), :controller => "profile", :action => 'communities' %> + <% if !environment.enabled?('disable_asset_enterprises') %> - — <%= link_to __('Enterprises'), :action => 'enterprises' %> + — <%= link_to __('Enterprises'), :controller => 'profile', :action => 'enterprises' %> <% end %> diff --git a/app/views/profile/index.rhtml b/app/views/profile/index.rhtml index 30c3337..8739e34 100644 --- a/app/views/profile/index.rhtml +++ b/app/views/profile/index.rhtml @@ -18,7 +18,7 @@ <%= _('Content published:') %> - <%= link_to _('Site map'), :action => 'sitemap' %> + <%= link_to _('Site map'), :controller => 'profile', :action => 'sitemap' %> diff --git a/test/functional/content_viewer_controller_test.rb b/test/functional/content_viewer_controller_test.rb index 4df1c94..7f77e60 100644 --- a/test/functional/content_viewer_controller_test.rb +++ b/test/functional/content_viewer_controller_test.rb @@ -51,15 +51,6 @@ class ContentViewerControllerTest < Test::Unit::TestCase assert_equal a, assigns(:page) end - def test_should_display_something_else_for_empty_homepage - profile.articles.destroy_all - - get :view_page, :profile => profile.identifier, :page => [] - - assert_response :success - assert_template 'no_home_page' - end - def test_should_get_not_found_error_for_unexisting_page uses_host 'anhetegua.net' get :view_page, :profile => 'aprofile', :page => ['some_unexisting_page'] @@ -707,14 +698,6 @@ class ContentViewerControllerTest < Test::Unit::TestCase assert_tag :tag => 'link', :attributes => { :rel => 'alternate', :type => 'application/rss+xml', :title => 'feed', :href => "http://#{environment.default_hostname}/testinguser/blog/feed" } end - should 'link to post with comment form opened' do - login_as(profile.identifier) - a = Blog.create!(:name => 'article folder', :profile => profile) - t = TextileArticle.create!(:name => 'first post', :parent => a, :profile => profile) - get :view_page, :profile => profile.identifier, :page => [a.path] - 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/ } } - end - should 'hit the article when viewed' do a = profile.articles.create!(:name => 'test article') get :view_page, :profile => profile.identifier, :page => [a.path] @@ -800,4 +783,10 @@ class ContentViewerControllerTest < Test::Unit::TestCase assert_no_tag :tag => 'div', :attributes => { :id => 'article-source' } end + should 'render profile screen when there is no homepage' do + profile.home_page.destroy + get :view_page, :profile => profile.identifier, :page => [] + assert_template 'profile/index' + end + end -- libgit2 0.21.2