Added support for new code in Refinery CMS since resolve/refinerycms#1234
This commit is contained in:
parent
30ebf2d338
commit
33bfa4dd23
35 changed files with 182 additions and 197 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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 => "<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 @@ 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 => "<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 @@ 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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) + " »").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 ("« " + 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 %>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<ul id='categories'>
|
||||
<% @categories.each do |category| %>
|
||||
<li<%= " class='selected'" if @category.present? and @category.id == category.id %>>
|
||||
<%= 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) %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<% if post.live? %>
|
||||
<article class="blog_post" id="<%= dom_id(post) %>">
|
||||
<header>
|
||||
<h1><%= link_to post.title, main_app.refinery_blog_post_path(post) %></h1>
|
||||
<h1><%= link_to post.title, refinery.blog_post_path(post) %></h1>
|
||||
<section class='details'>
|
||||
<time datetime="<%=l post.published_at.to_date, :format => :default %>" class='posted_at'>
|
||||
<%= t('created_at', :scope => 'refinery.blog.shared.posts', :when => l(post.published_at.to_date, :format => :short)) %>
|
||||
|
@ -10,13 +10,13 @@
|
|||
<% if (categories = post.categories).any? %>
|
||||
<aside class='filed_in'>
|
||||
<%= t('filed_in', :scope => 'refinery.blog.posts.show') %>
|
||||
<%=raw categories.collect { |category| link_to category.title, main_app.refinery_blog_category_path(category) }.to_sentence %>
|
||||
<%=raw categories.collect { |category| link_to category.title, refinery.blog_category_path(category) }.to_sentence %>
|
||||
</aside>
|
||||
<% end %>
|
||||
<% if (tags = post.tags).any? %>
|
||||
<aside class='tagged'>
|
||||
<%= t('tagged', :scope => 'refinery.blog.posts.show') %>
|
||||
<%=raw tags.collect { |tag| link_to tag, main_app.refinery_blog_tagged_posts_path(tag.id, tag.name.parameterize) }.to_sentence %>
|
||||
<%=raw tags.collect { |tag| link_to tag, refinery.blog_tagged_posts_path(tag.id, tag.name.parameterize) }.to_sentence %>
|
||||
</aside>
|
||||
<% end %>
|
||||
</section>
|
||||
|
@ -30,7 +30,7 @@
|
|||
</section>
|
||||
<footer>
|
||||
<p>
|
||||
<%= link_to t('read_more', :scope => 'refinery.blog.shared.posts'), main_app.refinery_blog_post_path(post) if blog_post_teaser_enabled? %>
|
||||
<%= link_to t('read_more', :scope => 'refinery.blog.shared.posts'), refinery.blog_post_path(post) if blog_post_teaser_enabled? %>
|
||||
</p>
|
||||
<aside class='comment_count'>
|
||||
<% if Refinery::Blog::Post.comments_allowed? %>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<ul id="blog_posts">
|
||||
<% @posts.each do |blog_post| %>
|
||||
<li class='clearfix'>
|
||||
<%= link_to blog_post.title, main_app.refinery_blog_post_path(blog_post) %>
|
||||
<%= link_to blog_post.title, refinery.blog_post_path(blog_post) %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
<h2><%= t('.title') %></h2>
|
||||
<%= link_to t('.subscribe'), main_app.refinery_blog_rss_feed_path, :id => "rss_feed_subscribe"%>
|
||||
<%= link_to t('.subscribe'), refinery.blog_rss_feed_path, :id => "rss_feed_subscribe"%>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<h2><%= t('.title') %></h2>
|
||||
<nav id='tags'>
|
||||
<% tag_cloud(@tags, %w(tag1 tag2 tag3 tag4)) do |tag, css_class| %>
|
||||
<%= link_to tag.name, main_app.refinery_blog_tagged_posts_path(tag.id, tag.name.parameterize), :class => css_class %>
|
||||
<%= link_to tag.name, refinery.blog_tagged_posts_path(tag.id, tag.name.parameterize), :class => css_class %>
|
||||
<% end %>
|
||||
</nav>
|
||||
<% end %>
|
|
@ -1,21 +1,19 @@
|
|||
Rails.application.routes.draw do
|
||||
namespace :refinery, :path => '' do
|
||||
namespace :blog do
|
||||
root :to => "posts#index"
|
||||
Refinery::Core::Engine.routes.draw do
|
||||
namespace :blog, :path => '' do
|
||||
root :to => "posts#index"
|
||||
resources :posts, :only => [:show]
|
||||
|
||||
resources :posts, :only => [:show]
|
||||
match 'feed.rss', :to => 'posts#index', :as => 'rss_feed', :defaults => {:format => "rss"}
|
||||
match 'categories/:id', :to => 'categories#show', :as => 'category'
|
||||
match ':id/comments', :to => 'posts#comment', :as => 'comments'
|
||||
get 'archive/:year(/:month)', :to => 'posts#archive', :as => 'archive_posts'
|
||||
get 'tagged/:tag_id(/:tag_name)' => 'posts#tagged', :as => 'tagged_posts'
|
||||
|
||||
match 'feed.rss', :to => 'posts#index', :as => 'rss_feed', :defaults => {:format => "rss"}
|
||||
match 'categories/:id', :to => 'categories#show', :as => 'category'
|
||||
match ':id/comments', :to => 'posts#comment', :as => 'comments'
|
||||
get 'archive/:year(/:month)', :to => 'posts#archive', :as => 'archive_posts'
|
||||
get 'tagged/:tag_id(/:tag_name)' => 'posts#tagged', :as => 'tagged_posts'
|
||||
end
|
||||
end
|
||||
|
||||
namespace :refinery do
|
||||
namespace :blog do
|
||||
namespace :admin, :path =>'' do
|
||||
namespace :blog, :path => '' do
|
||||
namespace :admin, :path => 'refinery' do
|
||||
scope :path => 'blog' do
|
||||
root :to => "posts#index"
|
||||
|
||||
resources :posts do
|
||||
|
|
|
@ -9,7 +9,7 @@ module Refinery
|
|||
end
|
||||
|
||||
it "sets the correct path for activity entries" do
|
||||
activity.url.should eq("edit_refinery_blog_admin_post_path")
|
||||
activity.url.should eq("refinery.edit_blog_admin_post_path")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ describe "Categories admin" do
|
|||
let(:title) { "lol" }
|
||||
|
||||
it "can create categories" do
|
||||
visit refinery_admin_root_path
|
||||
visit refinery.admin_root_path
|
||||
|
||||
within("nav#menu") { click_link "Blog" }
|
||||
within("nav.multilist") { click_link "Create new category" }
|
||||
|
|
|
@ -5,115 +5,113 @@ module Refinery
|
|||
module Admin
|
||||
describe Comment do
|
||||
login_refinery_user
|
||||
|
||||
describe "#index" do
|
||||
|
||||
describe "#index" do
|
||||
context "when has no new unapproved comments" do
|
||||
before(:each) do
|
||||
before(:each) do
|
||||
subject.class.delete_all
|
||||
visit refinery_blog_admin_comments_path
|
||||
end
|
||||
|
||||
visit refinery.blog_admin_comments_path
|
||||
end
|
||||
|
||||
it "should list no comments" do
|
||||
visit refinery_blog_admin_comments_path
|
||||
|
||||
page.should have_content('there are no new comments')
|
||||
visit refinery.blog_admin_comments_path
|
||||
|
||||
page.should have_content('There are no new comments')
|
||||
end
|
||||
end
|
||||
context "when has new unapproved comments" do
|
||||
let!(:blog_comment) { FactoryGirl.create(:blog_comment) }
|
||||
before(:each) { visit refinery_blog_admin_comments_path }
|
||||
|
||||
before(:each) { visit refinery.blog_admin_comments_path }
|
||||
|
||||
it "should list comments" do
|
||||
page.should have_content(blog_comment.body)
|
||||
page.should have_content(blog_comment.name)
|
||||
end
|
||||
|
||||
|
||||
it "should allow me to approve a comment" do
|
||||
click_link "Approve this comment"
|
||||
|
||||
|
||||
page.should have_content("has been approved")
|
||||
end
|
||||
|
||||
|
||||
it "should allow me to reject a comment" do
|
||||
click_link "Reject this comment"
|
||||
|
||||
|
||||
page.should have_content("has been rejected")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "#approved" do
|
||||
|
||||
describe "#approved" do
|
||||
context "when has no approved comments" do
|
||||
before(:each) do
|
||||
subject.class.delete_all
|
||||
visit approved_refinery_blog_admin_comments_path
|
||||
visit refinery.approved_blog_admin_comments_path
|
||||
end
|
||||
|
||||
it "should list no comments" do
|
||||
page.should have_content('there are no approved comments')
|
||||
|
||||
it "should list no comments" do
|
||||
page.should have_content('There are no approved comments')
|
||||
end
|
||||
end
|
||||
context "when has approved comments" do
|
||||
let!(:blog_comment) do
|
||||
FactoryGirl.create(:blog_comment,
|
||||
:state => 'approved')
|
||||
FactoryGirl.create(:blog_comment, :state => 'approved')
|
||||
end
|
||||
before(:each) { visit approved_refinery_blog_admin_comments_path }
|
||||
|
||||
it "should list comments" do
|
||||
before(:each) { visit refinery.approved_blog_admin_comments_path }
|
||||
|
||||
it "should list comments" do
|
||||
page.should have_content(blog_comment.body)
|
||||
page.should have_content(blog_comment.name)
|
||||
end
|
||||
|
||||
|
||||
it "should allow me to reject a comment" do
|
||||
click_link "Reject this comment"
|
||||
|
||||
|
||||
page.should have_content("has been rejected")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "#rejected" do
|
||||
|
||||
describe "#rejected" do
|
||||
context "when has no rejected comments" do
|
||||
before(:each) do
|
||||
subject.class.delete_all
|
||||
visit rejected_refinery_blog_admin_comments_path
|
||||
visit refinery.rejected_blog_admin_comments_path
|
||||
end
|
||||
|
||||
it "should list no comments" do
|
||||
page.should have_content('there are no rejected comments')
|
||||
|
||||
it "should list no comments" do
|
||||
page.should have_content('There are no rejected comments')
|
||||
end
|
||||
end
|
||||
context "when has rejected comments" do
|
||||
let!(:blog_comment) do
|
||||
FactoryGirl.create(:blog_comment,
|
||||
:state => 'rejected')
|
||||
FactoryGirl.create(:blog_comment, :state => 'rejected')
|
||||
end
|
||||
before(:each) { visit rejected_refinery_blog_admin_comments_path }
|
||||
|
||||
it "should list comments" do
|
||||
before(:each) { visit refinery.rejected_blog_admin_comments_path }
|
||||
|
||||
it "should list comments" do
|
||||
page.should have_content(blog_comment.body)
|
||||
page.should have_content(blog_comment.name)
|
||||
end
|
||||
|
||||
|
||||
it "should allow me to approve a comment" do
|
||||
click_link "Approve this comment"
|
||||
|
||||
|
||||
page.should have_content("has been approved")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
describe "#show" do
|
||||
let!(:blog_comment) { FactoryGirl.create(:blog_comment) }
|
||||
before(:each) { visit refinery_blog_admin_comment_path(blog_comment) }
|
||||
before(:each) { visit refinery.blog_admin_comment_path(blog_comment) }
|
||||
it "should display the comment" do
|
||||
page.should have_content(blog_comment.body)
|
||||
page.should have_content(blog_comment.name)
|
||||
end
|
||||
it "should allow me to approve the comment" do
|
||||
click_link "Approve this comment"
|
||||
|
||||
|
||||
page.should have_content("has been approved")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,7 +4,7 @@ describe "Blog menu entry" do
|
|||
login_refinery_user
|
||||
|
||||
it "is highlighted when managing the blog" do
|
||||
visit refinery_admin_root_path
|
||||
visit refinery.admin_root_path
|
||||
|
||||
within("#menu") { click_link "Blog" }
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ module Refinery
|
|||
before(:each) { subject.class.destroy_all }
|
||||
|
||||
describe "blog post listing" do
|
||||
before(:each) { visit refinery_blog_admin_posts_path }
|
||||
before(:each) { visit refinery.blog_admin_posts_path }
|
||||
|
||||
it "invites to create new post" do
|
||||
page.should have_content("There are no Blog Posts yet. Click \"Create new post\" to add your first blog post.")
|
||||
|
@ -21,7 +21,7 @@ module Refinery
|
|||
|
||||
describe "new blog post form" do
|
||||
before(:each) do
|
||||
visit refinery_blog_admin_posts_path
|
||||
visit refinery.blog_admin_posts_path
|
||||
click_link "Create new post"
|
||||
end
|
||||
|
||||
|
@ -53,7 +53,7 @@ module Refinery
|
|||
subject.class.first.author.should eq(::Refinery::User.last)
|
||||
end
|
||||
|
||||
it "should save categories", :focus => true do
|
||||
it "should save categories" do
|
||||
subject.class.last.categories.count.should eq(1)
|
||||
subject.class.last.categories.first.title.should eq(blog_category.title)
|
||||
end
|
||||
|
@ -87,14 +87,14 @@ module Refinery
|
|||
let!(:blog_post) { FactoryGirl.create(:blog_post) }
|
||||
|
||||
describe "blog post listing" do
|
||||
before(:each) { visit refinery_blog_admin_posts_path }
|
||||
before(:each) { visit refinery.blog_admin_posts_path }
|
||||
|
||||
describe "edit blog post" do
|
||||
it "should succeed" do
|
||||
page.should have_content(blog_post.title)
|
||||
|
||||
click_link("Edit this blog post")
|
||||
current_path.should == edit_refinery_blog_admin_post_path(blog_post)
|
||||
current_path.should == refinery.edit_blog_admin_post_path(blog_post)
|
||||
|
||||
fill_in "Title", :with => "hax0r"
|
||||
click_button "Save"
|
||||
|
@ -118,7 +118,7 @@ module Refinery
|
|||
it "redirects to blog post in the frontend" do
|
||||
click_link "View this blog post live"
|
||||
|
||||
current_path.should == refinery_blog_post_path(blog_post)
|
||||
current_path.should == refinery.blog_post_path(blog_post)
|
||||
page.should have_content(blog_post.title)
|
||||
end
|
||||
end
|
||||
|
@ -126,7 +126,7 @@ module Refinery
|
|||
|
||||
context "when uncategorized post" do
|
||||
it "shows up in the list" do
|
||||
visit uncategorized_refinery_blog_admin_posts_path
|
||||
visit refinery.uncategorized_blog_admin_posts_path
|
||||
page.should have_content(blog_post.title)
|
||||
end
|
||||
end
|
||||
|
@ -136,7 +136,7 @@ module Refinery
|
|||
blog_post.categories << blog_category
|
||||
blog_post.save!
|
||||
|
||||
visit uncategorized_refinery_blog_admin_posts_path
|
||||
visit refinery.uncategorized_blog_admin_posts_path
|
||||
page.should_not have_content(blog_post.title)
|
||||
end
|
||||
end
|
||||
|
@ -147,7 +147,7 @@ module Refinery
|
|||
|
||||
describe "create blog post with alternate author" do
|
||||
before(:each) do
|
||||
visit refinery_blog_admin_posts_path
|
||||
visit refinery.blog_admin_posts_path
|
||||
click_link "Create new post"
|
||||
|
||||
fill_in "Title", :with => "This is some other guy's blog post"
|
||||
|
|
|
@ -13,7 +13,7 @@ module Refinery
|
|||
end
|
||||
|
||||
describe "show categories blog posts" do
|
||||
before(:each) { visit refinery_blog_category_path(@category) }
|
||||
before(:each) { visit refinery.blog_category_path(@category) }
|
||||
it "should displays categories blog posts" do
|
||||
page.should have_content("Refinery CMS blog post")
|
||||
page.should have_content("Video Games")
|
||||
|
|
|
@ -8,13 +8,13 @@ module Refinery
|
|||
let!(:blog_post) { FactoryGirl.create(:blog_post, :title => "Refinery CMS blog post") }
|
||||
|
||||
it "should display blog post" do
|
||||
visit refinery_blog_post_path(blog_post)
|
||||
visit refinery.blog_post_path(blog_post)
|
||||
|
||||
page.should have_content(blog_post.title)
|
||||
end
|
||||
|
||||
it "should display the blog rss feed" do
|
||||
get refinery_blog_rss_feed_path
|
||||
get refinery.blog_rss_feed_path
|
||||
|
||||
response.should be_success
|
||||
response.content_type.should eq("application/rss+xml")
|
||||
|
@ -31,7 +31,7 @@ module Refinery
|
|||
@tag = ::Refinery::Blog::Post.tag_counts_on(:tags).first
|
||||
end
|
||||
it "should have one tagged post" do
|
||||
visit refinery_blog_tagged_posts_path(@tag.id, @tag_name.parameterize)
|
||||
visit refinery.blog_tagged_posts_path(@tag.id, @tag_name.parameterize)
|
||||
|
||||
page.should have_content(@tag_name)
|
||||
page.should have_content(@post.title)
|
||||
|
@ -44,7 +44,7 @@ module Refinery
|
|||
let(:blog_post) { FactoryGirl.create(:blog_post) }
|
||||
|
||||
it "should display the blog post" do
|
||||
visit refinery_blog_post_path(blog_post)
|
||||
visit refinery.blog_post_path(blog_post)
|
||||
page.should have_content(blog_post.title)
|
||||
page.should have_content(blog_post.body)
|
||||
end
|
||||
|
@ -53,7 +53,7 @@ module Refinery
|
|||
let(:approved_comment) { FactoryGirl.create(:approved_comment) }
|
||||
|
||||
it "should display the comments" do
|
||||
visit refinery_blog_post_path(approved_comment.post)
|
||||
visit refinery.blog_post_path(approved_comment.post)
|
||||
|
||||
page.should have_content(approved_comment.body)
|
||||
page.should have_content("Posted by #{approved_comment.name}")
|
||||
|
@ -63,7 +63,7 @@ module Refinery
|
|||
let(:rejected_comment) { FactoryGirl.create(:rejected_comment) }
|
||||
|
||||
it "should not display the comments" do
|
||||
visit refinery_blog_post_path(rejected_comment.post)
|
||||
visit refinery.blog_post_path(rejected_comment.post)
|
||||
|
||||
page.should_not have_content(rejected_comment.body)
|
||||
end
|
||||
|
@ -72,7 +72,7 @@ module Refinery
|
|||
let(:blog_comment) { FactoryGirl.create(:blog_comment) }
|
||||
|
||||
it "should not display the comments" do
|
||||
visit refinery_blog_post_path(blog_comment.post)
|
||||
visit refinery.blog_post_path(blog_comment.post)
|
||||
|
||||
page.should_not have_content(blog_comment.body)
|
||||
end
|
||||
|
@ -85,7 +85,7 @@ module Refinery
|
|||
let(:body) { "Witty comment." }
|
||||
|
||||
before do
|
||||
visit refinery_blog_post_path(blog_post)
|
||||
visit refinery.blog_post_path(blog_post)
|
||||
|
||||
fill_in "Name", :with => name
|
||||
fill_in "Email", :with => email
|
||||
|
@ -107,16 +107,16 @@ module Refinery
|
|||
let(:blog_post) { FactoryGirl.create(:blog_post_draft) }
|
||||
context "when logged in as admin" do
|
||||
it "should display the draft notification" do
|
||||
visit refinery_blog_post_path(blog_post)
|
||||
visit refinery.blog_post_path(blog_post)
|
||||
|
||||
page.should have_content('This page is NOT live for public viewing.')
|
||||
end
|
||||
end
|
||||
context "when not logged in as an admin" do
|
||||
before(:each) { visit destroy_refinery_user_session_path }
|
||||
before(:each) { visit refinery.destroy_refinery_user_session_path }
|
||||
|
||||
it "should not display the blog post" do
|
||||
visit refinery_blog_post_path(blog_post)
|
||||
visit refinery.blog_post_path(blog_post)
|
||||
|
||||
page.should have_content("The page you were looking for doesn't exist (404)")
|
||||
end
|
||||
|
|
|
@ -1,37 +1,58 @@
|
|||
require 'rubygems'
|
||||
|
||||
def load_all(*patterns)
|
||||
patterns.each { |pattern| Dir[pattern].sort.each { |path| load File.expand_path(path) } }
|
||||
end
|
||||
|
||||
def setup_environment
|
||||
def setup_environment
|
||||
# Configure Rails Environment
|
||||
ENV["RAILS_ENV"] = 'test'
|
||||
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
||||
|
||||
ENV["RAILS_ENV"] ||= 'test'
|
||||
|
||||
require File.expand_path("../dummy/config/environment", __FILE__)
|
||||
|
||||
require 'rspec/rails'
|
||||
require 'capybara/rspec'
|
||||
require 'factory_girl_rails'
|
||||
|
||||
|
||||
Rails.backtrace_cleaner.remove_silencers!
|
||||
|
||||
RSpec.configure do |config|
|
||||
config.mock_with :rspec
|
||||
config.treat_symbols_as_metadata_keys_with_true_values = true
|
||||
config.filter_run :focus => true
|
||||
config.run_all_when_everything_filtered = true
|
||||
end
|
||||
|
||||
# set javascript driver for capybara
|
||||
Capybara.javascript_driver = :selenium
|
||||
|
||||
# minimize password hashing stretches
|
||||
Devise.stretches = 1
|
||||
end
|
||||
|
||||
def each_run
|
||||
FactoryGirl.reload
|
||||
def each_run
|
||||
ActiveSupport::Dependencies.clear
|
||||
|
||||
load_all 'spec/support/**/*.rb'
|
||||
load_all 'spec/factories/**/*.rb' if FactoryGirl.factories.none?
|
||||
FactoryGirl.reload
|
||||
|
||||
# Requires supporting files with custom matchers and macros, etc,
|
||||
# in ./support/ and its subdirectories including factories.
|
||||
([Rails.root.to_s] | ::Refinery::Plugins.registered.pathnames).map{|p|
|
||||
Dir[File.join(p, 'spec', 'support', '**', '*.rb').to_s]
|
||||
}.flatten.sort.each do |support_file|
|
||||
require support_file
|
||||
end
|
||||
end
|
||||
|
||||
# If spork is available in the Gemfile it'll be used but we don't force it.
|
||||
unless (begin; require 'spork'; rescue LoadError; nil end).nil?
|
||||
Spork.prefork { setup_environment }
|
||||
Spork.each_run { each_run }
|
||||
Spork.prefork do
|
||||
# Loading more in this block will cause your tests to run faster. However,
|
||||
# if you change any configuration or code from libraries loaded here, you'll
|
||||
# need to restart spork for it take effect.
|
||||
setup_environment
|
||||
end
|
||||
|
||||
Spork.each_run do
|
||||
# This code will be run each time you run your specs.
|
||||
each_run
|
||||
end
|
||||
else
|
||||
setup_environment
|
||||
each_run
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
require 'database_cleaner'
|
||||
|
||||
RSpec.configure do |config|
|
||||
config.use_transactional_fixtures = false
|
||||
|
||||
config.before(:suite) do
|
||||
DatabaseCleaner.strategy = :truncation
|
||||
end
|
||||
|
||||
config.before(:each) do
|
||||
DatabaseCleaner.start
|
||||
end
|
||||
|
||||
config.after(:each) do
|
||||
DatabaseCleaner.clean
|
||||
end
|
||||
end
|
|
@ -1,8 +0,0 @@
|
|||
require 'devise'
|
||||
|
||||
RSpec.configure do |config|
|
||||
config.mock_with :rspec
|
||||
config.use_transactional_fixtures = false
|
||||
|
||||
config.include Devise::TestHelpers, :type => :controller
|
||||
end
|
|
@ -1,6 +0,0 @@
|
|||
require 'refinerycms-testing'
|
||||
|
||||
RSpec.configure do |config|
|
||||
config.extend Refinery::Testing::ControllerMacros::Authentication, :type => :controller
|
||||
config.extend Refinery::Testing::RequestMacros::Authentication, :type => :request
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue