diff --git a/app/controllers/my_profile/cms_controller.rb b/app/controllers/my_profile/cms_controller.rb index b0dd31d..0bbb6e4 100644 --- a/app/controllers/my_profile/cms_controller.rb +++ b/app/controllers/my_profile/cms_controller.rb @@ -118,10 +118,7 @@ class CmsController < MyProfileController end end - unless @article.kind_of?(RssFeed) - @escaped_body = CGI::escapeHTML(@article.body || '') - @escaped_abstract = CGI::escapeHTML(@article.abstract || '') - end + escape_fields @article end def new @@ -192,6 +189,8 @@ class CmsController < MyProfileController end end + escape_fields @article + render :action => 'edit' end @@ -541,4 +540,10 @@ class CmsController < MyProfileController end end + def escape_fields article + unless article.kind_of?(RssFeed) + @escaped_body = CGI::escapeHTML(article.body || '') + @escaped_abstract = CGI::escapeHTML(article.abstract || '') + end + end end diff --git a/test/functional/cms_controller_test.rb b/test/functional/cms_controller_test.rb index 4da4482..6551132 100644 --- a/test/functional/cms_controller_test.rb +++ b/test/functional/cms_controller_test.rb @@ -1839,14 +1839,6 @@ class CmsControllerTest < ActionController::TestCase assert_equal 'first version', assigns(:article).name end - should 'clone article with its content' do - article = profile.articles.create(:name => 'first version') - - get :new, :profile => profile.identifier, :id => article.id, :clone => true, :type => 'TinyMceArticle' - - assert_match article.name, @response.body - end - should 'save article with content from older version' do article = profile.articles.create(:name => 'first version') article.name = 'second version'; article.save @@ -1918,6 +1910,10 @@ class CmsControllerTest < ActionController::TestCase assert_equal main_article.parent_id, cloned_main_article.parent_id + get :new, :profile => profile.identifier, :id => cloned_main_article.id, + :clone => true, :type => 'TinyMceArticle' + + assert_match main_article.body, @response.body end protected -- libgit2 0.21.2