From 33bfa4dd231e4042456b3a70059c9cf57af858cf Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Wed, 1 Feb 2012 16:34:06 +1300 Subject: Added support for new code in Refinery CMS since resolve/refinerycms#1234 --- .../refinery/blog/admin/comments_controller.rb | 16 ++++++------- .../refinery/blog/admin/posts_controller.rb | 6 ++--- .../refinery/blog/admin/settings_controller.rb | 10 ++++---- app/controllers/refinery/blog/posts_controller.rb | 4 ++-- app/helpers/refinery/blog/posts_helper.rb | 4 ++-- app/views/refinery/blog/admin/_submenu.html.erb | 28 +++++++++++----------- .../blog/admin/categories/_category.html.erb | 4 ++-- .../refinery/blog/admin/categories/_form.html.erb | 2 +- .../refinery/blog/admin/comments/_comment.html.erb | 8 +++---- .../refinery/blog/admin/comments/index.html.erb | 3 +-- .../refinery/blog/admin/comments/show.html.erb | 8 +++---- app/views/refinery/blog/admin/posts/_form.html.erb | 4 ++-- app/views/refinery/blog/admin/posts/_post.html.erb | 6 ++--- .../settings/notification_recipients.html.erb | 4 ++-- app/views/refinery/blog/posts/_comments.html.erb | 2 +- app/views/refinery/blog/posts/_nav.html.erb | 6 ++--- app/views/refinery/blog/posts/_post.html.erb | 2 +- app/views/refinery/blog/posts/index.rss.builder | 4 ++-- .../refinery/blog/shared/_categories.html.erb | 2 +- app/views/refinery/blog/shared/_post.html.erb | 8 +++---- app/views/refinery/blog/shared/_posts.html.erb | 2 +- app/views/refinery/blog/shared/_rss_feed.html.erb | 2 +- app/views/refinery/blog/shared/_tags.html.erb | 2 +- 23 files changed, 68 insertions(+), 69 deletions(-) (limited to 'app') diff --git a/app/controllers/refinery/blog/admin/comments_controller.rb b/app/controllers/refinery/blog/admin/comments_controller.rb index f9addaa..8565b28 100644 --- a/app/controllers/refinery/blog/admin/comments_controller.rb +++ b/app/controllers/refinery/blog/admin/comments_controller.rb @@ -2,7 +2,7 @@ module Refinery module Blog module Admin class CommentsController < ::Refinery::AdminController - + cache_sweeper Refinery::BlogSweeper crudify :'refinery/blog/comment', @@ -11,35 +11,35 @@ module Refinery def index @comments = Refinery::Blog::Comment.unmoderated.page(params[:page]) - + render :action => 'index' end def approved unless params[:id].present? @comments = Refinery::Blog::Comment.approved.page(params[:page]) - + render :action => 'index' else @comment = Refinery::Blog::Comment.find(params[:id]) @comment.approve! flash[:notice] = t('approved', :scope => 'refinery.blog.admin.comments', :author => @comment.name) - - redirect_to main_app.url_for(:action => params[:return_to] || 'index') + + redirect_to refinery.url_for(:action => params[:return_to] || 'index', :id => nil) end end def rejected unless params[:id].present? @comments = Refinery::Blog::Comment.rejected.page(params[:page]) - + render :action => 'index' else @comment = Refinery::Blog::Comment.find(params[:id]) @comment.reject! flash[:notice] = t('rejected', :scope => 'refinery.blog.admin.comments', :author => @comment.name) - - redirect_to main_app.url_for(:action => params[:return_to] || 'index') + + redirect_to refinery.url_for(:action => params[:return_to] || 'index', :id => nil) end end diff --git a/app/controllers/refinery/blog/admin/posts_controller.rb b/app/controllers/refinery/blog/admin/posts_controller.rb index f8d0f8f..5b50c75 100644 --- a/app/controllers/refinery/blog/admin/posts_controller.rb +++ b/app/controllers/refinery/blog/admin/posts_controller.rb @@ -8,7 +8,7 @@ module Refinery crudify :'refinery/blog/post', :title_attribute => :title, :order => 'published_at DESC', - :redirect_to_url => "main_app.refinery_blog_admin_posts_path" + :redirect_to_url => "refinery.blog_admin_posts_path" before_filter :find_all_categories, :only => [:new, :edit, :create, :update] @@ -54,7 +54,7 @@ module Refinery unless from_dialog? unless params[:continue_editing] =~ /true|on|1/ - redirect_back_or_default(main_app.refinery_blog_admin_posts_path) + redirect_back_or_default(refinery.blog_admin_posts_path) else unless request.xhr? redirect_to :back @@ -63,7 +63,7 @@ module Refinery end end else - render :text => "" + render :text => "" end else unless request.xhr? diff --git a/app/controllers/refinery/blog/admin/settings_controller.rb b/app/controllers/refinery/blog/admin/settings_controller.rb index e47fe7b..96687ad 100644 --- a/app/controllers/refinery/blog/admin/settings_controller.rb +++ b/app/controllers/refinery/blog/admin/settings_controller.rb @@ -11,9 +11,9 @@ module Refinery flash[:notice] = t('updated', :scope => 'admin.blog.settings.notification_recipients', :recipients => Refinery::Blog::Comment::Notification.recipients) unless request.xhr? or from_dialog? - redirect_back_or_default(main_app.refinery_blog_admin_posts_path) + redirect_back_or_default(refinery.blog_admin_posts_path) else - render :text => "", + render :text => "", :layout => false end end @@ -22,7 +22,7 @@ module Refinery def moderation enabled = Refinery::Blog::Comment::Moderation.toggle! unless request.xhr? - redirect_back_or_default(main_app.refinery_blog_admin_posts_path) + redirect_back_or_default(refinery.blog_admin_posts_path) else render :json => {:enabled => enabled}, :layout => false @@ -32,7 +32,7 @@ module Refinery def comments enabled = Refinery::Blog::Comment.toggle! unless request.xhr? - redirect_back_or_default(main_app.refinery_blog_admin_posts_path) + redirect_back_or_default(refinery.blog_admin_posts_path) else render :json => {:enabled => enabled}, :layout => false @@ -42,7 +42,7 @@ module Refinery def teasers enabled = Refinery::Blog::Post.teaser_enabled_toggle! unless request.xhr? - redirect_back_or_default(main_app.refinery_blog_admin_posts_path) + redirect_back_or_default(refinery.blog_admin_posts_path) else render :json => {:enabled => enabled}, :layout => false diff --git a/app/controllers/refinery/blog/posts_controller.rb b/app/controllers/refinery/blog/posts_controller.rb index 417cf29..abd60f4 100644 --- a/app/controllers/refinery/blog/posts_controller.rb +++ b/app/controllers/refinery/blog/posts_controller.rb @@ -42,10 +42,10 @@ module Refinery if Comment::Moderation.enabled? flash[:notice] = t('thank_you_moderated', :scope => 'refinery.blog.posts.comments') - redirect_to main_app.refinery_blog_post_url(params[:id]) + redirect_to refinery.blog_post_url(params[:id]) else flash[:notice] = t('thank_you', :scope => 'refinery.blog.posts.comments') - redirect_to main_app.refinery_blog_post_url(params[:id], + redirect_to refinery.blog_post_url(params[:id], :anchor => "comment-#{@comment.to_param}") end else diff --git a/app/helpers/refinery/blog/posts_helper.rb b/app/helpers/refinery/blog/posts_helper.rb index 49e5250..ee19cec 100644 --- a/app/helpers/refinery/blog/posts_helper.rb +++ b/app/helpers/refinery/blog/posts_helper.rb @@ -36,14 +36,14 @@ module Refinery count = Blog::Post.by_archive(Time.parse(post_date)).size text = t("date.month_names")[month.to_i] + " #{year} (#{count})" - link_to(text, main_app.refinery_blog_archive_posts_path(:year => year, :month => month)) + link_to(text, refinery.blog_archive_posts_path(:year => year, :month => month)) else post_date = post.published_at.strftime('01/%Y') year = post_date.split('/')[1] count = Refinery::Blog::Post.by_year(Time.parse(post_date)).size text = "#{year} (#{count})" - link_to(text, main_app.refinery_blog_archive_posts_path(:year => year)) + link_to(text, refinery.blog_archive_posts_path(:year => year)) end end end diff --git a/app/views/refinery/blog/admin/_submenu.html.erb b/app/views/refinery/blog/admin/_submenu.html.erb index d290ce8..e78510e 100644 --- a/app/views/refinery/blog/admin/_submenu.html.erb +++ b/app/views/refinery/blog/admin/_submenu.html.erb @@ -3,7 +3,7 @@ @@ -14,15 +14,15 @@ :class => 'page_copy_icon' %>
  • - <%= link_to t('.posts.manage'), main_app.refinery_blog_admin_posts_path, + <%= link_to t('.posts.manage'), refinery.blog_admin_posts_path, :class => 'page_icon' %>
  • - <%= link_to t('.posts.uncategorized'), main_app.uncategorized_refinery_blog_admin_posts_path, + <%= link_to t('.posts.uncategorized'), refinery.uncategorized_blog_admin_posts_path, :class => 'page_icon' %>
  • - <%= link_to t('.posts.new'), main_app.new_refinery_blog_admin_post_path, + <%= link_to t('.posts.new'), refinery.new_blog_admin_post_path, :class => 'page_add_icon' %>
  • @@ -38,15 +38,15 @@ :class => 'comments_icon' %>
  • - <%= link_to t('.comments.new'), main_app.refinery_blog_admin_comments_path, + <%= link_to t('.comments.new'), refinery.blog_admin_comments_path, :class => 'comment_icon' %>
  • - <%= link_to t('.comments.approved'), main_app.approved_refinery_blog_admin_comments_path, + <%= link_to t('.comments.approved'), refinery.approved_blog_admin_comments_path, :class => 'comment_tick_icon' %>
  • - <%= link_to t('.comments.rejected'), main_app.rejected_refinery_blog_admin_comments_path, + <%= link_to t('.comments.rejected'), refinery.rejected_blog_admin_comments_path, :class => 'comment_cross_icon' %>
  • @@ -58,36 +58,36 @@ :class => 'folder_icon' %>
  • - <%= link_to t('.categories.manage'), main_app.refinery_blog_admin_categories_path, + <%= link_to t('.categories.manage'), refinery.blog_admin_categories_path, :class => 'folder_edit_icon' %>
  • - <%= link_to t('.categories.new'), main_app.new_refinery_blog_admin_category_path(:dialog => true, :height => 325), + <%= link_to t('.categories.new'), refinery.new_blog_admin_category_path(:dialog => true, :height => 325), :class => 'folder_add_icon' %>
  • diff --git a/app/views/refinery/blog/admin/categories/_category.html.erb b/app/views/refinery/blog/admin/categories/_category.html.erb index d476439..a8c4ab0 100644 --- a/app/views/refinery/blog/admin/categories/_category.html.erb +++ b/app/views/refinery/blog/admin/categories/_category.html.erb @@ -5,11 +5,11 @@ <%= link_to refinery_icon_tag("application_edit.png"), - main_app.edit_refinery_blog_admin_category_path(category, + refinery.edit_blog_admin_category_path(category, :dialog => true, :height => 325), :title => t('.edit') %> - <%= link_to refinery_icon_tag("delete.png"), main_app.refinery_blog_admin_category_path(category), + <%= link_to refinery_icon_tag("delete.png"), refinery.blog_admin_category_path(category), :class => "cancel confirm-delete", :title => t('.delete'), :method => :delete, diff --git a/app/views/refinery/blog/admin/categories/_form.html.erb b/app/views/refinery/blog/admin/categories/_form.html.erb index 3ad489f..b1cf16c 100644 --- a/app/views/refinery/blog/admin/categories/_form.html.erb +++ b/app/views/refinery/blog/admin/categories/_form.html.erb @@ -1,4 +1,4 @@ -<%= form_for [main_app, :refinery_blog_admin, @category] do |f| -%> +<%= form_for [refinery, :blog_admin, @category] do |f| -%> <%= render :partial => "/refinery/admin/error_messages", :locals => { :object => f.object, diff --git a/app/views/refinery/blog/admin/comments/_comment.html.erb b/app/views/refinery/blog/admin/comments/_comment.html.erb index f4a7a16..c007294 100644 --- a/app/views/refinery/blog/admin/comments/_comment.html.erb +++ b/app/views/refinery/blog/admin/comments/_comment.html.erb @@ -5,16 +5,16 @@ <%= link_to refinery_icon_tag("application_go.png"), - main_app.refinery_blog_post_path(comment.post, :anchor => "comment-#{comment.to_param}"), + refinery.blog_post_path(comment.post, :anchor => "comment-#{comment.to_param}"), :title => t('.view_live_html'), :target => "_blank" unless comment.unmoderated? %> - <%= link_to refinery_icon_tag('zoom.png'), main_app.refinery_blog_admin_comment_path(comment), + <%= link_to refinery_icon_tag('zoom.png'), refinery.blog_admin_comment_path(comment), :title => t('.read') %> <%= link_to refinery_icon_tag("cross.png"), - main_app.rejected_refinery_blog_admin_comment_path(comment, :return_to => request.path.split('/').last.gsub(/^comments$/, 'index')), + refinery.rejected_blog_admin_comment_path(comment, :return_to => request.path.split('/').last.gsub(/^comments$/, 'index')), :title => t('.reject') unless comment.rejected? %> <%= link_to refinery_icon_tag("tick.png"), - main_app.approved_refinery_blog_admin_comment_path(comment, :return_to => request.path.split('/').last.gsub(/^comments$/, 'index')), + refinery.approved_blog_admin_comment_path(comment, :return_to => request.path.split('/').last.gsub(/^comments$/, 'index')), :title => t('.approve') unless comment.approved? %> diff --git a/app/views/refinery/blog/admin/comments/index.html.erb b/app/views/refinery/blog/admin/comments/index.html.erb index 991980d..dd84e9d 100644 --- a/app/views/refinery/blog/admin/comments/index.html.erb +++ b/app/views/refinery/blog/admin/comments/index.html.erb @@ -23,8 +23,7 @@ <%= will_paginate @comments %> <% else %>

    - <%= t('.no_items_yet', - :type => action_name.gsub('index', 'new')).downcase %> + <%= t('.no_items_yet', :type => action_name.gsub('index', 'new').downcase) %>

    <% end %> <% end %> diff --git a/app/views/refinery/blog/admin/comments/show.html.erb b/app/views/refinery/blog/admin/comments/show.html.erb index df04b3e..2246c2f 100644 --- a/app/views/refinery/blog/admin/comments/show.html.erb +++ b/app/views/refinery/blog/admin/comments/show.html.erb @@ -6,14 +6,14 @@

    <%= t('.actions') %>

    @@ -27,7 +27,7 @@ <%= link_to @comment.post.title, - main_app.refinery_blog_post_path(@comment.post, :anchor => "comment-#{@comment.to_param}"), + refinery.blog_post_path(@comment.post, :anchor => "comment-#{@comment.to_param}"), :target => '_blank' %> diff --git a/app/views/refinery/blog/admin/posts/_form.html.erb b/app/views/refinery/blog/admin/posts/_form.html.erb index 68b1d31..9bfd42a 100644 --- a/app/views/refinery/blog/admin/posts/_form.html.erb +++ b/app/views/refinery/blog/admin/posts/_form.html.erb @@ -1,4 +1,4 @@ -<%= form_for [main_app, :refinery_blog_admin, @post] do |f| -%> +<%= form_for [refinery, :blog_admin, @post] do |f| -%> <%= render :partial => "/refinery/admin/error_messages", :locals => { :object => f.object, @@ -121,4 +121,4 @@ <% content_for :stylesheets, stylesheet_link_tag('refinery/blog/backend') %> <% content_for :javascripts, javascript_include_tag('refinery/blog/backend') %> -<%= render 'refinery/shared/admin/autocomplete', :dom_id => '#blog_post_tag_list', :url => main_app.tags_refinery_blog_admin_posts_url %> +<%= render 'refinery/shared/admin/autocomplete', :dom_id => '#blog_post_tag_list', :url => refinery.tags_blog_admin_posts_url %> diff --git a/app/views/refinery/blog/admin/posts/_post.html.erb b/app/views/refinery/blog/admin/posts/_post.html.erb index 887c830..b5018f3 100644 --- a/app/views/refinery/blog/admin/posts/_post.html.erb +++ b/app/views/refinery/blog/admin/posts/_post.html.erb @@ -7,12 +7,12 @@ - <%= link_to refinery_icon_tag("application_go.png"), main_app.refinery_blog_post_path(post), + <%= link_to refinery_icon_tag("application_go.png"), refinery.blog_post_path(post), :title => t('.view_live_html'), :target => "_blank" %> - <%= link_to refinery_icon_tag("application_edit.png"), main_app.edit_refinery_blog_admin_post_path(post), + <%= link_to refinery_icon_tag("application_edit.png"), refinery.edit_blog_admin_post_path(post), :title => t('.edit') %> - <%= link_to refinery_icon_tag("delete.png"), main_app.refinery_blog_admin_post_path(post), + <%= link_to refinery_icon_tag("delete.png"), refinery.blog_admin_post_path(post), :class => "cancel confirm-delete", :title => t('.delete'), :method => :delete, diff --git a/app/views/refinery/blog/admin/settings/notification_recipients.html.erb b/app/views/refinery/blog/admin/settings/notification_recipients.html.erb index f4579d3..132ab17 100644 --- a/app/views/refinery/blog/admin/settings/notification_recipients.html.erb +++ b/app/views/refinery/blog/admin/settings/notification_recipients.html.erb @@ -1,4 +1,4 @@ -<%= form_tag main_app.notification_recipients_refinery_blog_admin_settings_path do %> +<%= form_tag refinery.notification_recipients_blog_admin_settings_path do %>
    @@ -18,7 +18,7 @@ :locals => { :f => nil, :continue_editing => false, - :cancel_url => main_app.refinery_blog_admin_posts_url, + :cancel_url => refinery.blog_admin_posts_url, :hide_delete => true } %> <% end %> diff --git a/app/views/refinery/blog/posts/_comments.html.erb b/app/views/refinery/blog/posts/_comments.html.erb index a34d106..d662a1f 100644 --- a/app/views/refinery/blog/posts/_comments.html.erb +++ b/app/views/refinery/blog/posts/_comments.html.erb @@ -15,7 +15,7 @@ <% end %>

    <%= t('add', :scope => 'refinery.blog.posts.show.comments') %>

    - <%= form_for [main_app, :refinery_blog, @comment] do |f| %> + <%= form_for [refinery, :blog, @comment] do |f| %> <%= render :partial => "/refinery/admin/error_messages", :locals => { :object => f.object, diff --git a/app/views/refinery/blog/posts/_nav.html.erb b/app/views/refinery/blog/posts/_nav.html.erb index 3daacab..eafd35e 100644 --- a/app/views/refinery/blog/posts/_nav.html.erb +++ b/app/views/refinery/blog/posts/_nav.html.erb @@ -1,17 +1,17 @@ diff --git a/app/views/refinery/blog/posts/_post.html.erb b/app/views/refinery/blog/posts/_post.html.erb index 77e43ff..c3ae924 100644 --- a/app/views/refinery/blog/posts/_post.html.erb +++ b/app/views/refinery/blog/posts/_post.html.erb @@ -21,7 +21,7 @@ <% end %> diff --git a/app/views/refinery/blog/posts/index.rss.builder b/app/views/refinery/blog/posts/index.rss.builder index 99ae0eb..867c6d6 100644 --- a/app/views/refinery/blog/posts/index.rss.builder +++ b/app/views/refinery/blog/posts/index.rss.builder @@ -3,14 +3,14 @@ xml.rss :version => "2.0" do xml.channel do xml.title Refinery::Core.config.site_name xml.description Refinery::Core.config.site_name + " Blog Posts" - xml.link main_app.refinery_blog_root_url + xml.link refinery.blog_root_url @posts.each do |post| xml.item do xml.title post.title xml.description post.body xml.pubDate post.published_at.to_s(:rfc822) - xml.link main_app.refinery_blog_post_url(post) + xml.link refinery.blog_post_url(post) end end end diff --git a/app/views/refinery/blog/shared/_categories.html.erb b/app/views/refinery/blog/shared/_categories.html.erb index d7524ef..64f4ee6 100644 --- a/app/views/refinery/blog/shared/_categories.html.erb +++ b/app/views/refinery/blog/shared/_categories.html.erb @@ -3,7 +3,7 @@
      <% @categories.each do |category| %> > - <%= link_to "#{category.title} (#{category.post_count})", main_app.refinery_blog_category_path(category) %> + <%= link_to "#{category.title} (#{category.post_count})", refinery.blog_category_path(category) %> <% end %>
    diff --git a/app/views/refinery/blog/shared/_post.html.erb b/app/views/refinery/blog/shared/_post.html.erb index 279de92..1a52fd4 100644 --- a/app/views/refinery/blog/shared/_post.html.erb +++ b/app/views/refinery/blog/shared/_post.html.erb @@ -1,7 +1,7 @@ <% if post.live? %>
    -

    <%= link_to post.title, main_app.refinery_blog_post_path(post) %>

    +

    <%= link_to post.title, refinery.blog_post_path(post) %>

    @@ -30,7 +30,7 @@