diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index f121639..d0218ea 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -77,11 +77,9 @@ module ApplicationHelper content_tag('div', @virtual_community.name, :id => 'virtual_community_identification') end - # TODO: test this helper - # TODO: remove the absolute path def link_to_cms(text, profile = nil, options = {}) profile ||= current_user.login - link_to text, profile_path(:controller => 'cms', :profile => profile), options + link_to text, myprofile_path(:controller => 'cms', :profile => profile), options end def link_to_profile(text, profile = nil, options = {}) diff --git a/app/views/cms/index.rhtml b/app/views/cms/index.rhtml index 567cba4..3a14de5 100644 --- a/app/views/cms/index.rhtml +++ b/app/views/cms/index.rhtml @@ -3,7 +3,7 @@

- <%= _('Document List') %> + <%= _('Articles') %> <%= image_tag 'comatose/spinner.gif', :id=>'spinner', :align=>'absmiddle', :style=>'display:none;' %>

@@ -13,6 +13,10 @@ <% end %> +
+ <%= link_to _('New article'), :action => 'new' %> +
+
<%= javascript_tag "ComatoseList.init()" %> diff --git a/app/views/layouts/application.rhtml b/app/views/layouts/application.rhtml index 401b00f..6b6d0f3 100644 --- a/app/views/layouts/application.rhtml +++ b/app/views/layouts/application.rhtml @@ -1,17 +1,20 @@ + <%= javascript_include_tag :defaults %> <%= design_all_header_tags %> <%= javascript_include_tag 'cms' %> + <%= javascript_include_tag 'menu' %> <% if params[:controller] == 'cms' %> <%= stylesheet_link_tag 'cms' %> <% end %> <%= stylesheet_link_tag 'common' %> + <%= stylesheet_link_tag 'menu' %> <%= image_tag 'loading.gif', :id => 'spinner', :style => "display:none; float:right;" %> -
+
<% unless flash[:notice].nil? %>
<%= flash[:notice] %> diff --git a/config/routes.rb b/config/routes.rb index 7032d27..27180e4 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -54,7 +54,6 @@ ActionController::Routing::Routes.draw do |map| ## Public controllers ###################################################### - map.profile 'profile/:profile/:controller', :controller => 'profile' # *content viewing* # XXX this route must come last so other routes have priority over it. map.homepage ':profile/*page', :controller => 'content_viewer', :action => 'view_page' diff --git a/test/integration/manage_documents_test.rb b/test/integration/manage_documents_test.rb index ad3cd33..9c1d580 100644 --- a/test/integration/manage_documents_test.rb +++ b/test/integration/manage_documents_test.rb @@ -9,9 +9,12 @@ class ManageDocumentsTest < ActionController::IntegrationTest login('ze', 'test') + assert_tag :tag => 'a', :attributes => { :href => '/myprofile/ze/cms' } + get '/myprofile/ze/cms' assert_response :success + assert_tag :tag => 'a', :attributes => { :href => '/myprofile/ze/cms/new' } get '/myprofile/ze/cms/new' assert_response :success assert_tag :tag => 'form', :attributes => { :action => '/myprofile/ze/cms/new' } @@ -21,6 +24,7 @@ class ManageDocumentsTest < ActionController::IntegrationTest follow_redirect! assert_response :success + assert_equal '/myprofile/ze/cms', path assert_equal count + 1, Article.count @@ -39,18 +43,24 @@ class ManageDocumentsTest < ActionController::IntegrationTest post "myprofile/ze/cms/edit/#{id}", :page => { :body => 'changed_body' } assert_response :redirect + follow_redirect! + assert_equal '/myprofile/ze/cms', path end def test_removing_an_article + article = Article.create!(:title => 'to be removed', :body => 'go to hell', :parent_id => Article.find_by_path('ze').id) count = Article.count get '/myprofile/ze/cms' assert_response :success + assert_tag :tag => 'a', :attributes => { :href => "/myprofile/ze/cms/delete/#{article.id}" } post "/myprofile/ze/cms/delete/#{article.id}" assert_response :redirect + follow_redirect! + assert_equal '/myprofile/ze/cms', path assert_raise ActiveRecord::RecordNotFound do Article.find(article.id) diff --git a/test/unit/profile_helper_test.rb b/test/unit/profile_helper_test.rb index 81a49a6..cd4ee85 100644 --- a/test/unit/profile_helper_test.rb +++ b/test/unit/profile_helper_test.rb @@ -3,14 +3,14 @@ require File.dirname(__FILE__) + '/../test_helper' class ProfileHelperTest < Test::Unit::TestCase def setup - @profile = Profile.new + @profile = mock @helper = mock helper.extend(ProfileHelper) end attr_reader :profile, :helper def test_should_ignore_nil - profile.stubs(:info).returns(nil) + profile.expects(:info).returns(nil) helper.expects(:content_tag) helper.expects(:_) -- libgit2 0.21.2