From a18ff65ca5322200d40bd54fe9b95b99cd8a116b Mon Sep 17 00:00:00 2001 From: Joenio Costa Date: Fri, 19 Dec 2008 17:55:41 -0300 Subject: [PATCH] ActionItem806: add button to config blog in control panel --- app/controllers/my_profile/cms_controller.rb | 11 ++++++++++- app/views/cms/_blog.rhtml | 2 ++ app/views/content_viewer/view_page.rhtml | 4 +++- app/views/profile_editor/index.rhtml | 6 ++++++ public/images/icons-app/README | 1 + public/images/icons-app/blog-disabled.png | Bin 0 -> 1897 bytes public/images/icons-app/blog.png | 1 + public/images/icons-app/livejournal.png | Bin 0 -> 3163 bytes test/functional/cms_controller_test.rb | 24 ++++++++++++++++++++++++ test/functional/profile_editor_controller_test.rb | 11 +++++++++++ 10 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 public/images/icons-app/blog-disabled.png create mode 120000 public/images/icons-app/blog.png create mode 100644 public/images/icons-app/livejournal.png diff --git a/app/controllers/my_profile/cms_controller.rb b/app/controllers/my_profile/cms_controller.rb index cdd7f82..dcc67e6 100644 --- a/app/controllers/my_profile/cms_controller.rb +++ b/app/controllers/my_profile/cms_controller.rb @@ -61,6 +61,9 @@ class CmsController < MyProfileController @article = profile.articles.find(params[:id]) @parent_id = params[:parent_id] @type = params[:type] + if !@article.nil? && @article.blog? || !@type.nil? && @type == 'Blog' + @back_url = url_for(:controller => 'profile_editor', :profile => profile.identifier) + end record_coming_from_public_view if request.post? @article.last_changed_by = user @@ -89,6 +92,10 @@ class CmsController < MyProfileController @parent_id = params[:parent_id] render :action => 'select_article_type', :layout => false return + else + if @type == 'Blog' + @back_url = url_for(:controller => 'profile_editor', :profile => profile.identifier) + end end raise "Invalid article type #{@type}" unless valid_article_type?(@type) @@ -175,7 +182,9 @@ class CmsController < MyProfileController protected def redirect_back - if params[:back_to] == 'public_view' + if params[:back_to] == 'control_panel' + redirect_to :controller => 'profile_editor', :profile => @profile.identifier + elsif params[:back_to] == 'public_view' redirect_to @article.url elsif @article.parent redirect_to :action => 'view', :id => @article.parent diff --git a/app/views/cms/_blog.rhtml b/app/views/cms/_blog.rhtml index 1e4f6ea..57414ef 100644 --- a/app/views/cms/_blog.rhtml +++ b/app/views/cms/_blog.rhtml @@ -15,3 +15,5 @@ <%= labelled_form_field(_('Use as description in RSS Feed:'), feed.select(:feed_item_description, [ [ _('Article abstract'), 'abstract'], [ _('Article body'), 'body']])) %> <% end %> + +<%= javascript_tag "$('back_to').value = 'control_panel'" %> diff --git a/app/views/content_viewer/view_page.rhtml b/app/views/content_viewer/view_page.rhtml index 0f70cf1..61e1070 100644 --- a/app/views/content_viewer/view_page.rhtml +++ b/app/views/content_viewer/view_page.rhtml @@ -30,11 +30,13 @@ if ( act ) act.className = ( show ? "show" : "hidden" ); } - <% if logged_in? && current_user.person.has_permission?('post_content', profile) %> + <% if logged_in? && current_user.person.has_permission?('post_content', profile) %>