From b3a25c1b686d205fc6b8b409a8f90059ae6b934d Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Mon, 9 Jan 2012 10:38:26 +1300 Subject: Restructured part of the project to Refinery::Blog::Admin not Refinery::Admin::Blog --- Rakefile | 2 +- .../refinery/admin/blog/categories_controller.rb | 13 -- .../refinery/admin/blog/comments_controller.rb | 49 ------ .../refinery/admin/blog/posts_controller.rb | 92 ----------- .../refinery/admin/blog/settings_controller.rb | 55 ------- .../refinery/blog/admin/categories_controller.rb | 13 ++ .../refinery/blog/admin/comments_controller.rb | 49 ++++++ .../refinery/blog/admin/posts_controller.rb | 92 +++++++++++ .../refinery/blog/admin/settings_controller.rb | 55 +++++++ app/views/refinery/admin/blog/_submenu.html.erb | 96 ----------- .../admin/blog/categories/_category.html.erb | 18 --- .../refinery/admin/blog/categories/_form.html.erb | 19 --- .../admin/blog/categories/_sortable_list.html.erb | 7 - .../refinery/admin/blog/categories/edit.html.erb | 1 - .../refinery/admin/blog/categories/index.html.erb | 27 ---- .../refinery/admin/blog/categories/new.html.erb | 1 - .../refinery/admin/blog/comments/_comment.html.erb | 20 --- .../admin/blog/comments/_sortable_list.html.erb | 7 - .../refinery/admin/blog/comments/index.html.erb | 31 ---- .../refinery/admin/blog/comments/show.html.erb | 63 -------- app/views/refinery/admin/blog/posts/_form.html.erb | 116 -------------- .../refinery/admin/blog/posts/_form_part.html.erb | 3 - app/views/refinery/admin/blog/posts/_post.html.erb | 21 --- .../admin/blog/posts/_sortable_list.html.erb | 7 - .../admin/blog/posts/_teaser_part.html.erb | 11 -- app/views/refinery/admin/blog/posts/edit.html.erb | 1 - app/views/refinery/admin/blog/posts/index.html.erb | 28 ---- app/views/refinery/admin/blog/posts/new.html.erb | 1 - .../admin/blog/posts/uncategorized.html.erb | 27 ---- .../blog/settings/notification_recipients.html.erb | 24 --- app/views/refinery/blog/admin/_submenu.html.erb | 96 +++++++++++ .../blog/admin/categories/_category.html.erb | 18 +++ .../refinery/blog/admin/categories/_form.html.erb | 19 +++ .../blog/admin/categories/_sortable_list.html.erb | 7 + .../refinery/blog/admin/categories/edit.html.erb | 1 + .../refinery/blog/admin/categories/index.html.erb | 27 ++++ .../refinery/blog/admin/categories/new.html.erb | 1 + .../refinery/blog/admin/comments/_comment.html.erb | 20 +++ .../blog/admin/comments/_sortable_list.html.erb | 7 + .../refinery/blog/admin/comments/index.html.erb | 31 ++++ .../refinery/blog/admin/comments/show.html.erb | 63 ++++++++ app/views/refinery/blog/admin/posts/_form.html.erb | 116 ++++++++++++++ .../refinery/blog/admin/posts/_form_part.html.erb | 3 + app/views/refinery/blog/admin/posts/_post.html.erb | 21 +++ .../blog/admin/posts/_sortable_list.html.erb | 7 + .../blog/admin/posts/_teaser_part.html.erb | 11 ++ app/views/refinery/blog/admin/posts/edit.html.erb | 1 + app/views/refinery/blog/admin/posts/index.html.erb | 28 ++++ app/views/refinery/blog/admin/posts/new.html.erb | 1 + .../blog/admin/posts/uncategorized.html.erb | 27 ++++ .../settings/notification_recipients.html.erb | 24 +++ config/routes.rb | 4 +- lib/refinery/blog/engine.rb | 2 +- spec/requests/refinery/admin/blog/comments_spec.rb | 124 --------------- spec/requests/refinery/admin/blog/posts_spec.rb | 171 -------------------- spec/requests/refinery/admin/menu_spec.rb | 13 -- spec/requests/refinery/blog/admin/comments_spec.rb | 128 +++++++++++++++ spec/requests/refinery/blog/admin/menu_spec.rb | 13 ++ spec/requests/refinery/blog/admin/posts_spec.rb | 175 +++++++++++++++++++++ 59 files changed, 1057 insertions(+), 1051 deletions(-) delete mode 100644 app/controllers/refinery/admin/blog/categories_controller.rb delete mode 100644 app/controllers/refinery/admin/blog/comments_controller.rb delete mode 100644 app/controllers/refinery/admin/blog/posts_controller.rb delete mode 100644 app/controllers/refinery/admin/blog/settings_controller.rb create mode 100644 app/controllers/refinery/blog/admin/categories_controller.rb create mode 100644 app/controllers/refinery/blog/admin/comments_controller.rb create mode 100644 app/controllers/refinery/blog/admin/posts_controller.rb create mode 100644 app/controllers/refinery/blog/admin/settings_controller.rb delete mode 100644 app/views/refinery/admin/blog/_submenu.html.erb delete mode 100644 app/views/refinery/admin/blog/categories/_category.html.erb delete mode 100644 app/views/refinery/admin/blog/categories/_form.html.erb delete mode 100644 app/views/refinery/admin/blog/categories/_sortable_list.html.erb delete mode 100644 app/views/refinery/admin/blog/categories/edit.html.erb delete mode 100644 app/views/refinery/admin/blog/categories/index.html.erb delete mode 100644 app/views/refinery/admin/blog/categories/new.html.erb delete mode 100644 app/views/refinery/admin/blog/comments/_comment.html.erb delete mode 100644 app/views/refinery/admin/blog/comments/_sortable_list.html.erb delete mode 100644 app/views/refinery/admin/blog/comments/index.html.erb delete mode 100644 app/views/refinery/admin/blog/comments/show.html.erb delete mode 100644 app/views/refinery/admin/blog/posts/_form.html.erb delete mode 100644 app/views/refinery/admin/blog/posts/_form_part.html.erb delete mode 100644 app/views/refinery/admin/blog/posts/_post.html.erb delete mode 100644 app/views/refinery/admin/blog/posts/_sortable_list.html.erb delete mode 100644 app/views/refinery/admin/blog/posts/_teaser_part.html.erb delete mode 100644 app/views/refinery/admin/blog/posts/edit.html.erb delete mode 100644 app/views/refinery/admin/blog/posts/index.html.erb delete mode 100644 app/views/refinery/admin/blog/posts/new.html.erb delete mode 100644 app/views/refinery/admin/blog/posts/uncategorized.html.erb delete mode 100644 app/views/refinery/admin/blog/settings/notification_recipients.html.erb create mode 100644 app/views/refinery/blog/admin/_submenu.html.erb create mode 100644 app/views/refinery/blog/admin/categories/_category.html.erb create mode 100644 app/views/refinery/blog/admin/categories/_form.html.erb create mode 100644 app/views/refinery/blog/admin/categories/_sortable_list.html.erb create mode 100644 app/views/refinery/blog/admin/categories/edit.html.erb create mode 100644 app/views/refinery/blog/admin/categories/index.html.erb create mode 100644 app/views/refinery/blog/admin/categories/new.html.erb create mode 100644 app/views/refinery/blog/admin/comments/_comment.html.erb create mode 100644 app/views/refinery/blog/admin/comments/_sortable_list.html.erb create mode 100644 app/views/refinery/blog/admin/comments/index.html.erb create mode 100644 app/views/refinery/blog/admin/comments/show.html.erb create mode 100644 app/views/refinery/blog/admin/posts/_form.html.erb create mode 100644 app/views/refinery/blog/admin/posts/_form_part.html.erb create mode 100644 app/views/refinery/blog/admin/posts/_post.html.erb create mode 100644 app/views/refinery/blog/admin/posts/_sortable_list.html.erb create mode 100644 app/views/refinery/blog/admin/posts/_teaser_part.html.erb create mode 100644 app/views/refinery/blog/admin/posts/edit.html.erb create mode 100644 app/views/refinery/blog/admin/posts/index.html.erb create mode 100644 app/views/refinery/blog/admin/posts/new.html.erb create mode 100644 app/views/refinery/blog/admin/posts/uncategorized.html.erb create mode 100644 app/views/refinery/blog/admin/settings/notification_recipients.html.erb delete mode 100644 spec/requests/refinery/admin/blog/comments_spec.rb delete mode 100644 spec/requests/refinery/admin/blog/posts_spec.rb delete mode 100644 spec/requests/refinery/admin/menu_spec.rb create mode 100644 spec/requests/refinery/blog/admin/comments_spec.rb create mode 100644 spec/requests/refinery/blog/admin/menu_spec.rb create mode 100644 spec/requests/refinery/blog/admin/posts_spec.rb diff --git a/Rakefile b/Rakefile index 743f388..de282bd 100644 --- a/Rakefile +++ b/Rakefile @@ -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/admin/blog/categories_controller.rb deleted file mode 100644 index 0fe4eec..0000000 --- a/app/controllers/refinery/admin/blog/categories_controller.rb +++ /dev/null @@ -1,13 +0,0 @@ -module Refinery - module Admin - module Blog - class CategoriesController < ::Refinery::AdminController - - crudify :'refinery/blog/category', - :title_attribute => :title, - :order => 'title ASC' - - end - end - end -end diff --git a/app/controllers/refinery/admin/blog/comments_controller.rb b/app/controllers/refinery/admin/blog/comments_controller.rb deleted file mode 100644 index 6c1417e..0000000 --- a/app/controllers/refinery/admin/blog/comments_controller.rb +++ /dev/null @@ -1,49 +0,0 @@ -module Refinery - module Admin - module Blog - class CommentsController < ::Refinery::AdminController - - cache_sweeper Refinery::BlogSweeper - - crudify :'refinery/blog/comment', - :title_attribute => :name, - :order => 'published_at DESC' - - def index - @blog_comments = Refinery::Blog::Comment.unmoderated.page(params[:page]) - - render :action => 'index' - end - - def approved - unless params[:id].present? - @blog_comments = Refinery::Blog::Comment.approved.page(params[:page]) - - render :action => 'index' - else - @blog_comment = Refinery::Blog::Comment.find(params[:id]) - @blog_comment.approve! - flash[:notice] = t('approved', :scope => 'refinery.admin.blog.comments', :author => @blog_comment.name) - - redirect_to main_app.url_for(:action => params[:return_to] || 'index') - end - end - - def rejected - unless params[:id].present? - @blog_comments = Refinery::Blog::Comment.rejected.page(params[:page]) - - render :action => 'index' - else - @blog_comment = Refinery::Blog::Comment.find(params[:id]) - @blog_comment.reject! - flash[:notice] = t('rejected', :scope => 'refinery.admin.blog.comments', :author => @blog_comment.name) - - redirect_to main_app.url_for(:action => params[:return_to] || 'index') - end - end - - end - end - end -end diff --git a/app/controllers/refinery/admin/blog/posts_controller.rb b/app/controllers/refinery/admin/blog/posts_controller.rb deleted file mode 100644 index 4645f3f..0000000 --- a/app/controllers/refinery/admin/blog/posts_controller.rb +++ /dev/null @@ -1,92 +0,0 @@ -module Refinery - module Admin - module Blog - class PostsController < ::Refinery::AdminController - - cache_sweeper Refinery::BlogSweeper - - crudify :'refinery/blog/post', - :title_attribute => :title, - :order => 'published_at DESC', - :redirect_to_url => "main_app.refinery_admin_blog_posts_path" - - before_filter :find_all_categories, - :only => [:new, :edit, :create, :update] - - before_filter :check_category_ids, :only => :update - - def uncategorized - @blog_posts = Refinery::Blog::Post.uncategorized.page(params[:page]) - end - - def tags - if ActiveRecord::Base.connection.adapter_name.downcase == 'postgresql' - op = '~*' - wildcard = '.*' - else - op = 'LIKE' - wildcard = '%' - end - - @tags = Refinery::Blog::Post.tag_counts_on(:tags).where( - ["tags.name #{op} ?", "#{wildcard}#{params[:term].to_s.downcase}#{wildcard}"] - ).map { |tag| {:id => tag.id, :value => tag.name}} - render :json => @tags.flatten - end - - def new - @blog_post = ::Refinery::Blog::Post.new(:author => current_refinery_user) - end - - def create - # if the position field exists, set this object as last object, given the conditions of this class. - if Refinery::Blog::Post.column_names.include?("position") - params[:blog_post].merge!({ - :position => ((Refinery::Blog::Post.maximum(:position, :conditions => "")||-1) + 1) - }) - end - - if (@blog_post = Refinery::Blog::Post.create(params[:blog_post])).valid? - (request.xhr? ? flash.now : flash).notice = t( - 'refinery.crudify.created', - :what => "'#{@blog_post.title}'" - ) - - unless from_dialog? - unless params[:continue_editing] =~ /true|on|1/ - redirect_back_or_default(main_app.refinery_admin_blog_posts_path) - else - unless request.xhr? - redirect_to :back - else - render :partial => "/shared/message" - end - end - else - render :text => "" - end - else - unless request.xhr? - render :action => 'new' - else - render :partial => "/refinery/admin/error_messages", - :locals => { - :object => @blog_post, - :include_object_name => true - } - end - end - end - - protected - def find_all_categories - @blog_categories = Refinery::Blog::Category.find(:all) - end - - def check_category_ids - params[:blog_post][:category_ids] ||= [] - end - end - end - end -end diff --git a/app/controllers/refinery/admin/blog/settings_controller.rb b/app/controllers/refinery/admin/blog/settings_controller.rb deleted file mode 100644 index ee71393..0000000 --- a/app/controllers/refinery/admin/blog/settings_controller.rb +++ /dev/null @@ -1,55 +0,0 @@ -module Refinery - module Admin - module Blog - class SettingsController < ::Refinery::AdminController - - def notification_recipients - @recipients = Refinery::Blog::Comment::Notification.recipients - - if request.post? - Refinery::Blog::Comment::Notification.recipients = params[: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(admin_blog_posts_path) - else - render :text => "", - :layout => false - end - end - end - - def moderation - enabled = Refinery::Blog::Comment::Moderation.toggle! - unless request.xhr? - redirect_back_or_default(admin_blog_posts_path) - else - render :json => {:enabled => enabled}, - :layout => false - end - end - - def comments - enabled = Refinery::Blog::Comment.toggle! - unless request.xhr? - redirect_back_or_default(admin_blog_posts_path) - else - render :json => {:enabled => enabled}, - :layout => false - end - end - - def teasers - enabled = Refinery::Blog::Post.teaser_enabled_toggle! - unless request.xhr? - redirect_back_or_default(admin_blog_posts_path) - else - render :json => {:enabled => enabled}, - :layout => false - end - end - - end - end - end -end diff --git a/app/controllers/refinery/blog/admin/categories_controller.rb b/app/controllers/refinery/blog/admin/categories_controller.rb new file mode 100644 index 0000000..cbde1cc --- /dev/null +++ b/app/controllers/refinery/blog/admin/categories_controller.rb @@ -0,0 +1,13 @@ +module Refinery + module Blog + module Admin + class CategoriesController < ::Refinery::AdminController + + crudify :'refinery/blog/category', + :title_attribute => :title, + :order => 'title ASC' + + end + end + end +end diff --git a/app/controllers/refinery/blog/admin/comments_controller.rb b/app/controllers/refinery/blog/admin/comments_controller.rb new file mode 100644 index 0000000..3128e97 --- /dev/null +++ b/app/controllers/refinery/blog/admin/comments_controller.rb @@ -0,0 +1,49 @@ +module Refinery + module Blog + module Admin + class CommentsController < ::Refinery::AdminController + + cache_sweeper Refinery::BlogSweeper + + crudify :'refinery/blog/comment', + :title_attribute => :name, + :order => 'published_at DESC' + + def index + @blog_comments = Refinery::Blog::Comment.unmoderated.page(params[:page]) + + render :action => 'index' + end + + def approved + unless params[:id].present? + @blog_comments = Refinery::Blog::Comment.approved.page(params[:page]) + + render :action => 'index' + else + @blog_comment = Refinery::Blog::Comment.find(params[:id]) + @blog_comment.approve! + flash[:notice] = t('approved', :scope => 'refinery.admin.blog.comments', :author => @blog_comment.name) + + redirect_to main_app.url_for(:action => params[:return_to] || 'index') + end + end + + def rejected + unless params[:id].present? + @blog_comments = Refinery::Blog::Comment.rejected.page(params[:page]) + + render :action => 'index' + else + @blog_comment = Refinery::Blog::Comment.find(params[:id]) + @blog_comment.reject! + flash[:notice] = t('rejected', :scope => 'refinery.admin.blog.comments', :author => @blog_comment.name) + + redirect_to main_app.url_for(:action => params[:return_to] || 'index') + end + end + + end + end + end +end diff --git a/app/controllers/refinery/blog/admin/posts_controller.rb b/app/controllers/refinery/blog/admin/posts_controller.rb new file mode 100644 index 0000000..04ee663 --- /dev/null +++ b/app/controllers/refinery/blog/admin/posts_controller.rb @@ -0,0 +1,92 @@ +module Refinery + module Blog + module Admin + class PostsController < ::Refinery::AdminController + + cache_sweeper Refinery::BlogSweeper + + crudify :'refinery/blog/post', + :title_attribute => :title, + :order => 'published_at DESC', + :redirect_to_url => "main_app.refinery_blog_admin_posts_path" + + before_filter :find_all_categories, + :only => [:new, :edit, :create, :update] + + before_filter :check_category_ids, :only => :update + + def uncategorized + @blog_posts = Refinery::Blog::Post.uncategorized.page(params[:page]) + end + + def tags + if ActiveRecord::Base.connection.adapter_name.downcase == 'postgresql' + op = '~*' + wildcard = '.*' + else + op = 'LIKE' + wildcard = '%' + end + + @tags = Refinery::Blog::Post.tag_counts_on(:tags).where( + ["tags.name #{op} ?", "#{wildcard}#{params[:term].to_s.downcase}#{wildcard}"] + ).map { |tag| {:id => tag.id, :value => tag.name}} + render :json => @tags.flatten + end + + def new + @blog_post = ::Refinery::Blog::Post.new(:author => current_refinery_user) + end + + def create + # if the position field exists, set this object as last object, given the conditions of this class. + if Refinery::Blog::Post.column_names.include?("position") + params[:blog_post].merge!({ + :position => ((Refinery::Blog::Post.maximum(:position, :conditions => "")||-1) + 1) + }) + end + + if (@blog_post = Refinery::Blog::Post.create(params[:blog_post])).valid? + (request.xhr? ? flash.now : flash).notice = t( + 'refinery.crudify.created', + :what => "'#{@blog_post.title}'" + ) + + unless from_dialog? + unless params[:continue_editing] =~ /true|on|1/ + redirect_back_or_default(main_app.refinery_blog_admin_posts_path) + else + unless request.xhr? + redirect_to :back + else + render :partial => "/shared/message" + end + end + else + render :text => "" + end + else + unless request.xhr? + render :action => 'new' + else + render :partial => "/refinery/admin/error_messages", + :locals => { + :object => @blog_post, + :include_object_name => true + } + end + end + end + + protected + def find_all_categories + @blog_categories = Refinery::Blog::Category.find(:all) + end + + def check_category_ids + params[:blog_post][:category_ids] ||= [] + end + end + end + end +end diff --git a/app/controllers/refinery/blog/admin/settings_controller.rb b/app/controllers/refinery/blog/admin/settings_controller.rb new file mode 100644 index 0000000..afa6b2b --- /dev/null +++ b/app/controllers/refinery/blog/admin/settings_controller.rb @@ -0,0 +1,55 @@ +module Refinery + module Blog + module Admin + class SettingsController < ::Refinery::AdminController + + def notification_recipients + @recipients = Refinery::Blog::Comment::Notification.recipients + + if request.post? + Refinery::Blog::Comment::Notification.recipients = params[: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(admin_blog_posts_path) + else + render :text => "", + :layout => false + end + end + end + + def moderation + enabled = Refinery::Blog::Comment::Moderation.toggle! + unless request.xhr? + redirect_back_or_default(admin_blog_posts_path) + else + render :json => {:enabled => enabled}, + :layout => false + end + end + + def comments + enabled = Refinery::Blog::Comment.toggle! + unless request.xhr? + redirect_back_or_default(admin_blog_posts_path) + else + render :json => {:enabled => enabled}, + :layout => false + end + end + + def teasers + enabled = Refinery::Blog::Post.teaser_enabled_toggle! + unless request.xhr? + redirect_back_or_default(admin_blog_posts_path) + else + render :json => {:enabled => enabled}, + :layout => false + end + end + + end + end + end +end diff --git a/app/views/refinery/admin/blog/_submenu.html.erb b/app/views/refinery/admin/blog/_submenu.html.erb deleted file mode 100644 index 2915610..0000000 --- a/app/views/refinery/admin/blog/_submenu.html.erb +++ /dev/null @@ -1,96 +0,0 @@ - - -<% content_for :stylesheets, stylesheet_link_tag('refinery/blog/backend') %> diff --git a/app/views/refinery/admin/blog/categories/_category.html.erb b/app/views/refinery/admin/blog/categories/_category.html.erb deleted file mode 100644 index 80cc2e3..0000000 --- a/app/views/refinery/admin/blog/categories/_category.html.erb +++ /dev/null @@ -1,18 +0,0 @@ -
  • - - <%= category.title %> -   - - - <%= link_to refinery_icon_tag("application_edit.png"), - main_app.edit_refinery_admin_blog_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), - :class => "cancel confirm-delete", - :title => t('.delete'), - :method => :delete, - :confirm => t('message', :scope => 'refinery.admin.delete', :title => category.title) %> - -
  • diff --git a/app/views/refinery/admin/blog/categories/_form.html.erb b/app/views/refinery/admin/blog/categories/_form.html.erb deleted file mode 100644 index a5d3de3..0000000 --- a/app/views/refinery/admin/blog/categories/_form.html.erb +++ /dev/null @@ -1,19 +0,0 @@ -<%= form_for [main_app, :refinery_admin, @blog_category] do |f| -%> - <%= render :partial => "/refinery/admin/error_messages", - :locals => { - :object => f.object, - :include_object_name => true - } %> - -
    - <%= f.label :title -%> - <%= f.text_field :title, :class => 'larger widest' -%> -
    - - <%= render :partial => "/refinery/admin/form_actions", - :locals => { - :f => f, - :continue_editing => false, - :delete_title => t('delete', :scope => 'refinery.admin.blog.categories.category') - } %> -<% end %> diff --git a/app/views/refinery/admin/blog/categories/_sortable_list.html.erb b/app/views/refinery/admin/blog/categories/_sortable_list.html.erb deleted file mode 100644 index f4e8641..0000000 --- a/app/views/refinery/admin/blog/categories/_sortable_list.html.erb +++ /dev/null @@ -1,7 +0,0 @@ - -<%= render :partial => "/refinery/admin/sortable_list", - :locals => { - :continue_reordering => (defined?(continue_reordering) ? continue_reordering : true) - } %> diff --git a/app/views/refinery/admin/blog/categories/edit.html.erb b/app/views/refinery/admin/blog/categories/edit.html.erb deleted file mode 100644 index 2872e82..0000000 --- a/app/views/refinery/admin/blog/categories/edit.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render :partial => "form" %> diff --git a/app/views/refinery/admin/blog/categories/index.html.erb b/app/views/refinery/admin/blog/categories/index.html.erb deleted file mode 100644 index 4ad59ab..0000000 --- a/app/views/refinery/admin/blog/categories/index.html.erb +++ /dev/null @@ -1,27 +0,0 @@ -<%= render :partial => '/refinery/admin/blog/submenu' %> -
    - <% if searching? %> -

    <%= t('results_for', :scope => 'refinery.admin.search', - :query => params[:search]) %>

    - <% if @blog_categories.any? %> - <%= render :partial => "blog_categories", - :collection => @blog_categories %> - <% else %> -

    <%= t('no_results', :scope => 'refinery.admin.search') %>

    - <% end %> - <% else %> - <% if @blog_categories.any? %> - <%= will_paginate @blog_categories %> - - <%= render :partial => "sortable_list" %> - - <%= will_paginate @blog_categories %> - <% else %> -

    - - <%= t('.no_items_yet', :create => t('new', :scope => 'refinery.admin.blog.submenu.categories')) %> - -

    - <% end %> - <% end %> -
    diff --git a/app/views/refinery/admin/blog/categories/new.html.erb b/app/views/refinery/admin/blog/categories/new.html.erb deleted file mode 100644 index 2872e82..0000000 --- a/app/views/refinery/admin/blog/categories/new.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render :partial => "form" %> diff --git a/app/views/refinery/admin/blog/comments/_comment.html.erb b/app/views/refinery/admin/blog/comments/_comment.html.erb deleted file mode 100644 index f5eba4d..0000000 --- a/app/views/refinery/admin/blog/comments/_comment.html.erb +++ /dev/null @@ -1,20 +0,0 @@ -
  • "> - - <%= comment.name %> - - <%= truncate(comment.message, :length => 75) %> - - - <%= link_to refinery_icon_tag("application_go.png"), - 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), - :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')), - :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')), - :title => t('.approve') unless comment.approved? %> - -
  • diff --git a/app/views/refinery/admin/blog/comments/_sortable_list.html.erb b/app/views/refinery/admin/blog/comments/_sortable_list.html.erb deleted file mode 100644 index f781ba1..0000000 --- a/app/views/refinery/admin/blog/comments/_sortable_list.html.erb +++ /dev/null @@ -1,7 +0,0 @@ - -<%= render :partial => "/refinery/admin/sortable_list", - :locals => { - :continue_reordering => (defined?(continue_reordering) ? continue_reordering : true) - } %> diff --git a/app/views/refinery/admin/blog/comments/index.html.erb b/app/views/refinery/admin/blog/comments/index.html.erb deleted file mode 100644 index 059ef59..0000000 --- a/app/views/refinery/admin/blog/comments/index.html.erb +++ /dev/null @@ -1,31 +0,0 @@ -<%= render :partial => '/refinery/admin/blog/submenu' %> -
    - <% if searching? %> -

    <%= t('results_for', :scope => 'shared.admin.search', :query => params[:search]) %>

    - <% if @blog_comments.any? %> - <%= will_paginate @blog_comments %> - - - - <%= will_paginate @blog_comments %> - <% else %> -

    <%= t('search_no_results', :scope => 'admin') %>

    - <% end %> - <% else %> - <% if @blog_comments.any? %> - <%= will_paginate @blog_comments %> - - <%= render :partial => "sortable_list" %> - - <%= will_paginate @blog_comments %> - <% else %> -

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

    - <% end %> - <% end %> -
    diff --git a/app/views/refinery/admin/blog/comments/show.html.erb b/app/views/refinery/admin/blog/comments/show.html.erb deleted file mode 100644 index 3dc50ff..0000000 --- a/app/views/refinery/admin/blog/comments/show.html.erb +++ /dev/null @@ -1,63 +0,0 @@ -
    -

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

    -

    - <%= t('.age') %>: <%= time_ago_in_words(@blog_comment.created_at) %> -

    -

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

    - -
    -
    -

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

    - - - - - - - - - - - - - - - - - -
    - <%= t('.blog_post') %> - - <%= link_to @blog_comment.post.title, - main_app.blog_post_path(@blog_comment.post, :anchor => "comment-#{@blog_comment.to_param}"), - :target => '_blank' %> -
    - <%= t('.from') %> - - <%= @blog_comment.name %> [<%= mail_to @blog_comment.email, @blog_comment.email, {:title => t('.click_to_email')} %>] -
    - <%= t('.date') %> - - <%= l(Date.parse(@blog_comment.created_at.to_s), :format => :long) %> -
    - <%= t('.message') %> - -

    - <%= @blog_comment.message.gsub("\r\n\r\n", "\r\n").gsub("\r\n", "

    ") %> -

    -
    -
    - -<% content_for :stylesheets, stylesheet_link_tag('refinery/blog/backend') %> diff --git a/app/views/refinery/admin/blog/posts/_form.html.erb b/app/views/refinery/admin/blog/posts/_form.html.erb deleted file mode 100644 index f20c0cc..0000000 --- a/app/views/refinery/admin/blog/posts/_form.html.erb +++ /dev/null @@ -1,116 +0,0 @@ -<%= form_for [main_app, :refinery_admin, @blog_post] do |f| -%> - <%= render :partial => "/refinery/admin/error_messages", - :locals => { - :object => f.object, - :include_object_name => true - } %> - -
    - <%= f.label :title -%> - <%= f.text_field :title, :class => 'larger widest' -%> -
    - -
    -
    -
      -
    • - <%= link_to t('body', :scope => 'activerecord.attributes.refinery/blog_post'), "#page_part_body" %> -
    • -
    • - <%= link_to t('teaser', :scope => 'activerecord.attributes.refinery/blog_post'), "#page_part_teaser" %> -
    • - <% Refinery::Blog.tabs.each_with_index do |tab, tab_index| %> -
    • - <%= link_to tab.name.titleize, "#custom_tab_#{tab_index}" %> -
    • - <% end %> -
    - -
    - <% part_index = -1 %> - <%= render :partial => 'form_part', - :locals => { - :f => f, - :part_index => (part_index += 1), - } -%> - <%= render :partial => 'teaser_part', - :locals => { - :f => f, - :part_index => (part_index += 1), - } if f.object.respond_to?(:custom_teaser) -%> - <% Refinery::Blog.tabs.each_with_index do |tab, tab_index| %> -
    - <%= render :partial => tab.partial, :locals => {:f => f} %> -
    - <% end %> -
    -
    -
    - -
    - <%= f.label :tag_list, t('refinery.blog.shared.tags.title') -%> - <%= f.text_field :tag_list, :class => 'larger' -%> -
    - -
    -

    - <%= link_to t('.advanced_options'), "#", - :id => 'toggle_advanced_options', - :title => t('.toggle_advanced_options') %> -

    - - <%= f.check_box :draft %> - <%= f.label :draft, t('.save_as_draft'), :class => "stripped" %> - -
    - - <%= render :partial => "/refinery/admin/form_actions", - :locals => { - :f => f, - :continue_editing => true, - :delete_title => t('delete', :scope => 'refinery.admin.blog.posts.post') - } %> -<% end -%> - -<% 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 %> diff --git a/app/views/refinery/admin/blog/posts/_form_part.html.erb b/app/views/refinery/admin/blog/posts/_form_part.html.erb deleted file mode 100644 index 114e493..0000000 --- a/app/views/refinery/admin/blog/posts/_form_part.html.erb +++ /dev/null @@ -1,3 +0,0 @@ -
    - <%= f.text_area :body, :rows => 20, :class => 'wymeditor widest' -%> -
    diff --git a/app/views/refinery/admin/blog/posts/_post.html.erb b/app/views/refinery/admin/blog/posts/_post.html.erb deleted file mode 100644 index 28704ff..0000000 --- a/app/views/refinery/admin/blog/posts/_post.html.erb +++ /dev/null @@ -1,21 +0,0 @@ -
  • - - <%= post.title %> - - <%= post.published_at.try(:strftime, '%b %d, %Y') || 'draft' %> - <%= " by #{post.author.username}" if post.author.present? %> - - - - <%= 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), - :title => t('.edit') %> - <%= link_to refinery_icon_tag("delete.png"), main_app.refinery_admin_blog_post_path(post), - :class => "cancel confirm-delete", - :title => t('.delete'), - :method => :delete, - :confirm => t('message', :scope => 'refinery.admin.delete', :title => post.title) %> - -
  • diff --git a/app/views/refinery/admin/blog/posts/_sortable_list.html.erb b/app/views/refinery/admin/blog/posts/_sortable_list.html.erb deleted file mode 100644 index 18d12cc..0000000 --- a/app/views/refinery/admin/blog/posts/_sortable_list.html.erb +++ /dev/null @@ -1,7 +0,0 @@ - -<%= render :partial => "/refinery/admin/sortable_list", - :locals => { - :continue_reordering => (defined?(continue_reordering) ? continue_reordering : true) - } %> diff --git a/app/views/refinery/admin/blog/posts/_teaser_part.html.erb b/app/views/refinery/admin/blog/posts/_teaser_part.html.erb deleted file mode 100644 index dc9186a..0000000 --- a/app/views/refinery/admin/blog/posts/_teaser_part.html.erb +++ /dev/null @@ -1,11 +0,0 @@ -
    - <%= f.text_area :custom_teaser, :rows => 20, :class => 'wymeditor widest' -%> -

    - - <%= link_to t('copy_body', :scope => 'refinery.admin.blog.posts.form'), "#", - :id => 'copy_body_link', - :title => t('copy_body_help', :scope => 'refinery.admin.blog.posts.form') %> - -

    -
    - diff --git a/app/views/refinery/admin/blog/posts/edit.html.erb b/app/views/refinery/admin/blog/posts/edit.html.erb deleted file mode 100644 index 2872e82..0000000 --- a/app/views/refinery/admin/blog/posts/edit.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render :partial => "form" %> diff --git a/app/views/refinery/admin/blog/posts/index.html.erb b/app/views/refinery/admin/blog/posts/index.html.erb deleted file mode 100644 index 922353c..0000000 --- a/app/views/refinery/admin/blog/posts/index.html.erb +++ /dev/null @@ -1,28 +0,0 @@ -<%= render :partial => '/refinery/admin/blog/submenu' %> -
    - <% if searching? %> -

    <%= t('results_for', :scope => 'refinery.admin.search', :query => params[:search]) %>

    - <% if @blog_posts.any? %> - - <% else %> -

    <%= t('no_results', :scope => 'refinery.admin.search') %>

    - <% end %> - <% else %> - <% if @blog_posts.any? %> - <%= will_paginate @blog_posts %> - - <%= render :partial => "sortable_list" %> - - <%= will_paginate @blog_posts %> - <% else %> -

    - - <%= t('.no_items_yet', :create => t('new', :scope => 'refinery.admin.blog.submenu.posts')) %> - -

    - <% end %> - <% end %> -
    diff --git a/app/views/refinery/admin/blog/posts/new.html.erb b/app/views/refinery/admin/blog/posts/new.html.erb deleted file mode 100644 index 2872e82..0000000 --- a/app/views/refinery/admin/blog/posts/new.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render :partial => "form" %> diff --git a/app/views/refinery/admin/blog/posts/uncategorized.html.erb b/app/views/refinery/admin/blog/posts/uncategorized.html.erb deleted file mode 100644 index 030e789..0000000 --- a/app/views/refinery/admin/blog/posts/uncategorized.html.erb +++ /dev/null @@ -1,27 +0,0 @@ -<%= render :partial => '/refinery/admin/blog/submenu' %> -
    - <% if searching? %> -

    <%= t('results_for', :scope => 'refinery.admin.search', - :query => params[:search]) %>

    - <% if @blog_posts.any? %> - <%= render :partial => "blog_posts", - :collection => @blog_posts %> - <% else %> -

    <%= t('no_results', :scope => 'refinery.admin.search') %>

    - <% end %> - <% else %> - <% if @blog_posts.any? %> - <%= will_paginate @blog_posts %> - - <%= render :partial => "sortable_list" %> - - <%= will_paginate @blog_posts %> - <% else %> -

    - - <%= t('.no_items_yet') %> - -

    - <% end %> - <% end %> -
    diff --git a/app/views/refinery/admin/blog/settings/notification_recipients.html.erb b/app/views/refinery/admin/blog/settings/notification_recipients.html.erb deleted file mode 100644 index d321ded..0000000 --- a/app/views/refinery/admin/blog/settings/notification_recipients.html.erb +++ /dev/null @@ -1,24 +0,0 @@ -<%= form_tag do %> - -
    - - <%= label_tag :recipients, t('.value') %> - - <%= text_field_tag :recipients, @recipients, :class => "larger widest" %> -
    - -

    - <%= t('.hint') %> -

    -

    - <%= t('.example') %> -

    - - <%= render :partial => "/refinery/admin/form_actions", - :locals => { - :f => nil, - :continue_editing => false, - :cancel_url => admin_blog_posts_url, - :hide_delete => true - } %> -<% end %> diff --git a/app/views/refinery/blog/admin/_submenu.html.erb b/app/views/refinery/blog/admin/_submenu.html.erb new file mode 100644 index 0000000..d290ce8 --- /dev/null +++ b/app/views/refinery/blog/admin/_submenu.html.erb @@ -0,0 +1,96 @@ + + +<% content_for :stylesheets, stylesheet_link_tag('refinery/blog/backend') %> diff --git a/app/views/refinery/blog/admin/categories/_category.html.erb b/app/views/refinery/blog/admin/categories/_category.html.erb new file mode 100644 index 0000000..d476439 --- /dev/null +++ b/app/views/refinery/blog/admin/categories/_category.html.erb @@ -0,0 +1,18 @@ +
  • + + <%= category.title %> +   + + + <%= link_to refinery_icon_tag("application_edit.png"), + 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_blog_admin_category_path(category), + :class => "cancel confirm-delete", + :title => t('.delete'), + :method => :delete, + :confirm => t('message', :scope => 'refinery.admin.delete', :title => category.title) %> + +
  • diff --git a/app/views/refinery/blog/admin/categories/_form.html.erb b/app/views/refinery/blog/admin/categories/_form.html.erb new file mode 100644 index 0000000..a5d3de3 --- /dev/null +++ b/app/views/refinery/blog/admin/categories/_form.html.erb @@ -0,0 +1,19 @@ +<%= form_for [main_app, :refinery_admin, @blog_category] do |f| -%> + <%= render :partial => "/refinery/admin/error_messages", + :locals => { + :object => f.object, + :include_object_name => true + } %> + +
    + <%= f.label :title -%> + <%= f.text_field :title, :class => 'larger widest' -%> +
    + + <%= render :partial => "/refinery/admin/form_actions", + :locals => { + :f => f, + :continue_editing => false, + :delete_title => t('delete', :scope => 'refinery.admin.blog.categories.category') + } %> +<% end %> diff --git a/app/views/refinery/blog/admin/categories/_sortable_list.html.erb b/app/views/refinery/blog/admin/categories/_sortable_list.html.erb new file mode 100644 index 0000000..f4e8641 --- /dev/null +++ b/app/views/refinery/blog/admin/categories/_sortable_list.html.erb @@ -0,0 +1,7 @@ + +<%= render :partial => "/refinery/admin/sortable_list", + :locals => { + :continue_reordering => (defined?(continue_reordering) ? continue_reordering : true) + } %> diff --git a/app/views/refinery/blog/admin/categories/edit.html.erb b/app/views/refinery/blog/admin/categories/edit.html.erb new file mode 100644 index 0000000..2872e82 --- /dev/null +++ b/app/views/refinery/blog/admin/categories/edit.html.erb @@ -0,0 +1 @@ +<%= render :partial => "form" %> diff --git a/app/views/refinery/blog/admin/categories/index.html.erb b/app/views/refinery/blog/admin/categories/index.html.erb new file mode 100644 index 0000000..4ad59ab --- /dev/null +++ b/app/views/refinery/blog/admin/categories/index.html.erb @@ -0,0 +1,27 @@ +<%= render :partial => '/refinery/admin/blog/submenu' %> +
    + <% if searching? %> +

    <%= t('results_for', :scope => 'refinery.admin.search', + :query => params[:search]) %>

    + <% if @blog_categories.any? %> + <%= render :partial => "blog_categories", + :collection => @blog_categories %> + <% else %> +

    <%= t('no_results', :scope => 'refinery.admin.search') %>

    + <% end %> + <% else %> + <% if @blog_categories.any? %> + <%= will_paginate @blog_categories %> + + <%= render :partial => "sortable_list" %> + + <%= will_paginate @blog_categories %> + <% else %> +

    + + <%= t('.no_items_yet', :create => t('new', :scope => 'refinery.admin.blog.submenu.categories')) %> + +

    + <% end %> + <% end %> +
    diff --git a/app/views/refinery/blog/admin/categories/new.html.erb b/app/views/refinery/blog/admin/categories/new.html.erb new file mode 100644 index 0000000..2872e82 --- /dev/null +++ b/app/views/refinery/blog/admin/categories/new.html.erb @@ -0,0 +1 @@ +<%= render :partial => "form" %> diff --git a/app/views/refinery/blog/admin/comments/_comment.html.erb b/app/views/refinery/blog/admin/comments/_comment.html.erb new file mode 100644 index 0000000..51f2996 --- /dev/null +++ b/app/views/refinery/blog/admin/comments/_comment.html.erb @@ -0,0 +1,20 @@ +
  • "> + + <%= comment.name %> + - <%= truncate(comment.message, :length => 75) %> + + + <%= link_to refinery_icon_tag("application_go.png"), + 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_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')), + :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')), + :title => t('.approve') unless comment.approved? %> + +
  • diff --git a/app/views/refinery/blog/admin/comments/_sortable_list.html.erb b/app/views/refinery/blog/admin/comments/_sortable_list.html.erb new file mode 100644 index 0000000..f781ba1 --- /dev/null +++ b/app/views/refinery/blog/admin/comments/_sortable_list.html.erb @@ -0,0 +1,7 @@ + +<%= render :partial => "/refinery/admin/sortable_list", + :locals => { + :continue_reordering => (defined?(continue_reordering) ? continue_reordering : true) + } %> diff --git a/app/views/refinery/blog/admin/comments/index.html.erb b/app/views/refinery/blog/admin/comments/index.html.erb new file mode 100644 index 0000000..059ef59 --- /dev/null +++ b/app/views/refinery/blog/admin/comments/index.html.erb @@ -0,0 +1,31 @@ +<%= render :partial => '/refinery/admin/blog/submenu' %> +
    + <% if searching? %> +

    <%= t('results_for', :scope => 'shared.admin.search', :query => params[:search]) %>

    + <% if @blog_comments.any? %> + <%= will_paginate @blog_comments %> + + + + <%= will_paginate @blog_comments %> + <% else %> +

    <%= t('search_no_results', :scope => 'admin') %>

    + <% end %> + <% else %> + <% if @blog_comments.any? %> + <%= will_paginate @blog_comments %> + + <%= render :partial => "sortable_list" %> + + <%= will_paginate @blog_comments %> + <% else %> +

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

    + <% end %> + <% end %> +
    diff --git a/app/views/refinery/blog/admin/comments/show.html.erb b/app/views/refinery/blog/admin/comments/show.html.erb new file mode 100644 index 0000000..2aa75f1 --- /dev/null +++ b/app/views/refinery/blog/admin/comments/show.html.erb @@ -0,0 +1,63 @@ +
    +

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

    +

    + <%= t('.age') %>: <%= time_ago_in_words(@blog_comment.created_at) %> +

    +

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

    + +
    +
    +

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

    + + + + + + + + + + + + + + + + + +
    + <%= t('.blog_post') %> + + <%= link_to @blog_comment.post.title, + main_app.blog_post_path(@blog_comment.post, :anchor => "comment-#{@blog_comment.to_param}"), + :target => '_blank' %> +
    + <%= t('.from') %> + + <%= @blog_comment.name %> [<%= mail_to @blog_comment.email, @blog_comment.email, {:title => t('.click_to_email')} %>] +
    + <%= t('.date') %> + + <%= l(Date.parse(@blog_comment.created_at.to_s), :format => :long) %> +
    + <%= t('.message') %> + +

    + <%= @blog_comment.message.gsub("\r\n\r\n", "\r\n").gsub("\r\n", "

    ") %> +

    +
    +
    + +<% content_for :stylesheets, stylesheet_link_tag('refinery/blog/backend') %> diff --git a/app/views/refinery/blog/admin/posts/_form.html.erb b/app/views/refinery/blog/admin/posts/_form.html.erb new file mode 100644 index 0000000..656c9c6 --- /dev/null +++ b/app/views/refinery/blog/admin/posts/_form.html.erb @@ -0,0 +1,116 @@ +<%= form_for [main_app, :refinery_admin, @blog_post] do |f| -%> + <%= render :partial => "/refinery/admin/error_messages", + :locals => { + :object => f.object, + :include_object_name => true + } %> + +
    + <%= f.label :title -%> + <%= f.text_field :title, :class => 'larger widest' -%> +
    + +
    +
    +
      +
    • + <%= link_to t('body', :scope => 'activerecord.attributes.refinery/blog_post'), "#page_part_body" %> +
    • +
    • + <%= link_to t('teaser', :scope => 'activerecord.attributes.refinery/blog_post'), "#page_part_teaser" %> +
    • + <% Refinery::Blog.tabs.each_with_index do |tab, tab_index| %> +
    • + <%= link_to tab.name.titleize, "#custom_tab_#{tab_index}" %> +
    • + <% end %> +
    + +
    + <% part_index = -1 %> + <%= render :partial => 'form_part', + :locals => { + :f => f, + :part_index => (part_index += 1), + } -%> + <%= render :partial => 'teaser_part', + :locals => { + :f => f, + :part_index => (part_index += 1), + } if f.object.respond_to?(:custom_teaser) -%> + <% Refinery::Blog.tabs.each_with_index do |tab, tab_index| %> +
    + <%= render :partial => tab.partial, :locals => {:f => f} %> +
    + <% end %> +
    +
    +
    + +
    + <%= f.label :tag_list, t('refinery.blog.shared.tags.title') -%> + <%= f.text_field :tag_list, :class => 'larger' -%> +
    + +
    +

    + <%= link_to t('.advanced_options'), "#", + :id => 'toggle_advanced_options', + :title => t('.toggle_advanced_options') %> +

    + + <%= f.check_box :draft %> + <%= f.label :draft, t('.save_as_draft'), :class => "stripped" %> + +
    + + <%= render :partial => "/refinery/admin/form_actions", + :locals => { + :f => f, + :continue_editing => true, + :delete_title => t('delete', :scope => 'refinery.admin.blog.posts.post') + } %> +<% end -%> + +<% 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 %> diff --git a/app/views/refinery/blog/admin/posts/_form_part.html.erb b/app/views/refinery/blog/admin/posts/_form_part.html.erb new file mode 100644 index 0000000..114e493 --- /dev/null +++ b/app/views/refinery/blog/admin/posts/_form_part.html.erb @@ -0,0 +1,3 @@ +
    + <%= f.text_area :body, :rows => 20, :class => 'wymeditor widest' -%> +
    diff --git a/app/views/refinery/blog/admin/posts/_post.html.erb b/app/views/refinery/blog/admin/posts/_post.html.erb new file mode 100644 index 0000000..c8baa80 --- /dev/null +++ b/app/views/refinery/blog/admin/posts/_post.html.erb @@ -0,0 +1,21 @@ +
  • + + <%= post.title %> + + <%= post.published_at.try(:strftime, '%b %d, %Y') || 'draft' %> + <%= " by #{post.author.username}" if post.author.present? %> + + + + <%= 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_blog_admin_post_path(post), + :title => t('.edit') %> + <%= link_to refinery_icon_tag("delete.png"), main_app.refinery_blog_admin_post_path(post), + :class => "cancel confirm-delete", + :title => t('.delete'), + :method => :delete, + :confirm => t('message', :scope => 'refinery.admin.delete', :title => post.title) %> + +
  • diff --git a/app/views/refinery/blog/admin/posts/_sortable_list.html.erb b/app/views/refinery/blog/admin/posts/_sortable_list.html.erb new file mode 100644 index 0000000..18d12cc --- /dev/null +++ b/app/views/refinery/blog/admin/posts/_sortable_list.html.erb @@ -0,0 +1,7 @@ + +<%= render :partial => "/refinery/admin/sortable_list", + :locals => { + :continue_reordering => (defined?(continue_reordering) ? continue_reordering : true) + } %> diff --git a/app/views/refinery/blog/admin/posts/_teaser_part.html.erb b/app/views/refinery/blog/admin/posts/_teaser_part.html.erb new file mode 100644 index 0000000..dc9186a --- /dev/null +++ b/app/views/refinery/blog/admin/posts/_teaser_part.html.erb @@ -0,0 +1,11 @@ +
    + <%= f.text_area :custom_teaser, :rows => 20, :class => 'wymeditor widest' -%> +

    + + <%= link_to t('copy_body', :scope => 'refinery.admin.blog.posts.form'), "#", + :id => 'copy_body_link', + :title => t('copy_body_help', :scope => 'refinery.admin.blog.posts.form') %> + +

    +
    + diff --git a/app/views/refinery/blog/admin/posts/edit.html.erb b/app/views/refinery/blog/admin/posts/edit.html.erb new file mode 100644 index 0000000..2872e82 --- /dev/null +++ b/app/views/refinery/blog/admin/posts/edit.html.erb @@ -0,0 +1 @@ +<%= render :partial => "form" %> diff --git a/app/views/refinery/blog/admin/posts/index.html.erb b/app/views/refinery/blog/admin/posts/index.html.erb new file mode 100644 index 0000000..922353c --- /dev/null +++ b/app/views/refinery/blog/admin/posts/index.html.erb @@ -0,0 +1,28 @@ +<%= render :partial => '/refinery/admin/blog/submenu' %> +
    + <% if searching? %> +

    <%= t('results_for', :scope => 'refinery.admin.search', :query => params[:search]) %>

    + <% if @blog_posts.any? %> + + <% else %> +

    <%= t('no_results', :scope => 'refinery.admin.search') %>

    + <% end %> + <% else %> + <% if @blog_posts.any? %> + <%= will_paginate @blog_posts %> + + <%= render :partial => "sortable_list" %> + + <%= will_paginate @blog_posts %> + <% else %> +

    + + <%= t('.no_items_yet', :create => t('new', :scope => 'refinery.admin.blog.submenu.posts')) %> + +

    + <% end %> + <% end %> +
    diff --git a/app/views/refinery/blog/admin/posts/new.html.erb b/app/views/refinery/blog/admin/posts/new.html.erb new file mode 100644 index 0000000..2872e82 --- /dev/null +++ b/app/views/refinery/blog/admin/posts/new.html.erb @@ -0,0 +1 @@ +<%= render :partial => "form" %> diff --git a/app/views/refinery/blog/admin/posts/uncategorized.html.erb b/app/views/refinery/blog/admin/posts/uncategorized.html.erb new file mode 100644 index 0000000..030e789 --- /dev/null +++ b/app/views/refinery/blog/admin/posts/uncategorized.html.erb @@ -0,0 +1,27 @@ +<%= render :partial => '/refinery/admin/blog/submenu' %> +
    + <% if searching? %> +

    <%= t('results_for', :scope => 'refinery.admin.search', + :query => params[:search]) %>

    + <% if @blog_posts.any? %> + <%= render :partial => "blog_posts", + :collection => @blog_posts %> + <% else %> +

    <%= t('no_results', :scope => 'refinery.admin.search') %>

    + <% end %> + <% else %> + <% if @blog_posts.any? %> + <%= will_paginate @blog_posts %> + + <%= render :partial => "sortable_list" %> + + <%= will_paginate @blog_posts %> + <% else %> +

    + + <%= t('.no_items_yet') %> + +

    + <% end %> + <% end %> +
    diff --git a/app/views/refinery/blog/admin/settings/notification_recipients.html.erb b/app/views/refinery/blog/admin/settings/notification_recipients.html.erb new file mode 100644 index 0000000..d321ded --- /dev/null +++ b/app/views/refinery/blog/admin/settings/notification_recipients.html.erb @@ -0,0 +1,24 @@ +<%= form_tag do %> + +
    + + <%= label_tag :recipients, t('.value') %> + + <%= text_field_tag :recipients, @recipients, :class => "larger widest" %> +
    + +

    + <%= t('.hint') %> +

    +

    + <%= t('.example') %> +

    + + <%= render :partial => "/refinery/admin/form_actions", + :locals => { + :f => nil, + :continue_editing => false, + :cancel_url => admin_blog_posts_url, + :hide_delete => true + } %> +<% end %> 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/admin/menu_spec.rb b/spec/requests/refinery/admin/menu_spec.rb deleted file mode 100644 index b02a473..0000000 --- a/spec/requests/refinery/admin/menu_spec.rb +++ /dev/null @@ -1,13 +0,0 @@ -require 'spec_helper' - -describe "Blog menu entry" do - login_refinery_user - - it "is highlighted when managing the blog" do - visit refinery_admin_root_path - - within("#menu") { click_link "Blog" } - - page.should have_css("a.active", :text => "Blog") - 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/blog/admin/menu_spec.rb b/spec/requests/refinery/blog/admin/menu_spec.rb new file mode 100644 index 0000000..b02a473 --- /dev/null +++ b/spec/requests/refinery/blog/admin/menu_spec.rb @@ -0,0 +1,13 @@ +require 'spec_helper' + +describe "Blog menu entry" do + login_refinery_user + + it "is highlighted when managing the blog" do + visit refinery_admin_root_path + + within("#menu") { click_link "Blog" } + + page.should have_css("a.active", :text => "Blog") + end +end 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 -- cgit v1.2.3