diff options
author | Philip Arndt <parndt@gmail.com> | 2012-01-09 10:38:26 +1300 |
---|---|---|
committer | Philip Arndt <parndt@gmail.com> | 2012-01-17 16:56:23 +1300 |
commit | b3a25c1b686d205fc6b8b409a8f90059ae6b934d (patch) | |
tree | b0590a4c85422d000a22423114849fd1679392dd | |
parent | 2a2fcca64972bc2fb6a3530395366fb2ade42303 (diff) | |
download | refinerycms-blog-b3a25c1b686d205fc6b8b409a8f90059ae6b934d.tar.gz refinerycms-blog-b3a25c1b686d205fc6b8b409a8f90059ae6b934d.tar.bz2 refinerycms-blog-b3a25c1b686d205fc6b8b409a8f90059ae6b934d.zip |
Restructured part of the project to Refinery::Blog::Admin not Refinery::Admin::Blog
-rw-r--r-- | Rakefile | 2 | ||||
-rw-r--r-- | app/controllers/refinery/blog/admin/categories_controller.rb (renamed from app/controllers/refinery/admin/blog/categories_controller.rb) | 4 | ||||
-rw-r--r-- | app/controllers/refinery/blog/admin/comments_controller.rb (renamed from app/controllers/refinery/admin/blog/comments_controller.rb) | 4 | ||||
-rw-r--r-- | app/controllers/refinery/blog/admin/posts_controller.rb (renamed from app/controllers/refinery/admin/blog/posts_controller.rb) | 8 | ||||
-rw-r--r-- | app/controllers/refinery/blog/admin/settings_controller.rb (renamed from app/controllers/refinery/admin/blog/settings_controller.rb) | 4 | ||||
-rw-r--r-- | app/views/refinery/blog/admin/_submenu.html.erb (renamed from app/views/refinery/admin/blog/_submenu.html.erb) | 28 | ||||
-rw-r--r-- | app/views/refinery/blog/admin/categories/_category.html.erb (renamed from app/views/refinery/admin/blog/categories/_category.html.erb) | 4 | ||||
-rw-r--r-- | app/views/refinery/blog/admin/categories/_form.html.erb (renamed from app/views/refinery/admin/blog/categories/_form.html.erb) | 0 | ||||
-rw-r--r-- | app/views/refinery/blog/admin/categories/_sortable_list.html.erb (renamed from app/views/refinery/admin/blog/categories/_sortable_list.html.erb) | 0 | ||||
-rw-r--r-- | app/views/refinery/blog/admin/categories/edit.html.erb (renamed from app/views/refinery/admin/blog/categories/edit.html.erb) | 0 | ||||
-rw-r--r-- | app/views/refinery/blog/admin/categories/index.html.erb (renamed from app/views/refinery/admin/blog/categories/index.html.erb) | 0 | ||||
-rw-r--r-- | app/views/refinery/blog/admin/categories/new.html.erb (renamed from app/views/refinery/admin/blog/categories/new.html.erb) | 0 | ||||
-rw-r--r-- | app/views/refinery/blog/admin/comments/_comment.html.erb (renamed from app/views/refinery/admin/blog/comments/_comment.html.erb) | 6 | ||||
-rw-r--r-- | app/views/refinery/blog/admin/comments/_sortable_list.html.erb (renamed from app/views/refinery/admin/blog/comments/_sortable_list.html.erb) | 0 | ||||
-rw-r--r-- | app/views/refinery/blog/admin/comments/index.html.erb (renamed from app/views/refinery/admin/blog/comments/index.html.erb) | 0 | ||||
-rw-r--r-- | app/views/refinery/blog/admin/comments/show.html.erb (renamed from app/views/refinery/admin/blog/comments/show.html.erb) | 6 | ||||
-rw-r--r-- | app/views/refinery/blog/admin/posts/_form.html.erb (renamed from app/views/refinery/admin/blog/posts/_form.html.erb) | 2 | ||||
-rw-r--r-- | app/views/refinery/blog/admin/posts/_form_part.html.erb (renamed from app/views/refinery/admin/blog/posts/_form_part.html.erb) | 0 | ||||
-rw-r--r-- | app/views/refinery/blog/admin/posts/_post.html.erb (renamed from app/views/refinery/admin/blog/posts/_post.html.erb) | 4 | ||||
-rw-r--r-- | app/views/refinery/blog/admin/posts/_sortable_list.html.erb (renamed from app/views/refinery/admin/blog/posts/_sortable_list.html.erb) | 0 | ||||
-rw-r--r-- | app/views/refinery/blog/admin/posts/_teaser_part.html.erb (renamed from app/views/refinery/admin/blog/posts/_teaser_part.html.erb) | 0 | ||||
-rw-r--r-- | app/views/refinery/blog/admin/posts/edit.html.erb (renamed from app/views/refinery/admin/blog/posts/edit.html.erb) | 0 | ||||
-rw-r--r-- | app/views/refinery/blog/admin/posts/index.html.erb (renamed from app/views/refinery/admin/blog/posts/index.html.erb) | 0 | ||||
-rw-r--r-- | app/views/refinery/blog/admin/posts/new.html.erb (renamed from app/views/refinery/admin/blog/posts/new.html.erb) | 0 | ||||
-rw-r--r-- | app/views/refinery/blog/admin/posts/uncategorized.html.erb (renamed from app/views/refinery/admin/blog/posts/uncategorized.html.erb) | 0 | ||||
-rw-r--r-- | app/views/refinery/blog/admin/settings/notification_recipients.html.erb (renamed from app/views/refinery/admin/blog/settings/notification_recipients.html.erb) | 0 | ||||
-rw-r--r-- | config/routes.rb | 4 | ||||
-rw-r--r-- | lib/refinery/blog/engine.rb | 2 | ||||
-rw-r--r-- | spec/requests/refinery/admin/blog/comments_spec.rb | 124 | ||||
-rw-r--r-- | spec/requests/refinery/admin/blog/posts_spec.rb | 171 | ||||
-rw-r--r-- | spec/requests/refinery/blog/admin/comments_spec.rb | 128 | ||||
-rw-r--r-- | spec/requests/refinery/blog/admin/menu_spec.rb (renamed from spec/requests/refinery/admin/menu_spec.rb) | 0 | ||||
-rw-r--r-- | spec/requests/refinery/blog/admin/posts_spec.rb | 175 |
33 files changed, 341 insertions, 335 deletions
@@ -14,6 +14,6 @@ end require "refinerycms-testing" Refinery::Testing::Railtie.load_tasks -Refinery::Testing::Railtie.load_dummy_tasks(ENGINE_PATH) +#Refinery::Testing::Railtie.load_dummy_tasks(ENGINE_PATH) load File.expand_path('../tasks/rspec.rake', __FILE__) diff --git a/app/controllers/refinery/admin/blog/categories_controller.rb b/app/controllers/refinery/blog/admin/categories_controller.rb index 0fe4eec..cbde1cc 100644 --- a/app/controllers/refinery/admin/blog/categories_controller.rb +++ b/app/controllers/refinery/blog/admin/categories_controller.rb @@ -1,6 +1,6 @@ module Refinery - module Admin - module Blog + module Blog + module Admin class CategoriesController < ::Refinery::AdminController crudify :'refinery/blog/category', diff --git a/app/controllers/refinery/admin/blog/comments_controller.rb b/app/controllers/refinery/blog/admin/comments_controller.rb index 6c1417e..3128e97 100644 --- a/app/controllers/refinery/admin/blog/comments_controller.rb +++ b/app/controllers/refinery/blog/admin/comments_controller.rb @@ -1,6 +1,6 @@ module Refinery - module Admin - module Blog + module Blog + module Admin class CommentsController < ::Refinery::AdminController cache_sweeper Refinery::BlogSweeper diff --git a/app/controllers/refinery/admin/blog/posts_controller.rb b/app/controllers/refinery/blog/admin/posts_controller.rb index 4645f3f..04ee663 100644 --- a/app/controllers/refinery/admin/blog/posts_controller.rb +++ b/app/controllers/refinery/blog/admin/posts_controller.rb @@ -1,6 +1,6 @@ module Refinery - module Admin - module Blog + module Blog + module Admin class PostsController < ::Refinery::AdminController cache_sweeper Refinery::BlogSweeper @@ -8,7 +8,7 @@ module Refinery crudify :'refinery/blog/post', :title_attribute => :title, :order => 'published_at DESC', - :redirect_to_url => "main_app.refinery_admin_blog_posts_path" + :redirect_to_url => "main_app.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_admin_blog_posts_path) + redirect_back_or_default(main_app.refinery_blog_admin_posts_path) else unless request.xhr? redirect_to :back diff --git a/app/controllers/refinery/admin/blog/settings_controller.rb b/app/controllers/refinery/blog/admin/settings_controller.rb index ee71393..afa6b2b 100644 --- a/app/controllers/refinery/admin/blog/settings_controller.rb +++ b/app/controllers/refinery/blog/admin/settings_controller.rb @@ -1,6 +1,6 @@ module Refinery - module Admin - module Blog + module Blog + module Admin class SettingsController < ::Refinery::AdminController def notification_recipients diff --git a/app/views/refinery/admin/blog/_submenu.html.erb b/app/views/refinery/blog/admin/_submenu.html.erb index 2915610..d290ce8 100644 --- a/app/views/refinery/admin/blog/_submenu.html.erb +++ b/app/views/refinery/blog/admin/_submenu.html.erb @@ -3,7 +3,7 @@ <li class='not_a_link'> <%= render :partial => "/refinery/admin/search", :locals => { - :url => main_app.refinery_admin_blog_posts_path + :url => main_app.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_admin_blog_posts_path, + <%= link_to t('.posts.manage'), main_app.refinery_blog_admin_posts_path, :class => 'page_icon' %> </li> <li> - <%= link_to t('.posts.uncategorized'), main_app.uncategorized_refinery_admin_blog_posts_path, + <%= link_to t('.posts.uncategorized'), main_app.uncategorized_refinery_blog_admin_posts_path, :class => 'page_icon' %> </li> <li> - <%= link_to t('.posts.new'), main_app.new_refinery_admin_blog_post_path, + <%= link_to t('.posts.new'), main_app.new_refinery_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_admin_blog_comments_path, + <%= link_to t('.comments.new'), main_app.refinery_blog_admin_comments_path, :class => 'comment_icon' %> </li> <li> - <%= link_to t('.comments.approved'), main_app.approved_refinery_admin_blog_comments_path, + <%= link_to t('.comments.approved'), main_app.approved_refinery_blog_admin_comments_path, :class => 'comment_tick_icon' %> </li> <li> - <%= link_to t('.comments.rejected'), main_app.rejected_refinery_admin_blog_comments_path, + <%= link_to t('.comments.rejected'), main_app.rejected_refinery_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_admin_blog_categories_path, + <%= link_to t('.categories.manage'), main_app.refinery_blog_admin_categories_path, :class => 'folder_edit_icon' %> </li> <li> - <%= link_to t('.categories.new'), main_app.new_refinery_admin_blog_category_path(:dialog => true, :height => 325), + <%= link_to t('.categories.new'), main_app.new_refinery_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_admin_blog_settings_path, + <%= link_to t('.settings.title'), main_app.refinery_blog_admin_settings_path, :class => 'settings_icon' %> </li> <li> - <%= link_to t('.settings.comments'), main_app.comments_refinery_admin_blog_settings_path, + <%= link_to t('.settings.comments'), main_app.comments_refinery_blog_admin_settings_path, :class => "#{Refinery::Blog::Post.comments_allowed? ? 'success' : 'failure'}_icon" %> </li> <li> - <%= link_to t('.settings.moderation'), main_app.moderation_refinery_admin_blog_settings_path, + <%= link_to t('.settings.moderation'), main_app.moderation_refinery_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_admin_blog_settings_path(:dialog => true, :height => 400), + main_app.notification_recipients_refinery_blog_admin_settings_path(:dialog => true, :height => 400), :class => 'user_comment_icon' %> </li> <li> <%= link_to t('.settings.teasers'), - main_app.teasers_refinery_admin_blog_settings_path, :class => "#{Refinery::Blog::Post.teasers_enabled? ? 'success' : 'failure'}_icon" %> + main_app.teasers_refinery_blog_admin_settings_path, :class => "#{Refinery::Blog::Post.teasers_enabled? ? 'success' : 'failure'}_icon" %> </li> </ul> diff --git a/app/views/refinery/admin/blog/categories/_category.html.erb b/app/views/refinery/blog/admin/categories/_category.html.erb index 80cc2e3..d476439 100644 --- a/app/views/refinery/admin/blog/categories/_category.html.erb +++ b/app/views/refinery/blog/admin/categories/_category.html.erb @@ -5,11 +5,11 @@ </span> <span class='actions'> <%= link_to refinery_icon_tag("application_edit.png"), - main_app.edit_refinery_admin_blog_category_path(category, + main_app.edit_refinery_blog_admin_category_path(category, :dialog => true, :height => 325), :title => t('.edit') %> - <%= link_to refinery_icon_tag("delete.png"), main_app.refinery_admin_blog_category_path(category), + <%= link_to refinery_icon_tag("delete.png"), main_app.refinery_blog_admin_category_path(category), :class => "cancel confirm-delete", :title => t('.delete'), :method => :delete, diff --git a/app/views/refinery/admin/blog/categories/_form.html.erb b/app/views/refinery/blog/admin/categories/_form.html.erb index a5d3de3..a5d3de3 100644 --- a/app/views/refinery/admin/blog/categories/_form.html.erb +++ b/app/views/refinery/blog/admin/categories/_form.html.erb diff --git a/app/views/refinery/admin/blog/categories/_sortable_list.html.erb b/app/views/refinery/blog/admin/categories/_sortable_list.html.erb index f4e8641..f4e8641 100644 --- a/app/views/refinery/admin/blog/categories/_sortable_list.html.erb +++ b/app/views/refinery/blog/admin/categories/_sortable_list.html.erb diff --git a/app/views/refinery/admin/blog/categories/edit.html.erb b/app/views/refinery/blog/admin/categories/edit.html.erb index 2872e82..2872e82 100644 --- a/app/views/refinery/admin/blog/categories/edit.html.erb +++ b/app/views/refinery/blog/admin/categories/edit.html.erb diff --git a/app/views/refinery/admin/blog/categories/index.html.erb b/app/views/refinery/blog/admin/categories/index.html.erb index 4ad59ab..4ad59ab 100644 --- a/app/views/refinery/admin/blog/categories/index.html.erb +++ b/app/views/refinery/blog/admin/categories/index.html.erb diff --git a/app/views/refinery/admin/blog/categories/new.html.erb b/app/views/refinery/blog/admin/categories/new.html.erb index 2872e82..2872e82 100644 --- a/app/views/refinery/admin/blog/categories/new.html.erb +++ b/app/views/refinery/blog/admin/categories/new.html.erb diff --git a/app/views/refinery/admin/blog/comments/_comment.html.erb b/app/views/refinery/blog/admin/comments/_comment.html.erb index f5eba4d..51f2996 100644 --- a/app/views/refinery/admin/blog/comments/_comment.html.erb +++ b/app/views/refinery/blog/admin/comments/_comment.html.erb @@ -8,13 +8,13 @@ main_app.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_admin_blog_comment_path(comment), + <%= link_to refinery_icon_tag('zoom.png'), main_app.refinery_blog_admin_comment_path(comment), :title => t('.read') %> <%= link_to refinery_icon_tag("cross.png"), - main_app.rejected_refinery_admin_blog_comment_path(comment, :return_to => request.path.split('/').last.gsub(/^comments$/, 'index')), + main_app.rejected_refinery_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_admin_blog_comment_path(comment, :return_to => request.path.split('/').last.gsub(/^comments$/, 'index')), + main_app.approved_refinery_blog_admin_comment_path(comment, :return_to => request.path.split('/').last.gsub(/^comments$/, 'index')), :title => t('.approve') unless comment.approved? %> </span> </li> diff --git a/app/views/refinery/admin/blog/comments/_sortable_list.html.erb b/app/views/refinery/blog/admin/comments/_sortable_list.html.erb index f781ba1..f781ba1 100644 --- a/app/views/refinery/admin/blog/comments/_sortable_list.html.erb +++ b/app/views/refinery/blog/admin/comments/_sortable_list.html.erb diff --git a/app/views/refinery/admin/blog/comments/index.html.erb b/app/views/refinery/blog/admin/comments/index.html.erb index 059ef59..059ef59 100644 --- a/app/views/refinery/admin/blog/comments/index.html.erb +++ b/app/views/refinery/blog/admin/comments/index.html.erb diff --git a/app/views/refinery/admin/blog/comments/show.html.erb b/app/views/refinery/blog/admin/comments/show.html.erb index 3dc50ff..2aa75f1 100644 --- a/app/views/refinery/admin/blog/comments/show.html.erb +++ b/app/views/refinery/blog/admin/comments/show.html.erb @@ -6,14 +6,14 @@ <h2><%= t('.actions') %></h2> <ul> <li> - <%= link_to t('.back'), main_app.refinery_admin_blog_comments_path, :class => "back_icon" %> + <%= link_to t('.back'), main_app.refinery_blog_admin_comments_path, :class => "back_icon" %> </li> <li> - <%= link_to t('.reject'), main_app.rejected_refinery_admin_blog_comment_path(@blog_comment, :return_to => 'rejected'), + <%= link_to t('.reject'), main_app.rejected_refinery_blog_admin_comment_path(@blog_comment, :return_to => 'rejected'), :class => 'comment_cross_icon' unless @blog_comment.rejected? %> </li> <li> - <%= link_to t('.approve'), main_app.approved_refinery_admin_blog_comment_path(@blog_comment, :return_to => 'approved'), + <%= link_to t('.approve'), main_app.approved_refinery_blog_admin_comment_path(@blog_comment, :return_to => 'approved'), :class => 'comment_tick_icon' unless @blog_comment.approved? %> </li> </ul> diff --git a/app/views/refinery/admin/blog/posts/_form.html.erb b/app/views/refinery/blog/admin/posts/_form.html.erb index f20c0cc..656c9c6 100644 --- a/app/views/refinery/admin/blog/posts/_form.html.erb +++ b/app/views/refinery/blog/admin/posts/_form.html.erb @@ -113,4 +113,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_admin_blog_posts_url %> +<%= render 'refinery/shared/admin/autocomplete', :dom_id => '#blog_post_tag_list', :url => main_app.tags_refinery_blog_admin_posts_url %> diff --git a/app/views/refinery/admin/blog/posts/_form_part.html.erb b/app/views/refinery/blog/admin/posts/_form_part.html.erb index 114e493..114e493 100644 --- a/app/views/refinery/admin/blog/posts/_form_part.html.erb +++ b/app/views/refinery/blog/admin/posts/_form_part.html.erb diff --git a/app/views/refinery/admin/blog/posts/_post.html.erb b/app/views/refinery/blog/admin/posts/_post.html.erb index 28704ff..c8baa80 100644 --- a/app/views/refinery/admin/blog/posts/_post.html.erb +++ b/app/views/refinery/blog/admin/posts/_post.html.erb @@ -10,9 +10,9 @@ <%= link_to refinery_icon_tag("application_go.png"), main_app.blog_post_path(post), :title => t('.view_live_html'), :target => "_blank" %> - <%= link_to refinery_icon_tag("application_edit.png"), main_app.edit_refinery_admin_blog_post_path(post), + <%= link_to refinery_icon_tag("application_edit.png"), main_app.edit_refinery_blog_admin_post_path(post), :title => t('.edit') %> - <%= link_to refinery_icon_tag("delete.png"), main_app.refinery_admin_blog_post_path(post), + <%= link_to refinery_icon_tag("delete.png"), main_app.refinery_blog_admin_post_path(post), :class => "cancel confirm-delete", :title => t('.delete'), :method => :delete, diff --git a/app/views/refinery/admin/blog/posts/_sortable_list.html.erb b/app/views/refinery/blog/admin/posts/_sortable_list.html.erb index 18d12cc..18d12cc 100644 --- a/app/views/refinery/admin/blog/posts/_sortable_list.html.erb +++ b/app/views/refinery/blog/admin/posts/_sortable_list.html.erb diff --git a/app/views/refinery/admin/blog/posts/_teaser_part.html.erb b/app/views/refinery/blog/admin/posts/_teaser_part.html.erb index dc9186a..dc9186a 100644 --- a/app/views/refinery/admin/blog/posts/_teaser_part.html.erb +++ b/app/views/refinery/blog/admin/posts/_teaser_part.html.erb diff --git a/app/views/refinery/admin/blog/posts/edit.html.erb b/app/views/refinery/blog/admin/posts/edit.html.erb index 2872e82..2872e82 100644 --- a/app/views/refinery/admin/blog/posts/edit.html.erb +++ b/app/views/refinery/blog/admin/posts/edit.html.erb diff --git a/app/views/refinery/admin/blog/posts/index.html.erb b/app/views/refinery/blog/admin/posts/index.html.erb index 922353c..922353c 100644 --- a/app/views/refinery/admin/blog/posts/index.html.erb +++ b/app/views/refinery/blog/admin/posts/index.html.erb diff --git a/app/views/refinery/admin/blog/posts/new.html.erb b/app/views/refinery/blog/admin/posts/new.html.erb index 2872e82..2872e82 100644 --- a/app/views/refinery/admin/blog/posts/new.html.erb +++ b/app/views/refinery/blog/admin/posts/new.html.erb diff --git a/app/views/refinery/admin/blog/posts/uncategorized.html.erb b/app/views/refinery/blog/admin/posts/uncategorized.html.erb index 030e789..030e789 100644 --- a/app/views/refinery/admin/blog/posts/uncategorized.html.erb +++ b/app/views/refinery/blog/admin/posts/uncategorized.html.erb diff --git a/app/views/refinery/admin/blog/settings/notification_recipients.html.erb b/app/views/refinery/blog/admin/settings/notification_recipients.html.erb index d321ded..d321ded 100644 --- a/app/views/refinery/admin/blog/settings/notification_recipients.html.erb +++ b/app/views/refinery/blog/admin/settings/notification_recipients.html.erb diff --git a/config/routes.rb b/config/routes.rb index 2ed6e8d..353d0b8 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -8,10 +8,8 @@ Rails.application.routes.draw do match ':id/comments', :to => 'posts#comment', :as => 'blog_post_blog_comments' get 'archive/:year(/:month)', :to => 'posts#archive', :as => 'archive_blog_posts' get 'tagged/:tag_id(/:tag_name)' => 'posts#tagged', :as => 'tagged_posts' - end - scope(:path => 'refinery', :as => 'refinery_admin', :module => 'admin') do - scope(:path => 'blog', :as => 'blog', :module => 'blog') do + scope(:path => 'refinery', :as => 'refinery_admin', :module => 'admin') do root :to => 'posts#index' resources :posts do collection do diff --git a/lib/refinery/blog/engine.rb b/lib/refinery/blog/engine.rb index cd764e3..47ac497 100644 --- a/lib/refinery/blog/engine.rb +++ b/lib/refinery/blog/engine.rb @@ -10,7 +10,7 @@ module Refinery Refinery::Plugin.register do |plugin| plugin.pathname = root plugin.name = "refinerycms_blog" - plugin.url = app.routes.url_helpers.refinery_admin_blog_posts_path + plugin.url = app.routes.url_helpers.refinery_blog_admin_posts_path plugin.menu_match = /refinery\/blog\/?(posts|comments|categories)?/ plugin.activity = { :class_name => :'refinery/blog/post' diff --git a/spec/requests/refinery/admin/blog/comments_spec.rb b/spec/requests/refinery/admin/blog/comments_spec.rb deleted file mode 100644 index a7367e3..0000000 --- a/spec/requests/refinery/admin/blog/comments_spec.rb +++ /dev/null @@ -1,124 +0,0 @@ -require "spec_helper" - -module Refinery - describe "AdminBlog::Comments" do - login_refinery_user - - describe "#index" do - context "when has no new unapproved comments" do - before(:each) do - Blog::Comment.delete_all - visit refinery_admin_blog_comments_path - end - - it "should list no comments" do - visit refinery_admin_blog_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_admin_blog_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 - context "when has no approved comments" do - before(:each) do - Blog::Comment.delete_all - visit approved_refinery_admin_blog_comments_path - end - - 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') - end - before(:each) { visit approved_refinery_admin_blog_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 - context "when has no rejected comments" do - before(:each) do - Blog::Comment.delete_all - visit rejected_refinery_admin_blog_comments_path - end - - 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') - end - before(:each) { visit rejected_refinery_admin_blog_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_admin_blog_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 - end -end diff --git a/spec/requests/refinery/admin/blog/posts_spec.rb b/spec/requests/refinery/admin/blog/posts_spec.rb deleted file mode 100644 index 53372b1..0000000 --- a/spec/requests/refinery/admin/blog/posts_spec.rb +++ /dev/null @@ -1,171 +0,0 @@ -require "spec_helper" - -module Refinery - describe "AdminBlog::Posts" do - login_refinery_user - - let!(:blog_category) { FactoryGirl.create(:blog_category, :title => "Video Games") } - - context "when no blog posts" do - before(:each) { Refinery::Blog::Post.destroy_all } - - describe "blog post listing" do - before(:each) { visit refinery_admin_blog_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.") - end - end - - describe "new blog post form" do - before(:each) do - visit refinery_admin_blog_posts_path - click_link "Create new post" - end - - it "should have Tags" do - page.should have_content("Tags") - end - - it "should have Video Games" do - page.should have_content(blog_category.title) - end - - describe "create blog post" do - before(:each) do - fill_in "Title", :with => "This is my blog post" - fill_in "blog_post_body", :with => "And I love it" - check blog_category.title - click_button "Save" - end - - it "should succeed" do - page.should have_content("was successfully added.") - end - - it "should be the only blog post" do - ::Refinery::Blog::Post.all.size.should eq(1) - end - - it "should belong to me" do - ::Refinery::Blog::Post.first.author.should eq(::Refinery::User.last) - end - - it "should save categories" do - ::Refinery::Blog::Post.last.categories.count.should eq(1) - ::Refinery::Blog::Post.last.categories.first.title.should eq(blog_category.title) - end - end - - describe "create blog post with tags" do - before(:each) do - @tag_list = "chicago, bikes, beers, babes" - fill_in "Title", :with => "This is a tagged blog post" - fill_in "blog_post_body", :with => "And I also love it" - fill_in "Tags", :with => @tag_list - click_button "Save" - end - - it "should succeed" do - page.should have_content("was successfully added.") - end - - it "should be the only blog post" do - ::Refinery::Blog::Post.all.size.should eq(1) - end - - it "should have the specified tags" do - ::Refinery::Blog::Post.last.tag_list.should eq(@tag_list.split(', ')) - end - end - end - end - - context "when has blog posts" do - let!(:blog_post) { FactoryGirl.create(:blog_post) } - - describe "blog post listing" do - before(:each) { visit refinery_admin_blog_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_admin_blog_post_path(blog_post) - - fill_in "Title", :with => "hax0r" - click_button "Save" - - page.should_not have_content(blog_post.title) - page.should have_content("'hax0r' was successfully updated.") - end - end - - describe "deleting blog post" do - it "should succeed" do - page.should have_content(blog_post.title) - - click_link "Remove this blog post forever" - - page.should have_content("'#{blog_post.title}' was successfully removed.") - end - end - - describe "view live" do - it "redirects to blog post in the frontend" do - click_link "View this blog post live" - - current_path.should == blog_post_path(blog_post) - page.should have_content(blog_post.title) - end - end - end - - context "when uncategorized post" do - it "shows up in the list" do - visit uncategorized_refinery_admin_blog_posts_path - page.should have_content(blog_post.title) - end - end - - context "when categorized post" do - it "won't show up in the list" do - blog_post.categories << blog_category - blog_post.save! - - visit uncategorized_refinery_admin_blog_posts_path - page.should_not have_content(blog_post.title) - end - end - end - - context "with multiple users" do - let!(:other_guy) { Factory(:refinery_user, :username => "Other Guy") } - - describe "create blog post with alternate author" do - before(:each) do - visit refinery_admin_blog_posts_path - click_link "Create new post" - - fill_in "Title", :with => "This is some other guy's blog post" - fill_in "blog_post_body", :with => "I totally didn't write it." - - click_link "Advanced Options" - - select other_guy.username, :from => "Author" - - click_button "Save" - end - - it "should succeed" do - page.should have_content("was successfully added.") - end - - it "belongs to another user" do - ::Refinery::Blog::Post.last.author.should eq(other_guy) - end - end - end - end -end diff --git a/spec/requests/refinery/blog/admin/comments_spec.rb b/spec/requests/refinery/blog/admin/comments_spec.rb new file mode 100644 index 0000000..b1a5afe --- /dev/null +++ b/spec/requests/refinery/blog/admin/comments_spec.rb @@ -0,0 +1,128 @@ +require "spec_helper" + +module Refinery + module Blog + module Admin + describe Comment do + login_refinery_user + + describe "#index" do + context "when has no new unapproved comments" do + before(:each) do + subject.class.delete_all + 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') + end + end + + context "when has new unapproved comments" do + let!(:blog_comment) { FactoryGirl.create(:blog_comment) } + 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 + context "when has no approved comments" do + before(:each) do + subject.class.delete_all + visit approved_refinery_blog_admin_comments_path + end + + 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') + end + before(:each) { visit approved_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 reject a comment" do + click_link "Reject this comment" + + page.should have_content("has been rejected") + end + end + end + + describe "#rejected" do + context "when has no rejected comments" do + before(:each) do + subject.class.delete_all + visit rejected_refinery_blog_admin_comments_path + end + + 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') + end + before(:each) { visit rejected_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 + end + end + + describe "#show" do + let!(:blog_comment) { FactoryGirl.create(: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 + end + end + end +end
\ No newline at end of file diff --git a/spec/requests/refinery/admin/menu_spec.rb b/spec/requests/refinery/blog/admin/menu_spec.rb index b02a473..b02a473 100644 --- a/spec/requests/refinery/admin/menu_spec.rb +++ b/spec/requests/refinery/blog/admin/menu_spec.rb diff --git a/spec/requests/refinery/blog/admin/posts_spec.rb b/spec/requests/refinery/blog/admin/posts_spec.rb new file mode 100644 index 0000000..6c50c37 --- /dev/null +++ b/spec/requests/refinery/blog/admin/posts_spec.rb @@ -0,0 +1,175 @@ +require "spec_helper" + +module Refinery + module Blog + module Admin + describe Post do + login_refinery_user + + let!(:blog_category) { FactoryGirl.create(:blog_category, :title => "Video Games") } + + context "when no blog posts" do + before(:each) { subject.class.destroy_all } + + describe "blog post listing" do + 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.") + end + end + + describe "new blog post form" do + before(:each) do + visit refinery_blog_admin_posts_path + click_link "Create new post" + end + + it "should have Tags" do + page.should have_content("Tags") + end + + it "should have Video Games" do + page.should have_content(blog_category.title) + end + + describe "create blog post" do + before(:each) do + fill_in "Title", :with => "This is my blog post" + fill_in "blog_post_body", :with => "And I love it" + check blog_category.title + click_button "Save" + end + + it "should succeed" do + page.should have_content("was successfully added.") + end + + it "should be the only blog post" do + subject.class.all.size.should eq(1) + end + + it "should belong to me" do + subject.class.first.author.should eq(::Refinery::User.last) + end + + 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 + end + + describe "create blog post with tags" do + before(:each) do + @tag_list = "chicago, bikes, beers, babes" + fill_in "Title", :with => "This is a tagged blog post" + fill_in "blog_post_body", :with => "And I also love it" + fill_in "Tags", :with => @tag_list + click_button "Save" + end + + it "should succeed" do + page.should have_content("was successfully added.") + end + + it "should be the only blog post" do + subject.class.all.size.should eq(1) + end + + it "should have the specified tags" do + subject.class.last.tag_list.should eq(@tag_list.split(', ')) + end + end + end + end + + context "when has blog posts" do + let!(:blog_post) { FactoryGirl.create(:blog_post) } + + describe "blog post listing" do + 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) + + fill_in "Title", :with => "hax0r" + click_button "Save" + + page.should_not have_content(blog_post.title) + page.should have_content("'hax0r' was successfully updated.") + end + end + + describe "deleting blog post" do + it "should succeed" do + page.should have_content(blog_post.title) + + click_link "Remove this blog post forever" + + page.should have_content("'#{blog_post.title}' was successfully removed.") + end + end + + describe "view live" do + it "redirects to blog post in the frontend" do + click_link "View this blog post live" + + current_path.should == blog_post_path(blog_post) + page.should have_content(blog_post.title) + end + end + end + + context "when uncategorized post" do + it "shows up in the list" do + visit uncategorized_refinery_blog_admin_posts_path + page.should have_content(blog_post.title) + end + end + + context "when categorized post" do + it "won't show up in the list" do + blog_post.categories << blog_category + blog_post.save! + + visit uncategorized_refinery_blog_admin_posts_path + page.should_not have_content(blog_post.title) + end + end + end + + context "with multiple users" do + let!(:other_guy) { Factory(:refinery_user, :username => "Other Guy") } + + describe "create blog post with alternate author" do + before(:each) do + visit refinery_blog_admin_posts_path + click_link "Create new post" + + fill_in "Title", :with => "This is some other guy's blog post" + fill_in "blog_post_body", :with => "I totally didn't write it." + + click_link "Advanced Options" + + select other_guy.username, :from => "Author" + + click_button "Save" + end + + it "should succeed" do + page.should have_content("was successfully added.") + end + + it "belongs to another user" do + subject.class.last.author.should eq(other_guy) + end + end + end + end + end + end +end
\ No newline at end of file |