Permalink
Browse files

Added support for new code in Refinery CMS since resolve/refinerycms#…

…1234
  • Loading branch information...
parndt committed Feb 1, 2012
1 parent 30ebf2d commit 33bfa4dd231e4042456b3a70059c9cf57af858cf
Showing with 184 additions and 199 deletions.
  1. +8 −8 app/controllers/refinery/blog/admin/comments_controller.rb
  2. +3 −3 app/controllers/refinery/blog/admin/posts_controller.rb
  3. +5 −5 app/controllers/refinery/blog/admin/settings_controller.rb
  4. +2 −2 app/controllers/refinery/blog/posts_controller.rb
  5. +2 −2 app/helpers/refinery/blog/posts_helper.rb
  6. +14 −14 app/views/refinery/blog/admin/_submenu.html.erb
  7. +2 −2 app/views/refinery/blog/admin/categories/_category.html.erb
  8. +1 −1 app/views/refinery/blog/admin/categories/_form.html.erb
  9. +4 −4 app/views/refinery/blog/admin/comments/_comment.html.erb
  10. +1 −2 app/views/refinery/blog/admin/comments/index.html.erb
  11. +4 −4 app/views/refinery/blog/admin/comments/show.html.erb
  12. +2 −2 app/views/refinery/blog/admin/posts/_form.html.erb
  13. +3 −3 app/views/refinery/blog/admin/posts/_post.html.erb
  14. +2 −2 app/views/refinery/blog/admin/settings/notification_recipients.html.erb
  15. +1 −1 app/views/refinery/blog/posts/_comments.html.erb
  16. +3 −3 app/views/refinery/blog/posts/_nav.html.erb
  17. +1 −1 app/views/refinery/blog/posts/_post.html.erb
  18. +2 −2 app/views/refinery/blog/posts/index.rss.builder
  19. +1 −1 app/views/refinery/blog/shared/_categories.html.erb
  20. +4 −4 app/views/refinery/blog/shared/_post.html.erb
  21. +1 −1 app/views/refinery/blog/shared/_posts.html.erb
  22. +1 −1 app/views/refinery/blog/shared/_rss_feed.html.erb
  23. +1 −1 app/views/refinery/blog/shared/_tags.html.erb
  24. +14 −16 config/routes.rb
  25. +1 −1 spec/lib/refinery/blog/engine_spec.rb
  26. +1 −1 spec/requests/refinery/blog/admin/categories_spec.rb
  27. +42 −44 spec/requests/refinery/blog/admin/comments_spec.rb
  28. +1 −1 spec/requests/refinery/blog/admin/menu_spec.rb
  29. +9 −9 spec/requests/refinery/blog/admin/posts_spec.rb
  30. +1 −1 spec/requests/refinery/blog/categories_spec.rb
  31. +11 −11 spec/requests/refinery/blog/posts_spec.rb
  32. +36 −15 spec/spec_helper.rb
  33. +0 −17 spec/support/database_cleaner.rb
  34. +0 −8 spec/support/devise.rb
  35. +0 −6 spec/support/refinery.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 @@ class CommentsController < ::Refinery::AdminController
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
@@ -8,7 +8,7 @@ class PostsController < ::Refinery::AdminController
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 @@ def create
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 @@ def create
end
end
else
render :text => "<script>parent.window.location = '#{main_app.refinery_blog_admin_posts_url}';</script>"
render :text => "<script>parent.window.location = '#{refinery.blog_admin_posts_url}';</script>"
end
else
unless request.xhr?
@@ -11,9 +11,9 @@ def notification_recipients
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 => "<script type='text/javascript'>parent.window.location = '#{main_app.refinery_blog_admin_posts_path}';</script>",
render :text => "<script type='text/javascript'>parent.window.location = '#{refinery.blog_admin_posts_path}';</script>",
:layout => false
end
end
@@ -22,7 +22,7 @@ def notification_recipients
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 @@ def moderation
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 @@ def comments
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
@@ -42,10 +42,10 @@ def comment
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
@@ -36,14 +36,14 @@ def archive_link(post)
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
@@ -3,7 +3,7 @@
<li class='not_a_link'>
<%= render :partial => "/refinery/admin/search",
:locals => {
:url => main_app.refinery_blog_admin_posts_path
:url => refinery.blog_admin_posts_path
} %>
</li>
</ul>
@@ -14,15 +14,15 @@
:class => 'page_copy_icon' %>
</li>
<li>
<%= 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' %>
</li>
<li>
<%= 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' %>
</li>
<li>
<%= 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' %>
</li>
</ul>
@@ -38,15 +38,15 @@
:class => 'comments_icon' %>
</li>
<li>
<%= 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' %>
</li>
<li>
<%= 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' %>
</li>
<li>
<%= 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' %>
</li>
</ul>
@@ -58,36 +58,36 @@
:class => 'folder_icon' %>
</li>
<li>
<%= 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' %>
</li>
<li>
<%= 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' %>
</li>
</ul>
<ul class='collapsible_menu'>
<li class='not_a_link'>
<%= link_to t('.settings.title'), main_app.refinery_blog_admin_settings_path,
<%= link_to t('.settings.title'), refinery.blog_admin_settings_path,
:class => 'settings_icon' %>
</li>
<li>
<%= link_to t('.settings.comments'), main_app.comments_refinery_blog_admin_settings_path,
<%= link_to t('.settings.comments'), refinery.comments_blog_admin_settings_path,
:class => "#{Refinery::Blog::Post.comments_allowed? ? 'success' : 'failure'}_icon" %>
</li>
<li>
<%= link_to t('.settings.moderation'), main_app.moderation_refinery_blog_admin_settings_path,
<%= link_to t('.settings.moderation'), refinery.moderation_blog_admin_settings_path,
:class => "#{Refinery::Blog::Comment::Moderation.enabled? ? 'success' : 'failure'}_icon" %>
</li>
<li>
<%= link_to t('.settings.update_notified'),
main_app.notification_recipients_refinery_blog_admin_settings_path(:dialog => true, :height => 400),
refinery.notification_recipients_blog_admin_settings_path(:dialog => true, :height => 400),
:class => 'user_comment_icon' %>
</li>
<li>
<%= link_to t('.settings.teasers'),
main_app.teasers_refinery_blog_admin_settings_path, :class => "#{Refinery::Blog::Post.teasers_enabled? ? 'success' : 'failure'}_icon" %>
refinery.teasers_blog_admin_settings_path, :class => "#{Refinery::Blog::Post.teasers_enabled? ? 'success' : 'failure'}_icon" %>
</li>
</ul>
@@ -5,11 +5,11 @@
</span>
<span class='actions'>
<%= 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,
@@ -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,
@@ -5,16 +5,16 @@
</span>
<span class='actions'>
<%= 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? %>
</span>
</li>
@@ -23,8 +23,7 @@
<%= will_paginate @comments %>
<% else %>
<h3>
<%= t('.no_items_yet',
:type => action_name.gsub('index', 'new')).downcase %>
<%= t('.no_items_yet', :type => action_name.gsub('index', 'new').downcase) %>
</h3>
<% end %>
<% end %>
@@ -6,14 +6,14 @@
<h2><%= t('.actions') %></h2>
<ul>
<li>
<%= link_to t('.back'), main_app.refinery_blog_admin_comments_path, :class => "back_icon" %>
<%= link_to t('.back'), refinery.blog_admin_comments_path, :class => "back_icon" %>
</li>
<li>
<%= link_to t('.reject'), main_app.rejected_refinery_blog_admin_comment_path(@comment, :return_to => 'rejected'),
<%= link_to t('.reject'), refinery.rejected_blog_admin_comment_path(@comment, :return_to => 'rejected'),
:class => 'comment_cross_icon' unless @comment.rejected? %>
</li>
<li>
<%= link_to t('.approve'), main_app.approved_refinery_blog_admin_comment_path(@comment, :return_to => 'approved'),
<%= link_to t('.approve'), refinery.approved_blog_admin_comment_path(@comment, :return_to => 'approved'),
:class => 'comment_tick_icon' unless @comment.approved? %>
</li>
</ul>
@@ -27,7 +27,7 @@
</td>
<td>
<%= 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' %>
</td>
</tr>
@@ -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 %>
@@ -7,12 +7,12 @@
</span>
</span>
<span class='actions'>
<%= 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,
@@ -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 %>
<div class='field'>
<span class='label_with_help'>
@@ -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 %>
@@ -15,7 +15,7 @@
<% end %>
<h2><%= t('add', :scope => 'refinery.blog.posts.show.comments') %></h2>
<%= 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,
@@ -1,17 +1,17 @@
<nav id="next_prev_article">
<% if @post.next.present? -%>
<%= link_to (truncate(@post.next.title) + " &#187;").html_safe,
main_app.refinery_blog_post_path(@post.next),
refinery.blog_post_path(@post.next),
:class => 'next' %>
<% end -%>
<%= link_to t('blog_home', :scope => 'refinery.blog.posts.show'),
main_app.refinery_blog_root_path,
refinery.blog_root_path,
:class => 'home' %>
<% if @post.prev.present? -%>
<%= link_to ("&#171; " + truncate(@post.prev.title)).html_safe,
main_app.refinery_blog_post_path(@post.prev),
refinery.blog_post_path(@post.prev),
:class => 'prev' %>
<% end -%>
</nav><!-- /next_prev_article -->
@@ -21,7 +21,7 @@
<aside class='filed_in'>
<%= t('filed_in', :scope => 'refinery.blog.posts.show') %>
<% categories.each_with_index do |category, index| %>
<%= link_to category.title, main_app.refinery_blog_category_path(category) -%><%= ',' if index < ((categories.length) - 1) %>
<%= link_to category.title, refinery.blog_category_path(category) -%><%= ',' if index < ((categories.length) - 1) %>
<% end %>
</aside>
<% end %>
Oops, something went wrong.

0 comments on commit 33bfa4d

Please sign in to comment.