From a1f7ea061ea2c9694a383c8d20137628a178d979 Mon Sep 17 00:00:00 2001 From: Amanda Wagener Date: Wed, 1 Dec 2010 11:27:26 +1300 Subject: [PATCH 001/494] WARNING: Rails 2 users should move to the rails2-stable branch. This commit moves to the new i18n string interpolation used in Rails 3. --- config/locales/en.yml | 20 ++++++++++---------- config/locales/it.yml | 20 ++++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index d12605c..930dfad 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -9,17 +9,17 @@ en: edit: Edit this category delete: Delete this category forever index: - no_items_yet: 'There are no categories yet. Click "{{create}}" to add your first category.' + no_items_yet: 'There are no categories yet. Click "%{create}" to add your first category.' comments: - approved: 'The comment from "{{author}}" has been approved.' + approved: 'The comment from "%{author}" has been approved.' comment: view_live: View this comment live
(opens in a new window) read: Read this comment reject: Reject this comment approve: Approve this comment - rejected: 'The comment from "{{author}}" has been rejected.' + rejected: 'The comment from "%{author}" has been rejected.' index: - no_items_yet: 'There are no {{type}} comments.' + no_items_yet: 'There are no %{type} comments.' show: comment: Comment blog_post: Blog Post @@ -39,7 +39,7 @@ en: save_as_draft: Save as Draft published_at: Publish Date index: - no_items_yet: 'There are no Blog Posts yet. Click "{{create}}" to add your first blog post.' + no_items_yet: 'There are no Blog Posts yet. Click "%{create}" to add your first blog post.' post: view_live: View this blog post live
(opens in a new window) edit: Edit this blog post @@ -50,7 +50,7 @@ en: explanation: 'Every time someone comments on a blog post, Refinery sends out an email to say there is a new comment.' hint: 'When a new comment is added, Refinery will send an email notification to you.' example: "Enter your email address(es) like: jack@work.com, jill@office.com" - updated: 'Notification recipients have been set to "{{recipients}}"' + updated: 'Notification recipients have been set to "%{recipients}"' submenu: categories: title: Categories @@ -58,7 +58,7 @@ en: new: Create new category comments: title: Comments - title_with_count: 'Comments ({{new_count}} new)' + title_with_count: 'Comments (%{new_count} new)' new: New unmoderated: New approved: Approved @@ -90,7 +90,7 @@ en: title: RSS Feed posts: other: Other Posts - created_at: 'Posted on {{when}}' + created_at: 'Posted on %{when}' read_more: Read more comments: singular: comment @@ -101,8 +101,8 @@ en: posts: comment: comment comments: - by: 'Posted by {{who}}' - time_ago: '{{time}} ago' + by: 'Posted by %{who}' + time_ago: '%{time} ago' thank_you: 'Thank you for commenting.' thank_you_moderated: 'Thank you for commenting. Your message has been placed in the moderation queue and will appear shortly.' show: diff --git a/config/locales/it.yml b/config/locales/it.yml index 93fdaf6..e0c9c79 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -9,17 +9,17 @@ it: edit: Modifica questa categoria delete: Elimina questa categoria per sempre index: - no_items_yet: 'Nessuna categoria ancora presente. Fare click su "{{create}}" per aggiungere la tua prima categoria.' + no_items_yet: 'Nessuna categoria ancora presente. Fare click su "%{create}" per aggiungere la tua prima categoria.' comments: - approved: 'Il commento di "{{author}}" è stato approvato.' + approved: 'Il commento di "%{author}" è stato approvato.' comment: view_live: Visualizza questo commento
live (si apre in una nuova finestra) read: Leggi questo commento reject: Rifiuta questo commento approve: Approva questo commento - rejected: 'Il commento di "{{author}}" è stato rifiutato.' + rejected: 'Il commento di "%{author}" è stato rifiutato.' index: - no_items_yet: 'Non ci sono {{type}} commenti.' + no_items_yet: 'Non ci sono %{type} commenti.' show: comment: Commento blog_post: Messaggio del Blog @@ -39,7 +39,7 @@ it: save_as_draft: Salva come Bozza published_at: Data di Pubblicazione index: - no_items_yet: 'Non ci sono ancora Messaggi per questo Blog. Clicca "{{create}}" per aggiungere il tuo primo messaggio.' + no_items_yet: 'Non ci sono ancora Messaggi per questo Blog. Clicca "%{create}" per aggiungere il tuo primo messaggio.' post: view_live: Visualizza questo messaggio live
(si apre in una nuova finestra) edit: Modifica questo messaggio @@ -50,7 +50,7 @@ it: explanation: "Ogni volta che qualcuno commenta un messaggio del blog, Refinery invia una mail per avvisare che c'è un nuovo comemnto" hint: 'Quando viene aggiunto un nuovo commento Refinery ti invierà una email di notifica.' example: "Inserisci il tuo indirizzo email. È possibile insierire più indirizzi separati dalla virgola. Es: jack@work.com, jill@office.com" - updated: 'I destinatari delle notifiche sono stati impostati "{{recipients}}"' + updated: 'I destinatari delle notifiche sono stati impostati "%{recipients}"' submenu: categories: title: Categorie @@ -58,7 +58,7 @@ it: new: Crea nuova categoria comments: title: Commenti - title_with_count: 'Comment1 ({{new_count}} nuovi)' + title_with_count: 'Comment1 (%{new_count} nuovi)' new: Nuovo unmoderated: Nuovo approved: Approvato @@ -79,7 +79,7 @@ it: title: RSS Feed posts: other: Altri Messaggi - created_at: 'Pubblicato il {{when}}' + created_at: 'Pubblicato il %{when}' read_more: Per saperne di più comments: singular: commento @@ -91,8 +91,8 @@ it: posts: comment: commento comments: - by: 'Pubblicato da {{who}}' - time_ago: '{{time}} fa' + by: 'Pubblicato da %{who}' + time_ago: '%{time} fa' thank_you: 'Grazie per aver scritto un commento.' thank_you_moderated: 'Grazie per aver scritto un commento. Il tuo messaggio è stato inserito nella coda di moderazione e sarà visibile a breve.' show: From c38d9c3da5b9b21df07c4c7ebc8617413977c7fb Mon Sep 17 00:00:00 2001 From: Amanda Wagener Date: Wed, 1 Dec 2010 11:43:26 +1300 Subject: [PATCH 002/494] Remove all Rails2/Rails3 checks as master is now Rails3 only --- app/controllers/blog/posts_controller.rb | 34 ++----- app/models/blog_comment.rb | 12 +-- app/models/blog_post.rb | 31 ++----- .../admin/blog/categories/_form.html.erb | 14 ++- app/views/admin/blog/posts/_form.html.erb | 14 ++- app/views/blog/posts/show.html.erb | 20 ++--- config/routes.rb | 90 ++++++------------- readme.md | 12 ++- 8 files changed, 67 insertions(+), 160 deletions(-) diff --git a/app/controllers/blog/posts_controller.rb b/app/controllers/blog/posts_controller.rb index 5de6984..f489039 100644 --- a/app/controllers/blog/posts_controller.rb +++ b/app/controllers/blog/posts_controller.rb @@ -3,29 +3,21 @@ class Blog::PostsController < BlogController before_filter :find_all_blog_posts, :except => [:archive] before_filter :find_blog_post, :only => [:show, :comment, :update_nav] - respond_to :html, :js, :rss if Rails.version >= '3.0.0' + respond_to :html, :js, :rss def index - if Rails.version < '3.0.0' - # TODO: respond_to block - else - respond_with (@blog_posts) do |format| - format.html - format.rss - end + respond_with (@blog_posts) do |format| + format.html + format.rss end end def show @blog_comment = BlogComment.new - if Rails.version < '3.0.0' - # TODO: respond_to block - else - respond_with (@blog_post) do |format| - format.html { present(@page) } - format.js { render :partial => 'post', :layout => false } - end + respond_with (@blog_post) do |format| + format.html { present(@page) } + format.js { render :partial => 'post', :layout => false } end end @@ -33,11 +25,7 @@ class Blog::PostsController < BlogController if (@blog_comment = @blog_post.comments.create(params[:blog_comment])).valid? if BlogComment::Moderation.enabled? or @blog_comment.ham? begin - if Rails.version < '3.0.0' - Blog::CommentMailer.deliver_notification(@blog_comment, request) - else - Blog::CommentMailer.notification(@blog_comment, request).deliver - end + Blog::CommentMailer.notification(@blog_comment, request).deliver rescue logger.warn "There was an error delivering a blog comment notification.\n#{$!}\n" end @@ -63,11 +51,7 @@ class Blog::PostsController < BlogController :page => params[:page], :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10) }) - if Rails.version < '3.0.0' - # TODO: respond_to block - else - respond_with (@blog_posts) - end + respond_with (@blog_posts) end protected diff --git a/app/models/blog_comment.rb b/app/models/blog_comment.rb index 63f9731..f608a1a 100644 --- a/app/models/blog_comment.rb +++ b/app/models/blog_comment.rb @@ -14,15 +14,9 @@ class BlogComment < ActiveRecord::Base validates_format_of :email, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i - if Rails.version < '3.0.0' - named_scope :unmoderated, :conditions => {:state => nil} - named_scope :approved, :conditions => {:state => 'approved'} - named_scope :rejected, :conditions => {:state => 'rejected'} - else - scope :unmoderated, :conditions => {:state => nil} - scope :approved, :conditions => {:state => 'approved'} - scope :rejected, :conditions => {:state => 'rejected'} - end + scope :unmoderated, :conditions => {:state => nil} + scope :approved, :conditions => {:state => 'approved'} + scope :rejected, :conditions => {:state => 'rejected'} def approve! self.update_attribute(:state, 'approved') diff --git a/app/models/blog_post.rb b/app/models/blog_post.rb index b965e5d..8937e09 100644 --- a/app/models/blog_post.rb +++ b/app/models/blog_post.rb @@ -10,33 +10,16 @@ class BlogPost < ActiveRecord::Base has_friendly_id :title, :use_slug => true - if Rails.version < '3.0.0' - named_scope :by_archive, lambda { |archive_date| {:conditions => ['published_at between ? and ?', archive_date.beginning_of_month, archive_date.end_of_month], :order => "published_at DESC"} } - else - scope :by_archive, lambda { |archive_date| - where(['published_at between ? and ?', archive_date.beginning_of_month, archive_date.end_of_month]).order("published_at DESC") - } - end + scope :by_archive, lambda { |archive_date| + where(['published_at between ? and ?', archive_date.beginning_of_month, archive_date.end_of_month]).order("published_at DESC") + } - if Rails.version < '3.0.0' - named_scope :all_previous, :conditions => ['published_at <= ?', Time.now.beginning_of_month], :order => "published_at DESC" - else - scope :all_previous, where(['published_at <= ?', Time.now.beginning_of_month]).order("published_at DESC") - end + scope :all_previous, where(['published_at <= ?', Time.now.beginning_of_month]).order("published_at DESC") - if Rails.version < '3.0.0' - named_scope :live, lambda { {:conditions => ["published_at < ? and draft = ?", Time.now, false], :order => "published_at DESC"} } - else - scope :live, lambda { where( "published_at < ? and draft = ?", Time.now, false).order("published_at DESC") } - end + scope :live, lambda { where( "published_at < ? and draft = ?", Time.now, false).order("published_at DESC") } - if Rails.version < '3.0.0' - named_scope :previous, lambda { |i| { :conditions => ["published_at < ?", i.published_at], :order => "published_at DESC", :limit => 1 } } - named_scope :next, lambda { |i| { :condtions => ["published_at > ?", i.published_at], :order => "published_at ASC", :limit => 1 } } - else - scope :previous, lambda { |i| where(["published_at < ?", i.published_at]).order("published_at DESC").limit(1) } - scope :next, lambda { |i| where(["published_at > ?", i.published_at]).order("published_at ASC").limit(1) } - end + scope :previous, lambda { |i| where(["published_at < ?", i.published_at]).order("published_at DESC").limit(1) } + scope :next, lambda { |i| where(["published_at > ?", i.published_at]).order("published_at ASC").limit(1) } def next self.class.next(self).first diff --git a/app/views/admin/blog/categories/_form.html.erb b/app/views/admin/blog/categories/_form.html.erb index 28227ae..4f1809a 100644 --- a/app/views/admin/blog/categories/_form.html.erb +++ b/app/views/admin/blog/categories/_form.html.erb @@ -1,13 +1,9 @@ <% form_for [:admin, @blog_category] do |f| -%> - <% if Rails.version < '3.0.0'%> - <%= f.error_messages %> - <% else %> - <%= render :partial => "/shared/admin/error_messages", - :locals => { - :object => f.object, - :include_object_name => true - } %> - <% end %> + <%= render :partial => "/shared/admin/error_messages", + :locals => { + :object => f.object, + :include_object_name => true + } %>
<%= f.label :title -%> diff --git a/app/views/admin/blog/posts/_form.html.erb b/app/views/admin/blog/posts/_form.html.erb index 5779e4c..29585ea 100644 --- a/app/views/admin/blog/posts/_form.html.erb +++ b/app/views/admin/blog/posts/_form.html.erb @@ -1,13 +1,9 @@ <% form_for [:admin, @blog_post] do |f| -%> - <% if Rails.version < '3.0.0'%> - <%= f.error_messages %> - <% else %> - <%= render :partial => "/shared/admin/error_messages", - :locals => { - :object => f.object, - :include_object_name => true - } %> - <% end %> + <%= render :partial => "/shared/admin/error_messages", + :locals => { + :object => f.object, + :include_object_name => true + } %>
<%= f.label :title -%> diff --git a/app/views/blog/posts/show.html.erb b/app/views/blog/posts/show.html.erb index 72916f3..b6cff8c 100644 --- a/app/views/blog/posts/show.html.erb +++ b/app/views/blog/posts/show.html.erb @@ -23,26 +23,18 @@

<%= t('.comments.add') %>

<% form_for [:blog_post, @blog_comment] do |f| %> - <% if Rails.version < '3.0.0'%> - <%= f.error_messages %> - <% else %> - <%= render :partial => "/shared/admin/error_messages", - :locals => { - :object => f.object, - :include_object_name => true - } %> - <% end %> + <%= render :partial => "/shared/admin/error_messages", + :locals => { + :object => f.object, + :include_object_name => true + } %>
<%= f.label :name %> <%= f.text_field :name %>
<%= f.label :email %> - <% if Rails.version > '3.0.0' %> - <%= f.email_field :email %> - <% else %> - <%= f.text_field :email %> - <% end %> + <%= f.email_field :email %>
<%= f.label :message %> diff --git a/config/routes.rb b/config/routes.rb index 2cb4723..20fa1b1 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,73 +1,37 @@ -if Rails.version < '3.0.0' - ActionController::Routing::Routes.draw do |map| - map.namespace(:blog) do |blog| - blog.rss_feed 'feed.rss', :controller => 'posts', :action => 'index', :format => 'rss' - blog.root :controller => "posts", :action => 'index' - blog.post ':id', :controller => "posts", :action => 'show' - blog.category 'categories/:id', :controller => "categories", :action => 'show' - blog.post_blog_comments ':id/comments', :controller => 'posts', :action => 'comment' - - ## what is the rails2 syntax for this? sorry ;__; - # get 'archive/:year/:month', :to => 'posts#archive', :as => 'archive_blog_posts' - end - - map.namespace(:admin, :path_prefix => 'refinery') do |admin| - admin.namespace :blog do |blog| - blog.resources :posts - - blog.resources :categories - - blog.resources :comments, :collection => { - :approved => :get, - :rejected => :get - }, :member => { - :approved => :get, - :rejected => :get - } - - blog.resources :settings, :collection => { - :notification_recipients => [:get, :post], - :moderation => :get - } - end - end +Refinery::Application.routes.draw do + scope(:path => 'blog', :module => 'blog') do + root :to => 'posts#index', :as => 'blog_root' + match 'feed.rss', :to => 'posts#index.rss', :as => 'blog_rss_feed' + match ':id', :to => 'posts#show', :as => 'blog_post' + match 'categories/:id', :to => 'categories#show', :as => 'blog_category' + match ':id/comments', :to => 'posts#comment', :as => 'blog_post_blog_comments' + get 'archive/:year/:month', :to => 'posts#archive', :as => 'archive_blog_posts' end -else - Refinery::Application.routes.draw do - scope(:path => 'blog', :module => 'blog') do - root :to => 'posts#index', :as => 'blog_root' - match 'feed.rss', :to => 'posts#index.rss', :as => 'blog_rss_feed' - match ':id', :to => 'posts#show', :as => 'blog_post' - match 'categories/:id', :to => 'categories#show', :as => 'blog_category' - match ':id/comments', :to => 'posts#comment', :as => 'blog_post_blog_comments' - get 'archive/:year/:month', :to => 'posts#archive', :as => 'archive_blog_posts' - end - scope(:path => 'refinery', :as => 'admin', :module => 'admin') do - scope(:path => 'blog', :as => 'blog', :module => 'blog') do - root :to => 'posts#index' - resources :posts + scope(:path => 'refinery', :as => 'admin', :module => 'admin') do + scope(:path => 'blog', :as => 'blog', :module => 'blog') do + root :to => 'posts#index' + resources :posts - resources :categories + resources :categories - resources :comments do - collection do - get :approved - get :rejected - end - member do - get :approved - get :rejected - end + resources :comments do + collection do + get :approved + get :rejected end + member do + get :approved + get :rejected + end + end - resources :settings do - collection do - get :notification_recipients - post :notification_recipients + resources :settings do + collection do + get :notification_recipients + post :notification_recipients - get :moderation - end + get :moderation end end end diff --git a/readme.md b/readme.md index 20d6187..9176829 100644 --- a/readme.md +++ b/readme.md @@ -1,13 +1,15 @@ -# About +# Refinery CMS Blog Simple blog engine for [Refinery CMS](http://refinerycms.com). It supports posts, categories and comments. +Refinery CMS Blog supports Rails 2.x using the [Rails 2.x stable branch](http://github.com/resolve/refinerycms-blog/tree/rails2-stable). + Options: * Comment moderation * [ShareThis.com](http://sharethis.com) support on posts. Set your key in Refinery's settings area to enable this. -# Install +## Install Open up your ``Gemfile`` and add at the bottom this line @@ -15,11 +17,7 @@ Open up your ``Gemfile`` and add at the bottom this line Now run ``bundle install`` -Next to install the blog plugin run (for Rails 2): - - ruby script/generate refinerycms_blog - -Or, for Rails 3: +Next to install the blog plugin run: rails generate refinerycms_blog From b4284b3a75fd5da47fb734b85883d33171a3a40d Mon Sep 17 00:00:00 2001 From: Amanda Wagener Date: Wed, 1 Dec 2010 11:48:14 +1300 Subject: [PATCH 003/494] Now dependent on Refinery 0.9.8 (and thus Rails 3) --- lib/gemspec.rb | 2 +- refinerycms-blog.gemspec | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/gemspec.rb b/lib/gemspec.rb index 5e3606b..7902d37 100644 --- a/lib/gemspec.rb +++ b/lib/gemspec.rb @@ -17,7 +17,7 @@ Gem::Specification.new do |s| s.homepage = %q{http://refinerycms.com} s.authors = %w(Resolve\\ Digital Neoteric\\ Design) s.require_paths = %w(lib) - s.add_dependency 'refinerycms', '>= 0.9.7.13' + s.add_dependency 'refinerycms', '>= 0.9.8' s.add_dependency 'filters_spam', '~> 0.2' s.files = %w( diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index 348f27c..cd6ccb8 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -2,13 +2,13 @@ Gem::Specification.new do |s| s.name = %q{refinerycms-blog} s.version = %q{1.0.rc16} s.description = %q{A really straightforward open source Ruby on Rails blog engine designed for integration with RefineryCMS.} - s.date = %q{2010-11-22} + s.date = %q{2010-12-01} s.summary = %q{Ruby on Rails blogging engine for RefineryCMS.} s.email = %q{info@refinerycms.com} s.homepage = %q{http://refinerycms.com} s.authors = %w(Resolve\ Digital Neoteric\ Design) s.require_paths = %w(lib) - s.add_dependency 'refinerycms', '>= 0.9.7.13' + s.add_dependency 'refinerycms', '>= 0.9.8' s.add_dependency 'filters_spam', '~> 0.2' s.files = %w( @@ -87,6 +87,13 @@ Gem::Specification.new do |s| config/locales/nb.yml config/locales/nl.yml config/routes.rb + features + features/support + features/support/factories + features/support/factories/blog_categories.rb + features/support/factories/blog_comments.rb + features/support/factories/blog_posts.rb + features/support/paths.rb Gemfile Gemfile.lock generators From 1a666d4a7313154b9ed416b0c1cfc51b0b0e3178 Mon Sep 17 00:00:00 2001 From: Amanda Wagener Date: Wed, 1 Dec 2010 12:05:05 +1300 Subject: [PATCH 004/494] Remove Rails2/Rails3 checks as this branch only supports Rails 2. --- app/controllers/blog/posts_controller.rb | 32 +------ app/models/blog_comment.rb | 12 +-- app/models/blog_post.rb | 29 ++---- .../admin/blog/categories/_form.html.erb | 10 +-- app/views/admin/blog/posts/_form.html.erb | 10 +-- app/views/blog/posts/show.html.erb | 17 +--- config/routes.rb | 90 +++++-------------- lib/gemspec.rb | 2 +- readme.md | 14 +-- refinerycms-blog.gemspec | 11 ++- 10 files changed, 58 insertions(+), 169 deletions(-) diff --git a/app/controllers/blog/posts_controller.rb b/app/controllers/blog/posts_controller.rb index 5de6984..eabb742 100644 --- a/app/controllers/blog/posts_controller.rb +++ b/app/controllers/blog/posts_controller.rb @@ -3,41 +3,21 @@ class Blog::PostsController < BlogController before_filter :find_all_blog_posts, :except => [:archive] before_filter :find_blog_post, :only => [:show, :comment, :update_nav] - respond_to :html, :js, :rss if Rails.version >= '3.0.0' - def index - if Rails.version < '3.0.0' - # TODO: respond_to block - else - respond_with (@blog_posts) do |format| - format.html - format.rss - end - end + # TODO: respond_to block end def show @blog_comment = BlogComment.new - if Rails.version < '3.0.0' - # TODO: respond_to block - else - respond_with (@blog_post) do |format| - format.html { present(@page) } - format.js { render :partial => 'post', :layout => false } - end - end + # TODO: respond_to block end def comment if (@blog_comment = @blog_post.comments.create(params[:blog_comment])).valid? if BlogComment::Moderation.enabled? or @blog_comment.ham? begin - if Rails.version < '3.0.0' - Blog::CommentMailer.deliver_notification(@blog_comment, request) - else - Blog::CommentMailer.notification(@blog_comment, request).deliver - end + Blog::CommentMailer.deliver_notification(@blog_comment, request) rescue logger.warn "There was an error delivering a blog comment notification.\n#{$!}\n" end @@ -63,11 +43,7 @@ class Blog::PostsController < BlogController :page => params[:page], :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10) }) - if Rails.version < '3.0.0' - # TODO: respond_to block - else - respond_with (@blog_posts) - end + # TODO: respond_to block end protected diff --git a/app/models/blog_comment.rb b/app/models/blog_comment.rb index 63f9731..4d8d5c1 100644 --- a/app/models/blog_comment.rb +++ b/app/models/blog_comment.rb @@ -14,15 +14,9 @@ class BlogComment < ActiveRecord::Base validates_format_of :email, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i - if Rails.version < '3.0.0' - named_scope :unmoderated, :conditions => {:state => nil} - named_scope :approved, :conditions => {:state => 'approved'} - named_scope :rejected, :conditions => {:state => 'rejected'} - else - scope :unmoderated, :conditions => {:state => nil} - scope :approved, :conditions => {:state => 'approved'} - scope :rejected, :conditions => {:state => 'rejected'} - end + named_scope :unmoderated, :conditions => {:state => nil} + named_scope :approved, :conditions => {:state => 'approved'} + named_scope :rejected, :conditions => {:state => 'rejected'} def approve! self.update_attribute(:state, 'approved') diff --git a/app/models/blog_post.rb b/app/models/blog_post.rb index b965e5d..fd071a3 100644 --- a/app/models/blog_post.rb +++ b/app/models/blog_post.rb @@ -10,33 +10,14 @@ class BlogPost < ActiveRecord::Base has_friendly_id :title, :use_slug => true - if Rails.version < '3.0.0' - named_scope :by_archive, lambda { |archive_date| {:conditions => ['published_at between ? and ?', archive_date.beginning_of_month, archive_date.end_of_month], :order => "published_at DESC"} } - else - scope :by_archive, lambda { |archive_date| - where(['published_at between ? and ?', archive_date.beginning_of_month, archive_date.end_of_month]).order("published_at DESC") - } - end + named_scope :by_archive, lambda { |archive_date| {:conditions => ['published_at between ? and ?', archive_date.beginning_of_month, archive_date.end_of_month], :order => "published_at DESC"} } - if Rails.version < '3.0.0' - named_scope :all_previous, :conditions => ['published_at <= ?', Time.now.beginning_of_month], :order => "published_at DESC" - else - scope :all_previous, where(['published_at <= ?', Time.now.beginning_of_month]).order("published_at DESC") - end + named_scope :all_previous, :conditions => ['published_at <= ?', Time.now.beginning_of_month], :order => "published_at DESC" - if Rails.version < '3.0.0' - named_scope :live, lambda { {:conditions => ["published_at < ? and draft = ?", Time.now, false], :order => "published_at DESC"} } - else - scope :live, lambda { where( "published_at < ? and draft = ?", Time.now, false).order("published_at DESC") } - end + named_scope :live, lambda { {:conditions => ["published_at < ? and draft = ?", Time.now, false], :order => "published_at DESC"} } - if Rails.version < '3.0.0' - named_scope :previous, lambda { |i| { :conditions => ["published_at < ?", i.published_at], :order => "published_at DESC", :limit => 1 } } - named_scope :next, lambda { |i| { :condtions => ["published_at > ?", i.published_at], :order => "published_at ASC", :limit => 1 } } - else - scope :previous, lambda { |i| where(["published_at < ?", i.published_at]).order("published_at DESC").limit(1) } - scope :next, lambda { |i| where(["published_at > ?", i.published_at]).order("published_at ASC").limit(1) } - end + named_scope :previous, lambda { |i| { :conditions => ["published_at < ?", i.published_at], :order => "published_at DESC", :limit => 1 } } + named_scope :next, lambda { |i| { :condtions => ["published_at > ?", i.published_at], :order => "published_at ASC", :limit => 1 } } def next self.class.next(self).first diff --git a/app/views/admin/blog/categories/_form.html.erb b/app/views/admin/blog/categories/_form.html.erb index 28227ae..286291f 100644 --- a/app/views/admin/blog/categories/_form.html.erb +++ b/app/views/admin/blog/categories/_form.html.erb @@ -1,13 +1,5 @@ <% form_for [:admin, @blog_category] do |f| -%> - <% if Rails.version < '3.0.0'%> - <%= f.error_messages %> - <% else %> - <%= render :partial => "/shared/admin/error_messages", - :locals => { - :object => f.object, - :include_object_name => true - } %> - <% end %> + <%= f.error_messages %>
<%= f.label :title -%> diff --git a/app/views/admin/blog/posts/_form.html.erb b/app/views/admin/blog/posts/_form.html.erb index 5779e4c..8310a72 100644 --- a/app/views/admin/blog/posts/_form.html.erb +++ b/app/views/admin/blog/posts/_form.html.erb @@ -1,13 +1,5 @@ <% form_for [:admin, @blog_post] do |f| -%> - <% if Rails.version < '3.0.0'%> - <%= f.error_messages %> - <% else %> - <%= render :partial => "/shared/admin/error_messages", - :locals => { - :object => f.object, - :include_object_name => true - } %> - <% end %> + <%= f.error_messages %>
<%= f.label :title -%> diff --git a/app/views/blog/posts/show.html.erb b/app/views/blog/posts/show.html.erb index 72916f3..ed154ea 100644 --- a/app/views/blog/posts/show.html.erb +++ b/app/views/blog/posts/show.html.erb @@ -23,26 +23,15 @@

<%= t('.comments.add') %>

<% form_for [:blog_post, @blog_comment] do |f| %> - <% if Rails.version < '3.0.0'%> - <%= f.error_messages %> - <% else %> - <%= render :partial => "/shared/admin/error_messages", - :locals => { - :object => f.object, - :include_object_name => true - } %> - <% end %> + <%= f.error_messages %> +
<%= f.label :name %> <%= f.text_field :name %>
<%= f.label :email %> - <% if Rails.version > '3.0.0' %> - <%= f.email_field :email %> - <% else %> - <%= f.text_field :email %> - <% end %> + <%= f.text_field :email %>
<%= f.label :message %> diff --git a/config/routes.rb b/config/routes.rb index 2cb4723..e7b0663 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,75 +1,33 @@ -if Rails.version < '3.0.0' - ActionController::Routing::Routes.draw do |map| - map.namespace(:blog) do |blog| - blog.rss_feed 'feed.rss', :controller => 'posts', :action => 'index', :format => 'rss' - blog.root :controller => "posts", :action => 'index' - blog.post ':id', :controller => "posts", :action => 'show' - blog.category 'categories/:id', :controller => "categories", :action => 'show' - blog.post_blog_comments ':id/comments', :controller => 'posts', :action => 'comment' +ActionController::Routing::Routes.draw do |map| + map.namespace(:blog) do |blog| + blog.rss_feed 'feed.rss', :controller => 'posts', :action => 'index', :format => 'rss' + blog.root :controller => "posts", :action => 'index' + blog.post ':id', :controller => "posts", :action => 'show' + blog.category 'categories/:id', :controller => "categories", :action => 'show' + blog.post_blog_comments ':id/comments', :controller => 'posts', :action => 'comment' - ## what is the rails2 syntax for this? sorry ;__; - # get 'archive/:year/:month', :to => 'posts#archive', :as => 'archive_blog_posts' - end - - map.namespace(:admin, :path_prefix => 'refinery') do |admin| - admin.namespace :blog do |blog| - blog.resources :posts - - blog.resources :categories - - blog.resources :comments, :collection => { - :approved => :get, - :rejected => :get - }, :member => { - :approved => :get, - :rejected => :get - } - - blog.resources :settings, :collection => { - :notification_recipients => [:get, :post], - :moderation => :get - } - end - end + ## TODO: what is the rails2 syntax for this? sorry ;__; + # get 'archive/:year/:month', :to => 'posts#archive', :as => 'archive_blog_posts' end -else - Refinery::Application.routes.draw do - scope(:path => 'blog', :module => 'blog') do - root :to => 'posts#index', :as => 'blog_root' - match 'feed.rss', :to => 'posts#index.rss', :as => 'blog_rss_feed' - match ':id', :to => 'posts#show', :as => 'blog_post' - match 'categories/:id', :to => 'categories#show', :as => 'blog_category' - match ':id/comments', :to => 'posts#comment', :as => 'blog_post_blog_comments' - get 'archive/:year/:month', :to => 'posts#archive', :as => 'archive_blog_posts' - end - scope(:path => 'refinery', :as => 'admin', :module => 'admin') do - scope(:path => 'blog', :as => 'blog', :module => 'blog') do - root :to => 'posts#index' - resources :posts + map.namespace(:admin, :path_prefix => 'refinery') do |admin| + admin.namespace :blog do |blog| + blog.resources :posts - resources :categories + blog.resources :categories - resources :comments do - collection do - get :approved - get :rejected - end - member do - get :approved - get :rejected - end - end + blog.resources :comments, :collection => { + :approved => :get, + :rejected => :get + }, :member => { + :approved => :get, + :rejected => :get + } - resources :settings do - collection do - get :notification_recipients - post :notification_recipients - - get :moderation - end - end - end + blog.resources :settings, :collection => { + :notification_recipients => [:get, :post], + :moderation => :get + } end end end diff --git a/lib/gemspec.rb b/lib/gemspec.rb index 5e3606b..6734af3 100644 --- a/lib/gemspec.rb +++ b/lib/gemspec.rb @@ -17,7 +17,7 @@ Gem::Specification.new do |s| s.homepage = %q{http://refinerycms.com} s.authors = %w(Resolve\\ Digital Neoteric\\ Design) s.require_paths = %w(lib) - s.add_dependency 'refinerycms', '>= 0.9.7.13' + s.add_dependency 'refinerycms', '~> 0.9.7.13' s.add_dependency 'filters_spam', '~> 0.2' s.files = %w( diff --git a/readme.md b/readme.md index 20d6187..1421bb3 100644 --- a/readme.md +++ b/readme.md @@ -1,28 +1,28 @@ -# About +# Refinery CMS Blog - Rails 2 branch Simple blog engine for [Refinery CMS](http://refinerycms.com). It supports posts, categories and comments. +Refinery CMS Blog supports Rails 3 on the [master branch](http://github.com/resolve/refinerycms-blog). + Options: * Comment moderation * [ShareThis.com](http://sharethis.com) support on posts. Set your key in Refinery's settings area to enable this. -# Install +## Install Open up your ``Gemfile`` and add at the bottom this line gem 'refinerycms-blog', '= 1.0.rc16' +Please note 1.0.rc16 is the last version of Refinery CMS Blog to support Rails 2. + Now run ``bundle install`` Next to install the blog plugin run (for Rails 2): ruby script/generate refinerycms_blog -Or, for Rails 3: - - rails generate refinerycms_blog - Finally migrate your database and you're done. - rake db:migrate \ No newline at end of file + rake db:migrate diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index 348f27c..c3baaf2 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -2,13 +2,13 @@ Gem::Specification.new do |s| s.name = %q{refinerycms-blog} s.version = %q{1.0.rc16} s.description = %q{A really straightforward open source Ruby on Rails blog engine designed for integration with RefineryCMS.} - s.date = %q{2010-11-22} + s.date = %q{2010-12-01} s.summary = %q{Ruby on Rails blogging engine for RefineryCMS.} s.email = %q{info@refinerycms.com} s.homepage = %q{http://refinerycms.com} s.authors = %w(Resolve\ Digital Neoteric\ Design) s.require_paths = %w(lib) - s.add_dependency 'refinerycms', '>= 0.9.7.13' + s.add_dependency 'refinerycms', '~> 0.9.7.13' s.add_dependency 'filters_spam', '~> 0.2' s.files = %w( @@ -87,6 +87,13 @@ Gem::Specification.new do |s| config/locales/nb.yml config/locales/nl.yml config/routes.rb + features + features/support + features/support/factories + features/support/factories/blog_categories.rb + features/support/factories/blog_comments.rb + features/support/factories/blog_posts.rb + features/support/paths.rb Gemfile Gemfile.lock generators From c038feb88adc9d9a693ecbd7c0fb40644b8a3483 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Wed, 1 Dec 2010 13:46:32 +1300 Subject: [PATCH 005/494] rc.17 is the proper format apparently (rc.xx rather than rcxx). Closes GH-20 --- lib/refinerycms-blog.rb | 2 +- readme.md | 4 ++-- refinerycms-blog.gemspec | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/refinerycms-blog.rb b/lib/refinerycms-blog.rb index 41d7093..5737992 100644 --- a/lib/refinerycms-blog.rb +++ b/lib/refinerycms-blog.rb @@ -42,7 +42,7 @@ module Refinery class << self def version - %q{1.0.rc16} + %q{1.0.rc.17} end end end diff --git a/readme.md b/readme.md index 9176829..ea90e78 100644 --- a/readme.md +++ b/readme.md @@ -2,7 +2,7 @@ Simple blog engine for [Refinery CMS](http://refinerycms.com). It supports posts, categories and comments. -Refinery CMS Blog supports Rails 2.x using the [Rails 2.x stable branch](http://github.com/resolve/refinerycms-blog/tree/rails2-stable). +Refinery CMS Blog supports Rails 2.3.x using the [Rails 2.3.x stable branch](http://github.com/resolve/refinerycms-blog/tree/rails2-stable). Options: @@ -13,7 +13,7 @@ Options: Open up your ``Gemfile`` and add at the bottom this line - gem 'refinerycms-blog', '= 1.0.rc16' + gem 'refinerycms-blog', '~> 1.0.rc.17' Now run ``bundle install`` diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index cd6ccb8..d7d9196 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = %q{refinerycms-blog} - s.version = %q{1.0.rc16} + s.version = %q{1.0.rc.17} s.description = %q{A really straightforward open source Ruby on Rails blog engine designed for integration with RefineryCMS.} s.date = %q{2010-12-01} s.summary = %q{Ruby on Rails blogging engine for RefineryCMS.} From 8bbb30aa3e6ef461ebaf3cc92cf89d76227a79f6 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Fri, 3 Dec 2010 16:40:35 +1300 Subject: [PATCH 006/494] RC versions driving me crazy, let's use 1.0 --- lib/refinerycms-blog.rb | 2 +- readme.md | 2 +- refinerycms-blog.gemspec | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/refinerycms-blog.rb b/lib/refinerycms-blog.rb index 5737992..b1ebf18 100644 --- a/lib/refinerycms-blog.rb +++ b/lib/refinerycms-blog.rb @@ -42,7 +42,7 @@ module Refinery class << self def version - %q{1.0.rc.17} + %q{1.0} end end end diff --git a/readme.md b/readme.md index ea90e78..2bae73e 100644 --- a/readme.md +++ b/readme.md @@ -13,7 +13,7 @@ Options: Open up your ``Gemfile`` and add at the bottom this line - gem 'refinerycms-blog', '~> 1.0.rc.17' + gem 'refinerycms-blog', '~> 1.0' Now run ``bundle install`` diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index d7d9196..2a5d65e 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -1,8 +1,8 @@ Gem::Specification.new do |s| s.name = %q{refinerycms-blog} - s.version = %q{1.0.rc.17} + s.version = %q{1.0} s.description = %q{A really straightforward open source Ruby on Rails blog engine designed for integration with RefineryCMS.} - s.date = %q{2010-12-01} + s.date = %q{2010-12-03} s.summary = %q{Ruby on Rails blogging engine for RefineryCMS.} s.email = %q{info@refinerycms.com} s.homepage = %q{http://refinerycms.com} From 75e9940a80602971f5448beb0da13f74ab6f2cb0 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Fri, 3 Dec 2010 17:02:26 +1300 Subject: [PATCH 007/494] Version 1.1 which supports Rails3 versions of RefineryCMS (1.0.1 etc are for Rails 2) --- lib/refinerycms-blog.rb | 2 +- readme.md | 12 ++++++++---- refinerycms-blog.gemspec | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/refinerycms-blog.rb b/lib/refinerycms-blog.rb index b1ebf18..9a5cf56 100644 --- a/lib/refinerycms-blog.rb +++ b/lib/refinerycms-blog.rb @@ -42,7 +42,7 @@ module Refinery class << self def version - %q{1.0} + %q{1.1} end end end diff --git a/readme.md b/readme.md index 2bae73e..7fbb1b6 100644 --- a/readme.md +++ b/readme.md @@ -9,15 +9,19 @@ Options: * Comment moderation * [ShareThis.com](http://sharethis.com) support on posts. Set your key in Refinery's settings area to enable this. +## Requirements + +Refinery CMS version 0.9.8 or above. + ## Install -Open up your ``Gemfile`` and add at the bottom this line +Open up your ``Gemfile`` and add at the bottom this line: - gem 'refinerycms-blog', '~> 1.0' + gem 'refinerycms-blog', '~> 1.1' -Now run ``bundle install`` +Now, run ``bundle install`` -Next to install the blog plugin run: +Next, to install the blog plugin run: rails generate refinerycms_blog diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index 2a5d65e..070664d 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = %q{refinerycms-blog} - s.version = %q{1.0} + s.version = %q{1.1} s.description = %q{A really straightforward open source Ruby on Rails blog engine designed for integration with RefineryCMS.} s.date = %q{2010-12-03} s.summary = %q{Ruby on Rails blogging engine for RefineryCMS.} From 7da21ab480a310b5f6ebd5557b6c28a71b1cb287 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?U=C4=A3is=20Ozols?= Date: Fri, 3 Dec 2010 08:38:30 +0200 Subject: [PATCH 008/494] Moved 'no blog posts' text to locale file. --- app/views/blog/posts/index.html.erb | 12 +++++++----- config/locales/en.yml | 2 ++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/views/blog/posts/index.html.erb b/app/views/blog/posts/index.html.erb index ab0abf0..20d8372 100644 --- a/app/views/blog/posts/index.html.erb +++ b/app/views/blog/posts/index.html.erb @@ -1,11 +1,13 @@ <% content_for :body_content_left do %> <%= @page[Page.default_parts.first.to_sym] %> -
- <%= render :partial => "/blog/shared/post", :collection => @blog_posts %> -
- <%= "

There are no blog articles posted yet. Stay tuned.

".html_safe unless @blog_posts.any? %> - <%# TODO: Add locale logic here - hubble is a n00b at that %> + <% if @blog_posts.any? %> +
+ <%= render :partial => "/blog/shared/post", :collection => @blog_posts %> +
+ <% else %> +

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

+ <% end %> <% end %> <% content_for :body_content_right do %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 930dfad..d4129c9 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -105,6 +105,8 @@ en: time_ago: '%{time} ago' thank_you: 'Thank you for commenting.' thank_you_moderated: 'Thank you for commenting. Your message has been placed in the moderation queue and will appear shortly.' + index: + no_blog_articles_yet: There are no blog articles posted yet. Stay tuned. show: comments: title: Comments From 447bbb5eb2f1bdc7cba2910437f068df1f235b75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?U=C4=A3is=20Ozols?= Date: Fri, 3 Dec 2010 09:03:54 +0200 Subject: [PATCH 009/494] Use :confirm and :method link_to methods. --- app/views/admin/blog/categories/_category.html.erb | 4 ++-- app/views/admin/blog/posts/_post.html.erb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/admin/blog/categories/_category.html.erb b/app/views/admin/blog/categories/_category.html.erb index 7997d68..6238c87 100644 --- a/app/views/admin/blog/categories/_category.html.erb +++ b/app/views/admin/blog/categories/_category.html.erb @@ -10,7 +10,7 @@ <%= link_to refinery_icon_tag("delete.png"), admin_blog_category_path(category), :class => "cancel confirm-delete", :title => t('.delete'), - :'data-method' => 'delete', - :'data-confirm' => t('shared.admin.delete.message', :title => category.title) %> + :method => 'delete', + :confirm => t('shared.admin.delete.message', :title => category.title) %> diff --git a/app/views/admin/blog/posts/_post.html.erb b/app/views/admin/blog/posts/_post.html.erb index a768279..2bb80b4 100644 --- a/app/views/admin/blog/posts/_post.html.erb +++ b/app/views/admin/blog/posts/_post.html.erb @@ -12,7 +12,7 @@ <%= link_to refinery_icon_tag("delete.png"), admin_blog_post_path(post), :class => "cancel confirm-delete", :title => t('.delete'), - :'data-method' => 'delete', - :'data-confirm' => t('shared.admin.delete.message', :title => post.title) %> + :method => :delete, + :confirm => t('shared.admin.delete.message', :title => post.title) %> From fef6dc47a6fb92dabcde7cdfc2448a524ceb2783 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?U=C4=A3is=20Ozols?= Date: Fri, 3 Dec 2010 09:05:09 +0200 Subject: [PATCH 010/494] Use symbol instead of string. --- app/views/admin/blog/categories/_category.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/blog/categories/_category.html.erb b/app/views/admin/blog/categories/_category.html.erb index 6238c87..fe484ee 100644 --- a/app/views/admin/blog/categories/_category.html.erb +++ b/app/views/admin/blog/categories/_category.html.erb @@ -10,7 +10,7 @@ <%= link_to refinery_icon_tag("delete.png"), admin_blog_category_path(category), :class => "cancel confirm-delete", :title => t('.delete'), - :method => 'delete', + :method => :delete, :confirm => t('shared.admin.delete.message', :title => category.title) %> From 1167a1d6a99e51f8f7d1a3cef3d75eaa402656a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?U=C4=A3is=20Ozols?= Date: Fri, 3 Dec 2010 09:08:07 +0200 Subject: [PATCH 011/494] We don't need those h in Rails 3. --- app/views/admin/blog/categories/_category.html.erb | 2 +- app/views/admin/blog/comments/_comment.html.erb | 2 +- app/views/admin/blog/posts/_post.html.erb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/admin/blog/categories/_category.html.erb b/app/views/admin/blog/categories/_category.html.erb index fe484ee..d8c8a61 100644 --- a/app/views/admin/blog/categories/_category.html.erb +++ b/app/views/admin/blog/categories/_category.html.erb @@ -1,6 +1,6 @@
  • - <%=h category.title %> + <%= category.title %>   diff --git a/app/views/admin/blog/comments/_comment.html.erb b/app/views/admin/blog/comments/_comment.html.erb index 1817c48..d762067 100644 --- a/app/views/admin/blog/comments/_comment.html.erb +++ b/app/views/admin/blog/comments/_comment.html.erb @@ -1,6 +1,6 @@
  • "> - <%=h comment.name %> + <%= comment.name %> - <%= truncate(comment.message, :length => 75) %> diff --git a/app/views/admin/blog/posts/_post.html.erb b/app/views/admin/blog/posts/_post.html.erb index 2bb80b4..795f897 100644 --- a/app/views/admin/blog/posts/_post.html.erb +++ b/app/views/admin/blog/posts/_post.html.erb @@ -1,6 +1,6 @@
  • - <%=h post.title %> + <%= post.title %>   From 420afaf199edba87623c1ec54b8c2fcec4001612 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?U=C4=A3is=20Ozols?= Date: Fri, 3 Dec 2010 09:13:38 +0200 Subject: [PATCH 012/494] Fix deprecation warnings. --- app/views/admin/blog/categories/_form.html.erb | 2 +- app/views/admin/blog/posts/_form.html.erb | 2 +- app/views/admin/blog/settings/notification_recipients.html.erb | 2 +- app/views/blog/posts/show.html.erb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/admin/blog/categories/_form.html.erb b/app/views/admin/blog/categories/_form.html.erb index 4f1809a..f55992a 100644 --- a/app/views/admin/blog/categories/_form.html.erb +++ b/app/views/admin/blog/categories/_form.html.erb @@ -1,4 +1,4 @@ -<% form_for [:admin, @blog_category] do |f| -%> +<%= form_for [:admin, @blog_category] do |f| -%> <%= render :partial => "/shared/admin/error_messages", :locals => { :object => f.object, diff --git a/app/views/admin/blog/posts/_form.html.erb b/app/views/admin/blog/posts/_form.html.erb index 29585ea..0dc6e9b 100644 --- a/app/views/admin/blog/posts/_form.html.erb +++ b/app/views/admin/blog/posts/_form.html.erb @@ -1,4 +1,4 @@ -<% form_for [:admin, @blog_post] do |f| -%> +<%= form_for [:admin, @blog_post] do |f| -%> <%= render :partial => "/shared/admin/error_messages", :locals => { :object => f.object, diff --git a/app/views/admin/blog/settings/notification_recipients.html.erb b/app/views/admin/blog/settings/notification_recipients.html.erb index ea36af1..41e7f2d 100644 --- a/app/views/admin/blog/settings/notification_recipients.html.erb +++ b/app/views/admin/blog/settings/notification_recipients.html.erb @@ -1,4 +1,4 @@ -<% form_tag do %> +<%= form_tag do %>
    diff --git a/app/views/blog/posts/show.html.erb b/app/views/blog/posts/show.html.erb index b6cff8c..5ac4c76 100644 --- a/app/views/blog/posts/show.html.erb +++ b/app/views/blog/posts/show.html.erb @@ -22,7 +22,7 @@ <% end %>

    <%= t('.comments.add') %>

    - <% form_for [:blog_post, @blog_comment] do |f| %> + <%= form_for [:blog_post, @blog_comment] do |f| %> <%= render :partial => "/shared/admin/error_messages", :locals => { :object => f.object, From a0ec0bce1469af3a5c41781344a7497f1870c3e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?U=C4=A3is=20Ozols?= Date: Fri, 3 Dec 2010 09:17:25 +0200 Subject: [PATCH 013/494] Added missing
  • tag. --- app/views/admin/blog/_submenu.html.erb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/admin/blog/_submenu.html.erb b/app/views/admin/blog/_submenu.html.erb index dcf2f4e..ab662e7 100644 --- a/app/views/admin/blog/_submenu.html.erb +++ b/app/views/admin/blog/_submenu.html.erb @@ -16,6 +16,7 @@
  • <%= link_to t('.posts.manage'), admin_blog_posts_path, :class => 'page_icon' %> +
  • <%= link_to t('.posts.new'), new_admin_blog_post_url, :class => 'page_add_icon' %> From 2db680dd9835bdfb01ebfff90398ae5a9d8b45da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?U=C4=A3is=20Ozols?= Date: Fri, 3 Dec 2010 09:48:47 +0200 Subject: [PATCH 014/494] Refactored nav partial, added 'blog home' to locale and removed unneeded tags. --- app/views/blog/posts/_nav.html.erb | 20 +++++++++----------- app/views/blog/posts/_post.html.erb | 4 +--- config/locales/en.yml | 1 + 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/app/views/blog/posts/_nav.html.erb b/app/views/blog/posts/_nav.html.erb index 50391ee..c73a294 100644 --- a/app/views/blog/posts/_nav.html.erb +++ b/app/views/blog/posts/_nav.html.erb @@ -1,13 +1,11 @@ -<% if next_or_previous?(@blog_post) -%> - diff --git a/app/views/blog/posts/_post.html.erb b/app/views/blog/posts/_post.html.erb index 6fb8e64..fc58af6 100644 --- a/app/views/blog/posts/_post.html.erb +++ b/app/views/blog/posts/_post.html.erb @@ -28,7 +28,5 @@ <%= render :partial => '/shared/draft_page_message' unless @blog_post.nil? or @blog_post.live? -%> <% if next_or_previous?(@blog_post) -%> - + <%= render 'nav' %> <% end -%> diff --git a/config/locales/en.yml b/config/locales/en.yml index d4129c9..9bd9ab0 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -108,6 +108,7 @@ en: index: no_blog_articles_yet: There are no blog articles posted yet. Stay tuned. show: + blog_home: Blog Home comments: title: Comments add: Make a Comment From 51095b80910618f7ce5bf1d991f46dd5fab5aa2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?U=C4=A3is=20Ozols?= Date: Fri, 3 Dec 2010 09:58:16 +0200 Subject: [PATCH 015/494] Moved some text to locale. --- app/views/blog/posts/archive.html.erb | 14 ++++++++------ app/views/blog/shared/_rss_feed.html.erb | 2 +- config/locales/en.yml | 6 +++++- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/app/views/blog/posts/archive.html.erb b/app/views/blog/posts/archive.html.erb index abeb0c1..d44aa7f 100644 --- a/app/views/blog/posts/archive.html.erb +++ b/app/views/blog/posts/archive.html.erb @@ -1,11 +1,13 @@ <% content_for :body_content_left do %> <%= @page[Page.default_parts.first.to_sym] %> -

    Blog Archive for <%= @archive_date.strftime('%B %Y') %>

    -
    - <%= render :partial => "/blog/shared/post", :collection => @blog_posts %> -
    - <%= "There are no blog articles posted for #{@archive_date.strftime('%B %Y')}. Stay tuned." unless @blog_posts.any? %> - <%# TODO: Add locale logic here - hubble is a n00b at that %> +

    <%= t('.blog_archive_for', :date => @archive_date.strftime('%B %Y')) %>

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

    <%= t('.no_blog_articles_posted', :date => @archive_date.strftime('%B %Y')) %>

    + <% end %> <% end %> <% content_for :body_content_right do %> diff --git a/app/views/blog/shared/_rss_feed.html.erb b/app/views/blog/shared/_rss_feed.html.erb index 047298e..1c2cef7 100644 --- a/app/views/blog/shared/_rss_feed.html.erb +++ b/app/views/blog/shared/_rss_feed.html.erb @@ -1,2 +1,2 @@

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

    -<%= link_to "Subscribe", blog_rss_feed_url, :id => "rss_feed_subscribe"%> +<%= link_to t('.subscribe'), blog_rss_feed_url, :id => "rss_feed_subscribe"%> diff --git a/config/locales/en.yml b/config/locales/en.yml index 9bd9ab0..d48621e 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -88,6 +88,7 @@ en: title: Categories rss_feed: title: RSS Feed + subscribe: Subscribe posts: other: Other Posts created_at: 'Posted on %{when}' @@ -114,4 +115,7 @@ en: add: Make a Comment other: Other Blog Posts filed_in: Filed in - submit: Send comment \ No newline at end of file + submit: Send comment + archive: + blog_archive_for: Blog Archive for %{date} + no_blog_articles_posted: There are no blog articles posted for %{date}. Stay tuned. From 1d7a814fb1a2e7725bc142dfbf9501cfd909c781 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?U=C4=A3is=20Ozols?= Date: Fri, 3 Dec 2010 10:55:09 +0200 Subject: [PATCH 016/494] Rails 3 validation style. --- app/models/blog_category.rb | 3 +-- app/models/blog_comment.rb | 5 ++--- app/models/blog_post.rb | 3 +-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/app/models/blog_category.rb b/app/models/blog_category.rb index 89bff27..6d5e886 100644 --- a/app/models/blog_category.rb +++ b/app/models/blog_category.rb @@ -4,8 +4,7 @@ class BlogCategory < ActiveRecord::Base acts_as_indexed :fields => [:title] - validates_presence_of :title - validates_uniqueness_of :title + validates :title, :presence => true, :uniqueness => true has_friendly_id :title, :use_slug => true diff --git a/app/models/blog_comment.rb b/app/models/blog_comment.rb index f608a1a..8ab1cf3 100644 --- a/app/models/blog_comment.rb +++ b/app/models/blog_comment.rb @@ -10,9 +10,8 @@ class BlogComment < ActiveRecord::Base alias_attribute :message, :body - validates_presence_of :name, :message - validates_format_of :email, - :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i + validates :name, :message, :presence => true + validates :email, :format => { :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i } scope :unmoderated, :conditions => {:state => nil} scope :approved, :conditions => {:state => 'approved'} diff --git a/app/models/blog_post.rb b/app/models/blog_post.rb index 8937e09..f2a1465 100644 --- a/app/models/blog_post.rb +++ b/app/models/blog_post.rb @@ -5,8 +5,7 @@ class BlogPost < ActiveRecord::Base acts_as_indexed :fields => [:title, :body] - validates_presence_of :title - validates_uniqueness_of :title + validates :title, :presence => true, :uniqueness => true has_friendly_id :title, :use_slug => true From 0dc56cc0173df7df09a8d7a8ad01373d3dc81cd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?U=C4=A3is=20Ozols?= Date: Fri, 3 Dec 2010 11:31:21 +0200 Subject: [PATCH 017/494] When we delete blog post it should delete associated comments too. --- app/models/blog_post.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/blog_post.rb b/app/models/blog_post.rb index f2a1465..ccd10e2 100644 --- a/app/models/blog_post.rb +++ b/app/models/blog_post.rb @@ -1,6 +1,6 @@ class BlogPost < ActiveRecord::Base - has_many :comments, :class_name => 'BlogComment' + has_many :comments, :class_name => 'BlogComment', :dependent => :destroy has_and_belongs_to_many :categories, :class_name => 'BlogCategory' acts_as_indexed :fields => [:title, :body] From deca138ec9054488233f100a22edd12acdeaaf58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?U=C4=A3is=20Ozols?= Date: Fri, 3 Dec 2010 13:01:12 +0200 Subject: [PATCH 018/494] Reduce db queries. --- app/controllers/blog/posts_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/blog/posts_controller.rb b/app/controllers/blog/posts_controller.rb index f489039..f7b6f3c 100644 --- a/app/controllers/blog/posts_controller.rb +++ b/app/controllers/blog/posts_controller.rb @@ -67,7 +67,7 @@ protected end def find_all_blog_posts - @blog_posts = BlogPost.live.paginate({ + @blog_posts = BlogPost.live.includes(:comments, :categories).paginate({ :page => params[:page], :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10) }) From 329f39a37d1316ca818f742b5407f5d6dc4ae258 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?U=C4=A3is=20Ozols?= Date: Fri, 3 Dec 2010 13:25:58 +0200 Subject: [PATCH 019/494] Optimised post_count method. See gist for benchmarks - https://gist.github.com/726844 --- app/models/blog_category.rb | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/app/models/blog_category.rb b/app/models/blog_category.rb index 6d5e886..8ffe834 100644 --- a/app/models/blog_category.rb +++ b/app/models/blog_category.rb @@ -8,15 +8,8 @@ class BlogCategory < ActiveRecord::Base has_friendly_id :title, :use_slug => true - # this might be able to be optimised a little more def post_count - count = 0 - - self.posts.each do |p| - count += 1 if p.live? - end - - count + posts.select(&:live?).count end end From a914c2721e85802a7c95fdc74a4a45d0d1248599 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?U=C4=A3is=20Ozols?= Date: Fri, 3 Dec 2010 13:47:32 +0200 Subject: [PATCH 020/494] Fix translation path. --- app/views/blog/posts/_post.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/blog/posts/_post.html.erb b/app/views/blog/posts/_post.html.erb index fc58af6..d9535e9 100644 --- a/app/views/blog/posts/_post.html.erb +++ b/app/views/blog/posts/_post.html.erb @@ -12,7 +12,7 @@ <% if (categories = @blog_post.categories).any? %>
  • +
  • + <%= link_to t('.posts.uncategorized'), uncategorized_admin_blog_posts_url, + :class => 'page_icon' %> +
  • <%= link_to t('.posts.new'), new_admin_blog_post_url, :class => 'page_add_icon' %> From d5ffea8e887799ccc30d9fa1e0a70b01c232abd0 Mon Sep 17 00:00:00 2001 From: Joe Sak Date: Wed, 16 Feb 2011 00:29:36 -0600 Subject: [PATCH 051/494] test coverage for uncategorized blog posts scope --- spec/models/blog_posts_spec.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/spec/models/blog_posts_spec.rb b/spec/models/blog_posts_spec.rb index ef9d700..0ef9b0e 100644 --- a/spec/models/blog_posts_spec.rb +++ b/spec/models/blog_posts_spec.rb @@ -94,6 +94,18 @@ describe BlogPost do BlogPost.next(blog_post1).should == [blog_post2] end end + + describe "uncategorized scope" do + it "returns uncategorized posts if they exist" do + uncategorized_blog_post = Factory(:post) + categorized_blog_post = Factory(:post) + + categorized_blog_post.categories << Factory(:blog_category) + + BlogPost.uncategorized.should include uncategorized_blog_post + BlogPost.uncategorized.should_not include categorized_blog_post + end + end describe "#live?" do it "returns true if post is not in draft and it's published" do From 7046ba73fe409c7d8202c5f441564200d1086c23 Mon Sep 17 00:00:00 2001 From: Joe Sak Date: Wed, 16 Feb 2011 01:15:05 -0600 Subject: [PATCH 052/494] default_scope :order => 'published_at DESC' move "next" to << self to use exclusive scope --- app/models/blog_category.rb | 2 +- app/models/blog_post.rb | 26 +++++++++++++++++--------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/app/models/blog_category.rb b/app/models/blog_category.rb index fbd5465..bc0165a 100644 --- a/app/models/blog_category.rb +++ b/app/models/blog_category.rb @@ -1,7 +1,7 @@ class BlogCategory < ActiveRecord::Base has_many :categorizations - has_many :posts, :through => :categorizations, :source => :blog_post, :order => 'published_at DESC' + has_many :posts, :through => :categorizations, :source => :blog_post acts_as_indexed :fields => [:title] diff --git a/app/models/blog_post.rb b/app/models/blog_post.rb index ed1e14c..c9929ce 100644 --- a/app/models/blog_post.rb +++ b/app/models/blog_post.rb @@ -1,5 +1,7 @@ class BlogPost < ActiveRecord::Base - + + default_scope :order => 'published_at DESC' + has_many :comments, :class_name => 'BlogComment', :dependent => :destroy has_many :categorizations @@ -13,19 +15,19 @@ class BlogPost < ActiveRecord::Base has_friendly_id :title, :use_slug => true scope :by_archive, lambda { |archive_date| - where(['published_at between ? and ?', archive_date.beginning_of_month, archive_date.end_of_month]).order("published_at DESC") + where(['published_at between ? and ?', archive_date.beginning_of_month, archive_date.end_of_month]) } scope :by_year, lambda { |archive_year| - where(['published_at between ? and ?', archive_year.beginning_of_year, archive_year.end_of_year]).order("published_at DESC") + where(['published_at between ? and ?', archive_year.beginning_of_year, archive_year.end_of_year]) } - scope :all_previous, where(['published_at <= ?', Time.now.beginning_of_month]).order("published_at DESC") + scope :all_previous, where(['published_at <= ?', Time.now.beginning_of_month]) - scope :live, lambda { where( "published_at < ? and draft = ?", Time.now, false).order("published_at DESC") } + scope :live, where( "published_at <= ? and draft = ?", Time.now, false) - scope :previous, lambda { |i| where(["published_at < ? and draft = ?", i.published_at, false]).order("published_at DESC").limit(1) } - scope :next, lambda { |i| where(["published_at > ? and draft = ?", i.published_at, false]).order("published_at ASC").limit(1) } + scope :previous, lambda { |i| where(["published_at < ? and draft = ?", i.published_at, false]).limit(1) } + # next is now in << self def next self.class.next(self).first @@ -46,6 +48,12 @@ class BlogPost < ActiveRecord::Base end class << self + def next current_record + self.send(:with_exclusive_scope) do + where(["published_at > ? and draft = ?", current_record.published_at, false]).order("published_at ASC") + end + end + def comments_allowed? RefinerySetting.find_or_set(:comments_allowed, true, { :scoping => 'blog' @@ -53,14 +61,14 @@ class BlogPost < ActiveRecord::Base end def uncategorized - posts = BlogPost.live.reject { |p| p.categories.any? } + BlogPost.all.reject { |p| p.categories.any? } end end module ShareThis DEFAULT_KEY = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" - class << self + class << self def key RefinerySetting.find_or_set(:share_this_key, BlogPost::ShareThis::DEFAULT_KEY, { :scoping => 'blog' From 4fe4a7ff245b3d9a831e143725aaa9b2130b1f0a Mon Sep 17 00:00:00 2001 From: Joe Sak Date: Wed, 16 Feb 2011 01:15:52 -0600 Subject: [PATCH 053/494] Show publish date in preview data of admin index --- app/views/admin/blog/posts/_post.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/blog/posts/_post.html.erb b/app/views/admin/blog/posts/_post.html.erb index 1f51932..fa64292 100644 --- a/app/views/admin/blog/posts/_post.html.erb +++ b/app/views/admin/blog/posts/_post.html.erb @@ -1,7 +1,7 @@
  • <%= post.title %> -   + <%= post.published_at.try(:strftime, '%b %d, %Y') || 'draft' %> <%= link_to refinery_icon_tag("application_go.png"), blog_post_url(post), From 5bf1926ec7d09e9032e51a2f776f81101cb0e286 Mon Sep 17 00:00:00 2001 From: Joe Sak Date: Wed, 16 Feb 2011 01:16:24 -0600 Subject: [PATCH 054/494] This is probably just faster --- app/models/blog_post.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/blog_post.rb b/app/models/blog_post.rb index c9929ce..c1918b6 100644 --- a/app/models/blog_post.rb +++ b/app/models/blog_post.rb @@ -30,11 +30,11 @@ class BlogPost < ActiveRecord::Base # next is now in << self def next - self.class.next(self).first + BlogPost.next(self).first end def prev - self.class.previous(self).first + BlogPost.previous(self).first end def live? From 6f9de45019b8cd6c589338cffdffcea1e0e40ed7 Mon Sep 17 00:00:00 2001 From: Joe Sak Date: Wed, 16 Feb 2011 01:17:05 -0600 Subject: [PATCH 055/494] Closes GH-34. Pagination was already in the public controller, the index view template "just" needed will_paginate Should probably add basic CSS style or make it say older / newer? Open to suggestions --- app/views/blog/posts/index.html.erb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/blog/posts/index.html.erb b/app/views/blog/posts/index.html.erb index a2e428a..08e3578 100644 --- a/app/views/blog/posts/index.html.erb +++ b/app/views/blog/posts/index.html.erb @@ -4,6 +4,7 @@ <% if @blog_posts.any? %>
    <%= render :partial => "/blog/shared/post", :collection => @blog_posts %> + <%= will_paginate @blog_posts %>
    <% else %>

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

    From a4b02b13c32002a962040b645c8abd03af48fd84 Mon Sep 17 00:00:00 2001 From: Joe Sak Date: Wed, 16 Feb 2011 01:18:37 -0600 Subject: [PATCH 056/494] Previous scope test wasn't testing BlogPost.previous --- spec/models/blog_posts_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/models/blog_posts_spec.rb b/spec/models/blog_posts_spec.rb index 0ef9b0e..c15d1da 100644 --- a/spec/models/blog_posts_spec.rb +++ b/spec/models/blog_posts_spec.rb @@ -91,7 +91,7 @@ describe BlogPost do it "returns previous article based on given article" do blog_post1 = Factory(:post) blog_post2 = Factory(:post, :published_at => Time.now + 1.minute) - BlogPost.next(blog_post1).should == [blog_post2] + BlogPost.previous(blog_post2).should == [blog_post1] end end From 69d65032f8fc53a19171bf21376daf168a4c7a10 Mon Sep 17 00:00:00 2001 From: Joe Sak Date: Wed, 16 Feb 2011 01:19:11 -0600 Subject: [PATCH 057/494] The first shall be the .last, and the last shall be the .first thanks to the default_scope :order_by published_at DESC --- spec/models/blog_posts_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/models/blog_posts_spec.rb b/spec/models/blog_posts_spec.rb index c15d1da..f15cd64 100644 --- a/spec/models/blog_posts_spec.rb +++ b/spec/models/blog_posts_spec.rb @@ -126,7 +126,7 @@ describe BlogPost do Factory(:post) blog_post = Factory(:post, :published_at => Time.now + 1.minute) blog_posts = BlogPost.all - blog_posts.first.next.should == blog_post + blog_posts.last.next.should == blog_post end end From f4660915616f656bf30338cc1f6ded4382e3d264 Mon Sep 17 00:00:00 2001 From: Joe Sak Date: Wed, 16 Feb 2011 08:28:51 -0600 Subject: [PATCH 058/494] lambda is necessary to keep Time.now from becoming a constant, which allows .uncategorized to use .live posts again --- app/models/blog_post.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/blog_post.rb b/app/models/blog_post.rb index c1918b6..679a21c 100644 --- a/app/models/blog_post.rb +++ b/app/models/blog_post.rb @@ -22,9 +22,9 @@ class BlogPost < ActiveRecord::Base where(['published_at between ? and ?', archive_year.beginning_of_year, archive_year.end_of_year]) } - scope :all_previous, where(['published_at <= ?', Time.now.beginning_of_month]) + scope :all_previous, lambda { where(['published_at <= ?', Time.now.beginning_of_month]) } - scope :live, where( "published_at <= ? and draft = ?", Time.now, false) + scope :live, lambda { where( "published_at <= ? and draft = ?", Time.now, false) } scope :previous, lambda { |i| where(["published_at < ? and draft = ?", i.published_at, false]).limit(1) } # next is now in << self @@ -61,7 +61,7 @@ class BlogPost < ActiveRecord::Base end def uncategorized - BlogPost.all.reject { |p| p.categories.any? } + BlogPost.live.reject { |p| p.categories.any? } end end From 46372aab0e7bcd59638fc91a0ffb508c0d45cb26 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Thu, 17 Feb 2011 11:03:09 +1300 Subject: [PATCH 059/494] Not sure why we were getting bundler involved. Regeneraed gemspec --- Gemfile | 2 -- Gemfile.lock | 11 ----------- lib/gemspec.rb | 1 + lib/refinerycms-blog.rb | 6 +----- refinerycms-blog.gemspec | 7 ++++++- 5 files changed, 8 insertions(+), 19 deletions(-) delete mode 100644 Gemfile delete mode 100644 Gemfile.lock diff --git a/Gemfile b/Gemfile deleted file mode 100644 index 84f127c..0000000 --- a/Gemfile +++ /dev/null @@ -1,2 +0,0 @@ -gem 'filters_spam', '~> 0.3' -gem "will_paginate", ">= 2.3.14" \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index ae2c41e..0000000 --- a/Gemfile.lock +++ /dev/null @@ -1,11 +0,0 @@ -GEM - specs: - filters_spam (0.3) - will_paginate (2.3.14) - -PLATFORMS - ruby - -DEPENDENCIES - filters_spam (~> 0.3) - will_paginate (>= 2.3.14) diff --git a/lib/gemspec.rb b/lib/gemspec.rb index 7902d37..ec6ace7 100644 --- a/lib/gemspec.rb +++ b/lib/gemspec.rb @@ -17,6 +17,7 @@ Gem::Specification.new do |s| s.homepage = %q{http://refinerycms.com} s.authors = %w(Resolve\\ Digital Neoteric\\ Design) s.require_paths = %w(lib) + s.add_dependency 'refinerycms', '>= 0.9.8' s.add_dependency 'filters_spam', '~> 0.2' diff --git a/lib/refinerycms-blog.rb b/lib/refinerycms-blog.rb index e982de0..1c4cbfc 100644 --- a/lib/refinerycms-blog.rb +++ b/lib/refinerycms-blog.rb @@ -1,8 +1,4 @@ -if defined?(Bundler) and !defined?(FiltersSpam) - # this will tell the user what to do - load(File.expand_path('../../Gemfile', __FILE__)) - require 'filters_spam' -end +require 'filters_spam' module Refinery module Blog diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index 25cd084..c2f5c12 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -2,12 +2,13 @@ Gem::Specification.new do |s| s.name = %q{refinerycms-blog} s.version = %q{1.2} s.description = %q{A really straightforward open source Ruby on Rails blog engine designed for integration with RefineryCMS.} - s.date = %q{2011-01-11} + s.date = %q{2011-02-17} s.summary = %q{Ruby on Rails blogging engine for RefineryCMS.} s.email = %q{info@refinerycms.com} s.homepage = %q{http://refinerycms.com} s.authors = %w(Resolve\ Digital Neoteric\ Design) s.require_paths = %w(lib) + s.add_dependency 'refinerycms', '>= 0.9.8' s.add_dependency 'filters_spam', '~> 0.2' @@ -35,6 +36,7 @@ Gem::Specification.new do |s| app/models/blog_category.rb app/models/blog_comment.rb app/models/blog_post.rb + app/models/categorization.rb app/views app/views/admin app/views/admin/blog @@ -60,6 +62,7 @@ Gem::Specification.new do |s| app/views/admin/blog/posts/edit.html.erb app/views/admin/blog/posts/index.html.erb app/views/admin/blog/posts/new.html.erb + app/views/admin/blog/posts/uncategorized.html.erb app/views/admin/blog/settings app/views/admin/blog/settings/notification_recipients.html.erb app/views/blog @@ -84,10 +87,12 @@ Gem::Specification.new do |s| config/locales config/locales/en.yml config/locales/es.yml + config/locales/fr.yml config/locales/it.yml config/locales/nb.yml config/locales/nl.yml config/locales/pt-BR.yml + config/locales/ru.yml config/routes.rb features features/support From 78e5eeb6247dac5306336e93459c37cdcefa25ad Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Thu, 17 Feb 2011 11:05:43 +1300 Subject: [PATCH 060/494] No more gemfile in the gemspec --- refinerycms-blog.gemspec | 2 -- 1 file changed, 2 deletions(-) diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index c2f5c12..393ffee 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -101,8 +101,6 @@ Gem::Specification.new do |s| features/support/factories/blog_comments.rb features/support/factories/blog_posts.rb features/support/paths.rb - Gemfile - Gemfile.lock generators generators/refinerycms_blog generators/refinerycms_blog/refinerycms_blog_generator.rb From 6fda9d4fa747310b9b6037987ec27f46c438fb10 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Thu, 17 Feb 2011 14:55:54 +1300 Subject: [PATCH 061/494] Chrome (atleast) got more strict about this and if you have a / in the selector then you need quotation marks. Closes GH-39 --- public/javascripts/refinery/refinerycms-blog.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/javascripts/refinery/refinerycms-blog.js b/public/javascripts/refinery/refinerycms-blog.js index 3ddbcc2..e730c6f 100644 --- a/public/javascripts/refinery/refinerycms-blog.js +++ b/public/javascripts/refinery/refinerycms-blog.js @@ -1,5 +1,5 @@ $(document).ready(function(){ - $('nav#actions.multilist > ul:not(.search_list) li a[href$=' + window.location.pathname + ']') + $('nav#actions.multilist > ul:not(.search_list) li a[href$="' + window.location.pathname + '"]') .parent().addClass('selected'); if($('nav#actions.multilist > ul:not(.search_list) li.selected').length == 0) { $('nav#actions.multilist > ul:not(.search_list) li a:nth(1)').parent().addClass('selected'); @@ -15,9 +15,9 @@ $(document).ready(function(){ $('ul.collapsible_menu').each(function(i, ul) { (first_li = $(this).children('li:first')).after(div=$("
    ")); - + $(" ").appendTo(first_li) - + if (($(this).children('li.selected')).length == 0) { div.hide(); first_li.addClass("closed"); From 8c01bcece45b0c132c595e5940ebcacc52fafaad Mon Sep 17 00:00:00 2001 From: Simon Hambly Date: Sun, 20 Feb 2011 22:11:45 +0000 Subject: [PATCH 062/494] tidy up views, removing reference to comments when comments disable --- app/views/admin/blog/_submenu.html.erb | 49 +++++++++++++------------- app/views/blog/posts/show.html.erb | 1 - app/views/blog/shared/_post.html.erb | 10 +++--- 3 files changed, 31 insertions(+), 29 deletions(-) diff --git a/app/views/admin/blog/_submenu.html.erb b/app/views/admin/blog/_submenu.html.erb index e5343e1..f7b95dd 100644 --- a/app/views/admin/blog/_submenu.html.erb +++ b/app/views/admin/blog/_submenu.html.erb @@ -26,30 +26,31 @@ :class => 'page_add_icon' %>
  • - -
      -
    • - <% if BlogComment.unmoderated.any? %> - <% title = t('.comments.title_with_count', :new_count => BlogComment.unmoderated.size) %> - <% else %> - <% title = t('.comments.title') %> - <% end %> - <%= link_to title, '#', - :class => 'comments_icon' %> -
    • -
    • - <%= link_to t('.comments.new'), admin_blog_comments_path, - :class => 'comment_icon' %> -
    • -
    • - <%= link_to t('.comments.approved'), approved_admin_blog_comments_path, - :class => 'comment_tick_icon' %> -
    • -
    • - <%= link_to t('.comments.rejected'), rejected_admin_blog_comments_path, - :class => 'comment_cross_icon' %> -
    • -
    + <% if BlogPost.comments_allowed? %> +
      +
    • + <% if BlogComment.unmoderated.any? %> + <% title = t('.comments.title_with_count', :new_count => BlogComment.unmoderated.size) %> + <% else %> + <% title = t('.comments.title') %> + <% end %> + <%= link_to title, '#', + :class => 'comments_icon' %> +
    • +
    • + <%= link_to t('.comments.new'), admin_blog_comments_path, + :class => 'comment_icon' %> +
    • +
    • + <%= link_to t('.comments.approved'), approved_admin_blog_comments_path, + :class => 'comment_tick_icon' %> +
    • +
    • + <%= link_to t('.comments.rejected'), rejected_admin_blog_comments_path, + :class => 'comment_cross_icon' %> +
    • +
    + <% end %>
    • diff --git a/app/views/blog/posts/show.html.erb b/app/views/blog/posts/show.html.erb index 5ac4c76..48ca0b8 100644 --- a/app/views/blog/posts/show.html.erb +++ b/app/views/blog/posts/show.html.erb @@ -6,7 +6,6 @@ <% if BlogPost.comments_allowed? %>
    + +
    + <%= f.label :tag_list, "Tags" -%> + <%= f.text_field :tag_list, :class => 'larger' -%> +
    +

    <%= link_to t('.advanced_options'), "#", diff --git a/features/support/factories/blog_posts.rb b/features/support/factories/blog_posts.rb index 24436b8..3eecf53 100644 --- a/features/support/factories/blog_posts.rb +++ b/features/support/factories/blog_posts.rb @@ -2,5 +2,6 @@ Factory.define(:post, :class => BlogPost) do |f| f.sequence(:title) { |n| "Top #{n} Shopping Centers in Chicago" } f.body "These are the top ten shopping centers in Chicago. You're going to read a long blog post about them. Come to peace with it." f.draft false + f.tag_list "chicago, shopping, fun times" f.published_at Time.now end diff --git a/features/support/step_definitions/tags_steps.rb b/features/support/step_definitions/tags_steps.rb new file mode 100644 index 0000000..00e8a3e --- /dev/null +++ b/features/support/step_definitions/tags_steps.rb @@ -0,0 +1,3 @@ +Then /^the blog post should have the tags "([^"]*)"$/ do |tag_list| + BlogPost.last.tag_list == tag_list.split(', ') +end diff --git a/features/tags.feature b/features/tags.feature new file mode 100644 index 0000000..d8b9427 --- /dev/null +++ b/features/tags.feature @@ -0,0 +1,21 @@ +@blog_tags +Feature: Blog Post Tags + Blog posts can be assigned tags + + Scenario: The blog post new/edit form has tag_list + Given I am a logged in refinery user + + When I am on the new blog post form + Then I should see "Tags" + + Scenario: The blog post new/edit form saves tag_list + Given I am a logged in refinery user + + When I am on the new blog post form + And I fill in "Title" with "This is my blog post" + And I fill in "Body" with "And I love it" + And I fill in "Tags" with "chicago, bikes, beers, babes" + And I press "Save" + + Then there should be 1 blog post + And the blog post should have the tags "chicago, bikes, beers, babes" \ No newline at end of file diff --git a/spec/models/blog_posts_spec.rb b/spec/models/blog_posts_spec.rb index 523ddf3..1b96ece 100644 --- a/spec/models/blog_posts_spec.rb +++ b/spec/models/blog_posts_spec.rb @@ -49,13 +49,14 @@ describe BlogPost do describe "tags" do it "acts as taggable" do - Factory(:post).should respond_to(:tag_list) + (post = Factory(:post)).should respond_to(:tag_list) + post.tag_list.should include("chicago") end end describe "authors" do it "are authored" do - BlogPost.instance_methods.map(&:to_sym).include? :author + BlogPost.instance_methods.map(&:to_sym).should include(:author) end end From 3748c1d9efabde0b62db7b92281c711c6411cfce Mon Sep 17 00:00:00 2001 From: Joe Sak Date: Fri, 11 Mar 2011 14:23:44 -0600 Subject: [PATCH 103/494] Closes GH-29. Blog posts act as taggable. rspec & cukes passing --- app/controllers/blog/posts_controller.rb | 13 +++++++++++ app/views/blog/posts/archive.html.erb | 3 +-- app/views/blog/posts/index.html.erb | 1 + app/views/blog/posts/show.html.erb | 1 + app/views/blog/posts/tagged.html.erb | 22 +++++++++++++++++++ app/views/blog/shared/_post.html.erb | 10 ++++++--- app/views/blog/shared/_tags.html.erb | 8 +++++++ config/locales/en.yml | 5 +++++ config/routes.rb | 1 + .../support/step_definitions/tags_steps.rb | 8 +++++++ features/tags.feature | 15 ++++++++----- 11 files changed, 77 insertions(+), 10 deletions(-) create mode 100644 app/views/blog/posts/tagged.html.erb create mode 100644 app/views/blog/shared/_tags.html.erb diff --git a/app/controllers/blog/posts_controller.rb b/app/controllers/blog/posts_controller.rb index 576073e..9c413ed 100644 --- a/app/controllers/blog/posts_controller.rb +++ b/app/controllers/blog/posts_controller.rb @@ -2,6 +2,7 @@ class Blog::PostsController < BlogController before_filter :find_all_blog_posts, :except => [:archive] before_filter :find_blog_post, :only => [:show, :comment, :update_nav] + before_filter :find_tags respond_to :html, :js, :rss @@ -64,6 +65,14 @@ class Blog::PostsController < BlogController end respond_with (@blog_posts) end + + def tagged + @tag_name = params[:tag_name] + @blog_posts = BlogPost.tagged_with(@tag_name.titleize).paginate({ + :page => params[:page], + :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10) + }) + end protected @@ -83,5 +92,9 @@ protected :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10) }) end + + def find_tags + @tags = BlogPost.tag_counts_on(:tags) + end end diff --git a/app/views/blog/posts/archive.html.erb b/app/views/blog/posts/archive.html.erb index d44aa7f..a2044e8 100644 --- a/app/views/blog/posts/archive.html.erb +++ b/app/views/blog/posts/archive.html.erb @@ -1,5 +1,4 @@ <% content_for :body_content_left do %> - <%= @page[Page.default_parts.first.to_sym] %>

    <%= t('.blog_archive_for', :date => @archive_date.strftime('%B %Y')) %>

    <% if @blog_posts.any? %>
    @@ -11,8 +10,8 @@ <% end %> <% content_for :body_content_right do %> - <%= @page[Page.default_parts.second.to_sym] %> <%= render :partial => "/blog/shared/categories" %> + <%= render :partial => "/blog/shared/tags" %> <%= render :partial => "/blog/shared/rss_feed" %> <%= blog_archive_list %> <% end %> diff --git a/app/views/blog/posts/index.html.erb b/app/views/blog/posts/index.html.erb index 08e3578..8c3801a 100644 --- a/app/views/blog/posts/index.html.erb +++ b/app/views/blog/posts/index.html.erb @@ -15,6 +15,7 @@ <%=raw @page[Page.default_parts.second.to_sym] if Page.default_parts.many? %> <%= render :partial => "/blog/shared/categories" %> + <%= render :partial => "/blog/shared/tags" %> <%= render :partial => "/blog/shared/rss_feed" %> <%= blog_archive_list %> <% end %> diff --git a/app/views/blog/posts/show.html.erb b/app/views/blog/posts/show.html.erb index 504db2c..92898a4 100644 --- a/app/views/blog/posts/show.html.erb +++ b/app/views/blog/posts/show.html.erb @@ -49,6 +49,7 @@ <% content_for :body_content_right do %> <%= render :partial => "/blog/shared/categories" %> + <%= render :partial => "/blog/shared/tags" %> <%= render :partial => "/blog/shared/posts" %> <%= render :partial => "/blog/shared/rss_feed" %> <%= blog_archive_list %> diff --git a/app/views/blog/posts/tagged.html.erb b/app/views/blog/posts/tagged.html.erb new file mode 100644 index 0000000..29de791 --- /dev/null +++ b/app/views/blog/posts/tagged.html.erb @@ -0,0 +1,22 @@ +<% content_for :body_content_title, "Posts tagged “#{@tag_name.titleize}”".html_safe -%> + +<% content_for :body_content_left do %> + <% if @blog_posts.any? %> +
    + <%= render :partial => "/blog/shared/post", :collection => @blog_posts %> + <%= will_paginate @blog_posts %> +
    + <% else %> +

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

    + <% end %> +<% end %> + +<% content_for :body_content_right do %> + <%= render :partial => "/blog/shared/categories" %> + <%= render :partial => "/blog/shared/tags" %> + <%= render :partial => "/blog/shared/rss_feed" %> + <%= blog_archive_list %> +<% end %> + +<%= render :partial => "/shared/content_page" %> +<% content_for :stylesheets, stylesheet_link_tag('refinerycms-blog') %> diff --git a/app/views/blog/shared/_post.html.erb b/app/views/blog/shared/_post.html.erb index 2e92f73..716c1ad 100644 --- a/app/views/blog/shared/_post.html.erb +++ b/app/views/blog/shared/_post.html.erb @@ -9,9 +9,13 @@ <% if (categories = post.categories).any? %> + <% end %> + <% if (tags = post.tag_list).any? %> + <% end %> diff --git a/app/views/blog/shared/_tags.html.erb b/app/views/blog/shared/_tags.html.erb new file mode 100644 index 0000000..f8833f1 --- /dev/null +++ b/app/views/blog/shared/_tags.html.erb @@ -0,0 +1,8 @@ +<% unless @tags.nil? %> +

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

    + +<% end %> \ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index 357f4be..f5b5461 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -101,6 +101,8 @@ en: singular: comment none: no comments archives: Archives + tags: + title: "Tags" categories: show: no_posts: There are no posts here yet. @@ -122,7 +124,10 @@ en: add: Make a Comment other: Other Blog Posts filed_in: Filed in + tagged: Tagged submit: Send comment + tagged: + no_blog_articles_yet: There are no blog articles posted yet. Stay tuned. archive: blog_archive_for: 'Blog Archive for %{date}' no_blog_articles_posted: 'There are no blog articles posted for %{date}. Stay tuned.' diff --git a/config/routes.rb b/config/routes.rb index e37987a..421e845 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -6,6 +6,7 @@ Refinery::Application.routes.draw do match 'categories/:id', :to => 'categories#show', :as => 'blog_category' 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_name' => 'posts#tagged', :as => 'tagged_posts' end scope(:path => 'refinery', :as => 'admin', :module => 'admin') do diff --git a/features/support/step_definitions/tags_steps.rb b/features/support/step_definitions/tags_steps.rb index 00e8a3e..5d4dced 100644 --- a/features/support/step_definitions/tags_steps.rb +++ b/features/support/step_definitions/tags_steps.rb @@ -1,3 +1,11 @@ +Given /^there is a blog post titled "([^"]*)" and tagged "([^"]*)"$/ do |title, tag_name| + @blog_post = Factory(:post, :title => title, :tag_list => tag_name) +end + +When /^I visit the tagged posts page for "([^"]*)"$/ do |tag_name| + visit tagged_posts_path(tag_name.parameterize) +end + Then /^the blog post should have the tags "([^"]*)"$/ do |tag_list| BlogPost.last.tag_list == tag_list.split(', ') end diff --git a/features/tags.feature b/features/tags.feature index d8b9427..07c73cd 100644 --- a/features/tags.feature +++ b/features/tags.feature @@ -2,15 +2,14 @@ Feature: Blog Post Tags Blog posts can be assigned tags - Scenario: The blog post new/edit form has tag_list + Background: Given I am a logged in refinery user - + + Scenario: The blog post new/edit form has tag_list When I am on the new blog post form Then I should see "Tags" Scenario: The blog post new/edit form saves tag_list - Given I am a logged in refinery user - When I am on the new blog post form And I fill in "Title" with "This is my blog post" And I fill in "Body" with "And I love it" @@ -18,4 +17,10 @@ Feature: Blog Post Tags And I press "Save" Then there should be 1 blog post - And the blog post should have the tags "chicago, bikes, beers, babes" \ No newline at end of file + And the blog post should have the tags "chicago, bikes, beers, babes" + + Scenario: The blog has a "tagged" route & view + Given there is a blog post titled "I love my city" and tagged "chicago" + When I visit the tagged posts page for "chicago" + Then I should see "Chicago" + And I should see "I love my city" \ No newline at end of file From 418244ff52b3fad2e7183a832657ef6fffda5f76 Mon Sep 17 00:00:00 2001 From: Joe Sak Date: Fri, 11 Mar 2011 14:26:10 -0600 Subject: [PATCH 104/494] Changelog udpated to reflect tags --- changelog.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/changelog.md b/changelog.md index c5ef614..2de48d8 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,9 @@ * Spanish language fixes [scambra](https://github.com/scambra) * Bug fixes [scambra](https://github.com/scambra) +* Tags [joemsak](https://github.com/joemsak) +* Tagged posts route / view [joemsak](https://github.com/joemsak) +* Tag cloud in sidebar * [See full list](https://github.com/resolve/refinerycms-blog/compare/1.3...1.4) ## 1.3 [03 March 2011] From af4fabe1c5f6679dc098fb720120e25160f80318 Mon Sep 17 00:00:00 2001 From: keram Date: Sun, 13 Mar 2011 16:25:08 +0100 Subject: [PATCH 105/494] Slovak and Czech translation --- config/locales/cs.yml | 128 ++++++++++++++++++++++++++++++++++++++++++ config/locales/sk.yml | 128 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 256 insertions(+) create mode 100644 config/locales/cs.yml create mode 100644 config/locales/sk.yml diff --git a/config/locales/cs.yml b/config/locales/cs.yml new file mode 100644 index 0000000..8d8d81d --- /dev/null +++ b/config/locales/cs.yml @@ -0,0 +1,128 @@ +cs: + plugins: + refinerycms_blog: + title: Blog + admin: + blog: + categories: + category: + edit: Upravit kategorii + delete: Smazat kategorii + index: + no_items_yet: 'Nejsou zde žádné kategorie. Klikni na "%{create}" pro přidání první.' + comments: + approved: 'Komentář od "%{author}" byl schválen.' + comment: + view_live_html: 'Zobrazit živý náhled
    (otevře nové okno)' + read: Zobrazit komentář + reject: Zamítnout komentář + approve: Schválit + rejected: 'Komentář od "%{author}" byl zamítnut.' + index: + no_items_yet: 'Nejsou zde žádné %{type} komentáře.' + show: + comment: Komentář + blog_post: Blog článek + from: Odeslal + date: Datum + message: Komentář + details: Detaily + age: Věk + actions: Akce + back: Zpět na seznam komentářů + reject: Zamítnout komentář + approve: Schváliť komentář + posts: + form: + advanced_options: Pokročilé nastavení + toggle_advanced_options: Klikni pro přístup k nastavením meta tagů a menu + save_as_draft: Uložit jako koncept + published_at: Datum publikování + index: + no_items_yet: 'Nejsou žádné články na blogu. Klikni na "%{create}" pro přidání prvního.' + uncategorized: + no_items_yet: 'Nejsou žádné nekategorizované články.' + post: + view_live_html: 'Zobrazit článek
    (otevře jej v novém okně)' + edit: Upravit článek + delete: Smazat článek + settings: + notification_recipients: + value: Poslat notifikaci pro + explanation: 'Vždycky když někdo přidá komentář, Refinery zašle oznámení.' + hint: 'Vždycky když někdo přidá komentář, Refinery ti pošle oznámení.' + example: "Zadej tvou emailovou adresu(y) jako například: jack@work.com, jill@office.com" + updated: 'Seznam příjemců notifikací "%{recipients}"' + submenu: + categories: + title: Kategorie + manage: Spravovat + new: Nová kategórie + comments: + title: Komentáře + title_with_count: 'Komentáře (%{new_count} nových)' + new: Nový + unmoderated: Nový + approved: Schválený + rejected: Zamítnutý + posts: + title: Články + manage: Spravovat články + new: Vytvořit nový článek + uncategorized: Nekategorizované články + settings: + title: Nastavení + moderation: Moderování + update_notified: Upravit seznam notifikovaných + comments: Komentáře + blog: + comment_mailer: + notification: + greeting: Ahoj + you_recieved_new_comment: Máš nový komentář na stránce + comment_starts: --- začátek komentáře --- + comment_ends: --- konec komentáře --- + from: Od + email: Email + message: Zpráva + closing_line: S pozdravem + ps: 'P.S. Všechny komentáře jsou uloženy v sekci "Blog" pod záložkou "Komentáře" v případě pokud by je bylo třeba zobrazit později.' + shared: + categories: + title: Kategorie + rss_feed: + title: RSS zdroj článků + subscribe: Přihlásit k odběru + posts: + other: Další články + created_at: 'Publikován %{when}' + read_more: Celý článek + comments: + singular: komentář + none: žiadne komentáře + archives: Archiv + categories: + show: + no_posts: Nejsou zde žádné články. + posts: + post: + filed_in: Podaný + comment: komentář + comments: + by: 'Odeslal %{who}' + time_ago: '%{time} zpět' + thank_you: 'Díky za komentář.' + thank_you_moderated: 'Děkujeme za Váš komentář. Vaše zpráva čeká na schválení a objeví se v nejbližší době.' + index: + no_blog_articles_yet: Právě nejsou žádné články na blogu. Zůstaňte naladěni. + show: + blog_home: Hlavní stránka blogu + comments: + title: Komentáře + add: Přidat komentář + other: Další články + filed_in: Podaný + submit: Odeslat komentář + archive: + blog_archive_for: 'Blog archiv pro %{date}' + no_blog_articles_posted: 'Nejsou žádné články publikované %{date}.' diff --git a/config/locales/sk.yml b/config/locales/sk.yml new file mode 100644 index 0000000..fea514d --- /dev/null +++ b/config/locales/sk.yml @@ -0,0 +1,128 @@ +sk: + plugins: + refinerycms_blog: + title: Blog + admin: + blog: + categories: + category: + edit: Upraviť kategóriu + delete: Zmazať kategóriu + index: + no_items_yet: 'Niesu tu žiadne kategórie. Klikni "%{create}" pre pridanie prvej.' + comments: + approved: 'Komentár od "%{author}" bol schválený.' + comment: + view_live_html: 'Zobraziť živý náhľad
    (otvorí nové okno)' + read: Zobraziť komentár + reject: Zamietnuť komentár + approve: Schváliť + rejected: 'Komentár od "%{author}" bol zamietnutý.' + index: + no_items_yet: 'Niesu tu žiadne %{type} komentáre.' + show: + comment: Komentár + blog_post: Blog článok + from: Odoslal + date: Dátum + message: Správa + details: Detaily + age: Vek + actions: Akcie + back: Späť na zoznam komentárov. + reject: Zamietnuť komentár + approve: Schváliť komentár + posts: + form: + advanced_options: Pokročilé nastavenia + toggle_advanced_options: Klikni pre prístup k nastaveniam meta tagov a menu + save_as_draft: Uložiť ako koncept + published_at: Dátum publikovania + index: + no_items_yet: 'Niesu žiadne články na blogu. Klikni na "%{create}" pre pridanie prvého.' + uncategorized: + no_items_yet: 'Niesu žiadne nekategorizované články.' + post: + view_live_html: 'Zobraziť článok
    (otvorí ho v novom okne)' + edit: Upraviť článok + delete: Zmazať článok + settings: + notification_recipients: + value: Poslať notifikáciu pre + explanation: 'Vždy keď niekto pridá komentár, Refinery pošle notifikáciu.' + hint: 'Vždy keď niekto pridá komentár, Refinery ti pošle notifikáciu.' + example: "Zadaj tvoju emailovú adresu(y) ako napríklad: jack@work.com, jill@office.com" + updated: 'Zoznam príjemcov notifikácií "%{recipients}"' + submenu: + categories: + title: Kategórie + manage: Spravovať + new: Nová kategória + comments: + title: Komentáre + title_with_count: 'Komentáre (%{new_count} nových)' + new: Nový + unmoderated: Nový + approved: Schválený + rejected: Zamietnutý + posts: + title: Články + manage: Spravovať články + new: Vytvoriť nový článok + uncategorized: Nekategorizované články + settings: + title: Nastavenia + moderation: Moderovanie + update_notified: Upraviť zoznam notifikovaných + comments: Komentáre + blog: + comment_mailer: + notification: + greeting: Ahoj + you_recieved_new_comment: Máš nový komentár na stránke + comment_starts: --- začiatok komentára --- + comment_ends: --- koniec komentára --- + from: Od + email: Email + message: Správa + closing_line: S pozdravom + ps: 'P.S. Všetky komentáre su uložené v sekcii "Blog" pod záložkou "Komentáre" v prípade ak by ich bolo potrebné zobraziť neskôr.' + shared: + categories: + title: Kategórie + rss_feed: + title: RSS zdroj článkov + subscribe: Prihlásiť k odberu + posts: + other: Ďaľšie články + created_at: 'Publikovaný %{when}' + read_more: Celý článok + comments: + singular: komentár + none: Niesu tu žiadne komentáre + archives: Archív + categories: + show: + no_posts: Niesu tu žiadne články momentálne. + posts: + post: + filed_in: Podaný + comment: komentár + comments: + by: 'Odoslal %{who}' + time_ago: '%{time} späť' + thank_you: 'Vďaka za komentár.' + thank_you_moderated: 'Ďakujeme za Váš komentár. Vaša správa čaká na schválenie a objaví sa v najbližšej dobe.' + index: + no_blog_articles_yet: Práve niesu žiadne články na blogu. Zostante naladení. + show: + blog_home: Hlavná stránka blogu + comments: + title: Komentáre + add: Pridať komentár + other: Ďalšie články + filed_in: Podaný + submit: Odoslať komentár + archive: + blog_archive_for: 'Blog archív pre %{date}' + no_blog_articles_posted: 'Niesu žiadne články publikované %{date}.' From 5eac0f349b105e74238a94592acfd7d448c74c50 Mon Sep 17 00:00:00 2001 From: Joe Sak Date: Sun, 13 Mar 2011 10:44:23 -0500 Subject: [PATCH 106/494] changelog update --- changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.md b/changelog.md index 2de48d8..e861958 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,7 @@ * Tags [joemsak](https://github.com/joemsak) * Tagged posts route / view [joemsak](https://github.com/joemsak) * Tag cloud in sidebar +* Czech & slovak translations [karem](https://github.com/keram) * [See full list](https://github.com/resolve/refinerycms-blog/compare/1.3...1.4) ## 1.3 [03 March 2011] From 8621b468ed973c968888d1a41e6e85de9051330a Mon Sep 17 00:00:00 2001 From: Marcelo Griggio Cajueiro Date: Mon, 14 Mar 2011 23:02:40 -0300 Subject: [PATCH 107/494] Added pt-Br translations to uncategorized. --- config/locales/pt-BR.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index deeeb3a..f2e2fdc 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -40,6 +40,8 @@ pt-BR: published_at: Data de publicação index: no_items_yet: 'Ainda não há Posts no Blog. Clique em "%{create}" para adicionar o primeiro post.' + uncategorized: + no_items_yet: 'Ainda não há posts sem categoria.' post: view_live_html: Ver este comentário
    (será aberto em outra janela) edit: Editar este post @@ -67,6 +69,7 @@ pt-BR: title: Posts manage: Gerenciar posts new: Criar novo post + uncategorized: Posts sem categoria settings: title: Configurações moderation: Moderação From 6b6179fafed1065f9727655329771745b6129574 Mon Sep 17 00:00:00 2001 From: Marcelo Griggio Cajueiro Date: Mon, 14 Mar 2011 23:02:40 -0300 Subject: [PATCH 108/494] Added pt-Br translations to uncategorized. --- config/locales/pt-BR.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index 2e5e8f2..706f34c 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -40,6 +40,8 @@ pt-BR: published_at: Data de publicação index: no_items_yet: 'Ainda não há Posts no Blog. Clique em "%{create}" para adicionar o primeiro post.' + uncategorized: + no_items_yet: 'Ainda não há posts sem categoria.' post: view_live_html: 'Ver este comentário
    (será aberto em outra janela)' edit: Editar este post @@ -67,6 +69,7 @@ pt-BR: title: Posts manage: Gerenciar posts new: Criar novo post + uncategorized: Posts sem categoria settings: title: Configurações moderation: Moderação From 3642dfbe3168f1396c1b2b9c774dc95255d7c1e3 Mon Sep 17 00:00:00 2001 From: Leonard Punt Date: Thu, 24 Mar 2011 18:49:55 +0100 Subject: [PATCH 109/494] improved and completed the Dutch translation --- config/locales/nl.yml | 132 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 121 insertions(+), 11 deletions(-) diff --git a/config/locales/nl.yml b/config/locales/nl.yml index cb58d69..7a48408 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -4,20 +4,130 @@ nl: title: Blog admin: blog: - posts: + categories: + category: + edit: Bewerk deze categorie + delete: Verwijder deze categorie definitief index: - no_items_yet: Er zijn nog geen Blog Post. Druk op 'Maak een nieuwe Blog Post' om de eerste aan te maken. + no_items_yet: 'Er zijn momenteel geen categorin. Klik op "%{create}" om uw eerste categorie toe te voegen.' + comments: + approved: 'De reactie van "%{author}" is goedgekeurd.' + comment: + view_live_html: 'Bekijk deze reactie op de website
    (opent in een nieuw venster)' + read: Lees deze reactie + reject: Keur deze reactie af + approve: Keur deze reactie goed + rejected: 'De reactie van "%{author}" is afgekeurd.' + index: + no_items_yet: 'Er zijn geen %{type} reacties.' + show: + comment: Reactie + blog_post: Blogpost + from: Gepost door + date: Gepost op + message: Reactie + details: Details + age: Leeftijd + actions: Acties + back: Terug naar alle reacties + reject: Keur deze reactie af + approve: Keur deze reactie goed + posts: + form: + advanced_options: Geavanceerde eigenschappen + toggle_advanced_options: Klik voor toegang tot meta tag instellingen en menu opties + save_as_draft: Sla op als concept + published_at: Publicatiedatum + index: + no_items_yet: 'Er zijn momenteel geen blogposts. Klik op "%{create}" om uw eerste blogpost toe te voegen.' + uncategorized: + no_items_yet: 'Er zijn geen ongecategoriseerde blogposts.' post: - view_live: 'Bekijk deze blog posts op de website
    (opent een nieuw venster)' - edit: Bewerk deze blog post - delete: Verwijder deze blog post voor eeuwig + view_live_html: 'Bekijk deze blogpost op de website
    (opent in een nieuw venster)' + edit: Bewerk deze blogpost + delete: Verwijder deze blogpost definitief + settings: + notification_recipients: + value: Stuur notificaties naar + explanation: 'Bij elke nieuwe reactie op een blogpost stuurt Refinery u een e-mail om dit te melden.' + hint: 'Als er een reactie is toegevoegd stuurt Refinery een e-mail notificatie naar u.' + example: "Voer uw e-mailadres(sen) in, bijvoorbeeld: jack@work.com, jill@office.com" + updated: 'De ontvanger(s) van notificaties is/zijn gewijzigd naar "%{recipients}"' submenu: + categories: + title: Categorin + manage: Beheren + new: Voeg een nieuwe categorie toe comments: - new: Nieuwe + title: Reacties + title_with_count: 'Reacties (%{new_count} nieuwe)' + new: Nieuw + unmoderated: Nieuw + approved: Goedgekeurd + rejected: Afgekeurd posts: - new: Maak een nieuwe post + title: Posts + manage: Beheer posts + new: Voeg een nieuwe post toe + uncategorized: Ongecategoriseerde posts settings: - update_notified: Wijzig wie een notificatie ontvangt - blog_posts: - show: - other: Andere Blog Post \ No newline at end of file + title: Instellingen + moderation: Stuur notificaties + update_notified: Wijzig wie notificaties ontvangt + comments: Reacties + blog: + comment_mailer: + notification: + greeting: Hallo + you_recieved_new_comment: Er is zojuist een reactie geplaatst op uw website. + comment_starts: --- begin reactie --- + comment_ends: --- einde reactie --- + from: Van + email: E-mail + message: Bericht + closing_line: Met vriendelijke groet + ps: 'P.S. Alle reacties worden opgeslagen in de "Blog" sectie van Refinery onder het submenu "Comments", voor als u deze reacties later wilt bekijken.' + shared: + categories: + title: Categorin + rss_feed: + title: RSS Feed + subscribe: Aanmelden + posts: + other: Andere posts + created_at: 'Gepost op %{when}' + read_more: Lees verder + comments: + singular: Reactie + none: Geen reacties + archives: Archief + tags: + title: "Tags" + categories: + show: + no_posts: Er zijn momenteel geen posts. + posts: + post: + filed_in: Toegevoegd aan + comment: Reactie + comments: + by: 'Gepost door %{who}' + time_ago: '%{time} geleden' + thank_you: 'Bedankt voor uw reactie.' + thank_you_moderated: 'Bedankt voor uw reactie. Uw reactie is in de wachtrij geplaatst en zal binnenkort verschijnen.' + index: + no_blog_articles_yet: Er zijn momenteel nog geen blogposts. Neem regelmatig een kijkje. + show: + blog_home: Blog Home + comments: + title: Reacties + add: Plaats een reactie + other: Andere blogposts + filed_in: Toegevoegd aan + tagged: Tagged + submit: Verstuur reactie + tagged: + no_blog_articles_yet: Er zijn momenteel nog geen blogposts. Neem regelmatig een kijkje. + archive: + blog_archive_for: 'Blog archief voor %{date}' + no_blog_articles_posted: 'Er zijn geen blogposts voor %{date}. Neem regelmatig een kijkje.' From c583f930e8b4ec1eda74b510b45b881dc40b4b46 Mon Sep 17 00:00:00 2001 From: Nate Bird Date: Fri, 25 Mar 2011 08:18:57 -0700 Subject: [PATCH 110/494] Fixed for failed migration when installing refinery_cms_blog. Also makes it consistent with generated engine format. --- db/seeds/refinerycms_blog.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/db/seeds/refinerycms_blog.rb b/db/seeds/refinerycms_blog.rb index f958fab..9686c7f 100644 --- a/db/seeds/refinerycms_blog.rb +++ b/db/seeds/refinerycms_blog.rb @@ -1,6 +1,8 @@ User.find(:all).each do |user| - user.plugins.create(:name => "refinerycms_blog", - :position => (user.plugins.maximum(:position) || -1) +1) + if user.plugins.where(:name => 'refinerycms_blog').blank? + user.plugins.create(:name => "refinerycms_blog", + :position => (user.plugins.maximum(:position) || -1) +1) + end end page = Page.create( From aed62fa7a01f372cb30b26eb43c49d187d1f4087 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Mon, 28 Mar 2011 08:54:31 +1300 Subject: [PATCH 111/494] We need to start targeting refinerycms-core not refinerycms because this would prevent people building their own stack and using this engine. --- lib/gemspec.rb | 2 +- lib/refinerycms-blog.rb | 2 +- refinerycms-blog.gemspec | 15 +++++++++++---- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/gemspec.rb b/lib/gemspec.rb index ec6ace7..918bd4f 100644 --- a/lib/gemspec.rb +++ b/lib/gemspec.rb @@ -18,7 +18,7 @@ Gem::Specification.new do |s| s.authors = %w(Resolve\\ Digital Neoteric\\ Design) s.require_paths = %w(lib) - s.add_dependency 'refinerycms', '>= 0.9.8' + s.add_dependency 'refinerycms-core', '>= 0.9.9.1' s.add_dependency 'filters_spam', '~> 0.2' s.files = %w( diff --git a/lib/refinerycms-blog.rb b/lib/refinerycms-blog.rb index 0158e0b..60c9bfa 100644 --- a/lib/refinerycms-blog.rb +++ b/lib/refinerycms-blog.rb @@ -38,7 +38,7 @@ module Refinery class << self def version - %q{1.3.2} + %q{1.4} end end end diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index 42ba28d..7c12e0c 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -1,17 +1,16 @@ Gem::Specification.new do |s| s.name = %q{refinerycms-blog} - s.version = %q{1.3.2} + s.version = %q{1.4} s.description = %q{A really straightforward open source Ruby on Rails blog engine designed for integration with RefineryCMS.} - s.date = %q{2011-03-09} + s.date = %q{2011-03-28} s.summary = %q{Ruby on Rails blogging engine for RefineryCMS.} s.email = %q{info@refinerycms.com} s.homepage = %q{http://refinerycms.com} s.authors = %w(Resolve\ Digital Neoteric\ Design) s.require_paths = %w(lib) - s.add_dependency 'refinerycms', '>= 0.9.8' + s.add_dependency 'refinerycms-core', '>= 0.9.9.1' s.add_dependency 'filters_spam', '~> 0.2' - s.add_dependency 'acts-as-taggable-on', '~> 2.0.6' s.files = %w( app @@ -79,14 +78,17 @@ Gem::Specification.new do |s| app/views/blog/posts/index.html.erb app/views/blog/posts/index.rss.builder app/views/blog/posts/show.html.erb + app/views/blog/posts/tagged.html.erb app/views/blog/shared app/views/blog/shared/_categories.html.erb app/views/blog/shared/_post.html.erb app/views/blog/shared/_posts.html.erb app/views/blog/shared/_rss_feed.html.erb + app/views/blog/shared/_tags.html.erb changelog.md config config/locales + config/locales/cs.yml config/locales/de.yml config/locales/en.yml config/locales/es.yml @@ -97,11 +99,14 @@ Gem::Specification.new do |s| config/locales/pl.yml config/locales/pt-BR.yml config/locales/ru.yml + config/locales/sk.yml + config/locales/zh-CN.yml config/routes.rb db db/migrate db/migrate/1_create_blog_structure.rb db/migrate/2_add_user_id_to_blog_posts.rb + db/migrate/3_acts_as_taggable_on_migration.rb db/seeds db/seeds/refinerycms_blog.rb features @@ -114,6 +119,8 @@ Gem::Specification.new do |s| features/support/paths.rb features/support/step_definitions features/support/step_definitions/authors_steps.rb + features/support/step_definitions/tags_steps.rb + features/tags.feature lib lib/gemspec.rb lib/generators From 0f789a77a5f52544322d2eda0b36e9981990360d Mon Sep 17 00:00:00 2001 From: Joe Sak Date: Mon, 28 Mar 2011 21:10:11 -0500 Subject: [PATCH 112/494] acts-as-taggable-on is a dependency, yo --- refinerycms-blog.gemspec | 1 + 1 file changed, 1 insertion(+) diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index 7c12e0c..0cf4b84 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -11,6 +11,7 @@ Gem::Specification.new do |s| s.add_dependency 'refinerycms-core', '>= 0.9.9.1' s.add_dependency 'filters_spam', '~> 0.2' + s.add_dependency 'acts-as-taggable-on' s.files = %w( app From a581629adbd676b86d36c626bc1f123dba3da264 Mon Sep 17 00:00:00 2001 From: Michael Hellein Date: Tue, 29 Mar 2011 11:18:13 -0400 Subject: [PATCH 113/494] removed nonexistent files from gemspec --- refinerycms-blog.gemspec | 2 -- 1 file changed, 2 deletions(-) diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index 0cf4b84..544e8fb 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -125,8 +125,6 @@ Gem::Specification.new do |s| lib lib/gemspec.rb lib/generators - lib/generators/refinerycms_blog - lib/generators/refinerycms_blog/templates lib/generators/refinerycms_blog_generator.rb lib/refinerycms-blog.rb public From 0d76f30fa384586e6ca18913c0604f4fb9db25aa Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Sat, 2 Apr 2011 12:10:42 +1300 Subject: [PATCH 114/494] mild refactor, one line if statement and decreased an indent one level. --- app/views/blog/posts/_post.html.erb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/views/blog/posts/_post.html.erb b/app/views/blog/posts/_post.html.erb index d1c204e..f589a33 100644 --- a/app/views/blog/posts/_post.html.erb +++ b/app/views/blog/posts/_post.html.erb @@ -14,7 +14,7 @@ <% end %> @@ -27,6 +27,4 @@ <% end %> <%= render :partial => '/shared/draft_page_message' unless @blog_post.nil? or @blog_post.live? -%> -<% if next_or_previous?(@blog_post) -%> - <%= render 'nav' %> -<% end -%> +<%= render 'nav' if next_or_previous?(@blog_post) %> From 5e00a69f8a2e33fb5cd4f871fbdf366ca6682995 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Sat, 2 Apr 2011 12:10:59 +1300 Subject: [PATCH 115/494] Added friendly_id to categories so instead of /categories/1 we get, say, /categories/news --- app/models/categorization.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/models/categorization.rb b/app/models/categorization.rb index 32e9967..20821d4 100644 --- a/app/models/categorization.rb +++ b/app/models/categorization.rb @@ -1,5 +1,9 @@ class Categorization < ActiveRecord::Base + set_table_name 'blog_categories_blog_posts' belongs_to :blog_post belongs_to :blog_category + + has_friendly_id :title, :use_slug => true + end \ No newline at end of file From b20ac15c5227bbde675ff3137abacd38828e55c4 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Sun, 3 Apr 2011 14:56:23 +1200 Subject: [PATCH 116/494] Define acts-as-taggable-on in the lib/gemspec.rb so that it's recreated every time. --- lib/gemspec.rb | 5 +++-- refinerycms-blog.gemspec | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/gemspec.rb b/lib/gemspec.rb index 918bd4f..d112795 100644 --- a/lib/gemspec.rb +++ b/lib/gemspec.rb @@ -14,12 +14,13 @@ Gem::Specification.new do |s| s.date = %q{#{Time.now.strftime('%Y-%m-%d')}} s.summary = %q{Ruby on Rails blogging engine for RefineryCMS.} s.email = %q{info@refinerycms.com} - s.homepage = %q{http://refinerycms.com} - s.authors = %w(Resolve\\ Digital Neoteric\\ Design) + s.homepage = %q{http://refinerycms.com/blog} + s.authors = ['Resolve Digital', 'Neoteric Design'] s.require_paths = %w(lib) s.add_dependency 'refinerycms-core', '>= 0.9.9.1' s.add_dependency 'filters_spam', '~> 0.2' + s.add_dependency 'acts-as-taggable-on' s.files = %w( #{files.join("\n ")} diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index 544e8fb..cd5af67 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -2,11 +2,11 @@ Gem::Specification.new do |s| s.name = %q{refinerycms-blog} s.version = %q{1.4} s.description = %q{A really straightforward open source Ruby on Rails blog engine designed for integration with RefineryCMS.} - s.date = %q{2011-03-28} + s.date = %q{2011-04-03} s.summary = %q{Ruby on Rails blogging engine for RefineryCMS.} s.email = %q{info@refinerycms.com} - s.homepage = %q{http://refinerycms.com} - s.authors = %w(Resolve\ Digital Neoteric\ Design) + s.homepage = %q{http://refinerycms.com/blog} + s.authors = ['Resolve Digital', 'Neoteric Design'] s.require_paths = %w(lib) s.add_dependency 'refinerycms-core', '>= 0.9.9.1' From f38e8750eacf69442f038d1e62c63534d892de19 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Sun, 3 Apr 2011 16:18:26 -0700 Subject: [PATCH 117/494] Made the distinction between branches supporting rails 3.0.x and rails 2.3.x clearer. --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index bce6569..d8a07c5 100644 --- a/readme.md +++ b/readme.md @@ -2,7 +2,7 @@ Simple blog engine for [Refinery CMS](http://refinerycms.com). It supports posts, categories and comments. -Refinery CMS Blog supports Rails 2.3.x using the [Rails 2.3.x stable branch](http://github.com/resolve/refinerycms-blog/tree/rails2-stable). +This version of `refinerycms-blog` supports Rails 3.0.x. To use Rails 2.3.x use the [refinerycms-blog "Rails 2.3.x stable branch"](http://github.com/resolve/refinerycms-blog/tree/rails2-stable). Options: From 688e7002ed763df5d47db92ccfefc88edb900ee4 Mon Sep 17 00:00:00 2001 From: Robin Wenglewski Date: Mon, 4 Apr 2011 19:11:24 +0200 Subject: [PATCH 118/494] fix for issue 58 --- config/routes.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/routes.rb b/config/routes.rb index 421e845..83b9364 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,4 @@ -Refinery::Application.routes.draw do +::Refinery::Application.routes.draw do scope(:path => 'blog', :module => 'blog') do root :to => 'posts#index', :as => 'blog_root' match 'feed.rss', :to => 'posts#index.rss', :as => 'blog_rss_feed' From 57b79b75083993a8bd8452a5d068cd58fbb95993 Mon Sep 17 00:00:00 2001 From: Joe Sak Date: Fri, 22 Apr 2011 13:44:29 -0500 Subject: [PATCH 119/494] bumping to 1.4 released --- changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index e861958..95d837d 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,4 @@ -## 1.4 [UNRELEASED] +## 1.4 [22 April 2011] * Spanish language fixes [scambra](https://github.com/scambra) * Bug fixes [scambra](https://github.com/scambra) From b0d7a687b7dcf2bc70fe83b8b4b191f8861d3c0f Mon Sep 17 00:00:00 2001 From: Joe Sak Date: Fri, 22 Apr 2011 13:48:50 -0500 Subject: [PATCH 120/494] Revert "bumping to 1.4 released" This reverts commit 57b79b75083993a8bd8452a5d068cd58fbb95993. --- changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 95d837d..e861958 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,4 @@ -## 1.4 [22 April 2011] +## 1.4 [UNRELEASED] * Spanish language fixes [scambra](https://github.com/scambra) * Bug fixes [scambra](https://github.com/scambra) From fe3bb08fcf7455bf446734e380e68bfc410886c3 Mon Sep 17 00:00:00 2001 From: Joe Sak Date: Fri, 22 Apr 2011 15:05:55 -0500 Subject: [PATCH 121/494] tests were failing all over the place --- app/models/categorization.rb | 2 - features/support/factories/blog_categories.rb | 1 - spec/models/blog_categories_spec.rb | 24 +++---- spec/models/blog_posts_spec.rb | 72 +++++++++---------- 4 files changed, 44 insertions(+), 55 deletions(-) diff --git a/app/models/categorization.rb b/app/models/categorization.rb index 20821d4..1735ea9 100644 --- a/app/models/categorization.rb +++ b/app/models/categorization.rb @@ -4,6 +4,4 @@ class Categorization < ActiveRecord::Base belongs_to :blog_post belongs_to :blog_category - has_friendly_id :title, :use_slug => true - end \ No newline at end of file diff --git a/features/support/factories/blog_categories.rb b/features/support/factories/blog_categories.rb index eaf025c..b2de802 100644 --- a/features/support/factories/blog_categories.rb +++ b/features/support/factories/blog_categories.rb @@ -1,4 +1,3 @@ Factory.define(:blog_category) do |f| f.sequence(:title) { |n| "Shopping #{n}" } - f.posts {|p| [p.association(:post)]} end diff --git a/spec/models/blog_categories_spec.rb b/spec/models/blog_categories_spec.rb index 53bc345..8ddec46 100644 --- a/spec/models/blog_categories_spec.rb +++ b/spec/models/blog_categories_spec.rb @@ -3,39 +3,39 @@ Dir[File.expand_path('../../../features/support/factories/*.rb', __FILE__)].each describe BlogCategory do before(:each) do - @attr = { :title => "RefineryCMS" } + @blog_category = Factory(:blog_category) end describe "validations" do it "requires title" do - BlogCategory.new(@attr.merge(:title => "")).should_not be_valid + Factory.build(:blog_category, :title => "").should_not be_valid end it "won't allow duplicate titles" do - BlogCategory.create!(@attr) - BlogCategory.new(@attr).should_not be_valid + Factory.build(:blog_category, :title => @blog_category.title).should_not be_valid end end describe "blog posts association" do it "has a posts attribute" do - BlogCategory.new.should respond_to(:posts) + @blog_category.should respond_to(:posts) end it "returns posts by published_at date in descending order" do - @category = BlogCategory.create!(@attr) - @first_post = @category.posts.create!({ :title => "Breaking News: Joe Sak is hot stuff you guys!!", :body => "True story.", :published_at => Time.now.yesterday }) - @latest_post = @category.posts.create!({ :title => "parndt is p. okay", :body => "For a kiwi.", :published_at => Time.now }) - @category.posts.first.should == @latest_post + first_post = @blog_category.posts.create!({ :title => "Breaking News: Joe Sak is hot stuff you guys!!", :body => "True story.", :published_at => Time.now.yesterday }) + latest_post = @blog_category.posts.create!({ :title => "parndt is p. okay", :body => "For a kiwi.", :published_at => Time.now }) + + @blog_category.posts.first.should == latest_post end end describe "#post_count" do it "returns post count in category" do - Factory(:post, :categories => [Factory(:blog_category)]) - Factory(:post, :categories => [Factory(:blog_category)]) - BlogCategory.first.post_count.should == 2 + 2.times do + @blog_category.posts << Factory(:post) + end + @blog_category.post_count.should == 2 end end end diff --git a/spec/models/blog_posts_spec.rb b/spec/models/blog_posts_spec.rb index 1b96ece..66947a9 100644 --- a/spec/models/blog_posts_spec.rb +++ b/spec/models/blog_posts_spec.rb @@ -2,46 +2,38 @@ require 'spec_helper' Dir[File.expand_path('../../../features/support/factories/*.rb', __FILE__)].each{|factory| require factory} describe BlogPost do + before(:each) do + @blog_post = Factory(:post) + end + describe "validations" do - before(:each) do - @attr = { :title => "RefineryCMS", :body => "Some random text ..." } - end - it "requires title" do - BlogPost.new(@attr.merge(:title => "")).should_not be_valid + Factory.build(:post, :title => "").should_not be_valid end it "won't allow duplicate titles" do - BlogPost.create!(@attr) - BlogPost.new(@attr).should_not be_valid + Factory.build(:post, :title => @blog_post.title).should_not be_valid end it "requires body" do - BlogPost.new(@attr.merge(:body => nil)).should_not be_valid + Factory.build(:post, :body => nil).should_not be_valid end end describe "comments association" do - before(:each) do - @blog_post = Factory(:post) - end it "have a comments attribute" do @blog_post.should respond_to(:comments) end it "destroys associated comments" do - Factory(:blog_comment, :blog_post_id => @blog_post) + Factory(:blog_comment, :blog_post_id => @blog_post.id) @blog_post.destroy - BlogComment.find_by_blog_post_id(@blog_post).should be_nil + BlogComment.find_by_blog_post_id(@blog_post.id).should == nil end end describe "categories association" do - before(:each) do - @blog_post = Factory(:post) - end - it "have categories attribute" do @blog_post.should respond_to(:categories) end @@ -49,8 +41,10 @@ describe BlogPost do describe "tags" do it "acts as taggable" do - (post = Factory(:post)).should respond_to(:tag_list) - post.tag_list.should include("chicago") + @blog_post.should respond_to(:tag_list) + + #the factory has default tags, including 'chicago' + @blog_post.tag_list.should include("chicago") end end @@ -62,9 +56,16 @@ describe BlogPost do describe "by_archive scope" do it "returns all posts from specified month" do - blog_post1 = Factory(:post, :published_at => Time.now.advance(:minutes => -2)) - blog_post2 = Factory(:post, :published_at => Time.now.advance(:minutes => -1)) + BlogPost.delete_all + + #this month + blog_post1 = Factory(:post, :published_at => Time.now - 2.days) + blog_post2 = Factory(:post, :published_at => Time.now - 1.day) + + #2 months ago Factory(:post, :published_at => Time.now - 2.months) + + #check for this month date = "#{Time.now.month}/#{Time.now.year}" BlogPost.by_archive(Time.parse(date)).count.should == 2 BlogPost.by_archive(Time.parse(date)).should == [blog_post2, blog_post1] @@ -73,8 +74,10 @@ describe BlogPost do describe "all_previous scope" do it "returns all posts from previous months" do - blog_post1 = Factory(:post, :published_at => Time.now.advance(:months => -2)) - blog_post2 = Factory(:post, :published_at => Time.now.advance(:months => -1)) + BlogPost.delete_all + + blog_post1 = Factory(:post, :published_at => Time.now - 2.months) + blog_post2 = Factory(:post, :published_at => Time.now - 1.month) Factory(:post, :published_at => Time.now) BlogPost.all_previous.count.should == 2 BlogPost.all_previous.should == [blog_post2, blog_post1] @@ -83,6 +86,8 @@ describe BlogPost do describe "live scope" do it "returns all posts which aren't in draft and pub date isn't in future" do + BlogPost.delete_all + blog_post1 = Factory(:post, :published_at => Time.now.advance(:minutes => -2)) blog_post2 = Factory(:post, :published_at => Time.now.advance(:minutes => -1)) Factory(:post, :draft => true) @@ -92,22 +97,6 @@ describe BlogPost do end end - describe "next scope" do - it "returns next article based on given article" do - blog_post1 = Factory(:post, :published_at => Time.now.advance(:minutes => -1)) - blog_post2 = Factory(:post) - BlogPost.next(blog_post1).should == [blog_post2] - end - end - - describe "previous scope" do - it "returns previous article based on given article" do - blog_post1 = Factory(:post, :published_at => Time.now.advance(:minutes => -1)) - blog_post2 = Factory(:post) - BlogPost.previous(blog_post2).should == [blog_post1] - end - end - describe "uncategorized scope" do it "returns uncategorized posts if they exist" do uncategorized_blog_post = Factory(:post) @@ -136,6 +125,8 @@ describe BlogPost do describe "#next" do it "returns next article when called on current article" do + BlogPost.delete_all + Factory(:post, :published_at => Time.now.advance(:minutes => -1)) blog_post = Factory(:post) blog_posts = BlogPost.all @@ -145,6 +136,8 @@ describe BlogPost do describe "#prev" do it "returns previous article when called on current article" do + BlogPost.delete_all + Factory(:post) blog_post = Factory(:post, :published_at => Time.now.advance(:minutes => -1)) blog_posts = BlogPost.all @@ -154,7 +147,6 @@ describe BlogPost do describe "#category_ids=" do before(:each) do - @blog_post = Factory(:post) @cat1 = Factory(:blog_category, :id => 1) @cat2 = Factory(:blog_category, :id => 2) @cat3 = Factory(:blog_category, :id => 3) From 7746f86dbf9bfe3c8cf2eaad88d9d87858e11dbe Mon Sep 17 00:00:00 2001 From: Joe Sak Date: Fri, 22 Apr 2011 15:59:24 -0500 Subject: [PATCH 122/494] have to explicitly require factory girl --- features/support/factories/blog_categories.rb | 2 ++ features/support/factories/blog_comments.rb | 6 ++---- features/support/factories/blog_posts.rb | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/features/support/factories/blog_categories.rb b/features/support/factories/blog_categories.rb index b2de802..2b47a87 100644 --- a/features/support/factories/blog_categories.rb +++ b/features/support/factories/blog_categories.rb @@ -1,3 +1,5 @@ +require 'factory_girl' + Factory.define(:blog_category) do |f| f.sequence(:title) { |n| "Shopping #{n}" } end diff --git a/features/support/factories/blog_comments.rb b/features/support/factories/blog_comments.rb index d5c5b1d..af364be 100644 --- a/features/support/factories/blog_comments.rb +++ b/features/support/factories/blog_comments.rb @@ -1,10 +1,8 @@ -Factory.sequence :email do |n| - "person#{n}@example.com" -end +require 'factory_girl' Factory.define(:blog_comment) do |f| f.name "Joe Commenter" - f.email { Factory.next(:email) } + f.sequence(:email) { |n| "person#{n}@example.com" } f.body "Which one is the best for picking up new shoes?" f.association :post end diff --git a/features/support/factories/blog_posts.rb b/features/support/factories/blog_posts.rb index 3eecf53..33f6b93 100644 --- a/features/support/factories/blog_posts.rb +++ b/features/support/factories/blog_posts.rb @@ -1,3 +1,5 @@ +require 'factory_girl' + Factory.define(:post, :class => BlogPost) do |f| f.sequence(:title) { |n| "Top #{n} Shopping Centers in Chicago" } f.body "These are the top ten shopping centers in Chicago. You're going to read a long blog post about them. Come to peace with it." From 5e69fdac1778ffb9f6a188e9b5cc2e56bd2febf8 Mon Sep 17 00:00:00 2001 From: Joe Sak Date: Fri, 22 Apr 2011 16:13:02 -0500 Subject: [PATCH 123/494] use factory_girl in development --- refinerycms-blog.gemspec | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index cd5af67..346e694 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -9,9 +9,10 @@ Gem::Specification.new do |s| s.authors = ['Resolve Digital', 'Neoteric Design'] s.require_paths = %w(lib) - s.add_dependency 'refinerycms-core', '>= 0.9.9.1' - s.add_dependency 'filters_spam', '~> 0.2' - s.add_dependency 'acts-as-taggable-on' + s.add_dependency 'refinerycms-core', '>= 0.9.9.1' + s.add_dependency 'filters_spam', '~> 0.2' + s.add_dependency 'acts-as-taggable-on' + s.add_development_dependency 'factory_girl' s.files = %w( app From 1f72e3d90a1e8678de4a4b658b6675d2597d857c Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Mon, 25 Apr 2011 13:43:14 +1200 Subject: [PATCH 124/494] Made version code more accessible and fixed up lib/gemspec.rb --- lib/gemspec.rb | 8 ++++++-- lib/refinery/blog/version.rb | 17 +++++++++++++++++ lib/refinerycms-blog.rb | 13 +++++++------ refinerycms-blog.gemspec | 18 ++++++++++++------ 4 files changed, 42 insertions(+), 14 deletions(-) create mode 100644 lib/refinery/blog/version.rb diff --git a/lib/gemspec.rb b/lib/gemspec.rb index d112795..dfd4213 100644 --- a/lib/gemspec.rb +++ b/lib/gemspec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path('../refinerycms-blog.rb', __FILE__) -version = ::Refinery::Blog.version +require File.expand_path('../refinery/blog/version', __FILE__) +version = ::Refinery::Blog::Version.to_s raise "Could not get version so gemspec can not be built" if version.nil? files = Dir.glob("**/*").flatten.reject do |file| file =~ /\.gem(spec)?$/ @@ -18,10 +18,14 @@ Gem::Specification.new do |s| s.authors = ['Resolve Digital', 'Neoteric Design'] s.require_paths = %w(lib) + # Runtime dependencies s.add_dependency 'refinerycms-core', '>= 0.9.9.1' s.add_dependency 'filters_spam', '~> 0.2' s.add_dependency 'acts-as-taggable-on' + # Development dependencies + s.add_development_dependency 'factory_girl' + s.files = %w( #{files.join("\n ")} ) diff --git a/lib/refinery/blog/version.rb b/lib/refinery/blog/version.rb new file mode 100644 index 0000000..6365f94 --- /dev/null +++ b/lib/refinery/blog/version.rb @@ -0,0 +1,17 @@ +module Refinery + module Blog + class Version + @major = 1 + @minor = 4 + @tiny = 0 + + class << self + attr_reader :major, :minor, :tiny + + def to_s + [@major, @minor, @tiny].compact.join('.') + end + end + end + end +end \ No newline at end of file diff --git a/lib/refinerycms-blog.rb b/lib/refinerycms-blog.rb index 60c9bfa..312ee9b 100644 --- a/lib/refinerycms-blog.rb +++ b/lib/refinerycms-blog.rb @@ -3,6 +3,13 @@ require 'filters_spam' module Refinery module Blog + autoload :Version, File.expand_path('../refinery/blog/version', __FILE__) + class << self + def version + ::Refinery::Blog::Version.to_s + end + end + class Engine < Rails::Engine initializer 'blog serves assets' do |app| app.middleware.insert_after ::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public" @@ -35,11 +42,5 @@ module Refinery end end end if defined?(Rails::Engine) - - class << self - def version - %q{1.4} - end - end end end diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index 346e694..6030428 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -1,18 +1,21 @@ Gem::Specification.new do |s| s.name = %q{refinerycms-blog} - s.version = %q{1.4} + s.version = %q{1.4.0} s.description = %q{A really straightforward open source Ruby on Rails blog engine designed for integration with RefineryCMS.} - s.date = %q{2011-04-03} + s.date = %q{2011-04-25} s.summary = %q{Ruby on Rails blogging engine for RefineryCMS.} s.email = %q{info@refinerycms.com} s.homepage = %q{http://refinerycms.com/blog} s.authors = ['Resolve Digital', 'Neoteric Design'] s.require_paths = %w(lib) - s.add_dependency 'refinerycms-core', '>= 0.9.9.1' - s.add_dependency 'filters_spam', '~> 0.2' - s.add_dependency 'acts-as-taggable-on' - s.add_development_dependency 'factory_girl' + # Runtime dependencies + s.add_dependency 'refinerycms-core', '>= 0.9.9.1' + s.add_dependency 'filters_spam', '~> 0.2' + s.add_dependency 'acts-as-taggable-on' + + # Development dependencies + s.add_development_dependency 'factory_girl' s.files = %w( app @@ -127,6 +130,9 @@ Gem::Specification.new do |s| lib/gemspec.rb lib/generators lib/generators/refinerycms_blog_generator.rb + lib/refinery + lib/refinery/blog + lib/refinery/blog/version.rb lib/refinerycms-blog.rb public public/images From 03e105b9e061ca658e0c8f3a3a05378390be4218 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Wed, 27 Apr 2011 22:17:30 -0700 Subject: [PATCH 125/494] Ensure that the seeds don't blow up when either 'User' or 'Page' are not defined. --- db/seeds/refinerycms_blog.rb | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/db/seeds/refinerycms_blog.rb b/db/seeds/refinerycms_blog.rb index 9686c7f..0be2a06 100644 --- a/db/seeds/refinerycms_blog.rb +++ b/db/seeds/refinerycms_blog.rb @@ -1,18 +1,20 @@ -User.find(:all).each do |user| +::User.find(:all).each do |user| if user.plugins.where(:name => 'refinerycms_blog').blank? user.plugins.create(:name => "refinerycms_blog", :position => (user.plugins.maximum(:position) || -1) +1) end -end +end if defined?(::User) -page = Page.create( - :title => "Blog", - :link_url => "/blog", - :deletable => false, - :position => ((Page.maximum(:position, :conditions => {:parent_id => nil}) || -1)+1), - :menu_match => "^/blogs?(\/|\/.+?|)$" -) +if defined?(::Page) + page = ::Page.create( + :title => "Blog", + :link_url => "/blog", + :deletable => false, + :position => ((Page.maximum(:position, :conditions => {:parent_id => nil}) || -1)+1), + :menu_match => "^/blogs?(\/|\/.+?|)$" + ) -Page.default_parts.each do |default_page_part| - page.parts.create(:title => default_page_part, :body => nil) -end + ::Page.default_parts.each do |default_page_part| + page.parts.create(:title => default_page_part, :body => nil) + end +end \ No newline at end of file From 1ae97bb9b1f4199d2b840bed982a9bb71d7c8c91 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Thu, 5 May 2011 23:43:43 +1200 Subject: [PATCH 126/494] Depend on seo_meta and create a migration for it unless it already exists. --- db/migrate/4_create_seo_meta_for_blog.rb | 25 ++++++++++++++++++++++++ lib/gemspec.rb | 1 + refinerycms-blog.gemspec | 3 ++- 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 db/migrate/4_create_seo_meta_for_blog.rb diff --git a/db/migrate/4_create_seo_meta_for_blog.rb b/db/migrate/4_create_seo_meta_for_blog.rb new file mode 100644 index 0000000..baf81a4 --- /dev/null +++ b/db/migrate/4_create_seo_meta_for_blog.rb @@ -0,0 +1,25 @@ +class CreateSeoMetaForBlog < ActiveRecord::Migration + + def self.up + unless ::SeoMetum.table_exists? + create_table ::SeoMetum.table_name do |t| + t.integer :seo_meta_id + t.string :seo_meta_type + + t.string :browser_title + t.string :meta_keywords + t.text :meta_description + + t.timestamps + end + + add_index ::SeoMetum.table_name, :id + add_index ::SeoMetum.table_name, [:seo_meta_id, :seo_meta_type] + end + end + + def self.down + # can't drop the table because someone else might be using it. + end + +end diff --git a/lib/gemspec.rb b/lib/gemspec.rb index dfd4213..5a02ae6 100644 --- a/lib/gemspec.rb +++ b/lib/gemspec.rb @@ -22,6 +22,7 @@ Gem::Specification.new do |s| s.add_dependency 'refinerycms-core', '>= 0.9.9.1' s.add_dependency 'filters_spam', '~> 0.2' s.add_dependency 'acts-as-taggable-on' + s.add_dependency 'seo_meta', '~> 1.0.5' # Development dependencies s.add_development_dependency 'factory_girl' diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index 6030428..f91bc7b 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |s| s.name = %q{refinerycms-blog} s.version = %q{1.4.0} s.description = %q{A really straightforward open source Ruby on Rails blog engine designed for integration with RefineryCMS.} - s.date = %q{2011-04-25} + s.date = %q{2011-05-05} s.summary = %q{Ruby on Rails blogging engine for RefineryCMS.} s.email = %q{info@refinerycms.com} s.homepage = %q{http://refinerycms.com/blog} @@ -13,6 +13,7 @@ Gem::Specification.new do |s| s.add_dependency 'refinerycms-core', '>= 0.9.9.1' s.add_dependency 'filters_spam', '~> 0.2' s.add_dependency 'acts-as-taggable-on' + s.add_dependency 'seo_meta', '~> 1.0.5' # Development dependencies s.add_development_dependency 'factory_girl' From e6af3d9c1af4d7d88e041dc65991ab59e33a9fce Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Thu, 5 May 2011 23:46:28 +1200 Subject: [PATCH 127/494] Add is_seo_meta call to blog posts. --- app/models/blog_post.rb | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/app/models/blog_post.rb b/app/models/blog_post.rb index db85a70..f95f81a 100644 --- a/app/models/blog_post.rb +++ b/app/models/blog_post.rb @@ -1,15 +1,17 @@ require 'acts-as-taggable-on' class BlogPost < ActiveRecord::Base - + + is_seo_meta if self.respond_to?(:is_seo_meta) + default_scope :order => 'published_at DESC' #.first & .last will be reversed -- consider a with_exclusive_scope on these? - + belongs_to :author, :class_name => 'User', :foreign_key => :user_id - + has_many :comments, :class_name => 'BlogComment', :dependent => :destroy acts_as_taggable - + has_many :categorizations has_many :categories, :through => :categorizations, :source => :blog_category @@ -23,7 +25,7 @@ class BlogPost < ActiveRecord::Base scope :by_archive, lambda { |archive_date| where(['published_at between ? and ?', archive_date.beginning_of_month, archive_date.end_of_month]) } - + scope :by_year, lambda { |archive_year| where(['published_at between ? and ?', archive_year.beginning_of_year, archive_year.end_of_year]) } @@ -34,7 +36,7 @@ class BlogPost < ActiveRecord::Base scope :previous, lambda { |i| where(["published_at < ? and draft = ?", i.published_at, false]).limit(1) } # next is now in << self - + def next BlogPost.next(self).first end @@ -59,13 +61,13 @@ class BlogPost < ActiveRecord::Base where(["published_at > ? and draft = ?", current_record.published_at, false]).order("published_at ASC") end end - + def comments_allowed? RefinerySetting.find_or_set(:comments_allowed, true, { :scoping => 'blog' }) end - + def uncategorized BlogPost.live.reject { |p| p.categories.any? } end @@ -74,7 +76,7 @@ class BlogPost < ActiveRecord::Base module ShareThis DEFAULT_KEY = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" - class << self + class << self def key RefinerySetting.find_or_set(:share_this_key, BlogPost::ShareThis::DEFAULT_KEY, { :scoping => 'blog' From 45bbd56a51c6793af576198a2e9137cfcb88f30b Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Fri, 6 May 2011 00:28:14 +1200 Subject: [PATCH 128/494] Added form fields for SEO and translations. --- app/models/blog_post.rb | 3 ++- app/views/admin/blog/posts/_form.html.erb | 24 ++++++++++++++++++++++- config/locales/cs.yml | 7 +++++++ config/locales/de.yml | 7 +++++++ config/locales/en.yml | 7 +++++++ config/locales/es.yml | 7 +++++++ config/locales/fr.yml | 7 +++++++ config/locales/it.yml | 7 +++++++ config/locales/nb.yml | 7 +++++++ config/locales/nl.yml | 7 +++++++ config/locales/pl.yml | 7 +++++++ config/locales/pt-BR.yml | 7 +++++++ config/locales/ru.yml | 7 +++++++ config/locales/sk.yml | 7 +++++++ config/locales/zh-CN.yml | 7 +++++++ 15 files changed, 116 insertions(+), 2 deletions(-) diff --git a/app/models/blog_post.rb b/app/models/blog_post.rb index f95f81a..b738018 100644 --- a/app/models/blog_post.rb +++ b/app/models/blog_post.rb @@ -1,8 +1,9 @@ require 'acts-as-taggable-on' +require 'seo_meta' class BlogPost < ActiveRecord::Base - is_seo_meta if self.respond_to?(:is_seo_meta) + is_seo_meta default_scope :order => 'published_at DESC' #.first & .last will be reversed -- consider a with_exclusive_scope on these? diff --git a/app/views/admin/blog/posts/_form.html.erb b/app/views/admin/blog/posts/_form.html.erb index 3c0a351..9d0e0bd 100644 --- a/app/views/admin/blog/posts/_form.html.erb +++ b/app/views/admin/blog/posts/_form.html.erb @@ -46,10 +46,32 @@ <% end %> -

    <%= t('admin.blog.posts.form.published_at') %>

    +

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

    <%= f.datetime_select :published_at %>
    +

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

    +
    + + <%= f.label :browser_title, t('.seo_override_title') %> + <%= refinery_help_tag t('.seo_override_title_help')%> + + <%= f.text_field :browser_title, :class => 'widest' %> +
    +
    + + <%= f.label :meta_keywords, t('.meta_keywords_title') %> + <%= refinery_help_tag t('.meta_keywords_help') %> + + <%= f.text_field :meta_keywords, :class => 'widest' %> +
    +
    + + <%= f.label :meta_description, t('.meta_description_title') %> + <%= refinery_help_tag t('.meta_description_help') %> + + <%= f.text_area :meta_description, :class => 'widest', :rows => 7 %> +
    <%= render :partial => "/shared/admin/form_actions", diff --git a/config/locales/cs.yml b/config/locales/cs.yml index 8d8d81d..aee745c 100644 --- a/config/locales/cs.yml +++ b/config/locales/cs.yml @@ -38,6 +38,13 @@ cs: toggle_advanced_options: Klikni pro přístup k nastavením meta tagů a menu save_as_draft: Uložit jako koncept published_at: Datum publikování + seo: Optimalizace pro vyhledávače + seo_override_title: Titulek prohlížeče + seo_override_title_help: Vložte titulek délky 5-10 slov, který vystihuje obsah článek. + meta_keywords_title: Klíčová slova + meta_keywords_help: Vložte 5-10 klíčových slov oddělených čárkou, které se vztahují k obsahu článek. + meta_description_title: Popisek + meta_description_help: Vložte 2-3 krátké věty shrnující obsah článek. index: no_items_yet: 'Nejsou žádné články na blogu. Klikni na "%{create}" pro přidání prvního.' uncategorized: diff --git a/config/locales/de.yml b/config/locales/de.yml index 1209b5f..bd47a11 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -38,6 +38,13 @@ de: toggle_advanced_options: 'Klicken, um auf Meta-Tag-Einstellungen und Menüoptionen zuzugreifen' save_as_draft: Als Entwurf speichern published_at: Veröffentlichungsdatum + seo: Suchmaschinenoptimierung + seo_override_title: Browsertitel + seo_override_title_help: Geben Sie einen 5-10 Wörter langen Titel an, den der Inhalt der Seite beschreibt. + meta_keywords_title: Meta-Schlüsselwörter + meta_keywords_help: Geben Sie 5-10 Schlüsselwörter für diese Seite an. Trennen Sie Schlüsselwörter mit einem Komma. + meta_description_title: Meta-Beschreibung + meta_description_help: Beschreiben Sie in knappen zwei oder drei Sätzen, um was es sich bei dieser Seite handelt. index: no_items_yet: 'Es sind noch keine Artikel vorhanden. Klicken Sie auf "%{create}", um Ihren ersten Artikel hinzuzufügen.' uncategorized: diff --git a/config/locales/en.yml b/config/locales/en.yml index f5b5461..4bfc962 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -38,6 +38,13 @@ en: toggle_advanced_options: Click to access meta tag settings and menu options save_as_draft: Save as Draft published_at: Publish Date + seo: Search Engine Optimization + seo_override_title: Browser title + seo_override_title_help: Enter a 5-10 word title that summarizes the contents of this post. + meta_keywords_title: Meta keywords + meta_keywords_help: Enter 5-10 keywords that relate to this post. Separate keywords by a comma. + meta_description_title: Meta description + meta_description_help: Enter a concise two or three sentences describing what this post is about. index: no_items_yet: 'There are no Blog Posts yet. Click "%{create}" to add your first blog post.' uncategorized: diff --git a/config/locales/es.yml b/config/locales/es.yml index bd9c383..4191195 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -38,6 +38,13 @@ es: toggle_advanced_options: Click para acceder a las opciones de menú y etiquetas save_as_draft: Guardar Borrador published_at: Fecha de publicación + seo: Optimización para motores de búsqueda (SEO) + seo_override_title: Título del navegador + seo_override_title_help: Introduce un título de 5-10 palabras que resuma los contenidos de la entrada. + meta_keywords_title: Palabras clave (meta keyboards) + meta_keywords_help: Introduce 5-10 palabras clave relacionadas con esta entrada, separadas por comas. + meta_description_title: Meta-descripción + meta_description_help: Describe en dos o tres frases de qué tema trata esta entrada. index: no_items_yet: 'Aún no hay entradas en el Blog. Haz click en "%{create}" para añadir el primero' uncategorized: diff --git a/config/locales/fr.yml b/config/locales/fr.yml index c71a01f..9817b4f 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -38,6 +38,13 @@ fr: toggle_advanced_options: Cliquez ici pour accéder aux paramêtres des meta-tags et au menu des options save_as_draft: Enregistrer comme Brouillon published_at: Date de publication + seo: Optimisations pour les moteurs de recherche (SEO) + seo_override_title: Titre du navigateur + seo_override_title_help: Entrez entre 5 et 10 mots qui résument votre article. + meta_keywords_title: Mots clefs + meta_keywords_help: Entrez entre 5 et 10 mots clefs en relation avec votre article (Séparer les mots clefs par des virgules). + meta_description_title: Description + meta_description_help: Entrez deux ou trois phrases concises décrivants le sujet de votre article. index: no_items_yet: 'Il n''y a aucun article pour l''instant. Cliquez sur "%{create}" pour ajouter votre premier article.' post: diff --git a/config/locales/it.yml b/config/locales/it.yml index 24023b6..1e4cdcd 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -38,6 +38,13 @@ it: toggle_advanced_options: Clicca per accedere alle impostationi dei meta tag e del menu save_as_draft: Salva come Bozza published_at: Data di Pubblicazione + seo: Ottimizzazione Motori di Ricerca + seo_override_title: Titolo del Browser + seo_override_title_help: È possibile inserire un testo per il titolo della barra del browser che sovrascriverà il valore predefinito + meta_keywords_title: Parole chiave + meta_keywords_help: Inserisci 5-10 parole chiave che riguardano questa messaggio, separate da una virgola. + meta_description_title: Descrizione + meta_description_help: Inserire due o tre frasi concise che descrivono questa messaggio. index: no_items_yet: 'Non ci sono ancora Messaggi per questo Blog. Clicca "%{create}" per aggiungere il tuo primo messaggio.' post: diff --git a/config/locales/nb.yml b/config/locales/nb.yml index 54cb73b..c71bd25 100644 --- a/config/locales/nb.yml +++ b/config/locales/nb.yml @@ -5,6 +5,13 @@ nb: admin: blog: posts: + form: + seo_override_title: Nettleser tittel + seo_override_title_help: Skriv inn en tittel på 5-10 ord som oppsummerer innholdet på siden. + meta_keywords_title: Meta stikkord + meta_keywords_help: Skriv inn 5-10 stikkord som relaterer til denne siden. Separer stikkordene med komma. + meta_description_title: Meta beskrivelse + meta_description_help: Skriv en kort beskrivelse på to eller tre setninger som forteller hva denne siden inneholder. index: no_items_yet: 'Det er ingen Blog Posts enda. Klikk på "Lag en ny Blog Posts" for å legge til din første blog posts.' post: diff --git a/config/locales/nl.yml b/config/locales/nl.yml index 7a48408..f551670 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -38,6 +38,13 @@ nl: toggle_advanced_options: Klik voor toegang tot meta tag instellingen en menu opties save_as_draft: Sla op als concept published_at: Publicatiedatum + seo: Zoekmachine optimalisatie + seo_override_title: Browser titel + seo_override_title_help: Als u de standaard titel van het browservenster wilt wijzigen, kunt u hier een alternatief invullen. + meta_keywords_title: Meta zoekwoorden + meta_keywords_help: Voeg 5 tot 10 meta zoekwoorden toe. Gebruik een komma om de zoekwoorden te scheiden. + meta_description_title: Meta omschrijving + meta_description_help: Voer een compacte (twee a drie zinnen) pagina beschrijving in. index: no_items_yet: 'Er zijn momenteel geen blogposts. Klik op "%{create}" om uw eerste blogpost toe te voegen.' uncategorized: diff --git a/config/locales/pl.yml b/config/locales/pl.yml index 5a9fe9d..7ff9309 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -44,6 +44,13 @@ pl: toggle_advanced_options: 'Kliknij, aby zarządzać meta-ustawieniami' save_as_draft: Zapisz jako szkic published_at: Data publikacji + seo: Optymalizacja dla wyszukiwarek + seo_override_title: Tytuł w przeglądarce + seo_override_title_help: Wpisz 5-10 słów które podsumowują zawartość tej strony. + meta_keywords_title: Słowa kluczowe meta + meta_keywords_help: Wpisz 5-10 słów kluczowych związanych z zawartością tej strony. Rozdziel słowa kluczowe przecinkiem. + meta_description_title: Opis meta + meta_description_help: Podaj dwu-trzyzdaniowy opis tego, o czym jest ta strona. index: no_items_yet: 'Na blogu nie ma jeszcze żadnych wpisów. Kliknij "%{create}" aby dodać pierwszy post.' uncategorized: diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index 706f34c..dff2133 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -38,6 +38,13 @@ pt-BR: toggle_advanced_options: Clique aqui para acessar as configurações de meta tag e menu save_as_draft: Salvar como rascunho published_at: Data de publicação + seo: Otimização de Motor de Busca + seo_override_title: Título para a busca + seo_override_title_help: Digite de 5 a 10 palvras pequenas que resumem o conteúdo desta página. + meta_keywords_title: Palavras-chave + meta_keywords_help: Digite de 5 a 10 palavras-chave presentes nesta página. Separe elas com vírgula. + meta_description_title: Meta descrição + meta_description_help: Digite duas ou três sentenças concisas descrevendo sobre o que é essa página. index: no_items_yet: 'Ainda não há Posts no Blog. Clique em "%{create}" para adicionar o primeiro post.' uncategorized: diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 98b22fc..351bcdb 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -38,6 +38,13 @@ ru: toggle_advanced_options: 'Нажмите, чтобы получить доступ к настройкам мета-тегов и меню' save_as_draft: Сохранить как черновик published_at: Дата публикации + seo: Поисковая оптимизация + seo_override_title: Заголовок браузера + seo_override_title_help: "Введите заголовок из 5–10 слов, которые описывают текст на этой странице." + meta_keywords_title: Ключевые слова + meta_keywords_help: "Введите 5–10 ключевых слов, которые относятся к этой странице, разделяя запятой." + meta_description_title: Описание + meta_description_help: "Введите два-три коротких предложения, описывающих страницу." index: no_items_yet: 'Записи в блоге отстутствуют. Нажмите "%{create}", чтобы добавить первую запись.' post: diff --git a/config/locales/sk.yml b/config/locales/sk.yml index fea514d..3542278 100644 --- a/config/locales/sk.yml +++ b/config/locales/sk.yml @@ -38,6 +38,13 @@ sk: toggle_advanced_options: Klikni pre prístup k nastaveniam meta tagov a menu save_as_draft: Uložiť ako koncept published_at: Dátum publikovania + seo: Optimalizácia pre vyhľadávanie + seo_override_title: Titulok prehliadača + seo_override_title_help: Vložte titulok dĺžky 5-10 slov, ktorý vystihuje obsah stránky. + meta_keywords_title: Kľúčové slová (Meta keywords) + meta_keywords_help: Vložte 5-10 kľúčových slov oddelených čiarkou, ktoré sa vzťahujú k obsahu stránky. + meta_description_title: Popis (Meta description) + meta_description_help: Vložte 2-3 krátke vety sumarizujúce obsah stránky. index: no_items_yet: 'Niesu žiadne články na blogu. Klikni na "%{create}" pre pridanie prvého.' uncategorized: diff --git a/config/locales/zh-CN.yml b/config/locales/zh-CN.yml index a3cafe5..36c8528 100644 --- a/config/locales/zh-CN.yml +++ b/config/locales/zh-CN.yml @@ -38,6 +38,13 @@ zh-CN: toggle_advanced_options: 点击进入标签详解设置和菜单选项 save_as_draft: 保存为草稿 published_at: 发布日期 + seo: 搜索引擎优化 + seo_override_title: 浏览标题 + seo_override_title_help: 输入 5 到 10 个字的标题去概括这个页面的内容. + meta_keywords_title: Meta 关键字 + meta_keywords_help: 输入 5 到 10 个与这个页面有关的关键字. 用逗号分开每个关键字. + meta_description_title: Meta 说明 + meta_description_help: 简洁地输入两三句话来介绍这个页面. index: no_items_yet: '目前尚未发博。 点击 "%{create}" 添加您的第一篇博文。' uncategorized: From 37de337eaf2e75696011f9ef56a2f9a993ec0679 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Fri, 6 May 2011 00:48:22 +1200 Subject: [PATCH 129/494] Present the blog post's meta information now. This will require refinerycms-core 1.0.0 --- app/controllers/blog/posts_controller.rb | 6 +++--- lib/gemspec.rb | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/blog/posts_controller.rb b/app/controllers/blog/posts_controller.rb index 9c413ed..6b59867 100644 --- a/app/controllers/blog/posts_controller.rb +++ b/app/controllers/blog/posts_controller.rb @@ -17,7 +17,7 @@ class Blog::PostsController < BlogController @blog_comment = BlogComment.new respond_with (@blog_post) do |format| - format.html { present(@page) } + format.html { present(@blog_post) } format.js { render :partial => 'post', :layout => false } end end @@ -65,7 +65,7 @@ class Blog::PostsController < BlogController end respond_with (@blog_posts) end - + def tagged @tag_name = params[:tag_name] @blog_posts = BlogPost.tagged_with(@tag_name.titleize).paginate({ @@ -92,7 +92,7 @@ protected :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10) }) end - + def find_tags @tags = BlogPost.tag_counts_on(:tags) end diff --git a/lib/gemspec.rb b/lib/gemspec.rb index 5a02ae6..5b6b2d1 100644 --- a/lib/gemspec.rb +++ b/lib/gemspec.rb @@ -19,7 +19,7 @@ Gem::Specification.new do |s| s.require_paths = %w(lib) # Runtime dependencies - s.add_dependency 'refinerycms-core', '>= 0.9.9.1' + s.add_dependency 'refinerycms-core', '~> 1.0.0' s.add_dependency 'filters_spam', '~> 0.2' s.add_dependency 'acts-as-taggable-on' s.add_dependency 'seo_meta', '~> 1.0.5' From 76708704c8bc3a6a6dcc4a87b2c2e8b6e332be20 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Fri, 6 May 2011 01:21:28 +1200 Subject: [PATCH 130/494] seo_meta 1.0.6 creates & saves more consistently so let's use it. --- lib/gemspec.rb | 2 +- refinerycms-blog.gemspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/gemspec.rb b/lib/gemspec.rb index 5b6b2d1..e347890 100644 --- a/lib/gemspec.rb +++ b/lib/gemspec.rb @@ -22,7 +22,7 @@ Gem::Specification.new do |s| s.add_dependency 'refinerycms-core', '~> 1.0.0' s.add_dependency 'filters_spam', '~> 0.2' s.add_dependency 'acts-as-taggable-on' - s.add_dependency 'seo_meta', '~> 1.0.5' + s.add_dependency 'seo_meta', '~> 1.0.6' # Development dependencies s.add_development_dependency 'factory_girl' diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index f91bc7b..797871b 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -13,7 +13,7 @@ Gem::Specification.new do |s| s.add_dependency 'refinerycms-core', '>= 0.9.9.1' s.add_dependency 'filters_spam', '~> 0.2' s.add_dependency 'acts-as-taggable-on' - s.add_dependency 'seo_meta', '~> 1.0.5' + s.add_dependency 'seo_meta', '~> 1.0.6' # Development dependencies s.add_development_dependency 'factory_girl' From fa9e6dae6d8392cf35ab8aebe98c98ea339da63a Mon Sep 17 00:00:00 2001 From: Marc Remolt Date: Mon, 2 May 2011 19:27:21 +0200 Subject: [PATCH 131/494] Fixes for blog_post specs * spec "returns all posts from specified month" failed on the second day of a month * refactorings and cleanups (while I'm at it) --- spec/models/blog_posts_spec.rb | 136 ++++++++++++++++++--------------- 1 file changed, 74 insertions(+), 62 deletions(-) diff --git a/spec/models/blog_posts_spec.rb b/spec/models/blog_posts_spec.rb index 66947a9..0514473 100644 --- a/spec/models/blog_posts_spec.rb +++ b/spec/models/blog_posts_spec.rb @@ -2,9 +2,7 @@ require 'spec_helper' Dir[File.expand_path('../../../features/support/factories/*.rb', __FILE__)].each{|factory| require factory} describe BlogPost do - before(:each) do - @blog_post = Factory(:post) - end + let(:blog_post ) { Factory :post } describe "validations" do it "requires title" do @@ -12,7 +10,7 @@ describe BlogPost do end it "won't allow duplicate titles" do - Factory.build(:post, :title => @blog_post.title).should_not be_valid + Factory.build(:post, :title => blog_post.title).should_not be_valid end it "requires body" do @@ -23,28 +21,28 @@ describe BlogPost do describe "comments association" do it "have a comments attribute" do - @blog_post.should respond_to(:comments) + blog_post.should respond_to(:comments) end it "destroys associated comments" do - Factory(:blog_comment, :blog_post_id => @blog_post.id) - @blog_post.destroy - BlogComment.find_by_blog_post_id(@blog_post.id).should == nil + Factory(:blog_comment, :blog_post_id => blog_post.id) + blog_post.destroy + BlogComment.find_by_blog_post_id(blog_post.id).should == nil end end describe "categories association" do it "have categories attribute" do - @blog_post.should respond_to(:categories) + blog_post.should respond_to(:categories) end end describe "tags" do it "acts as taggable" do - @blog_post.should respond_to(:tag_list) + blog_post.should respond_to(:tag_list) #the factory has default tags, including 'chicago' - @blog_post.tag_list.should include("chicago") + blog_post.tag_list.should include("chicago") end end @@ -55,57 +53,60 @@ describe BlogPost do end describe "by_archive scope" do + before do + @blog_post1 = Factory(:post, :published_at => Date.new(2011, 3, 11)) + @blog_post2 = Factory(:post, :published_at => Date.new(2011, 3, 12)) + + #2 months before + Factory(:post, :published_at => Date.new(2011, 1, 10)) + end + it "returns all posts from specified month" do - BlogPost.delete_all - - #this month - blog_post1 = Factory(:post, :published_at => Time.now - 2.days) - blog_post2 = Factory(:post, :published_at => Time.now - 1.day) - - #2 months ago - Factory(:post, :published_at => Time.now - 2.months) - #check for this month - date = "#{Time.now.month}/#{Time.now.year}" + date = "03/2011" BlogPost.by_archive(Time.parse(date)).count.should == 2 - BlogPost.by_archive(Time.parse(date)).should == [blog_post2, blog_post1] + BlogPost.by_archive(Time.parse(date)).should == [@blog_post2, @blog_post1] end end describe "all_previous scope" do + before do + @blog_post1 = Factory(:post, :published_at => Time.now - 2.months) + @blog_post2 = Factory(:post, :published_at => Time.now - 1.month) + Factory :post, :published_at => Time.now + end + it "returns all posts from previous months" do - BlogPost.delete_all - - blog_post1 = Factory(:post, :published_at => Time.now - 2.months) - blog_post2 = Factory(:post, :published_at => Time.now - 1.month) - Factory(:post, :published_at => Time.now) BlogPost.all_previous.count.should == 2 - BlogPost.all_previous.should == [blog_post2, blog_post1] + BlogPost.all_previous.should == [@blog_post2, @blog_post1] end end describe "live scope" do - it "returns all posts which aren't in draft and pub date isn't in future" do - BlogPost.delete_all - - blog_post1 = Factory(:post, :published_at => Time.now.advance(:minutes => -2)) - blog_post2 = Factory(:post, :published_at => Time.now.advance(:minutes => -1)) + before do + @blog_post1 = Factory(:post, :published_at => Time.now.advance(:minutes => -2)) + @blog_post2 = Factory(:post, :published_at => Time.now.advance(:minutes => -1)) Factory(:post, :draft => true) Factory(:post, :published_at => Time.now + 1.minute) + end + + it "returns all posts which aren't in draft and pub date isn't in future" do BlogPost.live.count.should == 2 - BlogPost.live.should == [blog_post2, blog_post1] + BlogPost.live.should == [@blog_post2, @blog_post1] end end describe "uncategorized scope" do + before do + @uncategorized_blog_post = Factory(:post) + @categorized_blog_post = Factory(:post) + + @categorized_blog_post.categories << Factory(:blog_category) + end + it "returns uncategorized posts if they exist" do - uncategorized_blog_post = Factory(:post) - categorized_blog_post = Factory(:post) - - categorized_blog_post.categories << Factory(:blog_category) - - BlogPost.uncategorized.should include uncategorized_blog_post - BlogPost.uncategorized.should_not include categorized_blog_post + BlogPost.uncategorized.should include @uncategorized_blog_post + BlogPost.uncategorized.should_not include @categorized_blog_post end end @@ -124,52 +125,63 @@ describe BlogPost do end describe "#next" do - it "returns next article when called on current article" do - BlogPost.delete_all - + before do Factory(:post, :published_at => Time.now.advance(:minutes => -1)) - blog_post = Factory(:post) - blog_posts = BlogPost.all - blog_posts.last.next.should == blog_post + @blog_post = Factory(:post) + end + + it "returns next article when called on current article" do + BlogPost.last.next.should == @blog_post end end describe "#prev" do - it "returns previous article when called on current article" do - BlogPost.delete_all - + before do Factory(:post) - blog_post = Factory(:post, :published_at => Time.now.advance(:minutes => -1)) - blog_posts = BlogPost.all - blog_posts.first.prev.should == blog_post + @blog_post = Factory(:post, :published_at => Time.now.advance(:minutes => -1)) + end + + it "returns previous article when called on current article" do + BlogPost.first.prev.should == @blog_post end end describe "#category_ids=" do - before(:each) do + before do @cat1 = Factory(:blog_category, :id => 1) @cat2 = Factory(:blog_category, :id => 2) @cat3 = Factory(:blog_category, :id => 3) - @blog_post.category_ids = [1,2,"","",3] + blog_post.category_ids = [1,2,"","",3] end it "rejects blank category ids" do - @blog_post.categories.count.should == 3 + blog_post.categories.count.should == 3 end it "returns array of categories based on given ids" do - @blog_post.categories.should == [@cat1, @cat2, @cat3] + blog_post.categories.should == [@cat1, @cat2, @cat3] end end describe ".comments_allowed?" do - it "returns true if comments_allowed setting is set to true" do - BlogPost.comments_allowed?.should be_true + context "with RefinerySetting comments_allowed set to true" do + before do + RefinerySetting.set(:comments_allowed, { :scoping => 'blog', :value => true }) + end + + it "should be true" do + BlogPost.comments_allowed?.should be_true + end end - it "returns false if comments_allowed setting is set to false" do - RefinerySetting.set(:comments_allowed, {:scoping => 'blog', :value => false}) - BlogPost.comments_allowed?.should be_false + context "with RefinerySetting comments_allowed set to true" do + before do + RefinerySetting.set(:comments_allowed, { :scoping => 'blog', :value => false }) + end + + it "should be false" do + BlogPost.comments_allowed?.should be_false + end end end end From fe39fc757aece97ccff6158ecb90c8cb448bb779 Mon Sep 17 00:00:00 2001 From: Marc Remolt Date: Mon, 2 May 2011 19:32:31 +0200 Subject: [PATCH 132/494] Model spec filenames should be singular --- spec/models/{blog_categories_spec.rb => blog_category_spec.rb} | 0 spec/models/{blog_comments_spec.rb => blog_comment_spec.rb} | 0 spec/models/{blog_posts_spec.rb => blog_post_spec.rb} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename spec/models/{blog_categories_spec.rb => blog_category_spec.rb} (100%) rename spec/models/{blog_comments_spec.rb => blog_comment_spec.rb} (100%) rename spec/models/{blog_posts_spec.rb => blog_post_spec.rb} (100%) diff --git a/spec/models/blog_categories_spec.rb b/spec/models/blog_category_spec.rb similarity index 100% rename from spec/models/blog_categories_spec.rb rename to spec/models/blog_category_spec.rb diff --git a/spec/models/blog_comments_spec.rb b/spec/models/blog_comment_spec.rb similarity index 100% rename from spec/models/blog_comments_spec.rb rename to spec/models/blog_comment_spec.rb diff --git a/spec/models/blog_posts_spec.rb b/spec/models/blog_post_spec.rb similarity index 100% rename from spec/models/blog_posts_spec.rb rename to spec/models/blog_post_spec.rb From f91793599476a8dd4ed5baef54dcaa754689fc4b Mon Sep 17 00:00:00 2001 From: Marc Remolt Date: Mon, 2 May 2011 20:09:03 +0200 Subject: [PATCH 133/494] I hate string evals --- lib/refinerycms-blog.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/refinerycms-blog.rb b/lib/refinerycms-blog.rb index 312ee9b..901535d 100644 --- a/lib/refinerycms-blog.rb +++ b/lib/refinerycms-blog.rb @@ -28,17 +28,17 @@ module Refinery # refinery 0.9.8 had a bug that we later found through using this engine. # the bug was that the plugin urls were not :controller => '/admin/whatever' if Refinery.version == '0.9.8' - ::Refinery::Plugin.class_eval %{ + ::Refinery::Plugin.class_eval do alias_method :old_url, :url def url if (plugin_url = self.old_url).is_a?(Hash) and plugin_url[:controller] =~ %r{^admin} - plugin_url[:controller] = "/\#{plugin_url[:controller]}" + plugin_url[:controller] = "/#{plugin_url[:controller]}" end plugin_url end - } + end end end end if defined?(Rails::Engine) From a9a0c5a385c16a0dfb5e36b3f5c0615b85ac28ae Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Mon, 9 May 2011 10:50:19 +1200 Subject: [PATCH 134/494] Tag all blog features with @blog. --- features/authors.feature | 8 ++++---- features/tags.feature | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/features/authors.feature b/features/authors.feature index 1042c9f..0e17e32 100644 --- a/features/authors.feature +++ b/features/authors.feature @@ -1,15 +1,15 @@ -@blog +@blog @blog_authors Feature: Blog Post Authors Blog posts can be assigned authors through the given user model current_user is assumed through admin screens - + Scenario: Saving a blog post in blog_posts#new associates the current_user as the author Given I am a logged in refinery user - + When I am on the new blog post form And I fill in "Title" with "This is my blog post" And I fill in "Body" with "And I love it" And I press "Save" - + Then there should be 1 blog post And the blog post should belong to me \ No newline at end of file diff --git a/features/tags.feature b/features/tags.feature index 07c73cd..05d6028 100644 --- a/features/tags.feature +++ b/features/tags.feature @@ -1,4 +1,4 @@ -@blog_tags +@blog @blog_tags Feature: Blog Post Tags Blog posts can be assigned tags From 55e0382220a5cfb91a2d61ad21e4d7aa4661fc02 Mon Sep 17 00:00:00 2001 From: Joe Sak Date: Tue, 10 May 2011 15:22:50 -0700 Subject: [PATCH 135/494] Edited refinerycms-blog.gemspec via GitHub --- refinerycms-blog.gemspec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index 797871b..8070b15 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -164,9 +164,9 @@ Gem::Specification.new do |s| readme.md spec spec/models - spec/models/blog_categories_spec.rb - spec/models/blog_comments_spec.rb - spec/models/blog_posts_spec.rb + spec/models/blog_category_spec.rb + spec/models/blog_comment_spec.rb + spec/models/blog_post_spec.rb ) end From 887251e53c048d1e45c5b3367650ca63e123eab9 Mon Sep 17 00:00:00 2001 From: Joe Sak Date: Tue, 10 May 2011 15:38:30 -0700 Subject: [PATCH 136/494] Edited lib/generators/refinerycms_blog_generator.rb via GitHub --- lib/generators/refinerycms_blog_generator.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/generators/refinerycms_blog_generator.rb b/lib/generators/refinerycms_blog_generator.rb index 6fca607..8c3ca25 100644 --- a/lib/generators/refinerycms_blog_generator.rb +++ b/lib/generators/refinerycms_blog_generator.rb @@ -1,6 +1,4 @@ -require 'refinery/generators' - -class RefinerycmsBlogGenerator < ::Refinery::Generators::EngineInstaller +class RefinerycmsBlog < Refinery::Generators::EngineInstaller source_root File.expand_path('../../../', __FILE__) engine_name "refinerycms-blog" From 18f0f69810c5f72d04c8c106d39c24b6aac0d2ed Mon Sep 17 00:00:00 2001 From: Joe Sak Date: Tue, 10 May 2011 15:46:36 -0700 Subject: [PATCH 137/494] Edited app/models/blog_post.rb via GitHub --- app/models/blog_post.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/blog_post.rb b/app/models/blog_post.rb index b738018..63c66ba 100644 --- a/app/models/blog_post.rb +++ b/app/models/blog_post.rb @@ -3,7 +3,7 @@ require 'seo_meta' class BlogPost < ActiveRecord::Base - is_seo_meta + is_seo_meta if self.table_exists? default_scope :order => 'published_at DESC' #.first & .last will be reversed -- consider a with_exclusive_scope on these? From 4cb096d2563016d73afdf4ed9c6fc54e79822dd7 Mon Sep 17 00:00:00 2001 From: Joe Sak Date: Tue, 10 May 2011 15:48:52 -0700 Subject: [PATCH 138/494] Edited lib/generators/refinerycms_blog_generator.rb via GitHub --- lib/generators/refinerycms_blog_generator.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/generators/refinerycms_blog_generator.rb b/lib/generators/refinerycms_blog_generator.rb index 8c3ca25..6fca607 100644 --- a/lib/generators/refinerycms_blog_generator.rb +++ b/lib/generators/refinerycms_blog_generator.rb @@ -1,4 +1,6 @@ -class RefinerycmsBlog < Refinery::Generators::EngineInstaller +require 'refinery/generators' + +class RefinerycmsBlogGenerator < ::Refinery::Generators::EngineInstaller source_root File.expand_path('../../../', __FILE__) engine_name "refinerycms-blog" From 2d37cbf479ce809fa11760d65b48ace8de64591b Mon Sep 17 00:00:00 2001 From: Marek Date: Thu, 19 May 2011 01:11:45 +0200 Subject: [PATCH 139/494] Approximate ascii on blog slugs. For: GH-60 --- app/models/blog_category.rb | 5 ++++- app/models/blog_post.rb | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/models/blog_category.rb b/app/models/blog_category.rb index bc0165a..d813655 100644 --- a/app/models/blog_category.rb +++ b/app/models/blog_category.rb @@ -7,7 +7,10 @@ class BlogCategory < ActiveRecord::Base validates :title, :presence => true, :uniqueness => true - has_friendly_id :title, :use_slug => true + has_friendly_id :title, :use_slug => true, + :default_locale => (::Refinery::I18n.default_frontend_locale rescue :en), + :approximate_ascii => RefinerySetting.find_or_set(:approximate_ascii, true, :scoping => 'blog'), + :strip_non_ascii => RefinerySetting.find_or_set(:strip_non_ascii, true, :scoping => 'blog') def post_count posts.select(&:live?).count diff --git a/app/models/blog_post.rb b/app/models/blog_post.rb index 63c66ba..224070d 100644 --- a/app/models/blog_post.rb +++ b/app/models/blog_post.rb @@ -21,7 +21,10 @@ class BlogPost < ActiveRecord::Base validates :title, :presence => true, :uniqueness => true validates :body, :presence => true - has_friendly_id :title, :use_slug => true + has_friendly_id :title, :use_slug => true, + :default_locale => (::Refinery::I18n.default_frontend_locale rescue :en), + :approximate_ascii => RefinerySetting.find_or_set(:approximate_ascii, true, :scoping => 'blog'), + :strip_non_ascii => RefinerySetting.find_or_set(:strip_non_ascii, true, :scoping => 'blog') scope :by_archive, lambda { |archive_date| where(['published_at between ? and ?', archive_date.beginning_of_month, archive_date.end_of_month]) From 5c58ba20b052dd19efb30aff500dd3158496ca14 Mon Sep 17 00:00:00 2001 From: Marek Date: Thu, 19 May 2011 11:56:46 +0200 Subject: [PATCH 140/494] For backwards compatibility must be approximate_ascii and strip_non_ascii by default false --- app/models/blog_category.rb | 4 ++-- app/models/blog_post.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/blog_category.rb b/app/models/blog_category.rb index d813655..263982c 100644 --- a/app/models/blog_category.rb +++ b/app/models/blog_category.rb @@ -9,8 +9,8 @@ class BlogCategory < ActiveRecord::Base has_friendly_id :title, :use_slug => true, :default_locale => (::Refinery::I18n.default_frontend_locale rescue :en), - :approximate_ascii => RefinerySetting.find_or_set(:approximate_ascii, true, :scoping => 'blog'), - :strip_non_ascii => RefinerySetting.find_or_set(:strip_non_ascii, true, :scoping => 'blog') + :approximate_ascii => RefinerySetting.find_or_set(:approximate_ascii, false, :scoping => 'blog'), + :strip_non_ascii => RefinerySetting.find_or_set(:strip_non_ascii, false, :scoping => 'blog') def post_count posts.select(&:live?).count diff --git a/app/models/blog_post.rb b/app/models/blog_post.rb index 224070d..d287c6f 100644 --- a/app/models/blog_post.rb +++ b/app/models/blog_post.rb @@ -23,8 +23,8 @@ class BlogPost < ActiveRecord::Base has_friendly_id :title, :use_slug => true, :default_locale => (::Refinery::I18n.default_frontend_locale rescue :en), - :approximate_ascii => RefinerySetting.find_or_set(:approximate_ascii, true, :scoping => 'blog'), - :strip_non_ascii => RefinerySetting.find_or_set(:strip_non_ascii, true, :scoping => 'blog') + :approximate_ascii => RefinerySetting.find_or_set(:approximate_ascii, false, :scoping => 'blog'), + :strip_non_ascii => RefinerySetting.find_or_set(:strip_non_ascii, false, :scoping => 'blog') scope :by_archive, lambda { |archive_date| where(['published_at between ? and ?', archive_date.beginning_of_month, archive_date.end_of_month]) From 083c6d21a7ffd84994548938e4860a0cf6f36def Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Sun, 22 May 2011 18:28:11 +1200 Subject: [PATCH 141/494] Target RefineryCMS ~> 1.0.0. --- lib/gemspec.rb | 6 +++--- refinerycms-blog.gemspec | 9 +++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/gemspec.rb b/lib/gemspec.rb index e347890..c343d2c 100644 --- a/lib/gemspec.rb +++ b/lib/gemspec.rb @@ -19,10 +19,10 @@ Gem::Specification.new do |s| s.require_paths = %w(lib) # Runtime dependencies - s.add_dependency 'refinerycms-core', '~> 1.0.0' - s.add_dependency 'filters_spam', '~> 0.2' + s.add_dependency 'refinerycms-core', '~> 1.0.0' + s.add_dependency 'filters_spam', '~> 0.2' s.add_dependency 'acts-as-taggable-on' - s.add_dependency 'seo_meta', '~> 1.0.6' + s.add_dependency 'seo_meta', '~> 1.1' # Development dependencies s.add_development_dependency 'factory_girl' diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index 8070b15..2dd018b 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |s| s.name = %q{refinerycms-blog} s.version = %q{1.4.0} s.description = %q{A really straightforward open source Ruby on Rails blog engine designed for integration with RefineryCMS.} - s.date = %q{2011-05-05} + s.date = %q{2011-05-22} s.summary = %q{Ruby on Rails blogging engine for RefineryCMS.} s.email = %q{info@refinerycms.com} s.homepage = %q{http://refinerycms.com/blog} @@ -10,10 +10,10 @@ Gem::Specification.new do |s| s.require_paths = %w(lib) # Runtime dependencies - s.add_dependency 'refinerycms-core', '>= 0.9.9.1' - s.add_dependency 'filters_spam', '~> 0.2' + s.add_dependency 'refinerycms-core', '~> 1.0.0' + s.add_dependency 'filters_spam', '~> 0.2' s.add_dependency 'acts-as-taggable-on' - s.add_dependency 'seo_meta', '~> 1.0.6' + s.add_dependency 'seo_meta', '~> 1.1' # Development dependencies s.add_development_dependency 'factory_girl' @@ -113,6 +113,7 @@ Gem::Specification.new do |s| db/migrate/1_create_blog_structure.rb db/migrate/2_add_user_id_to_blog_posts.rb db/migrate/3_acts_as_taggable_on_migration.rb + db/migrate/4_create_seo_meta_for_blog.rb db/seeds db/seeds/refinerycms_blog.rb features From e7a9a0a7bbbe76b2bdfb1cfc8a2fef2f2b6d4e58 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Thu, 26 May 2011 14:06:33 +1200 Subject: [PATCH 142/494] Decrement the required RefineryCMS version back down to 0.9.9.22 so that we can release 1.4.0. --- app/views/admin/blog/posts/_form.html.erb | 23 +---------------------- changelog.md | 3 ++- config/locales/cs.yml | 7 ------- config/locales/de.yml | 7 ------- config/locales/en.yml | 7 ------- config/locales/es.yml | 7 ------- config/locales/fr.yml | 7 ------- config/locales/it.yml | 7 ------- config/locales/nl.yml | 7 ------- config/locales/pl.yml | 7 ------- config/locales/pt-BR.yml | 7 ------- config/locales/ru.yml | 7 ------- config/locales/sk.yml | 7 ------- config/locales/zh-CN.yml | 7 ------- lib/gemspec.rb | 4 ++-- refinerycms-blog.gemspec | 6 +++--- 16 files changed, 8 insertions(+), 112 deletions(-) diff --git a/app/views/admin/blog/posts/_form.html.erb b/app/views/admin/blog/posts/_form.html.erb index 9d0e0bd..7bcca84 100644 --- a/app/views/admin/blog/posts/_form.html.erb +++ b/app/views/admin/blog/posts/_form.html.erb @@ -50,28 +50,7 @@ <%= f.datetime_select :published_at %>
    -

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

    -
    - - <%= f.label :browser_title, t('.seo_override_title') %> - <%= refinery_help_tag t('.seo_override_title_help')%> - - <%= f.text_field :browser_title, :class => 'widest' %> -
    -
    - - <%= f.label :meta_keywords, t('.meta_keywords_title') %> - <%= refinery_help_tag t('.meta_keywords_help') %> - - <%= f.text_field :meta_keywords, :class => 'widest' %> -
    -
    - - <%= f.label :meta_description, t('.meta_description_title') %> - <%= refinery_help_tag t('.meta_description_help') %> - - <%= f.text_area :meta_description, :class => 'widest', :rows => 7 %> -
    + <%= render :partial => '/seo_meta/form', :locals => {:form => f} %>
    <%= render :partial => "/shared/admin/form_actions", diff --git a/changelog.md b/changelog.md index e861958..8094a91 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,4 @@ -## 1.4 [UNRELEASED] +## 1.4 [26 May 2011] * Spanish language fixes [scambra](https://github.com/scambra) * Bug fixes [scambra](https://github.com/scambra) @@ -6,6 +6,7 @@ * Tagged posts route / view [joemsak](https://github.com/joemsak) * Tag cloud in sidebar * Czech & slovak translations [karem](https://github.com/keram) +* SEO fields and migration [parndt](https://github.com/parndt) [ugisozols](https://github.com/ugisozols) * [See full list](https://github.com/resolve/refinerycms-blog/compare/1.3...1.4) ## 1.3 [03 March 2011] diff --git a/config/locales/cs.yml b/config/locales/cs.yml index aee745c..8d8d81d 100644 --- a/config/locales/cs.yml +++ b/config/locales/cs.yml @@ -38,13 +38,6 @@ cs: toggle_advanced_options: Klikni pro přístup k nastavením meta tagů a menu save_as_draft: Uložit jako koncept published_at: Datum publikování - seo: Optimalizace pro vyhledávače - seo_override_title: Titulek prohlížeče - seo_override_title_help: Vložte titulek délky 5-10 slov, který vystihuje obsah článek. - meta_keywords_title: Klíčová slova - meta_keywords_help: Vložte 5-10 klíčových slov oddělených čárkou, které se vztahují k obsahu článek. - meta_description_title: Popisek - meta_description_help: Vložte 2-3 krátké věty shrnující obsah článek. index: no_items_yet: 'Nejsou žádné články na blogu. Klikni na "%{create}" pro přidání prvního.' uncategorized: diff --git a/config/locales/de.yml b/config/locales/de.yml index bd47a11..1209b5f 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -38,13 +38,6 @@ de: toggle_advanced_options: 'Klicken, um auf Meta-Tag-Einstellungen und Menüoptionen zuzugreifen' save_as_draft: Als Entwurf speichern published_at: Veröffentlichungsdatum - seo: Suchmaschinenoptimierung - seo_override_title: Browsertitel - seo_override_title_help: Geben Sie einen 5-10 Wörter langen Titel an, den der Inhalt der Seite beschreibt. - meta_keywords_title: Meta-Schlüsselwörter - meta_keywords_help: Geben Sie 5-10 Schlüsselwörter für diese Seite an. Trennen Sie Schlüsselwörter mit einem Komma. - meta_description_title: Meta-Beschreibung - meta_description_help: Beschreiben Sie in knappen zwei oder drei Sätzen, um was es sich bei dieser Seite handelt. index: no_items_yet: 'Es sind noch keine Artikel vorhanden. Klicken Sie auf "%{create}", um Ihren ersten Artikel hinzuzufügen.' uncategorized: diff --git a/config/locales/en.yml b/config/locales/en.yml index 4bfc962..f5b5461 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -38,13 +38,6 @@ en: toggle_advanced_options: Click to access meta tag settings and menu options save_as_draft: Save as Draft published_at: Publish Date - seo: Search Engine Optimization - seo_override_title: Browser title - seo_override_title_help: Enter a 5-10 word title that summarizes the contents of this post. - meta_keywords_title: Meta keywords - meta_keywords_help: Enter 5-10 keywords that relate to this post. Separate keywords by a comma. - meta_description_title: Meta description - meta_description_help: Enter a concise two or three sentences describing what this post is about. index: no_items_yet: 'There are no Blog Posts yet. Click "%{create}" to add your first blog post.' uncategorized: diff --git a/config/locales/es.yml b/config/locales/es.yml index 4191195..bd9c383 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -38,13 +38,6 @@ es: toggle_advanced_options: Click para acceder a las opciones de menú y etiquetas save_as_draft: Guardar Borrador published_at: Fecha de publicación - seo: Optimización para motores de búsqueda (SEO) - seo_override_title: Título del navegador - seo_override_title_help: Introduce un título de 5-10 palabras que resuma los contenidos de la entrada. - meta_keywords_title: Palabras clave (meta keyboards) - meta_keywords_help: Introduce 5-10 palabras clave relacionadas con esta entrada, separadas por comas. - meta_description_title: Meta-descripción - meta_description_help: Describe en dos o tres frases de qué tema trata esta entrada. index: no_items_yet: 'Aún no hay entradas en el Blog. Haz click en "%{create}" para añadir el primero' uncategorized: diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 9817b4f..c71a01f 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -38,13 +38,6 @@ fr: toggle_advanced_options: Cliquez ici pour accéder aux paramêtres des meta-tags et au menu des options save_as_draft: Enregistrer comme Brouillon published_at: Date de publication - seo: Optimisations pour les moteurs de recherche (SEO) - seo_override_title: Titre du navigateur - seo_override_title_help: Entrez entre 5 et 10 mots qui résument votre article. - meta_keywords_title: Mots clefs - meta_keywords_help: Entrez entre 5 et 10 mots clefs en relation avec votre article (Séparer les mots clefs par des virgules). - meta_description_title: Description - meta_description_help: Entrez deux ou trois phrases concises décrivants le sujet de votre article. index: no_items_yet: 'Il n''y a aucun article pour l''instant. Cliquez sur "%{create}" pour ajouter votre premier article.' post: diff --git a/config/locales/it.yml b/config/locales/it.yml index 1e4cdcd..24023b6 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -38,13 +38,6 @@ it: toggle_advanced_options: Clicca per accedere alle impostationi dei meta tag e del menu save_as_draft: Salva come Bozza published_at: Data di Pubblicazione - seo: Ottimizzazione Motori di Ricerca - seo_override_title: Titolo del Browser - seo_override_title_help: È possibile inserire un testo per il titolo della barra del browser che sovrascriverà il valore predefinito - meta_keywords_title: Parole chiave - meta_keywords_help: Inserisci 5-10 parole chiave che riguardano questa messaggio, separate da una virgola. - meta_description_title: Descrizione - meta_description_help: Inserire due o tre frasi concise che descrivono questa messaggio. index: no_items_yet: 'Non ci sono ancora Messaggi per questo Blog. Clicca "%{create}" per aggiungere il tuo primo messaggio.' post: diff --git a/config/locales/nl.yml b/config/locales/nl.yml index f551670..7a48408 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -38,13 +38,6 @@ nl: toggle_advanced_options: Klik voor toegang tot meta tag instellingen en menu opties save_as_draft: Sla op als concept published_at: Publicatiedatum - seo: Zoekmachine optimalisatie - seo_override_title: Browser titel - seo_override_title_help: Als u de standaard titel van het browservenster wilt wijzigen, kunt u hier een alternatief invullen. - meta_keywords_title: Meta zoekwoorden - meta_keywords_help: Voeg 5 tot 10 meta zoekwoorden toe. Gebruik een komma om de zoekwoorden te scheiden. - meta_description_title: Meta omschrijving - meta_description_help: Voer een compacte (twee a drie zinnen) pagina beschrijving in. index: no_items_yet: 'Er zijn momenteel geen blogposts. Klik op "%{create}" om uw eerste blogpost toe te voegen.' uncategorized: diff --git a/config/locales/pl.yml b/config/locales/pl.yml index 7ff9309..5a9fe9d 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -44,13 +44,6 @@ pl: toggle_advanced_options: 'Kliknij, aby zarządzać meta-ustawieniami' save_as_draft: Zapisz jako szkic published_at: Data publikacji - seo: Optymalizacja dla wyszukiwarek - seo_override_title: Tytuł w przeglądarce - seo_override_title_help: Wpisz 5-10 słów które podsumowują zawartość tej strony. - meta_keywords_title: Słowa kluczowe meta - meta_keywords_help: Wpisz 5-10 słów kluczowych związanych z zawartością tej strony. Rozdziel słowa kluczowe przecinkiem. - meta_description_title: Opis meta - meta_description_help: Podaj dwu-trzyzdaniowy opis tego, o czym jest ta strona. index: no_items_yet: 'Na blogu nie ma jeszcze żadnych wpisów. Kliknij "%{create}" aby dodać pierwszy post.' uncategorized: diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index dff2133..706f34c 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -38,13 +38,6 @@ pt-BR: toggle_advanced_options: Clique aqui para acessar as configurações de meta tag e menu save_as_draft: Salvar como rascunho published_at: Data de publicação - seo: Otimização de Motor de Busca - seo_override_title: Título para a busca - seo_override_title_help: Digite de 5 a 10 palvras pequenas que resumem o conteúdo desta página. - meta_keywords_title: Palavras-chave - meta_keywords_help: Digite de 5 a 10 palavras-chave presentes nesta página. Separe elas com vírgula. - meta_description_title: Meta descrição - meta_description_help: Digite duas ou três sentenças concisas descrevendo sobre o que é essa página. index: no_items_yet: 'Ainda não há Posts no Blog. Clique em "%{create}" para adicionar o primeiro post.' uncategorized: diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 351bcdb..98b22fc 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -38,13 +38,6 @@ ru: toggle_advanced_options: 'Нажмите, чтобы получить доступ к настройкам мета-тегов и меню' save_as_draft: Сохранить как черновик published_at: Дата публикации - seo: Поисковая оптимизация - seo_override_title: Заголовок браузера - seo_override_title_help: "Введите заголовок из 5–10 слов, которые описывают текст на этой странице." - meta_keywords_title: Ключевые слова - meta_keywords_help: "Введите 5–10 ключевых слов, которые относятся к этой странице, разделяя запятой." - meta_description_title: Описание - meta_description_help: "Введите два-три коротких предложения, описывающих страницу." index: no_items_yet: 'Записи в блоге отстутствуют. Нажмите "%{create}", чтобы добавить первую запись.' post: diff --git a/config/locales/sk.yml b/config/locales/sk.yml index 3542278..fea514d 100644 --- a/config/locales/sk.yml +++ b/config/locales/sk.yml @@ -38,13 +38,6 @@ sk: toggle_advanced_options: Klikni pre prístup k nastaveniam meta tagov a menu save_as_draft: Uložiť ako koncept published_at: Dátum publikovania - seo: Optimalizácia pre vyhľadávanie - seo_override_title: Titulok prehliadača - seo_override_title_help: Vložte titulok dĺžky 5-10 slov, ktorý vystihuje obsah stránky. - meta_keywords_title: Kľúčové slová (Meta keywords) - meta_keywords_help: Vložte 5-10 kľúčových slov oddelených čiarkou, ktoré sa vzťahujú k obsahu stránky. - meta_description_title: Popis (Meta description) - meta_description_help: Vložte 2-3 krátke vety sumarizujúce obsah stránky. index: no_items_yet: 'Niesu žiadne články na blogu. Klikni na "%{create}" pre pridanie prvého.' uncategorized: diff --git a/config/locales/zh-CN.yml b/config/locales/zh-CN.yml index 36c8528..a3cafe5 100644 --- a/config/locales/zh-CN.yml +++ b/config/locales/zh-CN.yml @@ -38,13 +38,6 @@ zh-CN: toggle_advanced_options: 点击进入标签详解设置和菜单选项 save_as_draft: 保存为草稿 published_at: 发布日期 - seo: 搜索引擎优化 - seo_override_title: 浏览标题 - seo_override_title_help: 输入 5 到 10 个字的标题去概括这个页面的内容. - meta_keywords_title: Meta 关键字 - meta_keywords_help: 输入 5 到 10 个与这个页面有关的关键字. 用逗号分开每个关键字. - meta_description_title: Meta 说明 - meta_description_help: 简洁地输入两三句话来介绍这个页面. index: no_items_yet: '目前尚未发博。 点击 "%{create}" 添加您的第一篇博文。' uncategorized: diff --git a/lib/gemspec.rb b/lib/gemspec.rb index c343d2c..8cbbb76 100644 --- a/lib/gemspec.rb +++ b/lib/gemspec.rb @@ -19,10 +19,10 @@ Gem::Specification.new do |s| s.require_paths = %w(lib) # Runtime dependencies - s.add_dependency 'refinerycms-core', '~> 1.0.0' + s.add_dependency 'refinerycms-core', '~> 0.9.9.22' s.add_dependency 'filters_spam', '~> 0.2' s.add_dependency 'acts-as-taggable-on' - s.add_dependency 'seo_meta', '~> 1.1' + s.add_dependency 'seo_meta', '~> 1.1.0' # Development dependencies s.add_development_dependency 'factory_girl' diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index 2dd018b..87c7678 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |s| s.name = %q{refinerycms-blog} s.version = %q{1.4.0} s.description = %q{A really straightforward open source Ruby on Rails blog engine designed for integration with RefineryCMS.} - s.date = %q{2011-05-22} + s.date = %q{2011-05-26} s.summary = %q{Ruby on Rails blogging engine for RefineryCMS.} s.email = %q{info@refinerycms.com} s.homepage = %q{http://refinerycms.com/blog} @@ -10,10 +10,10 @@ Gem::Specification.new do |s| s.require_paths = %w(lib) # Runtime dependencies - s.add_dependency 'refinerycms-core', '~> 1.0.0' + s.add_dependency 'refinerycms-core', '~> 0.9.9.22' s.add_dependency 'filters_spam', '~> 0.2' s.add_dependency 'acts-as-taggable-on' - s.add_dependency 'seo_meta', '~> 1.1' + s.add_dependency 'seo_meta', '~> 1.1.0' # Development dependencies s.add_development_dependency 'factory_girl' From f88cd445a16c019629979ecc78f098a5aaf601f5 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Thu, 26 May 2011 14:15:22 +1200 Subject: [PATCH 143/494] Allow plugin to work on Refinery CMS ~> 1.0.0 again, rebranded as 1.5.0 --- lib/gemspec.rb | 2 +- lib/refinery/blog/version.rb | 2 +- refinerycms-blog.gemspec | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/gemspec.rb b/lib/gemspec.rb index 8cbbb76..25f9157 100644 --- a/lib/gemspec.rb +++ b/lib/gemspec.rb @@ -19,7 +19,7 @@ Gem::Specification.new do |s| s.require_paths = %w(lib) # Runtime dependencies - s.add_dependency 'refinerycms-core', '~> 0.9.9.22' + s.add_dependency 'refinerycms-core', '~> 1.0.0' s.add_dependency 'filters_spam', '~> 0.2' s.add_dependency 'acts-as-taggable-on' s.add_dependency 'seo_meta', '~> 1.1.0' diff --git a/lib/refinery/blog/version.rb b/lib/refinery/blog/version.rb index 6365f94..fc2d268 100644 --- a/lib/refinery/blog/version.rb +++ b/lib/refinery/blog/version.rb @@ -2,7 +2,7 @@ module Refinery module Blog class Version @major = 1 - @minor = 4 + @minor = 5 @tiny = 0 class << self diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index 87c7678..01e00d4 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = %q{refinerycms-blog} - s.version = %q{1.4.0} + s.version = %q{1.5.0} s.description = %q{A really straightforward open source Ruby on Rails blog engine designed for integration with RefineryCMS.} s.date = %q{2011-05-26} s.summary = %q{Ruby on Rails blogging engine for RefineryCMS.} @@ -10,7 +10,7 @@ Gem::Specification.new do |s| s.require_paths = %w(lib) # Runtime dependencies - s.add_dependency 'refinerycms-core', '~> 0.9.9.22' + s.add_dependency 'refinerycms-core', '~> 1.0.0' s.add_dependency 'filters_spam', '~> 0.2' s.add_dependency 'acts-as-taggable-on' s.add_dependency 'seo_meta', '~> 1.1.0' From 92e128d2fbd049c62389598a6c97e6ffd400e2e9 Mon Sep 17 00:00:00 2001 From: David Jones Date: Fri, 27 May 2011 21:51:34 +1200 Subject: [PATCH 144/494] don't need p tags here because simple_format already renders those for us --- app/views/blog/posts/_comment.html.erb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/views/blog/posts/_comment.html.erb b/app/views/blog/posts/_comment.html.erb index 71eab30..ba4a508 100644 --- a/app/views/blog/posts/_comment.html.erb +++ b/app/views/blog/posts/_comment.html.erb @@ -1,7 +1,5 @@
    -

    - <%= simple_format auto_link(comment.message.to_s) %> -

    + <%= simple_format auto_link(comment.message.to_s) %>

    <%= t('blog.posts.comments.by', :who => comment.name) %>, From ff795b2ab0040b5846960aeed238d9cd749cdad0 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Fri, 27 May 2011 23:41:50 +1200 Subject: [PATCH 145/494] Added avatar to blog comments based on email address associated with a gravatar. --- app/models/blog_comment.rb | 7 +++++++ app/views/blog/posts/_comment.html.erb | 1 + 2 files changed, 8 insertions(+) diff --git a/app/models/blog_comment.rb b/app/models/blog_comment.rb index 13aceb1..f461cdb 100644 --- a/app/models/blog_comment.rb +++ b/app/models/blog_comment.rb @@ -19,6 +19,13 @@ class BlogComment < ActiveRecord::Base scope :approved, :conditions => {:state => 'approved'} scope :rejected, :conditions => {:state => 'rejected'} + def avatar_url(options = {}) + options = {:size => 60} + require 'digest/md5' + options[:size] = "?s=#{size}" if options[:size] + "http://gravatar.com/avatar/#{Digest::MD5.hexdigest(self.email.to_s.strip.downcase)}#{size}.jpg" + end + def approve! self.update_attribute(:state, 'approved') end diff --git a/app/views/blog/posts/_comment.html.erb b/app/views/blog/posts/_comment.html.erb index ba4a508..17b2002 100644 --- a/app/views/blog/posts/_comment.html.erb +++ b/app/views/blog/posts/_comment.html.erb @@ -1,4 +1,5 @@

    + <%= image_tag comment.avatar_url, :alt => comment.name, :class => 'avatar' %> <%= simple_format auto_link(comment.message.to_s) %>

    From 5cc058dfe13c9a2920423d22f2a21040da893933 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Fri, 27 May 2011 23:43:14 +1200 Subject: [PATCH 146/494] Documented changes in this very small 1.5.0 release. --- changelog.md | 5 +++++ refinerycms-blog.gemspec | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 8094a91..1851d2d 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,8 @@ +## 1.5 [28 May 2011] + +* Added Gravatar support. [parndt](https://github.com/parndt) +* Added support for Refinery CMS 1.0.0 and above. [parndt](https://github.com/parndt) + ## 1.4 [26 May 2011] * Spanish language fixes [scambra](https://github.com/scambra) diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index 01e00d4..b541113 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |s| s.name = %q{refinerycms-blog} s.version = %q{1.5.0} s.description = %q{A really straightforward open source Ruby on Rails blog engine designed for integration with RefineryCMS.} - s.date = %q{2011-05-26} + s.date = %q{2011-05-28} s.summary = %q{Ruby on Rails blogging engine for RefineryCMS.} s.email = %q{info@refinerycms.com} s.homepage = %q{http://refinerycms.com/blog} @@ -169,5 +169,5 @@ Gem::Specification.new do |s| spec/models/blog_comment_spec.rb spec/models/blog_post_spec.rb ) - + end From 6287603a2bc9a2095fece3e3cfc29c620bd0960b Mon Sep 17 00:00:00 2001 From: David Jones Date: Fri, 27 May 2011 05:24:19 -0700 Subject: [PATCH 147/494] Updated readme to latest versions --- readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index d8a07c5..c8b8e3a 100644 --- a/readme.md +++ b/readme.md @@ -11,13 +11,13 @@ Options: ## Requirements -Refinery CMS version 0.9.8 or above. +Refinery CMS version 1.0.0 or above. ## Install Open up your ``Gemfile`` and add at the bottom this line: - gem 'refinerycms-blog', '~> 1.3' + gem 'refinerycms-blog', '~> 1.5' Now, run ``bundle install`` From 2d41081770110bdc8679ed7355a5345ccee60dd1 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Sat, 28 May 2011 00:28:02 +1200 Subject: [PATCH 148/494] use options[:size] not size. --- app/models/blog_comment.rb | 2 +- lib/refinery/blog/version.rb | 2 +- refinerycms-blog.gemspec | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/blog_comment.rb b/app/models/blog_comment.rb index f461cdb..42059c7 100644 --- a/app/models/blog_comment.rb +++ b/app/models/blog_comment.rb @@ -23,7 +23,7 @@ class BlogComment < ActiveRecord::Base options = {:size => 60} require 'digest/md5' options[:size] = "?s=#{size}" if options[:size] - "http://gravatar.com/avatar/#{Digest::MD5.hexdigest(self.email.to_s.strip.downcase)}#{size}.jpg" + "http://gravatar.com/avatar/#{Digest::MD5.hexdigest(self.email.to_s.strip.downcase)}#{options[:size]}.jpg" end def approve! diff --git a/lib/refinery/blog/version.rb b/lib/refinery/blog/version.rb index fc2d268..a1144ea 100644 --- a/lib/refinery/blog/version.rb +++ b/lib/refinery/blog/version.rb @@ -3,7 +3,7 @@ module Refinery class Version @major = 1 @minor = 5 - @tiny = 0 + @tiny = 1 class << self attr_reader :major, :minor, :tiny diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index b541113..2e0df3f 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = %q{refinerycms-blog} - s.version = %q{1.5.0} + s.version = %q{1.5.1} s.description = %q{A really straightforward open source Ruby on Rails blog engine designed for integration with RefineryCMS.} s.date = %q{2011-05-28} s.summary = %q{Ruby on Rails blogging engine for RefineryCMS.} @@ -169,5 +169,5 @@ Gem::Specification.new do |s| spec/models/blog_comment_spec.rb spec/models/blog_post_spec.rb ) - + end From 3a5d3f56f3446704e1e5c1564011d88e257af97c Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Sat, 28 May 2011 00:32:20 +1200 Subject: [PATCH 149/494] Wow, I'm getting good at releasing new versions of this. Fixes size (again). --- app/models/blog_comment.rb | 4 ++-- lib/refinery/blog/version.rb | 2 +- refinerycms-blog.gemspec | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/blog_comment.rb b/app/models/blog_comment.rb index 42059c7..6216cc2 100644 --- a/app/models/blog_comment.rb +++ b/app/models/blog_comment.rb @@ -22,8 +22,8 @@ class BlogComment < ActiveRecord::Base def avatar_url(options = {}) options = {:size => 60} require 'digest/md5' - options[:size] = "?s=#{size}" if options[:size] - "http://gravatar.com/avatar/#{Digest::MD5.hexdigest(self.email.to_s.strip.downcase)}#{options[:size]}.jpg" + size = ("?s=#{options[:size]}" if options[:size]) + "http://gravatar.com/avatar/#{Digest::MD5.hexdigest(self.email.to_s.strip.downcase)}#{size}.jpg" end def approve! diff --git a/lib/refinery/blog/version.rb b/lib/refinery/blog/version.rb index a1144ea..3899eeb 100644 --- a/lib/refinery/blog/version.rb +++ b/lib/refinery/blog/version.rb @@ -3,7 +3,7 @@ module Refinery class Version @major = 1 @minor = 5 - @tiny = 1 + @tiny = 2 class << self attr_reader :major, :minor, :tiny diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index 2e0df3f..b645f83 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = %q{refinerycms-blog} - s.version = %q{1.5.1} + s.version = %q{1.5.2} s.description = %q{A really straightforward open source Ruby on Rails blog engine designed for integration with RefineryCMS.} s.date = %q{2011-05-28} s.summary = %q{Ruby on Rails blogging engine for RefineryCMS.} From 0310b489542106e6bcb5d8db6327af86daeddb5b Mon Sep 17 00:00:00 2001 From: Guirec CORBEL Date: Sun, 29 May 2011 14:34:53 -0400 Subject: [PATCH 150/494] add some options for translation and translate in french --- app/views/blog/posts/_post.html.erb | 4 ++-- app/views/blog/posts/tagged.html.erb | 2 +- app/views/blog/shared/_post.html.erb | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/views/blog/posts/_post.html.erb b/app/views/blog/posts/_post.html.erb index f589a33..e5aabdb 100644 --- a/app/views/blog/posts/_post.html.erb +++ b/app/views/blog/posts/_post.html.erb @@ -8,8 +8,8 @@

    <%= @blog_post.title %>

    <%= " by #{@blog_post.author.username}" if @blog_post.author.present? %> + <%= t('blog.shared.posts.created_at', :when => l(@blog_post.published_at.to_date, :format => :short)) %> + <%= "#{t('blog.posts.show.by')} #{@blog_post.author.username}" if @blog_post.author.present? %>. <% if (categories = @blog_post.categories).any? %>
    - <%= f.label :body -%> - <%= f.text_area :body, :rows => 20, :class => 'wymeditor widest' -%> +
    +
      +
    • + <%= link_to "Body", "#page_part_body" %> +
    • + <% 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), + } -%> + <% Refinery::Blog.tabs.each_with_index do |tab, tab_index| %> +
    + <%= render :partial => tab.partial, :locals => {:f => f} %> +
    + <% end %> +
    +
    diff --git a/app/views/admin/blog/posts/_form.js.erb b/app/views/admin/blog/posts/_form.js.erb index 1d65448..98a61d0 100644 --- a/app/views/admin/blog/posts/_form.js.erb +++ b/app/views/admin/blog/posts/_form.js.erb @@ -10,4 +10,5 @@ }, 250); }); }); + var tabs = $('#page-tabs').tabs(); diff --git a/app/views/admin/blog/posts/_form_part.html.erb b/app/views/admin/blog/posts/_form_part.html.erb new file mode 100644 index 0000000..114e493 --- /dev/null +++ b/app/views/admin/blog/posts/_form_part.html.erb @@ -0,0 +1,3 @@ +
    + <%= f.text_area :body, :rows => 20, :class => 'wymeditor widest' -%> +
    diff --git a/lib/refinery/blog/tab.rb b/lib/refinery/blog/tab.rb new file mode 100644 index 0000000..083d50b --- /dev/null +++ b/lib/refinery/blog/tab.rb @@ -0,0 +1,28 @@ +module Refinery + module Blog + attr_accessor :tabs + + def self.tabs + @tabs ||= [] + end + + class Tab + attr_accessor :name, :partial + + def self.register(&block) + tab = self.new + + yield tab + + raise "A tab MUST have a name!: #{tab.inspect}" if tab.name.blank? + raise "A tab MUST have a partial!: #{tab.inspect}" if tab.partial.blank? + end + + protected + + def initialize + ::Refinery::Blog.tabs << self # add me to the collection of registered page tabs + end + end + end +end \ No newline at end of file diff --git a/lib/refinerycms-blog.rb b/lib/refinerycms-blog.rb index 901535d..db9beda 100644 --- a/lib/refinerycms-blog.rb +++ b/lib/refinerycms-blog.rb @@ -2,8 +2,9 @@ require 'filters_spam' module Refinery module Blog - autoload :Version, File.expand_path('../refinery/blog/version', __FILE__) + autoload :Tab, File.expand_path("../refinery/blog/tab", __FILE__) + class << self def version ::Refinery::Blog::Version.to_s From 2dc08f3a496af8ddf8bdbb760b551494ffdefeb2 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Tue, 31 May 2011 14:16:04 +1200 Subject: [PATCH 156/494] tab -> tabs and requiring the file on to_prepare so that it actually loads. Fixed specs now that the form 'looks' different. --- features/authors.feature | 2 +- features/tags.feature | 2 +- lib/refinery/blog/{tab.rb => tabs.rb} | 0 lib/refinerycms-blog.rb | 8 ++++++-- 4 files changed, 8 insertions(+), 4 deletions(-) rename lib/refinery/blog/{tab.rb => tabs.rb} (100%) diff --git a/features/authors.feature b/features/authors.feature index 0e17e32..f3fd3ec 100644 --- a/features/authors.feature +++ b/features/authors.feature @@ -8,7 +8,7 @@ Feature: Blog Post Authors When I am on the new blog post form And I fill in "Title" with "This is my blog post" - And I fill in "Body" with "And I love it" + And I fill in "blog_post_body" with "And I love it" And I press "Save" Then there should be 1 blog post diff --git a/features/tags.feature b/features/tags.feature index 05d6028..24dff2a 100644 --- a/features/tags.feature +++ b/features/tags.feature @@ -12,7 +12,7 @@ Feature: Blog Post Tags Scenario: The blog post new/edit form saves tag_list When I am on the new blog post form And I fill in "Title" with "This is my blog post" - And I fill in "Body" with "And I love it" + And I fill in "blog_post_body" with "And I love it" And I fill in "Tags" with "chicago, bikes, beers, babes" And I press "Save" diff --git a/lib/refinery/blog/tab.rb b/lib/refinery/blog/tabs.rb similarity index 100% rename from lib/refinery/blog/tab.rb rename to lib/refinery/blog/tabs.rb diff --git a/lib/refinerycms-blog.rb b/lib/refinerycms-blog.rb index db9beda..407b840 100644 --- a/lib/refinerycms-blog.rb +++ b/lib/refinerycms-blog.rb @@ -3,8 +3,8 @@ require 'filters_spam' module Refinery module Blog autoload :Version, File.expand_path('../refinery/blog/version', __FILE__) - autoload :Tab, File.expand_path("../refinery/blog/tab", __FILE__) - + autoload :Tab, File.expand_path("../refinery/blog/tabs", __FILE__) + class << self def version ::Refinery::Blog::Version.to_s @@ -16,6 +16,10 @@ module Refinery app.middleware.insert_after ::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public" end + config.to_prepare do + require File.expand_path('../refinery/blog/tabs', __FILE__) + end + config.after_initialize do Refinery::Plugin.register do |plugin| plugin.name = "refinerycms_blog" From e382521a7d2a78e9bb61c56f779a2bbb97d538b2 Mon Sep 17 00:00:00 2001 From: Resolve Digital Date: Mon, 30 May 2011 19:18:48 -0700 Subject: [PATCH 157/494] Make the blog stylesheet work better with the default Refinery frontend stylesheet. Without this all posts displayed have a 1000px wide header and footer. --- public/stylesheets/refinerycms-blog.css | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/public/stylesheets/refinerycms-blog.css b/public/stylesheets/refinerycms-blog.css index 73a4e42..2e891ee 100644 --- a/public/stylesheets/refinerycms-blog.css +++ b/public/stylesheets/refinerycms-blog.css @@ -1,6 +1,9 @@ +.blog_post header, .blog_post footer { + width: auto; +} .blog_post .posted_at{ - display:block; - margin:0 0 10px; + display:block; + margin:0 0 10px; } .post_categories .filed_in { display: inline; From 8fc9af832c101078b49fdfa6cdbb9d8187fb8668 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Tue, 31 May 2011 14:21:45 +1200 Subject: [PATCH 158/494] Wrapped javascript inside a jQuery wrapper. --- app/views/admin/blog/posts/_form.js.erb | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/app/views/admin/blog/posts/_form.js.erb b/app/views/admin/blog/posts/_form.js.erb index 98a61d0..1c030b4 100644 --- a/app/views/admin/blog/posts/_form.js.erb +++ b/app/views/admin/blog/posts/_form.js.erb @@ -1,14 +1,16 @@ From f0e4b6c8c144bf30f2d57885371a16b66302e9e7 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Tue, 31 May 2011 14:45:36 +1200 Subject: [PATCH 159/494] This will have to be 1.6.0 when it's released. --- lib/refinery/blog/version.rb | 4 ++-- refinerycms-blog.gemspec | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/refinery/blog/version.rb b/lib/refinery/blog/version.rb index 3899eeb..b4bad51 100644 --- a/lib/refinery/blog/version.rb +++ b/lib/refinery/blog/version.rb @@ -2,8 +2,8 @@ module Refinery module Blog class Version @major = 1 - @minor = 5 - @tiny = 2 + @minor = 6 + @tiny = 0 class << self attr_reader :major, :minor, :tiny diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index b645f83..518ba88 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -1,8 +1,8 @@ Gem::Specification.new do |s| s.name = %q{refinerycms-blog} - s.version = %q{1.5.2} + s.version = %q{1.6.0} s.description = %q{A really straightforward open source Ruby on Rails blog engine designed for integration with RefineryCMS.} - s.date = %q{2011-05-28} + s.date = %q{2011-05-31} s.summary = %q{Ruby on Rails blogging engine for RefineryCMS.} s.email = %q{info@refinerycms.com} s.homepage = %q{http://refinerycms.com/blog} @@ -63,6 +63,7 @@ Gem::Specification.new do |s| app/views/admin/blog/posts/_form.css.erb app/views/admin/blog/posts/_form.html.erb app/views/admin/blog/posts/_form.js.erb + app/views/admin/blog/posts/_form_part.html.erb app/views/admin/blog/posts/_post.html.erb app/views/admin/blog/posts/_sortable_list.html.erb app/views/admin/blog/posts/edit.html.erb @@ -134,6 +135,7 @@ Gem::Specification.new do |s| lib/generators/refinerycms_blog_generator.rb lib/refinery lib/refinery/blog + lib/refinery/blog/tabs.rb lib/refinery/blog/version.rb lib/refinerycms-blog.rb public From ee47505833ff4a6f28932ecdcb2ec35d8f31458f Mon Sep 17 00:00:00 2001 From: David Jones Date: Tue, 31 May 2011 14:57:05 +1200 Subject: [PATCH 160/494] fix locale key. 'i18n' was showing up in the blog index output --- app/views/blog/shared/_post.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/blog/shared/_post.html.erb b/app/views/blog/shared/_post.html.erb index 05c6af2..662d91a 100644 --- a/app/views/blog/shared/_post.html.erb +++ b/app/views/blog/shared/_post.html.erb @@ -5,7 +5,7 @@
    <%= "#{t('blog.shared.posts.by')} #{post.author.username}" if post.author.present? %>. + <%= "#{t('blog.posts.show.by')} #{post.author.username}" if post.author.present? %>. <% if (categories = post.categories).any? %>
    -<% if Refinery.version < '0.9.9' %> - <% content_for :head, stylesheet_link_tag('refinery/refinerycms-blog') %> -<% else %> - <% content_for :stylesheets, stylesheet_link_tag('refinery/refinerycms-blog') %> -<% end %> + +<% content_for :stylesheets, stylesheet_link_tag('refinery/refinerycms-blog') %> diff --git a/app/views/admin/blog/posts/_form.html.erb b/app/views/admin/blog/posts/_form.html.erb index 7d95052..24b14ba 100644 --- a/app/views/admin/blog/posts/_form.html.erb +++ b/app/views/admin/blog/posts/_form.html.erb @@ -86,12 +86,5 @@ } %> <% end -%> -<% if Refinery.version < '0.9.9' %> - <% content_for :head do %> - <%= render :partial => 'form.css' %> - <%= render :partial => 'form.js' %> - <% end %> -<% else %> - <% content_for :stylesheets, render(:partial => 'form.css') -%> - <% content_for :javascripts, render(:partial => 'form.js') -%> -<% end %> +<% content_for :stylesheets, render(:partial => 'form.css') -%> +<% content_for :javascripts, render(:partial => 'form.js') -%> diff --git a/app/views/blog/posts/show.html.erb b/app/views/blog/posts/show.html.erb index 92898a4..97b8af2 100644 --- a/app/views/blog/posts/show.html.erb +++ b/app/views/blog/posts/show.html.erb @@ -57,24 +57,11 @@ <%= render :partial => "/shared/content_page", :locals => { :remove_automatic_sections => true } %> -<% if Refinery.version < '0.9.9' %> - <% content_for :head_libraries, jquery_include_tags(:jquery_ui => false) %> - <% content_for :head do %> - <%= stylesheet_link_tag 'refinerycms-blog' %> - <%# enable AJAX'd post nav at your own risk until html5 history API implemented. %> - <%#= javascript_include_tag('refinerycms-blog') %> - <% if BlogPost::ShareThis.enabled? %> - - - <% end %> - <% end %> -<% else %> - <% content_for :stylesheets, stylesheet_link_tag('refinerycms-blog') %> - <% content_for :before_javascript_libraries, jquery_include_tags(:jquery_ui => false) %> - <% content_for :javascripts do %> - <%# enable AJAX'd post nav at your own risk until html5 history API implemented. %> - <%#= javascript_include_tag('refinerycms-blog') %> - - - <% end if BlogPost::ShareThis.enabled? %> -<% end %> +<% content_for :stylesheets, stylesheet_link_tag('refinerycms-blog') %> +<% content_for :before_javascript_libraries, jquery_include_tags(:jquery_ui => false) %> +<% content_for :javascripts do %> + <%# enable AJAX'd post nav at your own risk until html5 history API implemented. %> + <%#= javascript_include_tag('refinerycms-blog') %> + + +<% end if BlogPost::ShareThis.enabled? %> From 63ec02d44e3063c2c92e99f13fb7525660d25956 Mon Sep 17 00:00:00 2001 From: Michael Gall Date: Wed, 8 Jun 2011 10:57:15 +1000 Subject: [PATCH 165/494] Add spec for blog post categories --- features/category.feature | 23 +++++++++++++++++++ .../step_definitions/category_steps.rb | 11 +++++++++ 2 files changed, 34 insertions(+) create mode 100644 features/category.feature create mode 100644 features/support/step_definitions/category_steps.rb diff --git a/features/category.feature b/features/category.feature new file mode 100644 index 0000000..14ec93e --- /dev/null +++ b/features/category.feature @@ -0,0 +1,23 @@ +@blog @blog_categories +Feature: Blog Post Categories + Blog posts can be assigned categories + + Background: + Given I am a logged in refinery user + Given there is a category titled "Videos" + + Scenario: The blog post new/edit form has category_list + When I am on the new blog post form + Then I should see "Tags" + Then I should see "Videos" + + Scenario: The blog post new/edit form saves categories + When I am on the new blog post form + And I fill in "Title" with "This is my blog post" + And I fill in "blog_post_body" with "And I love it" + And I check "Videos" + And I press "Save" + + Then there should be 1 blog post + And the blog post should have "1" category + And the blog post should have the category "Videos" \ No newline at end of file diff --git a/features/support/step_definitions/category_steps.rb b/features/support/step_definitions/category_steps.rb new file mode 100644 index 0000000..31176b4 --- /dev/null +++ b/features/support/step_definitions/category_steps.rb @@ -0,0 +1,11 @@ +Given /^there is a category titled "([^"]*)"$/ do |title| + @category = Factory(:blog_category, :title => title) +end + +Then /^the blog post should have "([^"]*)" category$/ do |num_category| + BlogPost.last.categories.count.should == num_category +end + +Then /^the blog post should have the category "([^"]*)"$/ do |category| + BlogPost.last.categories.first.title.should == category +end \ No newline at end of file From b91b381e8eb6e5dc572ea4e53b138caba1a011fa Mon Sep 17 00:00:00 2001 From: Joe Sak Date: Mon, 13 Jun 2011 17:22:51 -0500 Subject: [PATCH 166/494] this functionality exists in refinery, so the double bind makes it scroll right back up --- app/views/admin/blog/posts/_form.js.erb | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/app/views/admin/blog/posts/_form.js.erb b/app/views/admin/blog/posts/_form.js.erb index 1c030b4..b829ec2 100644 --- a/app/views/admin/blog/posts/_form.js.erb +++ b/app/views/admin/blog/posts/_form.js.erb @@ -1,16 +1,5 @@ From 9310b4176047dc24fce5841237441882ffee2e2f Mon Sep 17 00:00:00 2001 From: Kyle Wilkinson Date: Mon, 13 Jun 2011 18:06:26 -0700 Subject: [PATCH 167/494] Modify the category view of the blog to show a paged view, rather than all blog posts. --- app/controllers/blog/categories_controller.rb | 4 ++++ app/views/blog/categories/show.html.erb | 13 ++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/controllers/blog/categories_controller.rb b/app/controllers/blog/categories_controller.rb index 4795e99..35a87c3 100644 --- a/app/controllers/blog/categories_controller.rb +++ b/app/controllers/blog/categories_controller.rb @@ -2,6 +2,10 @@ class Blog::CategoriesController < BlogController def show @category = BlogCategory.find(params[:id]) + @blog_posts = @category.posts.live.includes(:comments, :categories).paginate({ + :page => params[:page], + :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10) + }) end end diff --git a/app/views/blog/categories/show.html.erb b/app/views/blog/categories/show.html.erb index 324c0fe..caecbfd 100644 --- a/app/views/blog/categories/show.html.erb +++ b/app/views/blog/categories/show.html.erb @@ -1,14 +1,13 @@ <% content_for :body_content_title, @category.title %> <% content_for :body_content_left do %> - <% if @category.posts.any? %> -
    - <%= render :partial => "/blog/shared/post", :collection => @category.posts %> -
    + <% if @blog_posts.any? %> +
    + <%= render :partial => "/blog/shared/post", :collection => @blog_posts %> + <%= will_paginate @blog_posts %> +
    <% else %> -

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

    +

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

    <% end %> <% end %> From a31f28126a0099fbf3f4f694c52b109e73c92e08 Mon Sep 17 00:00:00 2001 From: Kyle Wilkinson Date: Mon, 13 Jun 2011 18:12:51 -0700 Subject: [PATCH 168/494] Use the correct message for no posts on category show page. --- app/views/blog/categories/show.html.erb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/views/blog/categories/show.html.erb b/app/views/blog/categories/show.html.erb index caecbfd..40444ec 100644 --- a/app/views/blog/categories/show.html.erb +++ b/app/views/blog/categories/show.html.erb @@ -7,7 +7,9 @@ <%= will_paginate @blog_posts %> <% else %> -

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

    +

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

    <% end %> <% end %> From 117de953b7f88e8582e2b7155d1e2857f2186bed Mon Sep 17 00:00:00 2001 From: Kyle Wilkinson Date: Tue, 14 Jun 2011 02:38:00 -0700 Subject: [PATCH 169/494] Make category_ids attribute accessible so that blog categories can be updated. --- app/models/blog_post.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/blog_post.rb b/app/models/blog_post.rb index c1b8973..5c0101d 100644 --- a/app/models/blog_post.rb +++ b/app/models/blog_post.rb @@ -26,7 +26,7 @@ class BlogPost < ActiveRecord::Base :approximate_ascii => RefinerySetting.find_or_set(:approximate_ascii, false, :scoping => 'blog'), :strip_non_ascii => RefinerySetting.find_or_set(:strip_non_ascii, false, :scoping => 'blog') - attr_accessible :title, :body, :tag_list, :draft, :published_at, :browser_title, :meta_keywords, :meta_description, :user_id + attr_accessible :title, :body, :tag_list, :draft, :published_at, :browser_title, :meta_keywords, :meta_description, :user_id, :category_ids scope :by_archive, lambda { |archive_date| where(['published_at between ? and ?', archive_date.beginning_of_month, archive_date.end_of_month]) From 434ad6535e82a5bf6ba43d50e8ad00c763e041a8 Mon Sep 17 00:00:00 2001 From: Joe Sak Date: Tue, 14 Jun 2011 13:53:22 -0500 Subject: [PATCH 170/494] cached slugs speed things up --- db/migrate/5_add_cached_slugs.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 db/migrate/5_add_cached_slugs.rb diff --git a/db/migrate/5_add_cached_slugs.rb b/db/migrate/5_add_cached_slugs.rb new file mode 100644 index 0000000..c189302 --- /dev/null +++ b/db/migrate/5_add_cached_slugs.rb @@ -0,0 +1,11 @@ +class AddCachedSlugs < ActiveRecord::Migration + def self.up + add_column :blog_categories, :cached_slug, :string + add_column :blog_posts, :cached_slug, :string + end + + def self.down + remove_column :blog_categories, :cached_slug + remove_column :blog_posts, :cached_slug + end +end From 687ffb62863fd036f1eb62e82a407b5a71a0e812 Mon Sep 17 00:00:00 2001 From: Joe Sak Date: Tue, 14 Jun 2011 17:50:26 -0500 Subject: [PATCH 171/494] changelog upkeep --- changelog.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/changelog.md b/changelog.md index 1851d2d..37e0942 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,10 @@ +## 1.6 [UNRELEASED] +* Category bug fixes and cleanup [wikyd](https://github.com/wikyd) +* Cleaned up deprecated code [ugisozols](https://github.com/ugisozols) +* Performance boosts (cached slugs) [joemsak](https://github.com/joemsak) +* More translations [cerebroso](https://github.com/cerebroso), [peresleguine](https://github.com/peresleguine) +* More testing [wakeless](https://github.com/wakeless) + ## 1.5 [28 May 2011] * Added Gravatar support. [parndt](https://github.com/parndt) From b8d2bcb913827e1db612b2952e74d316669e6835 Mon Sep 17 00:00:00 2001 From: Joe Sak Date: Wed, 15 Jun 2011 11:02:59 -0500 Subject: [PATCH 172/494] autocomplete added for tags --- .../admin/blog/posts_controller.rb | 8 + app/views/admin/blog/posts/_form.html.erb | 1 + app/views/shared/admin/_autocomplete.html.erb | 55 +++ config/routes.rb | 5 +- .../ui-bg_diagonals-thick_18_b81900_40x40.png | Bin 0 -> 260 bytes .../ui-bg_diagonals-thick_20_666666_40x40.png | Bin 0 -> 251 bytes .../images/ui-bg_flat_10_000000_40x100.png | Bin 0 -> 178 bytes .../images/ui-bg_glass_100_f6f6f6_1x400.png | Bin 0 -> 104 bytes .../images/ui-bg_glass_100_fdf5ce_1x400.png | Bin 0 -> 125 bytes .../images/ui-bg_glass_65_ffffff_1x400.png | Bin 0 -> 105 bytes .../ui-bg_gloss-wave_35_f6a828_500x100.png | Bin 0 -> 3762 bytes .../ui-bg_highlight-soft_100_eeeeee_1x100.png | Bin 0 -> 90 bytes .../ui-bg_highlight-soft_75_ffe45c_1x100.png | Bin 0 -> 129 bytes .../images/ui-icons_222222_256x240.png | Bin 0 -> 4369 bytes .../images/ui-icons_228ef1_256x240.png | Bin 0 -> 4369 bytes .../images/ui-icons_ef8c08_256x240.png | Bin 0 -> 4369 bytes .../images/ui-icons_ffd27a_256x240.png | Bin 0 -> 4369 bytes .../images/ui-icons_ffffff_256x240.png | Bin 0 -> 4369 bytes .../ui-lightness/jquery-ui-1.8.13.custom.css | 337 ++++++++++++++++++ 19 files changed, 405 insertions(+), 1 deletion(-) create mode 100644 app/views/shared/admin/_autocomplete.html.erb create mode 100755 public/stylesheets/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png create mode 100755 public/stylesheets/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png create mode 100755 public/stylesheets/ui-lightness/images/ui-bg_flat_10_000000_40x100.png create mode 100755 public/stylesheets/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png create mode 100755 public/stylesheets/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png create mode 100755 public/stylesheets/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png create mode 100755 public/stylesheets/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png create mode 100755 public/stylesheets/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png create mode 100755 public/stylesheets/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png create mode 100755 public/stylesheets/ui-lightness/images/ui-icons_222222_256x240.png create mode 100755 public/stylesheets/ui-lightness/images/ui-icons_228ef1_256x240.png create mode 100755 public/stylesheets/ui-lightness/images/ui-icons_ef8c08_256x240.png create mode 100755 public/stylesheets/ui-lightness/images/ui-icons_ffd27a_256x240.png create mode 100755 public/stylesheets/ui-lightness/images/ui-icons_ffffff_256x240.png create mode 100755 public/stylesheets/ui-lightness/jquery-ui-1.8.13.custom.css diff --git a/app/controllers/admin/blog/posts_controller.rb b/app/controllers/admin/blog/posts_controller.rb index e8ffed2..7569aa6 100644 --- a/app/controllers/admin/blog/posts_controller.rb +++ b/app/controllers/admin/blog/posts_controller.rb @@ -11,6 +11,14 @@ class Admin::Blog::PostsController < Admin::BaseController }) end + def tags + @tags = BlogPost.tag_counts_on(:tags).where(["tags.name LIKE ?", "%#{params[:term].to_s.downcase}%"]) + .collect { |tag| + {:id => tag.id, :value => tag.name} + } + render :json => @tags.flatten + end + def create # if the position field exists, set this object as last object, given the conditions of this class. if BlogPost.column_names.include?("position") diff --git a/app/views/admin/blog/posts/_form.html.erb b/app/views/admin/blog/posts/_form.html.erb index 24b14ba..c0467fd 100644 --- a/app/views/admin/blog/posts/_form.html.erb +++ b/app/views/admin/blog/posts/_form.html.erb @@ -88,3 +88,4 @@ <% content_for :stylesheets, render(:partial => 'form.css') -%> <% content_for :javascripts, render(:partial => 'form.js') -%> +<%= render 'shared/admin/autocomplete', :dom_id => '#blog_post_tag_list', :url => tags_admin_blog_posts_url %> diff --git a/app/views/shared/admin/_autocomplete.html.erb b/app/views/shared/admin/_autocomplete.html.erb new file mode 100644 index 0000000..7a3baa1 --- /dev/null +++ b/app/views/shared/admin/_autocomplete.html.erb @@ -0,0 +1,55 @@ +<% content_for :stylesheets, stylesheet_link_tag("ui-lightness/jquery-ui-1.8.13.custom") -%> + +<% content_for :javascripts do %> + <%= javascript_include_tag "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js" %> + +<% end %> \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 83b9364..4deeb4e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -13,7 +13,10 @@ scope(:path => 'blog', :as => 'blog', :module => 'blog') do root :to => 'posts#index' resources :posts do - get 'uncategorized', :on => :collection + collection do + get :uncategorized + get :tags + end end resources :categories diff --git a/public/stylesheets/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png b/public/stylesheets/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png new file mode 100755 index 0000000000000000000000000000000000000000..954e22dbd99e8c6dd7091335599abf2d10bf8003 GIT binary patch literal 260 zcmeAS@N?(olHy`uVBq!ia0vp^8X(NU1|)m_?Z^dEr#)R9Ln2z=UU%d=WFXS=@V?HT z#xG*`>Yvsgk=}99w^d^D^d*@m74oMo<%#FcopJf?u00-~YVKV2wzrI*_R6;UORMea zBFVSEnN~eiVA6V&z`E)YLz5Aok^D)In}Yn=OzDpgR5Wv0XfT8pOkmV{sKAJ-PO9#T zZK}IXj&Q-V!U)!LcB_3K0&C*{ literal 0 HcmV?d00001 diff --git a/public/stylesheets/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png b/public/stylesheets/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png new file mode 100755 index 0000000000000000000000000000000000000000..64ece5707d91a6edf9fad4bfcce0c4dbcafcf58d GIT binary patch literal 251 zcmVbvPcjKS|RKP(6sDcCAB(_QB%0978a<$Ah$!b|E zwn;|HO0i8cQj@~)s!ajF0S002ovPDHLkV1oEp BYH0uf literal 0 HcmV?d00001 diff --git a/public/stylesheets/ui-lightness/images/ui-bg_flat_10_000000_40x100.png b/public/stylesheets/ui-lightness/images/ui-bg_flat_10_000000_40x100.png new file mode 100755 index 0000000000000000000000000000000000000000..abdc01082bf3534eafecc5819d28c9574d44ea89 GIT binary patch literal 178 zcmeAS@N?(olHy`uVBq!ia0vp^8bF-F!3HG1q!d*FsY*{5$B>N1x91EQ4=4yQY-ImG zFPf9b{J;c_6SHRK%WcbN_hZpM=(Ry;4Rxv2@@2Y=$K57eF$X$=!PC{xWt~$(69B)$ BI)4BF literal 0 HcmV?d00001 diff --git a/public/stylesheets/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png b/public/stylesheets/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png new file mode 100755 index 0000000000000000000000000000000000000000..9b383f4d2eab09c0f2a739d6b232c32934bc620b GIT binary patch literal 104 zcmeAS@N?(olHy`uVBq!ia0vp^j6gJjgAK^akKnour1U*q978O6-yYw{%b*}|_(02F z@qbE9)0CJMo;*v*PWv`Vh2h6EmG8IS-Cm{3U~` zFlmZ}YMcJY=eo?o%*@I?2`NblNeMudl#t?{+tN>ySr~=F{k$>;_x^_y?afmf9pRKH0)6?eSP?3s5hEr>mdKI;Vst E0O;M1& literal 0 HcmV?d00001 diff --git a/public/stylesheets/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png b/public/stylesheets/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png new file mode 100755 index 0000000000000000000000000000000000000000..39d5824d6af5456f1e89fc7847ea3599ea5fd815 GIT binary patch literal 3762 zcmb_eYgiKKwx-=Q?Pdi0+w!yaC|_1uvA>yaxz|iX3eBv#HR0ASmSVIKMS&kf`CSAV4g0DJLgPkRO79xj%J<(hH6`bTGj zrr^$JeiHJI?;s&<5pRw-^kj}=E;X0OX+pgz+f5GVt0NQv_gbu0>-8J+F$O>HpW?Lx z+YFO`CV&6VV9fsEwG#js0_-|v*!ujZ*M=jfo457?0Do-z<^}+8bI+qk+W~+$zz%Z& z;L7&@&ns`l8Ofh*WdU0pO%RP^?Xa_h7I}7K#}4Xt`s%-(m-enaPWX$O&- zX~a1aOzn?!r?5wJVBNPJ_o8-(9Fz<_c1LYGxUl(E+Wdx?wkNHH2T%eWq9Kz00h#RB zYKI~=a<9_QqC^n<>hyWlS66waWgyAP#t&TfTWP=Sxa)ukRY%j7WH}(@r=B^W_;b&M zRzPYsb*j^Kou%%`K6VP+dKtR@x~qEHq4rXMxoX-gcSf&->lMY%TMXF!Gw_A)(tp6} z2A%kN3twbr%KyUrrmw24V3d%wzK<-q(M;MTr41}un`P!!xejADEv_CJ{CTif907B& zEP`pDJIZHVgnmxh$EZnBOUxz~Ap+ZzKbFmg39_n-)$wY!Q@i~5aGmHbN7&*gkq9zWgV|2(Zhxl zoDqJp&MxW(qX#C@oF8L)*r$RdSjVFSc$%z?*9%YoZ6sOZ!vtxXtBM<*r82vyC}_Eiz1PJ2L$bttko`=+fH{Ne@G#lMDxkKt_y)O(J5&Ak)w-I znm!vzYX3$kLDG$hOp-KJg~7}M;73BFWA{!a61fe?NJkjR_}Xw+*`O0=AGg7&dUA`A?9`whW zM{fkFf`G`P^9j*|-q9KLvS<191z9a^mK3Lss}W8O=sZ}N$V4Fh*SWF5NbZQ>p{0>$ z0pe}d$*s!y*R&NSXbjmld6{4Y;O89MuDTK0Hn0C?QdL9z1qGegXs! z7$MIGkPkwdHF2os-Z-e85B?5An>yc|m<}>!Iirg%H-%F11XY{{>@kgL>a#6fM9JzBE&an&F>eWh|b0^kJ zNBM5*nCa~(xwn~rG~>GSG9mz3h z9F~64y}giIrz^lfl|_5HpUsG}?Wpr*&f?bS=|9biqivN)-a~u>uK<{Lfcng{663QL zLXzO@*N5)q4C=j6E8nC+P%lEwI#~0wkt;M4Y8!+DYzN2rBuYao1*HRIa^NC9nFeep z+ns5$X9Bh48S-`ss!k&!J#Ddd=j1O-9}?`v(B|>R7wD97BV;nK~quUHx^mj^G6K2GZ1*uSN?iLm!7vHB7_1^TGbKhmnK+K`GYA zocp2=on8LxJH^`7^1ch0ft(MTU$vJB!R@gQ^R`qoX>(=iY#u++3K>oqSpG={?#YVw zp3m99FXk^~<6#X9X1oKYXEH%8t2btG65(u0zF-J)^>8dj0Evc+9_Bd^Y)k9AfW~FV z%iDV(ClS6)TC7eVzh{ml;p4cx8)$TV&qhRWp+dqiw>i32?1;5d>HLrNj=^OdJ<}L) zWxqw8aFI<~_TkMDQHS?`z+KQ?+{ASoy%}RBu6i9?BXbh%OEx1OuZ}?n(VjrT(!B1; zQ!#WA0NBx=^6rJrFVsDCuT4)OTGzZ3$Z4Yqz z&c9+7%g!%zxtv#p2fhHbo98KBwfE&Y(&2#=}qEEU`ECEjlCp=X^_tIoMx>%kBT5k)^c=zyV5w3 zc>DLKY6%=y0igWi9B@4hB}bR6K|+jYBt+}i6Ld|b`*s62c6Ge?zGYvdW)=p90~$Ad zxGB>c<3Dy~hPJ#vNXierOl41xBn_0L<5NhK6JO-LvtS&Z{xjGKfIC6*9%*?tv*?+! zv;Q{?mHN2b|3DEJO}R9w11ZT5QVC(H0u|0n9cVK_@2r%C<)OnZ(3aS0Ux^6G$ja*< z9R~o~9XjhPL)w@vYi6r;H$tR>wW`0-Z&Qed`X0LZY9-~mfso!@dt?5Q;@|K6$mAB& z$J41&y)<{N;QATPeU}BC{lM_@-LlQ2hjX;}6~qdglT zGm%qJm*F^in=w*?j;@C_PCMnXK5Fd^wXV**pZOdS1KbSJsC~s#R;tmXIMb` zHB>sxQg&E5Yf@}d#~Z9D4R{}ZpLm7S=bY0x#k<=H?=R+=W$=Bm2aU*n z)qgD*0#4>GGlHhQ`bx#k=Njc;+9D@{F5`xI^tMkBf{XIzwB=b9KbuuLF7jMTR~Mwt zN#!)9J4&^V@JRe9Y!b2!;$rCLPWZfG`C;Qz`u~TJdCzv->e`=R8uHX_2{Fp&pWJ*h z#A60&bY(j(^P@t_`_pktBV7{tFVoeNWlNA|zgNr&DMjJ_!k2%2s2~F@la$M6k%hWi z7}}hoDuoaN7?lchVk@4DunpEIS$72&uuF&F;&4uhC$L)6IzHHUryR9emzpxwsRXmj zfc}pI#oRCB7Y1;t=*58Gsv7x3PGuW^spn6V&dWf#?*TQ0(|*rr=EeE1o~y1wyQi%)e*oX6iX@$m0F1RtKUT0vgg!8^fWhYLqS zF@EOpFld7>f^kprb~YwMq=^<e|gw?QFyf8ck|ZC^>)3c`b$^C>jCB4Fne_1e$Cqt=4Ud#K~~8Nfa91W zwk17&D?X?4FRzR+5qCiIqPf0};K4$tW$}l~A?u_E=JSe;*f_DO>r{z=U4_<)dY)M! z7O#mizC+GN&#;)k)vkBUS@fZesb{v?YuFlCPRjsT5bxB4@+sqdq}xvvBhTngZ(N1LUCS-ei=5sgE-Tbc z7HK+A_O23MP@sUoc?I?*ZB|F)&%us|2O$#G7V$6z zq>G%6!cu7OEf+_#^A=23Hd6Db9-yK*NQ#S+kjJI7 zhLiLz{>zKKtHH>H;B-cALzj`>@+-~?X2aP7ypf9WMf8q0m)wS!Nkf+&R&&zEjFOUx zlq^>v#VAq}=)?dKRMe+010g9O;qAiaTA4dV+==mw%i3Re)DwZ$Wd5CK1m4Ivy&&Ef zO8W!SpcgA>zfTGAE!{IPJMhdZ`T4{K#7ndDT8K2&*jf=J8O>H*iDJ}ZK}z|$C3U62 z$nZhk4v$QIYzMaV+0`B8S!=9RSYzi*QG#tp>ZY|lY_`}A-zI7)(tV$B9G-tC#zt8m zre~pD7oIFkmIAM=s zw+Iili%nSC?yks)t~q4lTlZW(#5^yUV@+^KvIuQzZDO^*TBz!j#nX%*uiW|{x9q0w literal 0 HcmV?d00001 diff --git a/public/stylesheets/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png b/public/stylesheets/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png new file mode 100755 index 0000000000000000000000000000000000000000..f1273672d253263b7564e9e21d69d7d9d0b337d9 GIT binary patch literal 90 zcmeAS@N?(olHy`uVBq!ia0vp^j6j^i!3HGVb)pi0l%l7LV~E7mxPQ=F85a&M@g_{ d|GeK{$Y5lo%PMu^>wln`44$rjF6*2UngE4^EGqy2 literal 0 HcmV?d00001 diff --git a/public/stylesheets/ui-lightness/images/ui-icons_222222_256x240.png b/public/stylesheets/ui-lightness/images/ui-icons_222222_256x240.png new file mode 100755 index 0000000000000000000000000000000000000000..b273ff111d219c9b9a8b96d57683d0075fb7871a GIT binary patch literal 4369 zcmd^?`8O2)_s3^phOrG}UnfiUEn8(9QW1?MNkxXVDEpFin2{xWrLx5kBC;k~GmPmYTG^FX}c% zlGE{DS1Q;~I7-6ze&TN@+F-xsI6sd%SwK#*O5K|pDRZqEy< zJg0Nd8F@!OxqElm`~U#piM22@u@8B<moyKE%ct`B(jysxK+1m?G)UyIFs1t0}L zemGR&?jGaM1YQblj?v&@0iXS#fi-VbR9zLEnHLP?xQ|=%Ihrc7^yPWR!tW$yH!zrw z#I2}_!JnT^(qk)VgJr`NGdPtT^dmQIZc%=6nTAyJDXk+^3}wUOilJuwq>s=T_!9V) zr1)DT6VQ2~rgd@!Jlrte3}}m~j}juCS`J4(d-5+e-3@EzzTJNCE2z)w(kJ90z*QE) zBtnV@4mM>jTrZZ*$01SnGov0&=A-JrX5Ge%Pce1Vj}=5YQqBD^W@n4KmFxxpFK`uH zP;(xKV+6VJ2|g+?_Lct7`uElL<&jzGS8Gfva2+=8A@#V+xsAj9|Dkg)vL5yhX@~B= zN2KZSAUD%QH`x>H+@Ou(D1~Pyv#0nc&$!1kI?IO01yw3jD0@80qvc?T*Nr8?-%rC8 z@5$|WY?Hqp`ixmEkzeJTz_`_wsSRi1%Zivd`#+T{Aib6-rf$}M8sz6v zb6ERbr-SniO2wbOv!M4)nb}6UVzoVZEh5kQWh_5x4rYy3c!871NeaM(_p=4(kbS6U#x<*k8Wg^KHs2ttCz<+pBxQ$Z zQMv;kVm5_fF_vH`Mzrq$Y&6u?j6~ftIV0Yg)Nw7JysIN_ z-_n*K_v1c&D}-1{NbBwS2h#m1y0a5RiEcYil+58$8IDh49bPnzE7R8In6P%V{2IZU z7#clr=V4yyrRe@oXNqbqo^^LvlLE?%8XaI&N(Np90-psU}7kqmbWk zZ;YBwJNnNs$~d!mx9oMGyT( znaBoj0d}gpQ^aRr?6nW)$4god*`@Uh2e+YpS@0(Mw{|z|6ko3NbTvDiCu3YO+)egL z>uW(^ahKFj>iJ-JF!^KhKQyPTznJa;xyHYwxJgr16&Wid_9)-%*mEwo{B_|M9t@S1 zf@T@q?b2Qgl!~_(Roe;fdK)y|XG0;ls;ZbT)w-aOVttk#daQcY7$cpY496H*`m@+L zeP#$&yRbBjFWv}B)|5-1v=(66M_;V1SWv6MHnO}}1=vby&9l+gaP?|pXwp0AFDe#L z&MRJ^*qX6wgxhA_`*o=LGZ>G_NTX%AKHPz4bO^R72ZYK}ale3lffDgM8H!Wrw{B7A z{?c_|dh2J*y8b04c37OmqUw;#;G<* z@nz@dV`;7&^$)e!B}cd5tl0{g(Q>5_7H^@bEJi7;fQ4B$NGZerH#Ae1#8WDTH`iB&) zC6Et3BYY#mcJxh&)b2C^{aLq~psFN)Q1SucCaBaBUr%5PYX{~-q{KGEh)*;n;?75k z=hq%i^I}rd;z-#YyI`8-OfMpWz5kgJE3I!3ean6=UZi!BxG7i(YBk? z02HM7wS0)Wni{dWbQMRtd-A)_Az!t>F;IwWf~!*)-Az4}yryNkz&9)w>ElA80Oc`6 zHo#9H!Y3*Qx9n@Jn)!w6G^hb;e_n8zpIyXCN`JFkPc)^Q?2MsLNFhMgrcZI-<#1ne zjH;KFf?4eAT9mQZ}ZfHLGA#d%s;SZK4p0FwZT2S^{ zQ2BG1xJsbK6?yrHTjJi|5C0u=!|r!?*4FL%y%3q#(d+e>b_2I9!*iI!30}42Ia0bq zUf`Z?LGSEvtz8s``Tg5o_CP(FbR0X$FlE0yCnB7suDPmI2=yOg^*2#cY9o`X z;NY-3VBHZjnVcGS){GZ98{e+lq~O$u6pEcgd0CrnIsWffN1MbCZDH<7c^hv+Z0Ucf0{w zSzi^qKuUHD9Dgp0EAGg@@$zr32dQx>N=ws`MESEsmzgT2&L;?MSTo&ky&!-JR3g~1 zPGTt515X)wr+Bx(G9lWd;@Y3^Vl}50Wb&6-Tiy;HPS0drF`rC}qYq22K4)G#AoD0X zYw$E+Bz@Zr^50MAwu@$?%f9$r4WHH?*2|67&FXFhXBrVFGmg)6?h3^-1?t;UzH0*I zNVf9wQLNLnG2@q>6CGm>&y|lC`iCFfYd}9i%+xkl^5oBJ?<;aneCfcHqJh7Yl5uLS z9Fx-(kMdcNyZejXh22N{mCw_rX1O!cOE&3>e(ZH81PR95wQC37En4O{w;{3q9n1t&;p)D%&Z%Nw$gSPa!nz8Slh7=ko2am)XARwOWw zpsz0~K!s{(dM$NB=(A=kkp>T(*yU6<_dwIx>cH4+LWl282hXa6-EUq>R3t?G2623< z*RwTN%-fgBmD{fu*ejNn)1@KG?Sg*8z3hYtkQJQjB6 zQ|x>wA=o$=O)+nLmgTXW3_6diA;b4EY{*i*R%6dO2EMg z@6g?M3rpbnfB@hOdUeb96=~I?OIA3@BWAGmTwiQ{x5Cqq<8c10L!P zd@Qk^BseTX%$Q7^s}5n%HB|)gKx}H$d8Sb$bBnq9-AglT2dGR2(+I;_fL|R4p$odJ zllfb0NqI)7=^z~qAm1V{(PkpxXsQ#4*NH9yYZ`Vf@)?#ueGgtCmGGY|9U#v|hRdg- zQ%0#cGIfXCd{Y)JB~qykO;KPvHu|5Ck&(Hn%DF~cct@}j+87xhs2ew;fLm5#2+mb| z8{9e*YI(u|gt|{x1G+U=DA3y)9s2w7@cvQ($ZJIA)x$e~5_3LKFV~ASci8W}jF&VeJoPDUy(BB>ExJpck;%;!`0AAo zAcHgcnT8%OX&UW_n|%{2B|<6Wp2MMGvd5`T2KKv;ltt_~H+w00x6+SlAD`{K4!9zx z*1?EpQ%Lwiik){3n{-+YNrT;fH_niD_Ng9|58@m8RsKFVF!6pk@qxa{BH-&8tsim0 zdAQ(GyC^9ane7_KW*#^vMIoeQdpJqmPp%%px3GIftbwESu#+vPyI*YTuJ6+4`z{s? zpkv~0x4c_PFH`-tqafw5)>4AuQ78SkZ!$8}INLK;Egr;2tS18hEO5=t;QDmZ-qu?I zG+=DN`nR72Xto{{bJp||`k}-2G;5#xg8E~xgz22)^_Z;=K|4@(E&5J)SY2of=olcw z5)@L)_Ntcm!*5nEy0M9v0`S33;pO4TN;>4(Z+19p_0>u#e-vE zXCU(6gAvu~I7Cw(xd%0e59MNLw^U37ZDbsBrj%eDCexw8a3G`nTcXVNL6{B7Hj@i& zbVB{;ApEtHk76q08DJ48dSxd$C(;$K6=FpU<~l9pVoT9arW^Vu{%Bcn4`eIpkOVC| z$)AKYG_`ypM{0@BUb3^9lqi_c?ONH|4UJMJWDowMVjacycX7}9g={O7swOB+{;+?; zjBo!9?+nd)ie#x5IbFW-zBOo0c4q@9wGVt5;pNt`=-~Zgcw#*`m($6ibxtZ`H=e=} zF#GZ~5$%AUn};8U#tRem0J(JTR}d4vR(dgK2ML~lZsPhayJ2h1%sD4FVst| zKF)+@`iNzLRjg4=K8@**0=5cE>%?FDc({I^+g9USk<8$&^qD~@%W0i4b|yMG*p4`N zh}I!ltTRI8Ex$+@V{02Br%xq#O?UlhO{r8WsaZnZCZq0MK9%AXU%MDLT;3=0A9(BV z9VxxxJd7jo$hw3q;3o?yBLmA=azBUrd9>-<_ANs0n3?-Ic*6&ytb@H~?0E(*d>T5n z-HiH2jsDf6uWhID%#n>SzOqrFCPDfUcu5QPd?<(=w6pv1BE#nsxS{n!UnC9qAha1< z;3cpZ9A-e$+Y)%b;w@!!YRA9p%Kf9IHGGg^{+p`mh;q8i7}&e@V3EQaMsItEMS&=X plT@$;k0WcB_jb;cn%_Idz4HO$QU*abf4}+wi?e96N>fbq{{i|W0@(ln literal 0 HcmV?d00001 diff --git a/public/stylesheets/ui-lightness/images/ui-icons_228ef1_256x240.png b/public/stylesheets/ui-lightness/images/ui-icons_228ef1_256x240.png new file mode 100755 index 0000000000000000000000000000000000000000..a641a371afa0fbb08ba599dc7ddf14b9bfc3c84f GIT binary patch literal 4369 zcmd^?`8O2)_s3^phOrG}UnfiUEn8(9QW1?MNkxXVDEpFin2{xWrLx5kBC;k~Gmw z<@?HsG!Qg3zaV+-xQ3ldtad!U<6iGz_enGH*2akP_r)o1D&8p^5M)_c8IIj6Wy*7HJo&CBLuo~nj>(63pZzO(Vv^ZuB3 zMYigjkwA;FEy|G}1jpiMj6|NTm7Uyiw=@FDE*nX<>jR!W@9XIyf%$Fd*J5*D0Z0Lm z9}ZQxyT|x5ftNy?V>EbJz-K>bV9gs9RaXUP<^=;e?&Fqxj;6{ieR-a-@HycA1KMKhql8GOmcxwZ?_-(3hMK^^a*(gaFvBH ziIC!fgH4$W*NbKIaY&T?%&13``KbD@S-0`xQ%v3TV+B!;RC7O!+1a9QCA$H@3tR;k z)SSoR7(s4)f{zM}eWgFN{(ZH5d1O}l)f$ruT!)Q&NImXyZsTzOf9TwctcSfr+M)aJ z5otO+$jvm-P4)ykH)x|cO5xeb>?!`qGw$(>&axqLL6yoB${vsMXgL_-bz@2J_tS92 zdvZG-+vKl@K4Vr(EL{WQt@Z+Ea-hxX0}nTSZxnpi^#Kn8Ox8FgIS|hc}KJQ4tm*HO16ui{(O9} z1YN)GjiQt6fGq`Cj+^`zUf?8hk^(T{{cOQGWFP98am}is28A!5%{R#ENv8fCN!j69 zlMEK(2z?|BY=Je$XD9mB-Kkem*(d-j^9j$2#6r$Dz?s)-TCDCGCs z8>6Pvj{Y+YIeFA@qY22V$)awy@q!9A4rgk5b9TcC;s9Ig^G|6nDP+5=Fzg&?(L=vc zCbGd>fSu~@6!94td+o#d@sid!EIX$rx7*cawe6 z`dScJ+$HssdOjE)O#Ybs56vm-FQ$7yuJJD^Zqk%hMaIgAJ<2yb_MFQte_i;62ScT$ zpjifYyR_E=rQ+>H)pmlr-Udzg*-!|ssw(D7wJvC+Sf8bb9;;q8#z?0p!!bsd{wy|5 zpBaMHE-Ve>i#LLjHRaMLtp%9&(HCng7Sw96jVv!#0k%?F^K7&=T)mnYn)D9(i;4x5 z^NJTJwq~pv;kH@#ejTd*48~(J(r6j34|m`h9fEDj0im)~+%I5XphWymhT;_Zty|Q& zzjPg#-ufAHZ1M*Gccw?Kf|8Pnhtb0`!{N`Bqsa37J+>wC$!e z00k+2Egzz;rbcWoUB%Jvp8W1}$XD%e3>4y;;OZ1ccT-O#uW6Ys@C}Pa`nZrNKzR(2 z4e%3)@QI4SE&E!lW`5y14QhbepBG%_XBV-O(%5tj)@9#|;sC-MNev!zGDHk}JdpGC`iJF#8=8-P$Xoku_=Dw%Cv3{U7L>gf zRQ?<$t`cZ*MP5GQmbmx#!+*!zu>0MewRO9GFGS{b^m_fJ-N0?j@EqoFf>$khj+E|@ z7r3We&^tR^YZrxKe*d22agXqCO0l44&kqCv{u)T|(lv`~PK@DvE z{QI_TlCH5z*gR!>LO)k67{^R+vWx24U2^2ODXpwT;6y+6+$5m)_*w4WY&#do9dCeE z)>p+Ykdhq($DhmMiaYXey!@N%L26uz($aJ!QT{B^Wu}U$^9e#5)=c+XF9@Ill?ZmM zlNgHiz*9!vDc&uxOo;ZVxb`Q!Sk0*gnfxWzmbZh4(=%CD%qP?0=);n$&zaW_$UKV9 z8axdcN#AyZ{P)wj?V{P}vM)YY!>6@}^>U+iv$`9>nMTCPjN>z%yF&3yf%>+T@0vh4 zlC8Xa6zeo?%=o3}M8{aebLHcO{^1Ar8qiM=Gquf?Jo)q5`-+?sUpg?QXyEUpWSm+n z$K-UyqkIwHLquru~o(OF)hhz$Y*|X>ZIbswnxRvr~ z2=rdOGVuD|xRlpAZE<0!X1F(%Anpl^@V^D3vbM}qxe|NI;TTiZy7(IM;R69RkA>a& z6gwYE2sREzQ_LHmWqB+ogMk(fMaSFeoDq-!HkFB_nXt5+2ncFuk9BQL1I&oB1zZi) zYW{6_&-Ip1l*OVRA##1ILQS;5R{-K^0wGTiJbVSi@LA^$D$;@J>^G{6@&+%4{b3(s zC~LEHiTv(0b#zxt?YJ0r_~pUZM~mQ(??(n#>&tD%+@nq=Abj5*8R!~Ul1`G~=qFJ4 zfl|m8ZDCYgtr`4LcOpgiJYX9qRY5;DcWti~PmS$VB$E-Zt^f4)vLDOe_3XTq5^ylW zJ9PKm!V-8sAOJXnUfuFNIf0R9tK-pNs2hO04zr620}5B(Ok>yB)Of-3sP59qfQNbm zA4{w!2@cB;GbR(~szVrbO%(w=5S!X`o@o@x++wbN_tMPT0Vc)*I;Fgsbf^*g0 z2Di?HTApwKq3+YwfNsqd3iP%{hyK1iyuVZc@*0tO_3+N0#GFsz>8MjeJ2UJ%L!%hi zGYYAthH`E+ywA*u{(eJ=ia3h*%k?779rk-K<0VZAPkl;TFUbmei|$fqWO8!_zIvqt z$ly$VrlH46nnpX~X5Yk0iBJl;=WuA4>~X4-f&K0yWf42h&0b30t@NYX$7egQ1Fp!a zbui-D6cWCWV&|R1CY@G8(qOmWjWeX3eX7UggZPGimA}soOuQdXe4uZ#2>5zN>qlI0 z9xk}lE=tNpX1m6*nFr2EQ3xs79!^sCldDJYE$m(qYv3q7>}1R7?iZW7>$~*%zKaC| z=$N?ME$>#+%T&MZC`dW1wUl6Z)JgyCn~V%K&i0H|iwE%$>xsZW3tTfZxIUePci@p;cRu|d=ItIwF z1clVHy{hH?@SD|(Zfqi^0DQ1hczHN7xq85h)rzQqLHMX2^IkuK7FB!kI40s$|CY7~ zNX^{_UjN8}L%Med;|+=4RNTMozn8KT;2tb77bUPCmioh+rZBfIiM6f_P34cQ__o1G zWqQp3VL~~pE5?qODf%iiQQ3f42YF@09tQ*$4v_EKUx;t1KCPCBtgqg z@+Tn;O)a0uky_%jm+WjNB?=~VyH>V#L!*=l*@OS6SVyt_UEH&NA=?V2stHPyKkVNy z&jg<#cjros){#ji)dK z%)We0L_478=HZ8-@xnwsKrWs8)x`MB;(Y`Cmu2c-&SH(vN-F(*e`l?c%+l$|y_AJJ zhcDGnwLvN+bu;_sX|1AiePhx@u&%P$hf*xE+O=~D?_(_KGWQ!158YL-y9$*6mmPo;Rp*Dl5lm-mVM2i`h- zM@nxv590_tvMwPD_{l=b$iOm|+|S{D9&P%zeT$GgX6Akl-tfUF>tL@Ld!B&{pN39t zH>3Vhqkr}2Yul+jb7UiouWVGPNsxX7Ueba+9|~dz?d*QM$ng0DZfO0`7fAy?2yMm| zcnRzUhZ&IcwgjH9cuU!w+VStYa{p*)4IgBf|E8)sqMYtB2KH_}SfsFq(c9i(Q6S3U oBo%DI*Kv;w;*%(i9W@e{{5C=l}o! literal 0 HcmV?d00001 diff --git a/public/stylesheets/ui-lightness/images/ui-icons_ef8c08_256x240.png b/public/stylesheets/ui-lightness/images/ui-icons_ef8c08_256x240.png new file mode 100755 index 0000000000000000000000000000000000000000..85e63e9f604ce042d59eb06a8428eeb7cb7896c9 GIT binary patch literal 4369 zcmd^?`8O2)_s3^phOrG}UnfiUEn8(9QW1?MNkxXVDEpFin2{xWrLx5kBC;k~GmC-Ajq!3AfU8Dx90^_ zp3}MKjJzYC+`T(&egFXQ#9Ek{*oVAaa!zrZtmlRFnwQPRJXH<%pkK2*eP`pT=lwD7 zifq+4BY_rUTa+U|2#&?i7>PVvD?7R4ZfOLPT{e9G~G!Ls3s8JtQE`jMM9wl2V9&Q+K2DHW0M+uQmEr%nYJ^7cK?uIpU-)=wn71ZZ-=@ar0;3^AY z5+TI{2b(e%t{2PZ^HKF*vu@+Xr&BAc@2BC4 z_vCgww#i=)ea5Vo$glEEVBBg_VPBj!)OO>)f@}#dg6ULOeC>LBHz<;*5Y;YfE0lNx zg{N+4@lO~ozxpF69qV@VOGnc248Iuag4C1T)P^(hWkpP!{h!JekX}m^Q#b2B4f1oT zIjsGz)4}-$rQ*-tSuc%qG>%<4xM#E& zN)7lRK~^2VdiloY4>;#}A!yHOAXEmEi^+eA#05pawGXs>!z)gSoDuI#>bRCq-qjJe zZ)r=A`*EMX6+)~er1kdv1L^)0-PsAEM7JF$O6G8>496$24lkOSR^RTfUuIz%iSfn5b-t!##cs7sQI);gdAvqmn_v|%I9k;fCPl0Z)R1+hNQONJN zH%3jT9sOq*a`LF*MiY=zlSSQZ;{_FL9M07A=In+O!~wR}=bzGEQpk2!Vc0p)qKAH? zOk{(%06W#)DdICQ_S%Q@<0Y+!?9%#$gWJ%)EO->^YZP{<`oB4~9xh zL9-0*c4@B#O2ylYs_g`Ky$zb~v!M`NRaMNFYF*Gsu|7)=JyyMHjFC=HhGUE@{aI|B zJ~ITXU052%7jFb5Ys#fhS_?4kqc7H0EU49B8(Chg0&JzU=Gka#xOz1)H0d4m7ZnRA z=M^tdY|U6T!fmte{W?_r8H~qdq|q{5AMU_2It1I4143n~xL?4&K#BOB48l9_Rdm!(c^C?JU;tF0 zEh@o1y6Qa_>}#AwX{VY+`C^kNkxhgb1P5cB0%xupAXyg9NO=SnXrJUE?rQg{Lcsn+ zAZKctGLfbK_B#^&Nev|0^fB&?DN=ak8|0!np524LD25=s84BP8Vl(3=jflNp{X>e@ z637Ri5xx;&JNl+XYImA|{;XR~P*svYDEWYJ6I5!6uO~2twFC1ZQevB7#3z~(apxn& z^J@>Mc`>PJair{yT`iuan-V+i%|Ho-pA<1?V-k^R2Q<5;Co%XxmL` z018t4T0TTwO^w)Gx{9OSJ^9_|kgwX`7%0Rw!PO~@?xvnfUehvN;2Rc;^l>3kfbtk3 z8{j7p;S&{uTlTe9&HTc38q@%_KQFk<&n{vmrN7y&Cz{etcE->rq!6HL)2F!aa=0%! zM%Bwo!7TQ5t;@a_#Q}sjk{UebWQZ8{cp&HN^$*JfH#8spkhk{R@CVBiPuP@yEhu{} zsQfuhTqV%rioATpEphMfhyRYbVfVW`YwLFXUWm-===J(byMf!5;W^CV1g~2194Xx) zFK|z{pm%n-)-DRe{Qhk(d!QaoI*y%Wn6h7<6A{i*Sob&B^y|Spg!&J$`kN>zwUJ3x zaB$ciu*0FJKg}T ztgnh)ASF8njz5>h6?f#{c=*Yr4W_34$GmVIo8OLWjcZK4a0`+Yv-!*}9 zBwKm;DAsA(nDI-`iH@;`=gP+m{lgFLHK3m$W@?)&dGhDA_Z2xOzI0$p(ZJtH$vCxE zj>+kYNBJzs-TlSx!tSH}%I9fQv)mc!C7X0bKlZv4f&}C3+O-4k7AmVO|KYZ9ydP%(N1^uisV8y;~p`x4qFXD?!_OyN9=w(Od6W; zGrT?G;l2v@Ob5k^8w<9w%Jbjb^|H}PYKo}I~bobd!XrTbzp2Zp~H8lgJ)I3?l&(bDiWf8gE&6b z>)9GB=Iu-6%I((+>=jGP>CzD8c0oWITFZGgM!Q7|JrUYq4#^Y(vuDu-a>OWDa4Y4} z5a_*lW#IL_aVf8L+Ty}c&2VojLEIA-;eQK6Wo?xAuK>i;1VWx3c=!s2;j_*iRHOsb*>6-CgcYP+Ho=L@XLd*j~2ln-;WHg)|cCixksH$K={5rGSD@yB%LI|(NCc8 z1Er8H+QO)~S~K{g?nH|2dB8SKs)BxQ?%G}}o*LV!NG2m*TmR|pWj~g`>)ClJCE#F$ zcj)fBg(dKOKmc$Cy}IRlasngIR>z~kP&WW~9cC951{AKmnZ~ZMsqup6QQf7J0T1;C zK9*Qd5*(HxW=tl|RfjO>nkoW#AU3t>JkuzWxy4-l?xmTv15_r1X@p@dz^{&j&;{Mq z$^0$0q&y?kbdZh)kZ+NfXfqLTG}Q^j>qHlUH4VEK`3y^-z6Y<6O88Hf4v^;}!{t-a zDWg;znYu%6zA1~A5~w?fxO~i8-Ib(^02{c4pXjhDI^2 zXB1LP4dvWuc%PXQ{r!d#6>${rm+M8EJM8yf#!H$Kp8AxwUXm5`7Tu-J$mHeCG>vw|&Ay415}_1w&*9K8+2d3v1N+@a$|820o4u60Tj@u&kI!~q2V9X; z>tMvQDI|O$#m+m2O**ZHq`_{#8)ry6`&5s~2k{O4Du16Fn0P;&_(0!e5%Bel){nU0 zJX~<8U6hoI%yx}qGY_1Tq7YKDJ)ETOCs&W)TiCrK*1%DE*vXdD-7hwE*LUgjeHRM` z&@pkhTi>m#Kc+QIK+2Ybn9-sFVKNHyIgfob4H_77yYh))Rq$7Pw|+aD6&yZ|ki9 z8Zb6s{oBt1G+PgfIcxd}{m@~1nzhe;LH)5;!gS8@ddyabpdBc?7JVl?tS+<#bPSMT z2@0uYdsWN(;Ww)n-PlA-0r+62@bYkEa`k{0s})fJgYZ#5=DmIdEvok7aZJRi{w-|} zkea&6X}ZA3b7&vbDb7)v8CuI(+zzSf3z&P2eOrPNP?D~ zf zn0@)0h;~5F&BG5vOFU!=woW&ZSl~nrs{?1w>nWfW_dnpTd z4qvLDYJ*ft>Sp%M(^_xCZpNBnc66JX}A|ZL9IENM`U>`ph7d<+RQiI}@E8Y)70s zMC*_&))}GlmR}@{v9*nm)29-=rn`Q$rc^4G)GVQHlTr6BpGxtHuU(8AF7Ffh54?5w zj+EYT9>x)PWL-iQ@RNmT?R+|c@=FOmj)5Za6_ z@DkVy4l^L>Z3#SI@s_eVwd3D)<^Ivq8a~J{|4mhOL^<7M4D8){ut;GIqqn`oqCk|x pNh;Wa$C0(mdpqYz&F>xK-uVD=DT5%Jzh8ZT#aXmjr70%*{{RacS`YvL literal 0 HcmV?d00001 diff --git a/public/stylesheets/ui-lightness/images/ui-icons_ffd27a_256x240.png b/public/stylesheets/ui-lightness/images/ui-icons_ffd27a_256x240.png new file mode 100755 index 0000000000000000000000000000000000000000..e117effa3dca24e7978cfc5f8b967f661e81044f GIT binary patch literal 4369 zcmd^?`8O2)_s3@pGmLE*`#M>&Z`mr_kcwz5Nh&g=McJ3E!;CE1E0ryV5Ro;>nvtvt zk&I==Xd;cVGZ@>q_xtnx{1u%7-D)N|5YqOB>i;(bZ#o62{J2Y9&^D3~R^$o+X? zwbxAEIb)xwCwK3TSR4QVym6N1rVgPmmt0caryBUceHP_&u}{?^Jn7f0PT$#h>UDqI zr!q(F&1jJ2_!jxdAB<)7H$foI*2zuncvu;;$SoU7br=AiJ@4=BC4vNO>DS`&UIB=K z;2)0F*t^FBvVfPuT4FVMSwUw%Xksjyl+;#*DDy%=ocFOyzDLvLR(`zCSOuJ=?FWYn z5ZD!UaoF>-$@=Vt?a&;UQYM$Oqe0ZB?Je?8ZnMxDe&uzzs*zlHd)V58nfJPc8S^({_4bj5HQ_B&EXHWj6wx@B;!mr04b_Mx)UFL)W7`V!c zpMp#C!a!!sh3h491y}^qfimXVY%!+sYu0_DWoJMqpN(FR9LM#jdZ{vJzEck`P^9(1N=4J za9%u4$2J8TAkUaJk_FX%iHuv#svL_mMmp{SR}ifc#ZcXv%CFsT?*>N^6r(%D?1YnU zAaT?UZGlOna6UXXs0m)3YDp}d%hb@)@Y!lK_A&D6{OPlNnj zYY*$b>vnRzL8=CDbQSi!DL3D!P^xhNtwrYByo?h-&OvQZYJ6ka{Re# zSc0ry_d(K$_Q2M{Y^O~DOK(szDOnMi_*h_Rx%eSRxA%n|FuC&=F=)B z_Qsgmj8g!GA+LZOX)gOW}vbo9|l8QW3iYw9qCD{o~xt^HIU>;dV5MJgc0#uHTA z80%Ee_r;G`GUjssm z*AhtwpW%Ly;X4Lq1Zq#ZpuwzrZE$sR087dN{w7PA6|Mo#6wwJP085K+h7+D>NyeX# zk|?MJ^Es)JtP-2eNr0EQe*ZM`&}OU zCD*uSSviE&p}uX|@1g_%|3*ra*MbBV#~cshdcFQ(dGLnTqaO-3{u==x1;Pp2im!#` zuZ2`ThfAmiSzb|4h`c4?^ZoGOF*oXYcV}(ge!v@^bse?daA`Ma+bSZLIg;pIN17vM zIOYfK=@s_Pj?~#lqnY2o?d1$MpoqsYQw%eX%X6Y4*^27{hMWGqILEMnVYUEMW#x7f zu^I*nzXQ@6HJ8n;26 zo^1+Ewi$fN$Unum1(FTb8I#cYgcGklwIExt#Mb(D=x~OTeZ^ubJ)S-ywfdZS?SRCq zDm=eU+CCWO@8S_m!W{alT)zj zZJbjxm5&No5xe_~Jw-i7`&G}=r)POGGfFq+c@kQbB#)ay`coj&C3- z(#&xV@Q3@VJd{qdH4g@4ZJi&mx9e@Io7@~(o5vTrkW>QEO1T-gmlTRHH+3)gcUC0P zk07rvDnf*7Y5J}8!>F_7D^Z3IoH^uGH}_a(ax{Q(IrvV$olf3WN&DY?uYZfvXI(;Vv&EAoQtfH;+4VI_a>yh*J+Cj!?h!QX?O`QXk@@G7AjloJe51Cw*rPXQ>#y?B^^ExRQFui zolmv*C5K|-p){rZiCNai^0H`1(Qr(Hz3v%7NnmriXu2tD>xsbN#*R3*wsZhRj6Lvb zn0Cu=qkC?*e4{NF_3=^bTb1f!g?@ryFH6Zw2tz%A zzz&o{w`dDv66!6Wk9w1-dglS#Sm{doxw&h5Z8&ONmlBBte{J)puaDzc!LC==rPRQK zQNH23?-rIo^MQdt3Tk!B@8l#}fxVtrlc8Y<>ORaVE($DKc{77qV^`+`%_DotrUD=8 z4}L7QnZi3RgUy*tteY-=$SqA2@IZWe(}mI`nzhAT{qC)my#rJsfoS*)xCXj!Tk6=3)cr@Jw#OcNqgS3pg7x|4!A$|w15X!huR*vB3q9Ya4 zF{xuzEQz{9YPl(gk`}Gffut%jotgqp$jZvzRO4EsExf~93vY~04AxH=lR>R3v3Qs2 zy$v4SN%ee@Kz#kDtARaQD`d!R%}#@T1=v8DAow*r>+0d1KS{ZtA~KMtgm)+$JHumW zw=;@qWk&MuG@LKx#K3@&WMw?r=jD2_)(*$LmkCm4_@};QZI|SPe8hIC6xqBy!LQyK z01_xmfNA9UlBU@Kzu7;zQYxHE>OCADA$gwaVqm`eN?XQF@NkrocB}lU4hcCf>wqir z>Ya=PcE!Xm#JG8v@G0lj&~)hScM}X57vGw3g<$^SUls53f|Bk>5FQwqE&{%u(f$!1 zl8+53vyYZ`mEEp&YT<=(krhKrw?~pS{N)?q{0qBR#2Y!w4!hWMdj`a(@A@r$zVB+u z06Hb@_9(cQ_AxbXI|-2w>#QUhp7k<+`z9+(jkh~v-Renr#C9U+&jL4vg6-E$f7@UU z(1fxB8{U2vq}h3rE!Z+n7=(>D&}@9~3mJ^R5}|WVG@!RSh3r{!>QHwg!t29YS&jiR ztyn_q*k9H0efZ7hO*b(WR|G!TDY`rol~Ob4&1OwdM8kbGj`^$~L5gdWYceWwL=PB{~NX=cu3p-{S;hqaE?bSHv$g+SA6bxy+VU3YVTPDj6CN zKLb_(9gM2Y#KW8ONxjH9To^Y)r?ql2cq8+WE438uIF$hjfdLs6-;!jv55jGcc3Ipg z;}aT32NAEGeU;J}&j5=+u`4?%xlwL7?NDn%2={4WS39yn3f;&r=|}5=M-Y2yrxeSw zv%*PmV{_{#Qk1sD>?M2KDapb~z3!E*-LPmCe9q86D%MGSe;4~~K-jKQxq6b^902_{ z%>4G>@Xqk8muR*|vGe5{@7sds2i|i;g}oMkd!o^0=HG+vcPrcN54A zLGv$PlTePRxp~-OSb_*aACO1qc{MpfS-fv(@UmRv%UO)cSt;ee@9(S)f>|~bwU@eZ z=kTS*sdjLclwMZG#?%U3)bq-uj?@@vj~6tq)ZS||Jxz`+di-M5SXM=h3EL`?pB>W9A;`V2vM)vk&%KFy|TAh#AQA zb_?J==3f@%LL{`vU$3Z@A2a9C3aC-YY43dR> pI7J0n@;b3~`)ubvsr|iU(l;L{A#E6J`}eC4usn-0uQEf&{2ws1m(ltoqJ#RmwV2==ic*rz7lOw=eaq=H~;_ux21)-Jpcgw zdj+hrf&W^f<%Qk9Zpqf#;q3n5{{POY;f!wmTR1An9(4&I0z1LNX50QSTV2M%4|y9c z#{ZQIVJKu~aY5?ZaZP*GIGqGs=e@q6o|EPhZB3CC?@LnORK8O@z{{<0KtSn5?#~OW zy=L;x8T&*%xqElS;s5~Pjk7d2bqIaA)xZbovnZd7eX17WNxx=w`p(8vulwUZ zl{so}MuRNJx5!8S5G;$o2?BApPHt+)!^#*Ww`?rcVE}mcyuY`X2o|uVUyI9o1t11O zemGWR?;aD#0$vJhiPhv~0iXS#iLq!>Qd$` zU{}<|Vb9Md>$4TMbL7C3GP#r;4Wc$}Z;^j;n}yc!E3d;`wry$!JkmJP0%(tIh!!TET8=+{rhUi^60G0t2HJSxXv-*DgC(HrJd8`|Dp3NvL5yg>xAvU zho|fEA~w^-HrW&H-JwkqNX2I-bEXBR&Uhp+y2^)1h1IIlNCzC!v-Mz@&z&VPz+cl1 z=f&f6Y*U~C`ixm4Sy1hl$hg(4%Dy;bq~k7d1<@K&%%NLT`L+A)-QXyKVswX?op90( zB#yeFEih@c{OXU8Oq~1CFI_38GXmns3(`;W(i+bslovCx4u7gvK>DrGOug*?G|1nz z_OR}|ZYS3pq-p?rS7G0qa`TM}r5XqDT4cV>%Qyk#9ES}`jc+Ww|DcbZrF6UG>CeXp zOVIV}K1e#z9@tu#?X)Ri=?zXMB`X3G-_I7FL-Zq`nbfWtX_EO1*!+U6pJW-_k&+vk zMd}THh}{(Ch_wPk(PI4vVB_KT76kGxVytLxpWg}&bHw`a3G#QzxV@ICNax&@hk3<_ zBh`Tq66G{-tCw$V{(y0v7l!tp20~@gdFXjzFbF#bJE7i>T4ux zQdrF3org^wFcnw$#bQMv@SfN3$Fuo7HnB_`2ZGB{ZqGr>%xP;2_!Q{=N-ZhU1c~^5 zdt=OO#wmcpkXJyCG?{{&n=R{Sn=Ytg;<09CH)l7TA&wkt{Q;>RrA2Ia6-QixEPLrU z%0)N$3Nh0?U825&v($Sz}0G_(!v&xSSAzje4{rup+^W@^}ByqOb95$E0sbwK*%#GP}!6`%*Z@L;&C z3^dE&>5%bWAXmP*X1 z_m}Pivs*u7@9i>qA!58fDCwj^M<1P(u^m;urVdlM@>aIf+E3-d9ZW>fc4cS7w5O3sCmKKn z+94A?VyfSBb9{}rEbCIYtXORJBCv__fnZ>?a}edaA%bP$jI?J^q0UKO!mduA8U!3b z0CJ_Js}NWQZoebapVUHP%pPOUm?1<)zd%`hzUM-Y6g1z|@@3G_kio?S0bcbjQuxJd>vU$Uyz(4*peEDSVc-G;O;% z9Y97%Tq}TRsH+oN%2u(oyC=W<9`e@&m;i;jC%L;sP(9RBDQnth3;ZMEQNFH3GEf0c zU<3RF!hNG-vCDooYFS^nPlFnv4(ElI1=vNcr42TF^uq67f{MoN>{f&>xA91r4pz5Zc&@P^i-9||`98v$Si!U@}ouZ88W zg;YL=OQ;4}UQtkpyd~lD{qWy0H|lwJXKmenz#E=*9kt$YX*X!wDk7ITlIUGWnj>a7 z<_GQR752@J)Y(U)ncu(dIit7P}oBq8x$FP85)&Nsw<#rOW z8U_x(1J)Zgm(8tZXU%+(yYcO+Z7#ZszPwa2`ygiMPayX9KondtFMRK!7x`9uWN;(f zfWW?8yOdj;GA3We0YAW92gWipn(d>zcbA+vZ_21BxF?-pfcW` zbqY??6ie(6M)p@6@WQ?Tl7 zoKrKEj|x~2yZehhMLkFRRnOC>XL&L+N;m0B{_OQ9gzzTYb!!Jct=bk?_hIpY9rOwY zMnr69R(?8EN52qR+k!~qnCYc-KmV&*d$&NY?t5cjR)V+ncMor=puTRoo?{5dH;@!* z<~RrV!+ljAN+;Qx2LraY&JWnz^|sYbZjP+Y;|pC#DuHUH+>F~x3PqTkx)=OAE0X9( z(AO6gp~AH^{nq+n)LHYDD8mQN?DDFcd!U&d4PaajzSD1~lXq3p{x=^vItrq3gD^4O z=hYS`?&C-0&KuAV>Jv}T?ba0IafL$~+bZ}p$9lwyyx=-uPN`Hpvv<)Ia>OWHa4+N4 z6zscrW$^XA32EJw^7hYtkRJr{Q8 zQ|*1pp_q6Mno|D6EX!kgSv0h0I3~ef_l%$DTFjL`0y16n%^dGNQn;2V82mqoIi9i{15vu zLq&(BTl9CInUjZlTIa>^!!HlMK3W8Sd_Ow0+E8IT?h$=55$^Z)$WYIuig=O;Lp_1Q z4wOT;XbWQ!>Mh`pdXuSo=KBba;wT!wK`Hf1Ueh04*%D7Kfj*#b~BNfvz zsbf?uiMm5-xhaQ|7Om2OrYbU>ngUM9%F5nU<65IFyu(`yZ;Vb1)=wCd!L2K?c$ezE z4IbS|^?Z>)eEp}ZfjwF)Waw?pPJ?{~*g%;efxO~Nx7dQGLWZ)cPQ*T!((W- zGm2?tM)K}7oG<0Xz<`ltWjxvE<$AH!4*R{A2~uYGr@m!vm*j+e#CE9^*}Oc#uihB| z5;#kMY2^8mrr80%*+02bDx6B{Jsch(d7kQGV7~iGTgFZBu$Pf`tNf`B2{|t7fGhIq zos0xF#l$bfxOtcGDd*MDbdKBaCKxgCEbr8JTNd_1bjWC{Ubgk z9~)9;A1&=FyIt$l!VBXfD~6VCk0fjO%QwLJ7k00RH*%I8cCqF542VzP^;`OU-_?=< zbV}OoQE)HqV`|)X5+WbgSxGWH>t+7-O;(l~Z+FJJ)sygu^+eF01#Suj+pnAcw!s>p z$-xF}c>7t9X6H$^V9hvT5H{jKv+=zzWHA0pgw8e5fZpm9vIphVq3%S4*N3%&jsY^Q zK%sSPuj=?d{ATs0o0y6#0w3%YT^@-_sTuTUwI(Q{;l3KjeAbVk#Wmi%PDxm`zoqQ~ z((<-}*FSP%5gt7uI3t1&75ne{@1^bpdW1;MMGNkSr~UAuDbB4+VQi|x(gdO^zin_) zncfs2hj8xdiiy)@vVkfkItLKvsGtJhrTb0T~tFl4Q3J!flauS==b& z6Bm!g%dDvlCf(St$kVofvH90|9yl-gmvRvcKS&Ye9DdoTK@2m}iSvC{3m%4E0 z@TJD7c1V?!URM7+t?f3)%{X(6JXg~A9TvGQyX6n(^Yt0NX;>vDPcr~mICPooLWA_` z<1A>FuXr|C)dtDr*PQt%Xs5WePWUB&gBj$zZ#BIY%?jDdpbSA-PV0`dGf^oa_Jp}Z zlrGV7oe`#B^+nPIQ`ZDJeJas=ru#=*YL#+n?Go}f33>1GsZ{TTy2bdBihj}mz*mp! zOzn%{WgLM=*CpiuKUs*GnHa{B$2siJqfNi|Z;|rH%stM*8b26kAMCYY&NHwPGtlYn z7UVx_^sgR$Z8x27foS63FCPt|gtcG_ zy#@C|!VQV~TY}G5e57qp?F4jRxqq~@h6^?-cvD>ySwVLl2m7=gERtEn>Fw_@ND%pO oiVC*mbz<%I+0K1Z`+LWvZ$3~$+A!Gm?^hpSc@||}WrmLVKLvuzv;Y7A literal 0 HcmV?d00001 diff --git a/public/stylesheets/ui-lightness/jquery-ui-1.8.13.custom.css b/public/stylesheets/ui-lightness/jquery-ui-1.8.13.custom.css new file mode 100755 index 0000000..5854273 --- /dev/null +++ b/public/stylesheets/ui-lightness/jquery-ui-1.8.13.custom.css @@ -0,0 +1,337 @@ +/* + * jQuery UI CSS Framework 1.8.13 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Theming/API + */ + +/* Layout helpers +----------------------------------*/ +.ui-helper-hidden { display: none; } +.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); } +.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; } +.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } +.ui-helper-clearfix { display: inline-block; } +/* required comment for clearfix to work in Opera \*/ +* html .ui-helper-clearfix { height:1%; } +.ui-helper-clearfix { display:block; } +/* end clearfix */ +.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); } + + +/* Interaction Cues +----------------------------------*/ +.ui-state-disabled { cursor: default !important; } + + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; } + + +/* Misc visuals +----------------------------------*/ + +/* Overlays */ +.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } +.ui-autocomplete{ background:#fff; border:solid #ccc; border-width:0 1px 1px; } + +/* + * jQuery UI CSS Framework 1.8.13 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Theming/API + * + * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Trebuchet%20MS,%20Tahoma,%20Verdana,%20Arial,%20sans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=f6a828&bgTextureHeader=12_gloss_wave.png&bgImgOpacityHeader=35&borderColorHeader=e78f08&fcHeader=ffffff&iconColorHeader=ffffff&bgColorContent=eeeeee&bgTextureContent=03_highlight_soft.png&bgImgOpacityContent=100&borderColorContent=dddddd&fcContent=333333&iconColorContent=222222&bgColorDefault=f6f6f6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=100&borderColorDefault=cccccc&fcDefault=1c94c4&iconColorDefault=ef8c08&bgColorHover=fdf5ce&bgTextureHover=02_glass.png&bgImgOpacityHover=100&borderColorHover=fbcb09&fcHover=c77405&iconColorHover=ef8c08&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=fbd850&fcActive=eb8f00&iconColorActive=ef8c08&bgColorHighlight=ffe45c&bgTextureHighlight=03_highlight_soft.png&bgImgOpacityHighlight=75&borderColorHighlight=fed22f&fcHighlight=363636&iconColorHighlight=228ef1&bgColorError=b81900&bgTextureError=08_diagonals_thick.png&bgImgOpacityError=18&borderColorError=cd0a0a&fcError=ffffff&iconColorError=ffd27a&bgColorOverlay=666666&bgTextureOverlay=08_diagonals_thick.png&bgImgOpacityOverlay=20&opacityOverlay=50&bgColorShadow=000000&bgTextureShadow=01_flat.png&bgImgOpacityShadow=10&opacityShadow=20&thicknessShadow=5px&offsetTopShadow=-5px&offsetLeftShadow=-5px&cornerRadiusShadow=5px + */ + + +/* Interaction states +----------------------------------*/ +.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #cccccc; background: #f6f6f6 url(images/ui-bg_glass_100_f6f6f6_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #1c94c4; } +.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #1c94c4; text-decoration: none; } +.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #fbcb09; background: #fdf5ce url(images/ui-bg_glass_100_fdf5ce_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #c77405; } +.ui-state-hover a, .ui-state-hover a:hover { color: #c77405; text-decoration: none; } +.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #fbd850; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #eb8f00; } +.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #eb8f00; text-decoration: none; } +.ui-widget :active { outline: none; } + +/* Interaction Cues +----------------------------------*/ +.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fed22f; background: #ffe45c url(images/ui-bg_highlight-soft_75_ffe45c_1x100.png) 50% top repeat-x; color: #363636; } +.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; } +.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #b81900 url(images/ui-bg_diagonals-thick_18_b81900_40x40.png) 50% 50% repeat; color: #ffffff; } +.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #ffffff; } +.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #ffffff; } +.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; } +.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; } +.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; } + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); } +.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); } +.ui-widget-header .ui-icon {background-image: url(images/ui-icons_ffffff_256x240.png); } +.ui-state-default .ui-icon { background-image: url(images/ui-icons_ef8c08_256x240.png); } +.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_ef8c08_256x240.png); } +.ui-state-active .ui-icon {background-image: url(images/ui-icons_ef8c08_256x240.png); } +.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_228ef1_256x240.png); } +.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_ffd27a_256x240.png); } + +/* positioning */ +.ui-icon-carat-1-n { background-position: 0 0; } +.ui-icon-carat-1-ne { background-position: -16px 0; } +.ui-icon-carat-1-e { background-position: -32px 0; } +.ui-icon-carat-1-se { background-position: -48px 0; } +.ui-icon-carat-1-s { background-position: -64px 0; } +.ui-icon-carat-1-sw { background-position: -80px 0; } +.ui-icon-carat-1-w { background-position: -96px 0; } +.ui-icon-carat-1-nw { background-position: -112px 0; } +.ui-icon-carat-2-n-s { background-position: -128px 0; } +.ui-icon-carat-2-e-w { background-position: -144px 0; } +.ui-icon-triangle-1-n { background-position: 0 -16px; } +.ui-icon-triangle-1-ne { background-position: -16px -16px; } +.ui-icon-triangle-1-e { background-position: -32px -16px; } +.ui-icon-triangle-1-se { background-position: -48px -16px; } +.ui-icon-triangle-1-s { background-position: -64px -16px; } +.ui-icon-triangle-1-sw { background-position: -80px -16px; } +.ui-icon-triangle-1-w { background-position: -96px -16px; } +.ui-icon-triangle-1-nw { background-position: -112px -16px; } +.ui-icon-triangle-2-n-s { background-position: -128px -16px; } +.ui-icon-triangle-2-e-w { background-position: -144px -16px; } +.ui-icon-arrow-1-n { background-position: 0 -32px; } +.ui-icon-arrow-1-ne { background-position: -16px -32px; } +.ui-icon-arrow-1-e { background-position: -32px -32px; } +.ui-icon-arrow-1-se { background-position: -48px -32px; } +.ui-icon-arrow-1-s { background-position: -64px -32px; } +.ui-icon-arrow-1-sw { background-position: -80px -32px; } +.ui-icon-arrow-1-w { background-position: -96px -32px; } +.ui-icon-arrow-1-nw { background-position: -112px -32px; } +.ui-icon-arrow-2-n-s { background-position: -128px -32px; } +.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; } +.ui-icon-arrow-2-e-w { background-position: -160px -32px; } +.ui-icon-arrow-2-se-nw { background-position: -176px -32px; } +.ui-icon-arrowstop-1-n { background-position: -192px -32px; } +.ui-icon-arrowstop-1-e { background-position: -208px -32px; } +.ui-icon-arrowstop-1-s { background-position: -224px -32px; } +.ui-icon-arrowstop-1-w { background-position: -240px -32px; } +.ui-icon-arrowthick-1-n { background-position: 0 -48px; } +.ui-icon-arrowthick-1-ne { background-position: -16px -48px; } +.ui-icon-arrowthick-1-e { background-position: -32px -48px; } +.ui-icon-arrowthick-1-se { background-position: -48px -48px; } +.ui-icon-arrowthick-1-s { background-position: -64px -48px; } +.ui-icon-arrowthick-1-sw { background-position: -80px -48px; } +.ui-icon-arrowthick-1-w { background-position: -96px -48px; } +.ui-icon-arrowthick-1-nw { background-position: -112px -48px; } +.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; } +.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; } +.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; } +.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; } +.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; } +.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; } +.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; } +.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; } +.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; } +.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; } +.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; } +.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; } +.ui-icon-arrowreturn-1-w { background-position: -64px -64px; } +.ui-icon-arrowreturn-1-n { background-position: -80px -64px; } +.ui-icon-arrowreturn-1-e { background-position: -96px -64px; } +.ui-icon-arrowreturn-1-s { background-position: -112px -64px; } +.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; } +.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; } +.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; } +.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; } +.ui-icon-arrow-4 { background-position: 0 -80px; } +.ui-icon-arrow-4-diag { background-position: -16px -80px; } +.ui-icon-extlink { background-position: -32px -80px; } +.ui-icon-newwin { background-position: -48px -80px; } +.ui-icon-refresh { background-position: -64px -80px; } +.ui-icon-shuffle { background-position: -80px -80px; } +.ui-icon-transfer-e-w { background-position: -96px -80px; } +.ui-icon-transferthick-e-w { background-position: -112px -80px; } +.ui-icon-folder-collapsed { background-position: 0 -96px; } +.ui-icon-folder-open { background-position: -16px -96px; } +.ui-icon-document { background-position: -32px -96px; } +.ui-icon-document-b { background-position: -48px -96px; } +.ui-icon-note { background-position: -64px -96px; } +.ui-icon-mail-closed { background-position: -80px -96px; } +.ui-icon-mail-open { background-position: -96px -96px; } +.ui-icon-suitcase { background-position: -112px -96px; } +.ui-icon-comment { background-position: -128px -96px; } +.ui-icon-person { background-position: -144px -96px; } +.ui-icon-print { background-position: -160px -96px; } +.ui-icon-trash { background-position: -176px -96px; } +.ui-icon-locked { background-position: -192px -96px; } +.ui-icon-unlocked { background-position: -208px -96px; } +.ui-icon-bookmark { background-position: -224px -96px; } +.ui-icon-tag { background-position: -240px -96px; } +.ui-icon-home { background-position: 0 -112px; } +.ui-icon-flag { background-position: -16px -112px; } +.ui-icon-calendar { background-position: -32px -112px; } +.ui-icon-cart { background-position: -48px -112px; } +.ui-icon-pencil { background-position: -64px -112px; } +.ui-icon-clock { background-position: -80px -112px; } +.ui-icon-disk { background-position: -96px -112px; } +.ui-icon-calculator { background-position: -112px -112px; } +.ui-icon-zoomin { background-position: -128px -112px; } +.ui-icon-zoomout { background-position: -144px -112px; } +.ui-icon-search { background-position: -160px -112px; } +.ui-icon-wrench { background-position: -176px -112px; } +.ui-icon-gear { background-position: -192px -112px; } +.ui-icon-heart { background-position: -208px -112px; } +.ui-icon-star { background-position: -224px -112px; } +.ui-icon-link { background-position: -240px -112px; } +.ui-icon-cancel { background-position: 0 -128px; } +.ui-icon-plus { background-position: -16px -128px; } +.ui-icon-plusthick { background-position: -32px -128px; } +.ui-icon-minus { background-position: -48px -128px; } +.ui-icon-minusthick { background-position: -64px -128px; } +.ui-icon-close { background-position: -80px -128px; } +.ui-icon-closethick { background-position: -96px -128px; } +.ui-icon-key { background-position: -112px -128px; } +.ui-icon-lightbulb { background-position: -128px -128px; } +.ui-icon-scissors { background-position: -144px -128px; } +.ui-icon-clipboard { background-position: -160px -128px; } +.ui-icon-copy { background-position: -176px -128px; } +.ui-icon-contact { background-position: -192px -128px; } +.ui-icon-image { background-position: -208px -128px; } +.ui-icon-video { background-position: -224px -128px; } +.ui-icon-script { background-position: -240px -128px; } +.ui-icon-alert { background-position: 0 -144px; } +.ui-icon-info { background-position: -16px -144px; } +.ui-icon-notice { background-position: -32px -144px; } +.ui-icon-help { background-position: -48px -144px; } +.ui-icon-check { background-position: -64px -144px; } +.ui-icon-bullet { background-position: -80px -144px; } +.ui-icon-radio-off { background-position: -96px -144px; } +.ui-icon-radio-on { background-position: -112px -144px; } +.ui-icon-pin-w { background-position: -128px -144px; } +.ui-icon-pin-s { background-position: -144px -144px; } +.ui-icon-play { background-position: 0 -160px; } +.ui-icon-pause { background-position: -16px -160px; } +.ui-icon-seek-next { background-position: -32px -160px; } +.ui-icon-seek-prev { background-position: -48px -160px; } +.ui-icon-seek-end { background-position: -64px -160px; } +.ui-icon-seek-start { background-position: -80px -160px; } +/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */ +.ui-icon-seek-first { background-position: -80px -160px; } +.ui-icon-stop { background-position: -96px -160px; } +.ui-icon-eject { background-position: -112px -160px; } +.ui-icon-volume-off { background-position: -128px -160px; } +.ui-icon-volume-on { background-position: -144px -160px; } +.ui-icon-power { background-position: 0 -176px; } +.ui-icon-signal-diag { background-position: -16px -176px; } +.ui-icon-signal { background-position: -32px -176px; } +.ui-icon-battery-0 { background-position: -48px -176px; } +.ui-icon-battery-1 { background-position: -64px -176px; } +.ui-icon-battery-2 { background-position: -80px -176px; } +.ui-icon-battery-3 { background-position: -96px -176px; } +.ui-icon-circle-plus { background-position: 0 -192px; } +.ui-icon-circle-minus { background-position: -16px -192px; } +.ui-icon-circle-close { background-position: -32px -192px; } +.ui-icon-circle-triangle-e { background-position: -48px -192px; } +.ui-icon-circle-triangle-s { background-position: -64px -192px; } +.ui-icon-circle-triangle-w { background-position: -80px -192px; } +.ui-icon-circle-triangle-n { background-position: -96px -192px; } +.ui-icon-circle-arrow-e { background-position: -112px -192px; } +.ui-icon-circle-arrow-s { background-position: -128px -192px; } +.ui-icon-circle-arrow-w { background-position: -144px -192px; } +.ui-icon-circle-arrow-n { background-position: -160px -192px; } +.ui-icon-circle-zoomin { background-position: -176px -192px; } +.ui-icon-circle-zoomout { background-position: -192px -192px; } +.ui-icon-circle-check { background-position: -208px -192px; } +.ui-icon-circlesmall-plus { background-position: 0 -208px; } +.ui-icon-circlesmall-minus { background-position: -16px -208px; } +.ui-icon-circlesmall-close { background-position: -32px -208px; } +.ui-icon-squaresmall-plus { background-position: -48px -208px; } +.ui-icon-squaresmall-minus { background-position: -64px -208px; } +.ui-icon-squaresmall-close { background-position: -80px -208px; } +.ui-icon-grip-dotted-vertical { background-position: 0 -224px; } +.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; } +.ui-icon-grip-solid-vertical { background-position: -32px -224px; } +.ui-icon-grip-solid-horizontal { background-position: -48px -224px; } +.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; } +.ui-icon-grip-diagonal-se { background-position: -80px -224px; } + + +/* Misc visuals +----------------------------------*/ + +/* Corner radius */ +.ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; } +.ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; } +.ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; } +.ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; } +.ui-corner-top { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; } +.ui-corner-bottom { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; } +.ui-corner-right { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; } +.ui-corner-left { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; } +.ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; } + +/* Overlays */ +.ui-widget-overlay { background: #666666 url(images/ui-bg_diagonals-thick_20_666666_40x40.png) 50% 50% repeat; opacity: .50;filter:Alpha(Opacity=50); } +.ui-widget-shadow { margin: -5px 0 0 -5px; padding: 5px; background: #000000 url(images/ui-bg_flat_10_000000_40x100.png) 50% 50% repeat-x; opacity: .20;filter:Alpha(Opacity=20); -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; }/* + * jQuery UI Autocomplete 1.8.13 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Autocomplete#theming + */ +.ui-autocomplete { position: absolute; cursor: default; } + +/* workarounds */ +* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */ + +/* + * jQuery UI Menu 1.8.13 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Menu#theming + */ +.ui-menu { + list-style:none; + padding: 2px; + margin: 0; + display:block; + float: left; +} +.ui-menu .ui-menu { + margin-top: -3px; +} +.ui-menu .ui-menu-item { + margin:0; + padding: 0; + zoom: 1; + float: left; + clear: left; + width: 100%; +} +.ui-menu .ui-menu-item a { + text-decoration:none; + display:block; + padding:.2em .4em; + line-height:1.5; + zoom:1; +} +.ui-menu .ui-menu-item a.ui-state-hover, +.ui-menu .ui-menu-item a.ui-state-active { + font-weight: normal; + margin: -1px; +} From 9fbe0a644cf5977cf42cd62402c660b247ba9a56 Mon Sep 17 00:00:00 2001 From: Joe Sak Date: Wed, 15 Jun 2011 11:03:38 -0500 Subject: [PATCH 173/494] changelog upkeep --- changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.md b/changelog.md index 37e0942..d583a5f 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,7 @@ * Performance boosts (cached slugs) [joemsak](https://github.com/joemsak) * More translations [cerebroso](https://github.com/cerebroso), [peresleguine](https://github.com/peresleguine) * More testing [wakeless](https://github.com/wakeless) +* Tag list autocomplete baked in [joemsak](https://github.com/joemsak) ## 1.5 [28 May 2011] From b3c06562a4a58e2cd0711f126f58d09b22c97e74 Mon Sep 17 00:00:00 2001 From: Joe Sak Date: Wed, 15 Jun 2011 11:24:40 -0500 Subject: [PATCH 174/494] you have to specify .css for some filenames --- app/views/shared/admin/_autocomplete.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/shared/admin/_autocomplete.html.erb b/app/views/shared/admin/_autocomplete.html.erb index 7a3baa1..b4898cc 100644 --- a/app/views/shared/admin/_autocomplete.html.erb +++ b/app/views/shared/admin/_autocomplete.html.erb @@ -1,4 +1,4 @@ -<% content_for :stylesheets, stylesheet_link_tag("ui-lightness/jquery-ui-1.8.13.custom") -%> +<% content_for :stylesheets, stylesheet_link_tag("ui-lightness/jquery-ui-1.8.13.custom.css") -%> <% content_for :javascripts do %> <%= javascript_include_tag "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js" %> From 07a1a81b95ff4be4b4a861496af6af6afbdf8923 Mon Sep 17 00:00:00 2001 From: Kyle Wilkinson Date: Thu, 16 Jun 2011 22:18:36 -0700 Subject: [PATCH 175/494] Add migration to add custom_url field to BlogPost. --- db/migrate/5_add_custom_url_field_to_blog_posts.rb | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 db/migrate/5_add_custom_url_field_to_blog_posts.rb diff --git a/db/migrate/5_add_custom_url_field_to_blog_posts.rb b/db/migrate/5_add_custom_url_field_to_blog_posts.rb new file mode 100644 index 0000000..5a8901e --- /dev/null +++ b/db/migrate/5_add_custom_url_field_to_blog_posts.rb @@ -0,0 +1,9 @@ +class AddCustomUrlFieldToBlogPosts < ActiveRecord::Migration + def self.up + add_column :blog_posts, :custom_url, :string + end + + def self.down + remove_column :blog_posts, :custom_url + end +end From 9320a6a608f097c8fc316b9c2a1e2a3f0bc21afb Mon Sep 17 00:00:00 2001 From: Kyle Wilkinson Date: Thu, 16 Jun 2011 22:24:49 -0700 Subject: [PATCH 176/494] Add logic to allow users to override the url for a post from just a title. --- app/models/blog_post.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/models/blog_post.rb b/app/models/blog_post.rb index 5c0101d..914e112 100644 --- a/app/models/blog_post.rb +++ b/app/models/blog_post.rb @@ -21,7 +21,7 @@ class BlogPost < ActiveRecord::Base validates :title, :presence => true, :uniqueness => true validates :body, :presence => true - has_friendly_id :title, :use_slug => true, + has_friendly_id :friendly_id_source, :use_slug => true, :default_locale => (::Refinery::I18n.default_frontend_locale rescue :en), :approximate_ascii => RefinerySetting.find_or_set(:approximate_ascii, false, :scoping => 'blog'), :strip_non_ascii => RefinerySetting.find_or_set(:strip_non_ascii, false, :scoping => 'blog') @@ -61,6 +61,10 @@ class BlogPost < ActiveRecord::Base }.compact end + def friendly_id_source + custom_url.present? ? custom_url : title + end + class << self def next current_record self.send(:with_exclusive_scope) do From ec405cdbea1d286da947b3b134dbc156b3e88f8e Mon Sep 17 00:00:00 2001 From: Kyle Wilkinson Date: Thu, 16 Jun 2011 22:47:50 -0700 Subject: [PATCH 177/494] Make blog_post custom_url field updatable. --- app/models/blog_post.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/blog_post.rb b/app/models/blog_post.rb index 914e112..a010d98 100644 --- a/app/models/blog_post.rb +++ b/app/models/blog_post.rb @@ -26,7 +26,7 @@ class BlogPost < ActiveRecord::Base :approximate_ascii => RefinerySetting.find_or_set(:approximate_ascii, false, :scoping => 'blog'), :strip_non_ascii => RefinerySetting.find_or_set(:strip_non_ascii, false, :scoping => 'blog') - attr_accessible :title, :body, :tag_list, :draft, :published_at, :browser_title, :meta_keywords, :meta_description, :user_id, :category_ids + attr_accessible :title, :body, :tag_list, :draft, :published_at, :browser_title, :meta_keywords, :meta_description, :user_id, :category_ids, :custom_url scope :by_archive, lambda { |archive_date| where(['published_at between ? and ?', archive_date.beginning_of_month, archive_date.end_of_month]) From e1390a0d72e2dc35f1306d11e1e756c138903572 Mon Sep 17 00:00:00 2001 From: Kyle Wilkinson Date: Thu, 16 Jun 2011 22:48:30 -0700 Subject: [PATCH 178/494] Add field to edit custom url on BlogPosts. --- app/views/admin/blog/posts/_form.html.erb | 9 +++++++++ config/locales/en.yml | 4 +++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/views/admin/blog/posts/_form.html.erb b/app/views/admin/blog/posts/_form.html.erb index c0467fd..abff4f2 100644 --- a/app/views/admin/blog/posts/_form.html.erb +++ b/app/views/admin/blog/posts/_form.html.erb @@ -73,6 +73,15 @@

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

    <%= f.datetime_select :published_at %> + +
    + + <%= f.label :custom_url, t('.custom_url') %> + <%= refinery_help_tag t('.custom_url_help') %> + + <%= f.text_field :custom_url, :class => "widest" %> +
    +
    <%= render :partial => '/seo_meta/form', :locals => {:form => f} %> diff --git a/config/locales/en.yml b/config/locales/en.yml index eb886a9..a4ad0fd 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -38,6 +38,8 @@ en: toggle_advanced_options: Click to access meta tag settings and menu options save_as_draft: Save as Draft published_at: Publish Date + custom_url: Custom Url + custom_url_help: Generate the url for the blog post from this text instead of the title. index: no_items_yet: 'There are no Blog Posts yet. Click "%{create}" to add your first blog post.' uncategorized: @@ -150,4 +152,4 @@ en: message: Message blog_post: title: Title - body: Body \ No newline at end of file + body: Body From 9edadabd56d97239e79076da35db37ef2ce12d8c Mon Sep 17 00:00:00 2001 From: Joe Sak Date: Fri, 17 Jun 2011 07:46:08 -0700 Subject: [PATCH 179/494] Edited changelog.md via GitHub --- changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.md b/changelog.md index d583a5f..799841f 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,7 @@ * More translations [cerebroso](https://github.com/cerebroso), [peresleguine](https://github.com/peresleguine) * More testing [wakeless](https://github.com/wakeless) * Tag list autocomplete baked in [joemsak](https://github.com/joemsak) +* Customize the URL of your blog post [wikyd](https://github.com/wikyd) ## 1.5 [28 May 2011] From ab57edba4078ed8e1ebc981080af0e9b83553ae6 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Tue, 21 Jun 2011 12:21:13 +1200 Subject: [PATCH 180/494] Fix failure on Ruby 1.8.7 where lines can't begin with a . (it has to be on the previous line) --- app/controllers/admin/blog/posts_controller.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/controllers/admin/blog/posts_controller.rb b/app/controllers/admin/blog/posts_controller.rb index 7569aa6..9fdc638 100644 --- a/app/controllers/admin/blog/posts_controller.rb +++ b/app/controllers/admin/blog/posts_controller.rb @@ -12,10 +12,9 @@ class Admin::Blog::PostsController < Admin::BaseController end def tags - @tags = BlogPost.tag_counts_on(:tags).where(["tags.name LIKE ?", "%#{params[:term].to_s.downcase}%"]) - .collect { |tag| - {:id => tag.id, :value => tag.name} - } + @tags = BlogPost.tag_counts_on(:tags).where( + ["tags.name LIKE ?", "%#{params[:term].to_s.downcase}%"] + ).map { |tag| {:id => tag.id, :value => tag.name}} render :json => @tags.flatten end From d32ae47b019ba80c6a3c9b3fdfd815e143f2542e Mon Sep 17 00:00:00 2001 From: Joe Sak Date: Mon, 20 Jun 2011 20:02:00 -0500 Subject: [PATCH 181/494] 1.6 released --- changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 799841f..84e4684 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,4 @@ -## 1.6 [UNRELEASED] +## 1.6 [20 June 2011] * Category bug fixes and cleanup [wikyd](https://github.com/wikyd) * Cleaned up deprecated code [ugisozols](https://github.com/ugisozols) * Performance boosts (cached slugs) [joemsak](https://github.com/joemsak) From 584aeecc29100a20d1ee31a100439c897f11ea86 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Tue, 21 Jun 2011 13:40:13 +1200 Subject: [PATCH 182/494] Using
    instead of
    to avoid this: https://skitch.com/parndt/ffa3d/refinery-cms-1.0-released-refinery-cms --- app/views/blog/posts/_post.html.erb | 4 ++-- app/views/blog/shared/_post.html.erb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/blog/posts/_post.html.erb b/app/views/blog/posts/_post.html.erb index e5aabdb..6d715c3 100644 --- a/app/views/blog/posts/_post.html.erb +++ b/app/views/blog/posts/_post.html.erb @@ -6,7 +6,7 @@

    <%= @blog_post.title %>

    -
    +
    <%= "#{t('blog.posts.show.by')} #{@blog_post.author.username}" if @blog_post.author.present? %>. @@ -18,7 +18,7 @@ <% end %> <% end %> -
    +
    <%= @blog_post.body.html_safe %> diff --git a/app/views/blog/shared/_post.html.erb b/app/views/blog/shared/_post.html.erb index 662d91a..e3ce714 100644 --- a/app/views/blog/shared/_post.html.erb +++ b/app/views/blog/shared/_post.html.erb @@ -2,7 +2,7 @@

    <%= link_to post.title, blog_post_url(post) %>

    -
    +
    <%= "#{t('blog.posts.show.by')} #{post.author.username}" if post.author.present? %>. @@ -18,7 +18,7 @@ <%=raw tags.collect { |tag| link_to tag, tagged_posts_path(tag.parameterize) }.to_sentence %> <% end %> -
    +
    <%= truncate(post.body, From bce2877b2a13619841c77b6de8e87d4acf7abd53 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Tue, 21 Jun 2011 13:43:22 +1200 Subject: [PATCH 183/494] Fixed migration numbering, regenerated gemspec. --- ...> 6_add_custom_url_field_to_blog_posts.rb} | 0 refinerycms-blog.gemspec | 26 ++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) rename db/migrate/{5_add_custom_url_field_to_blog_posts.rb => 6_add_custom_url_field_to_blog_posts.rb} (100%) diff --git a/db/migrate/5_add_custom_url_field_to_blog_posts.rb b/db/migrate/6_add_custom_url_field_to_blog_posts.rb similarity index 100% rename from db/migrate/5_add_custom_url_field_to_blog_posts.rb rename to db/migrate/6_add_custom_url_field_to_blog_posts.rb diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index 518ba88..32739fc 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |s| s.name = %q{refinerycms-blog} s.version = %q{1.6.0} s.description = %q{A really straightforward open source Ruby on Rails blog engine designed for integration with RefineryCMS.} - s.date = %q{2011-05-31} + s.date = %q{2011-06-21} s.summary = %q{Ruby on Rails blogging engine for RefineryCMS.} s.email = %q{info@refinerycms.com} s.homepage = %q{http://refinerycms.com/blog} @@ -92,6 +92,9 @@ Gem::Specification.new do |s| app/views/blog/shared/_posts.html.erb app/views/blog/shared/_rss_feed.html.erb app/views/blog/shared/_tags.html.erb + app/views/shared + app/views/shared/admin + app/views/shared/admin/_autocomplete.html.erb changelog.md config config/locales @@ -115,10 +118,13 @@ Gem::Specification.new do |s| db/migrate/2_add_user_id_to_blog_posts.rb db/migrate/3_acts_as_taggable_on_migration.rb db/migrate/4_create_seo_meta_for_blog.rb + db/migrate/5_add_cached_slugs.rb + db/migrate/6_add_custom_url_field_to_blog_posts.rb db/seeds db/seeds/refinerycms_blog.rb features features/authors.feature + features/category.feature features/support features/support/factories features/support/factories/blog_categories.rb @@ -127,6 +133,7 @@ Gem::Specification.new do |s| features/support/paths.rb features/support/step_definitions features/support/step_definitions/authors_steps.rb + features/support/step_definitions/category_steps.rb features/support/step_definitions/tags_steps.rb features/tags.feature lib @@ -164,6 +171,23 @@ Gem::Specification.new do |s| public/stylesheets/refinery public/stylesheets/refinery/refinerycms-blog.css public/stylesheets/refinerycms-blog.css + public/stylesheets/ui-lightness + public/stylesheets/ui-lightness/images + public/stylesheets/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png + public/stylesheets/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png + public/stylesheets/ui-lightness/images/ui-bg_flat_10_000000_40x100.png + public/stylesheets/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png + public/stylesheets/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png + public/stylesheets/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png + public/stylesheets/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png + public/stylesheets/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png + public/stylesheets/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png + public/stylesheets/ui-lightness/images/ui-icons_222222_256x240.png + public/stylesheets/ui-lightness/images/ui-icons_228ef1_256x240.png + public/stylesheets/ui-lightness/images/ui-icons_ef8c08_256x240.png + public/stylesheets/ui-lightness/images/ui-icons_ffd27a_256x240.png + public/stylesheets/ui-lightness/images/ui-icons_ffffff_256x240.png + public/stylesheets/ui-lightness/jquery-ui-1.8.13.custom.css readme.md spec spec/models From 70e8d3c49c3e1db9a2c895ad7afb2ec46671c21a Mon Sep 17 00:00:00 2001 From: Kyle Wilkinson Date: Tue, 21 Jun 2011 02:09:16 -0700 Subject: [PATCH 184/494] Add migration to create a new field on BlogPosts for custom teasers. --- db/migrate/7_add_custom_teaser_field_to_blog_posts.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 db/migrate/7_add_custom_teaser_field_to_blog_posts.rb diff --git a/db/migrate/7_add_custom_teaser_field_to_blog_posts.rb b/db/migrate/7_add_custom_teaser_field_to_blog_posts.rb new file mode 100644 index 0000000..daa4d04 --- /dev/null +++ b/db/migrate/7_add_custom_teaser_field_to_blog_posts.rb @@ -0,0 +1,10 @@ +class AddCustomTeaserFieldToBlogPosts < ActiveRecord::Migration + def self.up + add_column :blog_posts, :custom_teaser, :text + end + + def self.down + remove_column :blog_posts, :custom_teaser + end +end + From 610cd865f27c458921e76ab340de41a642823cba Mon Sep 17 00:00:00 2001 From: Kyle Wilkinson Date: Tue, 21 Jun 2011 02:48:07 -0700 Subject: [PATCH 185/494] Allow custom_teaser field to be updated via forms. --- app/models/blog_post.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/blog_post.rb b/app/models/blog_post.rb index a010d98..2126827 100644 --- a/app/models/blog_post.rb +++ b/app/models/blog_post.rb @@ -26,7 +26,7 @@ class BlogPost < ActiveRecord::Base :approximate_ascii => RefinerySetting.find_or_set(:approximate_ascii, false, :scoping => 'blog'), :strip_non_ascii => RefinerySetting.find_or_set(:strip_non_ascii, false, :scoping => 'blog') - attr_accessible :title, :body, :tag_list, :draft, :published_at, :browser_title, :meta_keywords, :meta_description, :user_id, :category_ids, :custom_url + attr_accessible :title, :body, :tag_list, :draft, :published_at, :browser_title, :meta_keywords, :meta_description, :user_id, :category_ids, :custom_url, :custom_teaser scope :by_archive, lambda { |archive_date| where(['published_at between ? and ?', archive_date.beginning_of_month, archive_date.end_of_month]) From 3c0412bfaa3c2dc3fff319af0c812f7a9fb286a3 Mon Sep 17 00:00:00 2001 From: Kyle Wilkinson Date: Tue, 21 Jun 2011 02:48:48 -0700 Subject: [PATCH 186/494] Add tab field for the custom teaser. Currently, width is set to zero for teaser editor... need to debug. --- app/views/admin/blog/posts/_form.html.erb | 8 ++++++++ app/views/admin/blog/posts/_teaser_part.html.erb | 4 ++++ 2 files changed, 12 insertions(+) create mode 100644 app/views/admin/blog/posts/_teaser_part.html.erb diff --git a/app/views/admin/blog/posts/_form.html.erb b/app/views/admin/blog/posts/_form.html.erb index abff4f2..4eb4cf4 100644 --- a/app/views/admin/blog/posts/_form.html.erb +++ b/app/views/admin/blog/posts/_form.html.erb @@ -16,6 +16,9 @@
  • <%= link_to "Body", "#page_part_body" %>
  • +
  • + <%= link_to "Teaser", "#page_part_teaser" %> +
  • <% Refinery::Blog.tabs.each_with_index do |tab, tab_index| %>
  • <%= link_to tab.name.titleize, "#custom_tab_#{tab_index}" %> @@ -31,6 +34,11 @@ :f => f, :part_index => (part_index += 1), } -%> + <%= render :partial => 'teaser_part', + :locals => { + :f => f, + :part_index => (part_index += 1), + } -%> <% Refinery::Blog.tabs.each_with_index do |tab, tab_index| %>
    <%= render :partial => tab.partial, :locals => {:f => f} %> diff --git a/app/views/admin/blog/posts/_teaser_part.html.erb b/app/views/admin/blog/posts/_teaser_part.html.erb new file mode 100644 index 0000000..22711a9 --- /dev/null +++ b/app/views/admin/blog/posts/_teaser_part.html.erb @@ -0,0 +1,4 @@ +
    + <%= f.text_area :custom_teaser, :rows => 20, :class => 'wymeditor widest' -%> +
    + From 6086e618c34aee1db1c43866539b6a3b1ccdc40f Mon Sep 17 00:00:00 2001 From: Kyle Wilkinson Date: Tue, 21 Jun 2011 02:49:28 -0700 Subject: [PATCH 187/494] Add helper for finding the teaser to display for a blog post. Use this when displaying short version of blog posts. --- app/helpers/blog_posts_helper.rb | 12 ++++++++++++ app/views/blog/shared/_post.html.erb | 4 +--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/helpers/blog_posts_helper.rb b/app/helpers/blog_posts_helper.rb index 6b4066a..1922862 100644 --- a/app/helpers/blog_posts_helper.rb +++ b/app/helpers/blog_posts_helper.rb @@ -41,4 +41,16 @@ module BlogPostsHelper def next_or_previous?(post) post.next.present? or post.prev.present? end + + def blog_post_teaser(post) + if post.custom_teaser.present? + post.custom_teaser.html_safe + else + truncate( + post.body, + :length => RefinerySetting.find_or_set(:blog_post_teaser_length, 250), + :preserve_html_tags => true + ) + end + end end diff --git a/app/views/blog/shared/_post.html.erb b/app/views/blog/shared/_post.html.erb index e3ce714..3b91930 100644 --- a/app/views/blog/shared/_post.html.erb +++ b/app/views/blog/shared/_post.html.erb @@ -21,9 +21,7 @@
  • - <%= truncate(post.body, - :length => RefinerySetting.find_or_set(:blog_post_teaser_length, 250), - :preserve_html_tags => true) %> + <%= blog_post_teaser(post) %>
    diff --git a/lib/gemspec.rb b/lib/gemspec.rb index df188fe..5508df6 100644 --- a/lib/gemspec.rb +++ b/lib/gemspec.rb @@ -24,6 +24,7 @@ Gem::Specification.new do |s| s.add_dependency 'filters_spam', '~> 0.2' s.add_dependency 'acts-as-taggable-on' s.add_dependency 'seo_meta', '~> 1.2.0.rc1' + s.add_dependency 'rails_autolink' # Development dependencies s.add_development_dependency 'refinerycms-testing', '~> 2.0.0' diff --git a/lib/refinery/blog/engine.rb b/lib/refinery/blog/engine.rb index ef21472..f67d4ab 100644 --- a/lib/refinery/blog/engine.rb +++ b/lib/refinery/blog/engine.rb @@ -1,6 +1,8 @@ module Refinery module Blog class Engine < Rails::Engine + require 'rails_autolink' + config.to_prepare do require 'refinery/blog/tabs' end diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index 24016af..46a86d3 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -5,7 +5,7 @@ Gem::Specification.new do |s| s.name = %q{refinerycms-blog} s.version = %q{2.0.0} s.description = %q{A really straightforward open source Ruby on Rails blog engine designed for integration with RefineryCMS.} - s.date = %q{2011-08-18} + s.date = %q{2011-09-04} s.summary = %q{Ruby on Rails blogging engine for RefineryCMS.} s.email = %q{info@refinerycms.com} s.homepage = %q{http://refinerycms.com/blog} @@ -14,9 +14,10 @@ Gem::Specification.new do |s| # Runtime dependencies s.add_dependency 'refinerycms-core', '~> 2.0.0' - s.add_dependency 'refinerycms-pages', '~> 2.0.0' s.add_dependency 'filters_spam', '~> 0.2' s.add_dependency 'acts-as-taggable-on' + s.add_dependency 'seo_meta', '~> 1.2.0.rc1' + s.add_dependency 'rails_autolink' # Development dependencies s.add_development_dependency 'refinerycms-testing', '~> 2.0.0' @@ -99,6 +100,9 @@ Gem::Specification.new do |s| app/models/refinery/blog_comment.rb app/models/refinery/blog_post.rb app/models/refinery/categorization.rb + app/sweepers + app/sweepers/refinery + app/sweepers/refinery/blog_sweeper.rb app/views app/views/refinery app/views/refinery/admin @@ -204,6 +208,10 @@ Gem::Specification.new do |s| script script/rails spec + spec/factories + spec/factories/blog_categories.rb + spec/factories/blog_comments.rb + spec/factories/blog_posts.rb spec/models spec/models/refinery spec/models/refinery/blog_category_spec.rb @@ -211,17 +219,18 @@ Gem::Specification.new do |s| spec/models/refinery/blog_post_spec.rb spec/rcov.opts spec/requests - spec/requests/blog_categories_spec.rb - spec/requests/blog_posts_spec.rb - spec/requests/manage_blog_posts_spec.rb + spec/requests/refinery + spec/requests/refinery/admin + spec/requests/refinery/admin/blog + spec/requests/refinery/admin/blog/comments_spec.rb + spec/requests/refinery/admin/blog/posts_spec.rb + spec/requests/refinery/blog + spec/requests/refinery/blog/categories_spec.rb + spec/requests/refinery/blog/posts_spec.rb spec/spec_helper.rb spec/support spec/support/database_cleaner.rb spec/support/devise.rb - spec/support/factories - spec/support/factories/blog_categories.rb - spec/support/factories/blog_comments.rb - spec/support/factories/blog_posts.rb spec/support/refinery.rb todo.md ) diff --git a/spec/dummy/.gitignore b/spec/dummy/.gitignore index d80f252..c698a36 100644 --- a/spec/dummy/.gitignore +++ b/spec/dummy/.gitignore @@ -31,6 +31,8 @@ public/themes/* # Public Cache public/javascripts/cache public/stylesheets/cache +public/*.html +public/refinery/cache # Vendor Cache vendor/cache diff --git a/spec/support/factories/blog_categories.rb b/spec/factories/blog_categories.rb similarity index 54% rename from spec/support/factories/blog_categories.rb rename to spec/factories/blog_categories.rb index 31ec28b..9ee4f16 100644 --- a/spec/support/factories/blog_categories.rb +++ b/spec/factories/blog_categories.rb @@ -1,5 +1,5 @@ FactoryGirl.define do - factory :blog_category, :class => 'refinery/blog_category' do + factory :blog_category, :class => Refinery::BlogCategory do sequence(:title) { |n| "Shopping #{n}" } end end diff --git a/spec/factories/blog_comments.rb b/spec/factories/blog_comments.rb new file mode 100644 index 0000000..9818c07 --- /dev/null +++ b/spec/factories/blog_comments.rb @@ -0,0 +1,19 @@ +FactoryGirl.define do + factory :blog_comment, :class => Refinery::BlogComment do + name "Joe Commenter" + sequence(:email) { |n| "person#{n}@example.com" } + body "Which one is the best for picking up new shoes?" + association :post, :factory => :blog_post + + trait :approved do + state 'approved' + end + + trait :rejected do + state 'rejected' + end + + factory :approved_comment, :traits => [:approved] + factory :rejected_comment, :traits => [:rejected] + end +end diff --git a/spec/support/factories/blog_posts.rb b/spec/factories/blog_posts.rb similarity index 85% rename from spec/support/factories/blog_posts.rb rename to spec/factories/blog_posts.rb index 4586b36..0b8b888 100644 --- a/spec/support/factories/blog_posts.rb +++ b/spec/factories/blog_posts.rb @@ -1,5 +1,5 @@ FactoryGirl.define do - factory :blog_post, :class => 'refinery/blog_post' do + factory :blog_post, :class => Refinery::BlogPost do sequence(:title) { |n| "Top #{n} Shopping Centers in Chicago" } body "These are the top ten shopping centers in Chicago. You're going to read a long blog post about them. Come to peace with it." draft false diff --git a/spec/requests/refinery/blog/posts_spec.rb b/spec/requests/refinery/blog/posts_spec.rb index eba6131..4017d03 100644 --- a/spec/requests/refinery/blog/posts_spec.rb +++ b/spec/requests/refinery/blog/posts_spec.rb @@ -5,36 +5,83 @@ module Refinery login_refinery_user context "when has blog posts" do - let(:blog_post) { FactoryGirl.create(:blog_post, :title => "Refinery CMS blog post") } + let!(:blog_post) { FactoryGirl.create(:blog_post, :title => "Refinery CMS blog post") } it "should display blog post" do visit blog_post_path(blog_post) - page.should have_content("Refinery CMS blog post") + + page.should have_content(blog_post.title) end it "should display the blog rss feed" do get blog_rss_feed_path + response.should be_success response.content_type.should eq("application/rss+xml") end end - + describe "list tagged posts" do context "when has tagged blog posts" do before(:each) do @tag_name = "chicago" @blog_post = FactoryGirl.create(:blog_post, - :title => "I Love my city", - :tag_list => @tag_name) - tag = ::Refinery::BlogPost.tag_counts_on(:tags).first - visit tagged_posts_path(tag.id, @tag_name.parameterize) + :title => "I Love my city", + :tag_list => @tag_name) + @tag = ::Refinery::BlogPost.tag_counts_on(:tags).first end it "should have one tagged post" do + visit tagged_posts_path(@tag.id, @tag_name.parameterize) + page.should have_content(@tag_name) page.should have_content(@blog_post.title) end end end + + describe "#show" do + context "when has no comments" do + let!(:blog_post) { FactoryGirl.create(:blog_post) } + + it "should display the blog post" do + visit blog_post_path(blog_post) + + page.should have_content(blog_post.title) + page.should have_content(blog_post.body) + end + end + + context "when has approved comments" do + let!(:approved_comment) { FactoryGirl.create(:approved_comment) } + + it "should display the comments" do + visit blog_post_path(approved_comment.post) + + page.should have_content(approved_comment.body) + page.should have_content("Posted by #{approved_comment.name}") + end + end + + context "when has rejected comments" do + let!(:rejected_comment) { FactoryGirl.create(:rejected_comment) } + + it "should not display the comments" do + visit blog_post_path(rejected_comment.post) + + page.should_not have_content(rejected_comment.body) + end + end + + context "when has new comments" do + let!(:blog_comment) { FactoryGirl.create(:blog_comment) } + + it "should not display the comments" do + visit blog_post_path(blog_comment.post) + + page.should_not have_content(blog_comment.body) + end + end + end end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index a3fe107..b8df592 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -6,34 +6,39 @@ def setup_environment # need to restart spork for it take effect. # Configure Rails Environment - ENV["RAILS_ENV"] ||= 'test' + ENV["RAILS_ENV"] = 'test' require File.expand_path("../dummy/config/environment.rb", __FILE__) require 'rspec/rails' require 'capybara/rspec' - require 'factory_girl' - require 'refinerycms-testing' - + Rails.backtrace_cleaner.remove_silencers! + RSpec.configure do |config| + config.mock_with :rspec + end +end + +def each_run + require 'factory_girl_rails' + require 'refinerycms-testing' + + Dir[File.expand_path("../../app/models/**/*.rb", __FILE__)].each do |model| + load model + end + Dir[ File.expand_path("../support/**/*.rb", __FILE__), File.expand_path("../factories/**/*.rb", __FILE__) ].each {|f| require f} - - RSpec.configure do |config| - config.mock_with :rspec - config.use_transactional_fixtures = false - end -end - -def each_run end # If spork is available in the Gemfile it'll be used but we don't force it. unless (begin; require 'spork'; rescue LoadError; nil end).nil? Spork.prefork do setup_environment + + ActiveSupport::Dependencies.clear end Spork.each_run do diff --git a/spec/support/database_cleaner.rb b/spec/support/database_cleaner.rb index a104c53..40acbc9 100644 --- a/spec/support/database_cleaner.rb +++ b/spec/support/database_cleaner.rb @@ -1,6 +1,8 @@ require 'database_cleaner' RSpec.configure do |config| + config.use_transactional_fixtures = false + config.before(:suite) do DatabaseCleaner.strategy = :truncation end diff --git a/spec/support/factories/blog_comments.rb b/spec/support/factories/blog_comments.rb deleted file mode 100644 index 0bb5206..0000000 --- a/spec/support/factories/blog_comments.rb +++ /dev/null @@ -1,8 +0,0 @@ -FactoryGirl.define do - factory :blog_comment, :class => 'refinery/blog_comment' do - name "Joe Commenter" - sequence(:email) { |n| "person#{n}@example.com" } - body "Which one is the best for picking up new shoes?" - association :post, :factory => :blog_post - end -end From ec6ed3f951917634496b0b7de3f575dc0c6de96f Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Sun, 4 Sep 2011 14:40:12 -0700 Subject: [PATCH 316/494] accidentally had left perform_caching set to true --- spec/dummy/config/environments/development.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/dummy/config/environments/development.rb b/spec/dummy/config/environments/development.rb index c777820..8604338 100644 --- a/spec/dummy/config/environments/development.rb +++ b/spec/dummy/config/environments/development.rb @@ -11,7 +11,7 @@ Dummy::Application.configure do # Show full error reports and disable caching config.consider_all_requests_local = true - config.action_controller.perform_caching = true + config.action_controller.perform_caching = false # Don't care if the mailer can't send config.action_mailer.raise_delivery_errors = false From 3431b15ef37ca4a685f3d4f6a80f0e069023d105 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Sun, 4 Sep 2011 14:46:45 -0700 Subject: [PATCH 317/494] fix localization string for submit button on comment --- app/views/refinery/blog/posts/_comments.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/refinery/blog/posts/_comments.html.erb b/app/views/refinery/blog/posts/_comments.html.erb index b177389..9bc0a13 100644 --- a/app/views/refinery/blog/posts/_comments.html.erb +++ b/app/views/refinery/blog/posts/_comments.html.erb @@ -34,7 +34,7 @@ <%= f.text_area :message, :rows => 6 %>
    - <%= f.submit t('.submit') %> + <%= f.submit t('submit', :scope => 'refinery.blog.posts.show') %>
    <% end %> From ba38b63370e3d1dce2f71ecdd6a30b9e9f0ecc15 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Sun, 4 Sep 2011 14:47:24 -0700 Subject: [PATCH 318/494] remove useless comment --- app/controllers/refinery/blog/posts_controller.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/controllers/refinery/blog/posts_controller.rb b/app/controllers/refinery/blog/posts_controller.rb index a22d251..3041439 100644 --- a/app/controllers/refinery/blog/posts_controller.rb +++ b/app/controllers/refinery/blog/posts_controller.rb @@ -3,7 +3,6 @@ module Refinery class PostsController < BlogController caches_page :index - # cache_sweeper Refinery::BlogSweeper, :only => [:comment] before_filter :find_all_blog_posts, :except => [:archive] before_filter :find_blog_post, :only => [:show, :comment, :update_nav] From e35e3994d5e019e7e39cc85d171a970a284c29b5 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Sun, 4 Sep 2011 14:48:35 -0700 Subject: [PATCH 319/494] convert expire_page parameters in blog sweeper from strings to url helpers --- app/sweepers/refinery/blog_sweeper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/sweepers/refinery/blog_sweeper.rb b/app/sweepers/refinery/blog_sweeper.rb index adf97fc..57a98d8 100644 --- a/app/sweepers/refinery/blog_sweeper.rb +++ b/app/sweepers/refinery/blog_sweeper.rb @@ -17,8 +17,8 @@ module Refinery private def expire_cache_for(record) - expire_page '/blog' - expire_page '/blog/feed.rss' + expire_page main_app.blog_root_path + expire_page main_app.blog_rss_feed_path end end From 4d4ae4e682954d7430ab8089ee2671638778cf78 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Sun, 4 Sep 2011 14:57:38 -0700 Subject: [PATCH 320/494] accidentally had refinerycms pointing to my local filesystem... --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 66587c9..97fac91 100644 --- a/Gemfile +++ b/Gemfile @@ -3,7 +3,7 @@ source "http://rubygems.org" gemspec ## Uncomment the following lines to develop against edge refinery -gem 'refinerycms', :path => "~/Code/refinerycms" # :git => 'git://github.com/resolve/refinerycms.git' +gem 'refinerycms', :git => 'git://github.com/resolve/refinerycms.git' gem 'awesome_nested_set', :git => 'git://github.com/collectiveidea/awesome_nested_set.git' group :development, :test do From b9c44d851e806f812c548dc0de43d3002c2d88a5 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Sun, 4 Sep 2011 15:10:00 -0700 Subject: [PATCH 321/494] use let instead of let! when we can lazily load these fixtures --- spec/requests/refinery/blog/posts_spec.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/requests/refinery/blog/posts_spec.rb b/spec/requests/refinery/blog/posts_spec.rb index 4017d03..7c5a90f 100644 --- a/spec/requests/refinery/blog/posts_spec.rb +++ b/spec/requests/refinery/blog/posts_spec.rb @@ -42,7 +42,7 @@ module Refinery describe "#show" do context "when has no comments" do - let!(:blog_post) { FactoryGirl.create(:blog_post) } + let(:blog_post) { FactoryGirl.create(:blog_post) } it "should display the blog post" do visit blog_post_path(blog_post) @@ -53,7 +53,7 @@ module Refinery end context "when has approved comments" do - let!(:approved_comment) { FactoryGirl.create(:approved_comment) } + let(:approved_comment) { FactoryGirl.create(:approved_comment) } it "should display the comments" do visit blog_post_path(approved_comment.post) @@ -64,7 +64,7 @@ module Refinery end context "when has rejected comments" do - let!(:rejected_comment) { FactoryGirl.create(:rejected_comment) } + let(:rejected_comment) { FactoryGirl.create(:rejected_comment) } it "should not display the comments" do visit blog_post_path(rejected_comment.post) @@ -74,7 +74,7 @@ module Refinery end context "when has new comments" do - let!(:blog_comment) { FactoryGirl.create(:blog_comment) } + let(:blog_comment) { FactoryGirl.create(:blog_comment) } it "should not display the comments" do visit blog_post_path(blog_comment.post) From 88556fe7090c60e685d69ad14858594d03cb780a Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Sun, 4 Sep 2011 15:54:51 -0700 Subject: [PATCH 322/494] Revert sweeper's expiration parameter to strings for now --- app/sweepers/refinery/blog_sweeper.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/sweepers/refinery/blog_sweeper.rb b/app/sweepers/refinery/blog_sweeper.rb index 57a98d8..ceed5fa 100644 --- a/app/sweepers/refinery/blog_sweeper.rb +++ b/app/sweepers/refinery/blog_sweeper.rb @@ -17,8 +17,9 @@ module Refinery private def expire_cache_for(record) - expire_page main_app.blog_root_path - expire_page main_app.blog_rss_feed_path + # TODO: Convert these to url helpers + expire_page '/blog' + expire_page '/blog/feed.rss' end end From 6be013e0c00d8ab965ff9a7933547bfb33eaebc8 Mon Sep 17 00:00:00 2001 From: Michael Gall Date: Mon, 5 Sep 2011 15:54:57 +1000 Subject: [PATCH 323/494] Second commit for ::Refinery::AdminController --- app/controllers/refinery/admin/blog/categories_controller.rb | 2 +- app/controllers/refinery/admin/blog/comments_controller.rb | 2 +- app/controllers/refinery/admin/blog/posts_controller.rb | 2 +- app/controllers/refinery/admin/blog/settings_controller.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/refinery/admin/blog/categories_controller.rb b/app/controllers/refinery/admin/blog/categories_controller.rb index 7196e8f..12f22ce 100644 --- a/app/controllers/refinery/admin/blog/categories_controller.rb +++ b/app/controllers/refinery/admin/blog/categories_controller.rb @@ -1,7 +1,7 @@ module Refinery module Admin module Blog - class CategoriesController < ::Admin::BaseController + class CategoriesController < ::Refinery::AdminController crudify :'refinery/blog_category', :title_attribute => :title, diff --git a/app/controllers/refinery/admin/blog/comments_controller.rb b/app/controllers/refinery/admin/blog/comments_controller.rb index f14e8eb..a3df235 100644 --- a/app/controllers/refinery/admin/blog/comments_controller.rb +++ b/app/controllers/refinery/admin/blog/comments_controller.rb @@ -1,7 +1,7 @@ module Refinery module Admin module Blog - class CommentsController < ::Admin::BaseController + class CommentsController < ::Refinery::AdminController cache_sweeper Refinery::BlogSweeper diff --git a/app/controllers/refinery/admin/blog/posts_controller.rb b/app/controllers/refinery/admin/blog/posts_controller.rb index 17ebe87..0fb49ee 100644 --- a/app/controllers/refinery/admin/blog/posts_controller.rb +++ b/app/controllers/refinery/admin/blog/posts_controller.rb @@ -1,7 +1,7 @@ module Refinery module Admin module Blog - class PostsController < ::Admin::BaseController + class PostsController < ::Refinery::AdminController cache_sweeper Refinery::BlogSweeper diff --git a/app/controllers/refinery/admin/blog/settings_controller.rb b/app/controllers/refinery/admin/blog/settings_controller.rb index 469a1dc..1894ac6 100644 --- a/app/controllers/refinery/admin/blog/settings_controller.rb +++ b/app/controllers/refinery/admin/blog/settings_controller.rb @@ -1,7 +1,7 @@ module Refinery module Admin module Blog - class SettingsController < ::Admin::BaseController + class SettingsController < ::Refinery::AdminController def notification_recipients @recipients = Refinery::BlogComment::Notification.recipients From 20cffcee84c407a40943f616db0aa3678b45a19f Mon Sep 17 00:00:00 2001 From: Marek Date: Sun, 11 Sep 2011 00:10:07 +0200 Subject: [PATCH 324/494] canonical tag for posts --- app/controllers/blog/posts_controller.rb | 34 +++++++++++++----------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/app/controllers/blog/posts_controller.rb b/app/controllers/blog/posts_controller.rb index edac5ab..5ec6ec1 100644 --- a/app/controllers/blog/posts_controller.rb +++ b/app/controllers/blog/posts_controller.rb @@ -9,7 +9,7 @@ module Blog def index # Rss feeders are greedy. Let's give them every blog post instead of paginating. - (@blog_posts = BlogPost.live.includes(:comments, :categories).all) if request.format.rss? + (@blog_posts = BlogPost.live.includes(:comments, :categories).all) if request.format.rss? respond_with (@blog_posts) do |format| format.html format.rss @@ -18,6 +18,7 @@ module Blog def show @blog_comment = BlogComment.new + @canonical = url_for(:locale => ::Refinery::I18n.default_frontend_locale) if canonical? respond_with (@blog_post) do |format| format.html { present(@blog_post) } @@ -41,7 +42,7 @@ module Blog else flash[:notice] = t('thank_you', :scope => 'blog.posts.comments') redirect_to blog_post_url(params[:id], - :anchor => "comment-#{@blog_comment.to_param}") + :anchor => "comment-#{@blog_comment.to_param}") end else render :action => 'show' @@ -54,17 +55,17 @@ module Blog @archive_date = Time.parse(date) @date_title = @archive_date.strftime('%B %Y') @blog_posts = BlogPost.live.by_archive(@archive_date).paginate({ - :page => params[:page], - :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10) - }) + :page => params[:page], + :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10) + }) else date = "01/#{params[:year]}" @archive_date = Time.parse(date) @date_title = @archive_date.strftime('%Y') @blog_posts = BlogPost.live.by_year(@archive_date).paginate({ - :page => params[:page], - :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10) - }) + :page => params[:page], + :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10) + }) end respond_with (@blog_posts) end @@ -73,12 +74,12 @@ module Blog @tag = ActsAsTaggableOn::Tag.find(params[:tag_id]) @tag_name = @tag.name @blog_posts = BlogPost.tagged_with(@tag_name).paginate({ - :page => params[:page], - :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10) - }) + :page => params[:page], + :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10) + }) end - protected + protected def find_blog_post unless (@blog_post = BlogPost.find(params[:id])).try(:live?) @@ -92,14 +93,17 @@ module Blog def find_all_blog_posts @blog_posts = BlogPost.live.includes(:comments, :categories).paginate({ - :page => params[:page], - :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10) - }) + :page => params[:page], + :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10) + }) end def find_tags @tags = BlogPost.tag_counts_on(:tags) end + def canonical? + ::Refinery.i18n_enabled? && ::Refinery::I18n.default_frontend_locale != ::Refinery::I18n.current_frontend_locale + end end end \ No newline at end of file From c1903f5797300202f15a4cd34ec7ded9c9f4fd9d Mon Sep 17 00:00:00 2001 From: Marek Date: Sun, 11 Sep 2011 01:53:01 +0200 Subject: [PATCH 325/494] fix corrupted indentation --- app/controllers/blog/posts_controller.rb | 32 ++++++++++++------------ 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/app/controllers/blog/posts_controller.rb b/app/controllers/blog/posts_controller.rb index 5ec6ec1..7eb167d 100644 --- a/app/controllers/blog/posts_controller.rb +++ b/app/controllers/blog/posts_controller.rb @@ -19,7 +19,7 @@ module Blog def show @blog_comment = BlogComment.new @canonical = url_for(:locale => ::Refinery::I18n.default_frontend_locale) if canonical? - + respond_with (@blog_post) do |format| format.html { present(@blog_post) } format.js { render :partial => 'post', :layout => false } @@ -42,7 +42,7 @@ module Blog else flash[:notice] = t('thank_you', :scope => 'blog.posts.comments') redirect_to blog_post_url(params[:id], - :anchor => "comment-#{@blog_comment.to_param}") + :anchor => "comment-#{@blog_comment.to_param}") end else render :action => 'show' @@ -55,17 +55,17 @@ module Blog @archive_date = Time.parse(date) @date_title = @archive_date.strftime('%B %Y') @blog_posts = BlogPost.live.by_archive(@archive_date).paginate({ - :page => params[:page], - :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10) - }) + :page => params[:page], + :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10) + }) else date = "01/#{params[:year]}" @archive_date = Time.parse(date) @date_title = @archive_date.strftime('%Y') @blog_posts = BlogPost.live.by_year(@archive_date).paginate({ - :page => params[:page], - :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10) - }) + :page => params[:page], + :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10) + }) end respond_with (@blog_posts) end @@ -74,12 +74,12 @@ module Blog @tag = ActsAsTaggableOn::Tag.find(params[:tag_id]) @tag_name = @tag.name @blog_posts = BlogPost.tagged_with(@tag_name).paginate({ - :page => params[:page], - :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10) - }) + :page => params[:page], + :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10) + }) end - protected + protected def find_blog_post unless (@blog_post = BlogPost.find(params[:id])).try(:live?) @@ -93,15 +93,15 @@ module Blog def find_all_blog_posts @blog_posts = BlogPost.live.includes(:comments, :categories).paginate({ - :page => params[:page], - :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10) - }) + :page => params[:page], + :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10) + }) end def find_tags @tags = BlogPost.tag_counts_on(:tags) end - + def canonical? ::Refinery.i18n_enabled? && ::Refinery::I18n.default_frontend_locale != ::Refinery::I18n.current_frontend_locale end From 65cb81b4c0ba29bf95b878c0d669b2dfd5b75fa7 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Wed, 14 Sep 2011 16:25:50 -0700 Subject: [PATCH 326/494] Change current_user to current_refinery_user Fixes for https://github.com/resolve/refinerycms/commit/8294a86c13943fcd9bb966341ecfa250ae4aeaf0 --- app/controllers/refinery/admin/blog/posts_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/refinery/admin/blog/posts_controller.rb b/app/controllers/refinery/admin/blog/posts_controller.rb index 0fb49ee..62b6949 100644 --- a/app/controllers/refinery/admin/blog/posts_controller.rb +++ b/app/controllers/refinery/admin/blog/posts_controller.rb @@ -47,7 +47,7 @@ module Refinery if Refinery::BlogPost.column_names.include?("user_id") params[:blog_post].merge!({ - :user_id => current_user.id + :user_id => current_refinery_user.id }) end From 66b445ad5cf7ccb8f0c2523ff0262bf2dc0b58af Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Fri, 16 Sep 2011 18:24:34 -0700 Subject: [PATCH 327/494] Remove jquery include - now handled by asset pipeline --- app/views/refinery/blog/posts/show.html.erb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/views/refinery/blog/posts/show.html.erb b/app/views/refinery/blog/posts/show.html.erb index 3f5cf07..020c964 100644 --- a/app/views/refinery/blog/posts/show.html.erb +++ b/app/views/refinery/blog/posts/show.html.erb @@ -13,7 +13,6 @@ <%= render :partial => "/refinery/content_page", :locals => { :remove_automatic_sections => true } %> <% content_for :stylesheets, stylesheet_link_tag('refinery/blog/frontend') %> -<% content_for :before_javascript_libraries, jquery_include_tags(:jquery_ui => false) %> <% content_for :javascripts do %> <%# enable AJAX'd post nav at your own risk until html5 history API implemented. %> <%#= javascript_include_tag('refinery/blog/frontend') %> From d37ef11f63904b0daa0dcf240dd5a55025423af3 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Mon, 19 Sep 2011 15:35:47 -0700 Subject: [PATCH 328/494] Abstract filter methods into controller helpers This will enable users to include the controller helper into their own controllers to perform common functions - such as finding a blog post or listing all blog posts. --- .../refinery/blog/posts_controller.rb | 23 ++------------- app/controllers/refinery/blog_controller.rb | 7 ++--- .../refinery/blog_controller_helper.rb | 28 +++++++++++++++++++ 3 files changed, 32 insertions(+), 26 deletions(-) create mode 100644 app/helpers/refinery/blog_controller_helper.rb diff --git a/app/controllers/refinery/blog/posts_controller.rb b/app/controllers/refinery/blog/posts_controller.rb index 3041439..a885d18 100644 --- a/app/controllers/refinery/blog/posts_controller.rb +++ b/app/controllers/refinery/blog/posts_controller.rb @@ -1,6 +1,8 @@ module Refinery module Blog class PostsController < BlogController + + include BlogControllerHelper caches_page :index @@ -71,27 +73,6 @@ module Refinery @tag_name = @tag.name @blog_posts = Refinery::BlogPost.tagged_with(@tag_name).page(params[:page]) end - - protected - - def find_blog_post - unless (@blog_post = Refinery::BlogPost.find(params[:id])).try(:live?) - if refinery_user? and current_user.authorized_plugins.include?("refinerycms_blog") - @blog_post = Refinery::BlogPost.find(params[:id]) - else - error_404 - end - end - end - - def find_all_blog_posts - @blog_posts = Refinery::BlogPost.live.includes(:comments, :categories).page(params[:page]) - end - - def find_tags - @tags = Refinery::BlogPost.tag_counts_on(:tags) - end - end end end diff --git a/app/controllers/refinery/blog_controller.rb b/app/controllers/refinery/blog_controller.rb index cbafdeb..b875b44 100644 --- a/app/controllers/refinery/blog_controller.rb +++ b/app/controllers/refinery/blog_controller.rb @@ -1,5 +1,7 @@ module Refinery class BlogController < ::ApplicationController + + include BlogControllerHelper helper :'refinery/blog_posts' before_filter :find_page, :find_all_blog_categories @@ -9,10 +11,5 @@ module Refinery def find_page @page = Refinery::Page.find_by_link_url("/blog") end - - def find_all_blog_categories - @blog_categories = Refinery::BlogCategory.all - end - end end diff --git a/app/helpers/refinery/blog_controller_helper.rb b/app/helpers/refinery/blog_controller_helper.rb new file mode 100644 index 0000000..2edc2f6 --- /dev/null +++ b/app/helpers/refinery/blog_controller_helper.rb @@ -0,0 +1,28 @@ +module Refinery + module BlogControllerHelper + + protected + + def find_blog_post + unless (@blog_post = Refinery::BlogPost.find(params[:id])).try(:live?) + if refinery_user? and current_user.authorized_plugins.include?("refinerycms_blog") + @blog_post = Refinery::BlogPost.find(params[:id]) + else + error_404 + end + end + end + + def find_all_blog_posts + @blog_posts = Refinery::BlogPost.live.includes(:comments, :categories).page(params[:page]) + end + + def find_tags + @tags = Refinery::BlogPost.tag_counts_on(:tags) + end + + def find_all_blog_categories + @blog_categories = Refinery::BlogCategory.all + end + end +end From c40eb83af3c85e15314fab75cf66e2ffe3ab2ed7 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Mon, 19 Sep 2011 18:35:58 -0700 Subject: [PATCH 329/494] remove duplicate BlogControllerHelper include --- app/controllers/refinery/blog/posts_controller.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/controllers/refinery/blog/posts_controller.rb b/app/controllers/refinery/blog/posts_controller.rb index a885d18..ad576a5 100644 --- a/app/controllers/refinery/blog/posts_controller.rb +++ b/app/controllers/refinery/blog/posts_controller.rb @@ -1,8 +1,6 @@ module Refinery module Blog class PostsController < BlogController - - include BlogControllerHelper caches_page :index From de4cc6b9efdba3e1eeb398f01a46331b80895314 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Mon, 19 Sep 2011 18:43:09 -0700 Subject: [PATCH 330/494] Namespace BlogControllerHelper to Blog::ControllerHelper --- app/controllers/refinery/blog_controller.rb | 2 +- .../refinery/blog/controller_helper.rb | 30 +++++++++++++++++++ .../refinery/blog_controller_helper.rb | 28 ----------------- 3 files changed, 31 insertions(+), 29 deletions(-) create mode 100644 app/helpers/refinery/blog/controller_helper.rb delete mode 100644 app/helpers/refinery/blog_controller_helper.rb diff --git a/app/controllers/refinery/blog_controller.rb b/app/controllers/refinery/blog_controller.rb index b875b44..314c919 100644 --- a/app/controllers/refinery/blog_controller.rb +++ b/app/controllers/refinery/blog_controller.rb @@ -1,7 +1,7 @@ module Refinery class BlogController < ::ApplicationController - include BlogControllerHelper + include Blog::ControllerHelper helper :'refinery/blog_posts' before_filter :find_page, :find_all_blog_categories diff --git a/app/helpers/refinery/blog/controller_helper.rb b/app/helpers/refinery/blog/controller_helper.rb new file mode 100644 index 0000000..74a189b --- /dev/null +++ b/app/helpers/refinery/blog/controller_helper.rb @@ -0,0 +1,30 @@ +module Refinery + module Blog + module ControllerHelper + + protected + + def find_blog_post + unless (@blog_post = Refinery::BlogPost.find(params[:id])).try(:live?) + if refinery_user? and current_user.authorized_plugins.include?("refinerycms_blog") + @blog_post = Refinery::BlogPost.find(params[:id]) + else + error_404 + end + end + end + + def find_all_blog_posts + @blog_posts = Refinery::BlogPost.live.includes(:comments, :categories).page(params[:page]) + end + + def find_tags + @tags = Refinery::BlogPost.tag_counts_on(:tags) + end + + def find_all_blog_categories + @blog_categories = Refinery::BlogCategory.all + end + end + end +end diff --git a/app/helpers/refinery/blog_controller_helper.rb b/app/helpers/refinery/blog_controller_helper.rb deleted file mode 100644 index 2edc2f6..0000000 --- a/app/helpers/refinery/blog_controller_helper.rb +++ /dev/null @@ -1,28 +0,0 @@ -module Refinery - module BlogControllerHelper - - protected - - def find_blog_post - unless (@blog_post = Refinery::BlogPost.find(params[:id])).try(:live?) - if refinery_user? and current_user.authorized_plugins.include?("refinerycms_blog") - @blog_post = Refinery::BlogPost.find(params[:id]) - else - error_404 - end - end - end - - def find_all_blog_posts - @blog_posts = Refinery::BlogPost.live.includes(:comments, :categories).page(params[:page]) - end - - def find_tags - @tags = Refinery::BlogPost.tag_counts_on(:tags) - end - - def find_all_blog_categories - @blog_categories = Refinery::BlogCategory.all - end - end -end From be7d341532c0e5fc92d2822eea924956ab704d54 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Mon, 19 Sep 2011 18:48:29 -0700 Subject: [PATCH 331/494] Namespace BlogController into Blog::BaseController --- .../refinery/blog/base_controller.rb | 17 +++++++++++++++++ .../refinery/blog/categories_controller.rb | 2 +- .../refinery/blog/posts_controller.rb | 2 +- app/controllers/refinery/blog_controller.rb | 15 --------------- 4 files changed, 19 insertions(+), 17 deletions(-) create mode 100644 app/controllers/refinery/blog/base_controller.rb delete mode 100644 app/controllers/refinery/blog_controller.rb diff --git a/app/controllers/refinery/blog/base_controller.rb b/app/controllers/refinery/blog/base_controller.rb new file mode 100644 index 0000000..7010283 --- /dev/null +++ b/app/controllers/refinery/blog/base_controller.rb @@ -0,0 +1,17 @@ +module Refinery + module Blog + class BaseController < ::ApplicationController + + include ControllerHelper + + helper :'refinery/blog_posts' + before_filter :find_page, :find_all_blog_categories + + protected + + def find_page + @page = Refinery::Page.find_by_link_url("/blog") + end + end + end +end diff --git a/app/controllers/refinery/blog/categories_controller.rb b/app/controllers/refinery/blog/categories_controller.rb index 57196c3..80e54d9 100644 --- a/app/controllers/refinery/blog/categories_controller.rb +++ b/app/controllers/refinery/blog/categories_controller.rb @@ -1,6 +1,6 @@ module Refinery module Blog - class CategoriesController < BlogController + class CategoriesController < BaseController def show @category = Refinery::BlogCategory.find(params[:id]) diff --git a/app/controllers/refinery/blog/posts_controller.rb b/app/controllers/refinery/blog/posts_controller.rb index ad576a5..7b09329 100644 --- a/app/controllers/refinery/blog/posts_controller.rb +++ b/app/controllers/refinery/blog/posts_controller.rb @@ -1,6 +1,6 @@ module Refinery module Blog - class PostsController < BlogController + class PostsController < BaseController caches_page :index diff --git a/app/controllers/refinery/blog_controller.rb b/app/controllers/refinery/blog_controller.rb deleted file mode 100644 index 314c919..0000000 --- a/app/controllers/refinery/blog_controller.rb +++ /dev/null @@ -1,15 +0,0 @@ -module Refinery - class BlogController < ::ApplicationController - - include Blog::ControllerHelper - - helper :'refinery/blog_posts' - before_filter :find_page, :find_all_blog_categories - - protected - - def find_page - @page = Refinery::Page.find_by_link_url("/blog") - end - end -end From 362088d0272d6d61824b0539e201356cf9219dc0 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Mon, 19 Sep 2011 18:50:38 -0700 Subject: [PATCH 332/494] Fix indent on protected methods --- .../refinery/blog/controller_helper.rb | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/app/helpers/refinery/blog/controller_helper.rb b/app/helpers/refinery/blog/controller_helper.rb index 74a189b..2b2add4 100644 --- a/app/helpers/refinery/blog/controller_helper.rb +++ b/app/helpers/refinery/blog/controller_helper.rb @@ -4,27 +4,27 @@ module Refinery protected - def find_blog_post - unless (@blog_post = Refinery::BlogPost.find(params[:id])).try(:live?) - if refinery_user? and current_user.authorized_plugins.include?("refinerycms_blog") - @blog_post = Refinery::BlogPost.find(params[:id]) - else - error_404 - end + def find_blog_post + unless (@blog_post = Refinery::BlogPost.find(params[:id])).try(:live?) + if refinery_user? and current_user.authorized_plugins.include?("refinerycms_blog") + @blog_post = Refinery::BlogPost.find(params[:id]) + else + error_404 end end - - def find_all_blog_posts - @blog_posts = Refinery::BlogPost.live.includes(:comments, :categories).page(params[:page]) - end + end + + def find_all_blog_posts + @blog_posts = Refinery::BlogPost.live.includes(:comments, :categories).page(params[:page]) + end - def find_tags - @tags = Refinery::BlogPost.tag_counts_on(:tags) - end - - def find_all_blog_categories - @blog_categories = Refinery::BlogCategory.all - end + def find_tags + @tags = Refinery::BlogPost.tag_counts_on(:tags) + end + + def find_all_blog_categories + @blog_categories = Refinery::BlogCategory.all + end end end end From 1b51e2343d477d2065c016d77ef73d527cb37b0e Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Mon, 19 Sep 2011 18:57:17 -0700 Subject: [PATCH 333/494] setting indentation to 'rails way' for protected and private classes --- .../refinery/blog/base_controller.rb | 6 ++-- .../refinery/blog/controller_helper.rb | 36 +++++++++---------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/app/controllers/refinery/blog/base_controller.rb b/app/controllers/refinery/blog/base_controller.rb index 7010283..01892d1 100644 --- a/app/controllers/refinery/blog/base_controller.rb +++ b/app/controllers/refinery/blog/base_controller.rb @@ -9,9 +9,9 @@ module Refinery protected - def find_page - @page = Refinery::Page.find_by_link_url("/blog") - end + def find_page + @page = Refinery::Page.find_by_link_url("/blog") + end end end end diff --git a/app/helpers/refinery/blog/controller_helper.rb b/app/helpers/refinery/blog/controller_helper.rb index 2b2add4..74a189b 100644 --- a/app/helpers/refinery/blog/controller_helper.rb +++ b/app/helpers/refinery/blog/controller_helper.rb @@ -4,27 +4,27 @@ module Refinery protected - def find_blog_post - unless (@blog_post = Refinery::BlogPost.find(params[:id])).try(:live?) - if refinery_user? and current_user.authorized_plugins.include?("refinerycms_blog") - @blog_post = Refinery::BlogPost.find(params[:id]) - else - error_404 + def find_blog_post + unless (@blog_post = Refinery::BlogPost.find(params[:id])).try(:live?) + if refinery_user? and current_user.authorized_plugins.include?("refinerycms_blog") + @blog_post = Refinery::BlogPost.find(params[:id]) + else + error_404 + end end end - end - - def find_all_blog_posts - @blog_posts = Refinery::BlogPost.live.includes(:comments, :categories).page(params[:page]) - end - - def find_tags - @tags = Refinery::BlogPost.tag_counts_on(:tags) - end - def find_all_blog_categories - @blog_categories = Refinery::BlogCategory.all - end + def find_all_blog_posts + @blog_posts = Refinery::BlogPost.live.includes(:comments, :categories).page(params[:page]) + end + + def find_tags + @tags = Refinery::BlogPost.tag_counts_on(:tags) + end + + def find_all_blog_categories + @blog_categories = Refinery::BlogCategory.all + end end end end From df0664b1420f03d8cdd3f7b6960a0e542a7eb374 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Mon, 19 Sep 2011 19:11:40 -0700 Subject: [PATCH 334/494] Update gemspec [ci skip] --- refinerycms-blog.gemspec | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index 46a86d3..50b431b 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -5,7 +5,7 @@ Gem::Specification.new do |s| s.name = %q{refinerycms-blog} s.version = %q{2.0.0} s.description = %q{A really straightforward open source Ruby on Rails blog engine designed for integration with RefineryCMS.} - s.date = %q{2011-09-04} + s.date = %q{2011-09-19} s.summary = %q{Ruby on Rails blogging engine for RefineryCMS.} s.email = %q{info@refinerycms.com} s.homepage = %q{http://refinerycms.com/blog} @@ -82,11 +82,13 @@ Gem::Specification.new do |s| app/controllers/refinery/admin/blog/posts_controller.rb app/controllers/refinery/admin/blog/settings_controller.rb app/controllers/refinery/blog + app/controllers/refinery/blog/base_controller.rb app/controllers/refinery/blog/categories_controller.rb app/controllers/refinery/blog/posts_controller.rb - app/controllers/refinery/blog_controller.rb app/helpers app/helpers/refinery + app/helpers/refinery/blog + app/helpers/refinery/blog/controller_helper.rb app/helpers/refinery/blog_posts_helper.rb app/mailers app/mailers/refinery From 5e91670a80f3f4ed50f54d3d8fdf2709d981e9c8 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Wed, 21 Sep 2011 00:56:54 -0700 Subject: [PATCH 335/494] Fix draft preview of blog posts --- .../refinery/blog/controller_helper.rb | 2 +- app/views/refinery/blog/posts/_post.html.erb | 2 +- spec/factories/blog_posts.rb | 4 ++++ spec/requests/refinery/blog/posts_spec.rb | 22 +++++++++++++++++++ 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/app/helpers/refinery/blog/controller_helper.rb b/app/helpers/refinery/blog/controller_helper.rb index 74a189b..c1c2a6a 100644 --- a/app/helpers/refinery/blog/controller_helper.rb +++ b/app/helpers/refinery/blog/controller_helper.rb @@ -6,7 +6,7 @@ module Refinery def find_blog_post unless (@blog_post = Refinery::BlogPost.find(params[:id])).try(:live?) - if refinery_user? and current_user.authorized_plugins.include?("refinerycms_blog") + if refinery_user? and current_refinery_user.authorized_plugins.include?("refinerycms_blog") @blog_post = Refinery::BlogPost.find(params[:id]) else error_404 diff --git a/app/views/refinery/blog/posts/_post.html.erb b/app/views/refinery/blog/posts/_post.html.erb index 08587aa..f86f63a 100644 --- a/app/views/refinery/blog/posts/_post.html.erb +++ b/app/views/refinery/blog/posts/_post.html.erb @@ -27,5 +27,5 @@ <% end %> -<%= render :partial => '/shared/draft_page_message' unless @blog_post.nil? or @blog_post.live? -%> +<%= render :partial => '/refinery/draft_page_message' unless @blog_post.nil? or @blog_post.live? -%> <%= render 'nav' if next_or_previous?(@blog_post) %> diff --git a/spec/factories/blog_posts.rb b/spec/factories/blog_posts.rb index 0b8b888..b839d02 100644 --- a/spec/factories/blog_posts.rb +++ b/spec/factories/blog_posts.rb @@ -5,5 +5,9 @@ FactoryGirl.define do draft false tag_list "chicago, shopping, fun times" published_at Time.now + + factory :blog_post_draft do + draft true + end end end diff --git a/spec/requests/refinery/blog/posts_spec.rb b/spec/requests/refinery/blog/posts_spec.rb index 7c5a90f..025586c 100644 --- a/spec/requests/refinery/blog/posts_spec.rb +++ b/spec/requests/refinery/blog/posts_spec.rb @@ -83,5 +83,27 @@ module Refinery end end end + + describe "#show draft preview" do + let(:blog_post) { FactoryGirl.create(:blog_post_draft) } + + context "when logged in as admin" do + it "should display the draft notification" do + visit blog_post_path(blog_post) + + page.should have_content('This page is NOT live for public viewing.') + end + end + + context "when not logged in as an admin" do + before(:each) { visit destroy_refinery_user_session_path } + + it "should not display the blog post" do + visit blog_post_path(blog_post) + + page.should have_content("The page you were looking for doesn't exist (404)") + end + end + end end end From ceaf2a0aa7db702cad7e6187a6b3e1a541c5653e Mon Sep 17 00:00:00 2001 From: Estanislao Date: Wed, 5 Oct 2011 17:59:08 -0700 Subject: [PATCH 336/494] complete traduction of es.yml --- config/locales/es.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/config/locales/es.yml b/config/locales/es.yml index bd9c383..363d87f 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -38,6 +38,10 @@ es: toggle_advanced_options: Click para acceder a las opciones de menú y etiquetas save_as_draft: Guardar Borrador published_at: Fecha de publicación + custom_url: Url personalizada + custom_url_help: Generar la url de la entrada en el blog de este texto en lugar del título. + copy_body: Copia el cuerpo de la publicación a teaser. + copy_body_help: Copia el cuerpo de la publicación a teaser. Deja teaser en blanco para que Refinery automaticamente genere el teaser. index: no_items_yet: 'Aún no hay entradas en el Blog. Haz click en "%{create}" para añadir el primero' uncategorized: @@ -75,6 +79,7 @@ es: moderation: Moderación update_notified: '¿Quién recibe las notificaciones?' comments: Comentarios + teasers: Teasers blog: comment_mailer: notification: @@ -101,6 +106,8 @@ es: singular: comentario none: no hay comentarios archives: Archivos + tags: + title: "Etiquetas" categories: show: no_posts: Todavía no hay entradas. @@ -123,6 +130,30 @@ es: other: Otros posts filed_in: Archivado en submit: Enviar comentario + tagged: Etiquetado en + name: Nombre + email: Email + message: Mensaje + by: por + tagged: + no_blog_articles_yet: Todavía no hay artículos. ¡Pero vuelve pronto!. + posts_tagged: Publicaciones etiquetadas archive: blog_archive_for: 'Archivo del blog en %{date}' no_blog_articles_posted: 'No hay entradas publicadas en %{date}.' + activerecord: + models: + blog_category: Categoría + blog_comment: Comentario + blog_post: Publicación + attributes: + blog_category: + title: Título + blog_comment: + name: Nombre + email: Email + message: Mensaje + blog_post: + title: Título + body: Cuerpo + teaser: Teaser \ No newline at end of file From 84e1a277cb1d92b58d16e79db9b1595de89245b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BD=B1=E6=9C=88=20=E9=9B=B6?= Date: Tue, 11 Oct 2011 02:39:44 +0900 Subject: [PATCH 337/494] moved jp to ja to match naming correction --- config/locales/ja.yml | 159 ++++++++++++++++++++++++++++++++++++++++++ config/locales/jp.yml | 158 ----------------------------------------- 2 files changed, 159 insertions(+), 158 deletions(-) create mode 100644 config/locales/ja.yml delete mode 100644 config/locales/jp.yml diff --git a/config/locales/ja.yml b/config/locales/ja.yml new file mode 100644 index 0000000..65508ce --- /dev/null +++ b/config/locales/ja.yml @@ -0,0 +1,159 @@ +ja: + refinery: + plugins: + refinerycms_blog: + title: ブログ + admin: + blog: + categories: + category: + edit: このカテゴリを編集 + delete: このカテゴリを削除 + index: + no_items_yet: 'まだカテゴリが一つも登録されていません。「%{create}」をクリックし、カテゴリを作成して下さい。' + comments: + approved: '「%{author}さん」の投稿が承認されました。' + comment: + view_live_html: 'このコメントを見る
    (新規ウインドウに開かれます)' + read: このコメントを読む + reject: このコメントを却下する + approve: このコメントを承認する + rejected: '「%{author}」によるコメントが却下されました。' + index: + no_items_yet: '%{type}に関するコメントがありません。' + show: + comment: コメント + blog_post: 投稿 + from: 投稿者 + date: 投稿時刻 + message: コメント + details: 詳細 + age: 投稿から + actions: アクション + back: 全てのコメントに戻る + reject: このコメントを却下する + approve: このコメントを承認する + posts: + form: + advanced_options: 詳細オプション + toggle_advanced_options: メタタグの設定メニューをアクセスするにはここをクリックして下さい + save_as_draft: 下書きとして保存 + published_at: 公開時刻 + custom_url: カスタムURL + custom_url_help: 投稿のURLをここのテキストとして登録する。 + copy_body: 本文を短説明文にコピーする + copy_body_help: 短説明文として本文を引用します。短説明文を空にすると自動的に反映されます。 + index: + no_items_yet: '投稿がありません。「%{create}」をクリックし、作成して下さい。' + uncategorized: + no_items_yet: '未分類の投稿がありませす。' + post: + view_live_html: 'この投稿を見る。
    (新規ウィンドウに開かれます)' + edit: この投稿を編集する + delete: この投稿を削除する + settings: + notification_recipients: + value: 通知の受信者 + explanation: '投稿にコメントが出される度にRefineryが通知を送れます。' + hint: 'コメントが追加されたらメールで通知されます。' + example: "複数のメールアドを登録することが出来ます。入力例: jack@work.com, jill@office.com" + updated: '通知受信者の「%{recipients}」に通知が送信されました。' + submenu: + categories: + title: カテゴリ + manage: 管理 + new: 新規カテゴリ作成 + comments: + title: コメント + title_with_count: 'コメント (新規%{new_count}通)' + new: 新規 + unmoderated: 新規 + approved: 承認された + rejected: 却下された + posts: + title: 投稿 + manage: 投稿管理 + new: 新規投稿 + uncategorized: 未分類 + settings: + title: 設定 + moderation: 管理する + update_notified: 通知者を変更・更新する + comments: コメント + blog: + comment_mailer: + notification: + greeting: こんにちわ + you_recieved_new_comment: サイトに新規コメントが投稿されました。 + comment_starts: --- コメント開始 --- + comment_ends: --- コメント終了 --- + from: 差出人 + email: メール + message: メッセージ + closing_line: 以上、 + ps: '追記: 全てのコメントを見るにはRefineryブログの「コメント」に参照して下さい。' + shared: + categories: + title: カテゴリ + rss_feed: + title: RSSフィード + subscribe: フィードを登録する + posts: + other: 他の投稿 + created_at: '%{when}に投稿' + read_more: もっと読む + comments: + singular: コメント + none: コメントが未登録 + archives: アーカイブ + tags: + title: "タグ" + categories: + show: + no_posts: 投稿がありません。 + posts: + post: + filed_in: に分類されている + comment: コメント + comments: + by: '%{who}より' + time_ago: '%{time}前に' + thank_you: 'コメントをありがとうございます。' + thank_you_moderated: 'コメントをありがとうございます。コメントが承認待ちとされています。承認次第公開されます。' + index: + no_blog_articles_yet: ブログ記事がまだ投稿されてません。 + show: + blog_home: ブログ・ホーム + comments: + title: コメント + add: コメントを投稿 + other: 他のブログ投稿 + filed_in: に分類されている + tagged: とのタグが付いている + submit: コメントを送信 + name: 名前 + email: メール + message: メッセージ + by: '投稿者:' + tagged: + no_blog_articles_yet: ブログ記事がまだ投稿されてません。 + posts_tagged: 投稿タグ + archive: + blog_archive_for: '%{date}搭載のブログ記事' + no_blog_articles_posted: '%{date}付のブログ記事が投稿されてません。' + activerecord: + models: + refinery/blog_category: カテゴリ + refinery/blog_comment: コメント + refinery/blog_post: 投稿 + attributes: + refinery/blog_category: + title: 題名 + refinery/blog_comment: + name: 名前 + email: メール + message: メッセージ + refinery/blog_post: + title: 題名 + body: 本文 + teaser: 短紹介文 diff --git a/config/locales/jp.yml b/config/locales/jp.yml deleted file mode 100644 index 4f34547..0000000 --- a/config/locales/jp.yml +++ /dev/null @@ -1,158 +0,0 @@ -jp: - plugins: - refinerycms_blog: - title: ブログ - admin: - blog: - categories: - category: - edit: このカテゴリを編集 - delete: このカテゴリを削除 - index: - no_items_yet: 'まだカテゴリが一つも登録されていません。「%{create}」をクリックし、カテゴリを作成して下さい。' - comments: - approved: '「%{author}さん」の投稿が承認されました。' - comment: - view_live_html: 'このコメントを見る
    (新規ウインドウに開かれます)' - read: このコメントを読む - reject: このコメントを却下する - approve: このコメントを承認する - rejected: '「%{author}」によるコメントが却下されました。' - index: - no_items_yet: '%{type}に関するコメントがありません。' - show: - comment: コメント - blog_post: 投稿 - from: 投稿者 - date: 投稿時刻 - message: コメント - details: 詳細 - age: 投稿から - actions: アクション - back: 全てのコメントに戻る - reject: このコメントを却下する - approve: このコメントを承認する - posts: - form: - advanced_options: 詳細オプション - toggle_advanced_options: メタタグの設定メニューをアクセスするにはここをクリックして下さい - save_as_draft: 下書きとして保存 - published_at: 公開時刻 - custom_url: カスタムURL - custom_url_help: 投稿のURLをここのテキストとして登録する。 - copy_body: 本文を短説明文にコピーする - copy_body_help: 短説明文として本文を引用します。短説明文を空にすると自動的に反映されます。 - index: - no_items_yet: '投稿がありません。「%{create}」をクリックし、作成して下さい。' - uncategorized: - no_items_yet: '未分類の投稿がありませす。' - post: - view_live_html: 'この投稿を見る。
    (新規ウィンドウに開かれます)' - edit: この投稿を編集する - delete: この投稿を削除する - settings: - notification_recipients: - value: 通知の受信者 - explanation: '投稿にコメントが出される度にRefineryが通知を送れます。' - hint: 'コメントが追加されたらメールで通知されます。' - example: "複数のメールアドを登録することが出来ます。入力例: jack@work.com, jill@office.com" - updated: '通知受信者の「%{recipients}」に通知が送信されました。' - submenu: - categories: - title: カテゴリ - manage: 管理 - new: 新規カテゴリ作成 - comments: - title: コメント - title_with_count: 'コメント (新規%{new_count}通)' - new: 新規 - unmoderated: 新規 - approved: 承認された - rejected: 却下された - posts: - title: 投稿 - manage: 投稿管理 - new: 新規投稿 - uncategorized: 未分類 - settings: - title: 設定 - moderation: 管理する - update_notified: 通知者を変更・更新する - comments: コメント - blog: - comment_mailer: - notification: - greeting: こんにちわ - you_recieved_new_comment: サイトに新規コメントが投稿されました。 - comment_starts: --- コメント開始 --- - comment_ends: --- コメント終了 --- - from: 差出人 - email: メール - message: メッセージ - closing_line: 以上、 - ps: '追記: 全てのコメントを見るにはRefineryブログの「コメント」に参照して下さい。' - shared: - categories: - title: カテゴリ - rss_feed: - title: RSSフィード - subscribe: フィードを登録する - posts: - other: 他の投稿 - created_at: '%{when}に投稿' - read_more: もっと読む - comments: - singular: コメント - none: コメントが未登録 - archives: アーカイブ - tags: - title: "タグ" - categories: - show: - no_posts: 投稿がありません。 - posts: - post: - filed_in: に分類されている - comment: コメント - comments: - by: '%{who}より' - time_ago: '%{time}前に' - thank_you: 'コメントをありがとうございます。' - thank_you_moderated: 'コメントをありがとうございます。コメントが承認待ちとされています。承認次第公開されます。' - index: - no_blog_articles_yet: ブログ記事がまだ投稿されてません。 - show: - blog_home: ブログ・ホーム - comments: - title: コメント - add: コメントを投稿 - other: 他のブログ投稿 - filed_in: に分類されている - tagged: とのタグが付いている - submit: コメントを送信 - name: 名前 - email: メール - message: メッセージ - by: '投稿者:' - tagged: - no_blog_articles_yet: ブログ記事がまだ投稿されてません。 - posts_tagged: 投稿タグ - archive: - blog_archive_for: '%{date}搭載のブログ記事' - no_blog_articles_posted: '%{date}付のブログ記事が投稿されてません。' - activerecord: - models: - blog_category: カテゴリ - blog_comment: コメント - blog_post: 投稿 - attributes: - blog_category: - title: 題名 - blog_comment: - name: 名前 - email: メール - message: メッセージ - blog_post: - title: 題名 - body: 本文 - teaser: 短紹介文 From 19ee4b8f69962bf2c861e964d7ee52a67d361097 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BD=B1=E6=9C=88=20=E9=9B=B6?= Date: Tue, 11 Oct 2011 02:43:58 +0900 Subject: [PATCH 338/494] jp to ja correction --- config/locales/{jp.yml => ja.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename config/locales/{jp.yml => ja.yml} (99%) diff --git a/config/locales/jp.yml b/config/locales/ja.yml similarity index 99% rename from config/locales/jp.yml rename to config/locales/ja.yml index f576611..65508ce 100644 --- a/config/locales/jp.yml +++ b/config/locales/ja.yml @@ -1,4 +1,4 @@ -jp: +ja: refinery: plugins: refinerycms_blog: From 754cddb141715eb152049451fff3e1dff1ac146a Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Mon, 10 Oct 2011 19:39:51 -0700 Subject: [PATCH 339/494] Load refinerycms factories properly Expose blog factories to other gems --- lib/refinerycms-blog.rb | 4 ++++ spec/spec_helper.rb | 36 ++++++++++++------------------------ spec/support/refinery.rb | 2 ++ 3 files changed, 18 insertions(+), 24 deletions(-) diff --git a/lib/refinerycms-blog.rb b/lib/refinerycms-blog.rb index fafedf5..135b3e1 100644 --- a/lib/refinerycms-blog.rb +++ b/lib/refinerycms-blog.rb @@ -19,6 +19,10 @@ module Refinery def version ::Refinery::Blog::Version.to_s end + + def factory_paths + @factory_paths ||= [ File.expand_path("../../spec/factories", __FILE__) ] + end end end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index b8df592..ea550e2 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,16 +1,17 @@ require 'rubygems' -def setup_environment - # Loading more in this block will cause your tests to run faster. However, - # if you change any configuration or code from libraries loaded here, you'll - # need to restart spork for it take effect. - +def load_all(*patterns) + patterns.each { |pattern| Dir[pattern].sort.each { |path| load File.expand_path(path) } } +end + +def setup_environment # Configure Rails Environment ENV["RAILS_ENV"] = 'test' require File.expand_path("../dummy/config/environment.rb", __FILE__) require 'rspec/rails' require 'capybara/rspec' + require 'factory_girl_rails' Rails.backtrace_cleaner.remove_silencers! @@ -20,30 +21,17 @@ def setup_environment end def each_run - require 'factory_girl_rails' - require 'refinerycms-testing' + FactoryGirl.reload + ActiveSupport::Dependencies.clear - Dir[File.expand_path("../../app/models/**/*.rb", __FILE__)].each do |model| - load model - end - - Dir[ - File.expand_path("../support/**/*.rb", __FILE__), - File.expand_path("../factories/**/*.rb", __FILE__) - ].each {|f| require f} + load_all 'spec/support/**/*.rb' + load_all 'spec/factories/**/*.rb' end # If spork is available in the Gemfile it'll be used but we don't force it. unless (begin; require 'spork'; rescue LoadError; nil end).nil? - Spork.prefork do - setup_environment - - ActiveSupport::Dependencies.clear - end - - Spork.each_run do - each_run - end + Spork.prefork { setup_environment } + Spork.each_run { each_run } else setup_environment each_run diff --git a/spec/support/refinery.rb b/spec/support/refinery.rb index d761787..575ac2b 100644 --- a/spec/support/refinery.rb +++ b/spec/support/refinery.rb @@ -1,5 +1,7 @@ require 'refinerycms-testing' +Refinery::Testing.load_factories + RSpec.configure do |config| config.extend Refinery::Testing::ControllerMacros::Authentication, :type => :controller config.extend Refinery::Testing::RequestMacros::Authentication, :type => :request From 64d83c5ce459f4a0b074a8ebe573b3e03aab79b1 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Tue, 11 Oct 2011 18:21:49 -0700 Subject: [PATCH 340/494] Regenerate gemspec --- refinerycms-blog.gemspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index 50b431b..817f6b5 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -5,7 +5,7 @@ Gem::Specification.new do |s| s.name = %q{refinerycms-blog} s.version = %q{2.0.0} s.description = %q{A really straightforward open source Ruby on Rails blog engine designed for integration with RefineryCMS.} - s.date = %q{2011-09-19} + s.date = %q{2011-10-11} s.summary = %q{Ruby on Rails blogging engine for RefineryCMS.} s.email = %q{info@refinerycms.com} s.homepage = %q{http://refinerycms.com/blog} @@ -171,7 +171,7 @@ Gem::Specification.new do |s| config/locales/es.yml config/locales/fr.yml config/locales/it.yml - config/locales/jp.yml + config/locales/ja.yml config/locales/nb.yml config/locales/nl.yml config/locales/pl.yml From 4ab9eccdee10b1f0612822d92d23a925b9c84535 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Wed, 26 Oct 2011 13:07:00 -0700 Subject: [PATCH 341/494] Add rbenv files to gitignore --- .gitignore | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitignore b/.gitignore index 2c06a4c..271bed4 100644 --- a/.gitignore +++ b/.gitignore @@ -43,5 +43,10 @@ nbproject # Capybara Bug capybara-*html +# rvm .rvmrc + +#rbenv +.rbenv-version + Gemfile.lock From 1b3195bf30ac0b6803525e1a4629cb2a5e60ce8b Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Wed, 26 Oct 2011 13:11:54 -0700 Subject: [PATCH 342/494] Remove dummy application for testing --- spec/dummy/.gitignore | 167 ------------ spec/dummy/Rakefile | 13 - spec/dummy/app/assets/images/.gitkeep | 0 spec/dummy/app/assets/javascripts/admin.js | 7 - .../app/assets/javascripts/application.js | 9 - .../app/assets/stylesheets/application.css | 1 - .../assets/stylesheets/application.css.backup | 1 - .../app/assets/stylesheets/formatting.css | 4 - spec/dummy/app/assets/stylesheets/home.css | 4 - spec/dummy/app/assets/stylesheets/theme.css | 4 - .../app/controllers/application_controller.rb | 3 - spec/dummy/app/helpers/application_helper.rb | 2 - spec/dummy/app/mailers/.gitkeep | 0 spec/dummy/app/models/.gitkeep | 0 .../views/layouts/application.html.erb.backup | 14 - .../dummy/app/views/sitemap/index.xml.builder | 25 -- spec/dummy/config.ru | 4 - spec/dummy/config/application.rb | 48 ---- spec/dummy/config/boot.rb | 10 - spec/dummy/config/database.yml | 26 -- spec/dummy/config/database.yml.mysql | 20 -- spec/dummy/config/database.yml.postgresql | 55 ---- spec/dummy/config/database.yml.sqlite3 | 26 -- spec/dummy/config/environment.rb | 5 - spec/dummy/config/environments/development.rb | 31 --- spec/dummy/config/environments/production.rb | 55 ---- spec/dummy/config/environments/test.rb | 43 ---- .../initializers/backtrace_silencers.rb | 7 - spec/dummy/config/initializers/devise.rb | 144 ----------- spec/dummy/config/initializers/inflections.rb | 10 - spec/dummy/config/initializers/mime_types.rb | 5 - .../dummy/config/initializers/secret_token.rb | 7 - .../config/initializers/session_store.rb | 8 - .../config/initializers/wrap_parameters.rb | 12 - spec/dummy/config/locales/en.yml | 5 - spec/dummy/config/routes.rb | 58 ----- spec/dummy/db/migrate/.gitkeep | 0 ...reate_refinerycms_authentication_schema.rb | 48 ---- ...13234706_create_refinerycms_core_schema.rb | 25 -- ...234707_create_refinerycms_images_schema.rb | 23 -- ...3234708_create_refinerycms_pages_schema.rb | 56 ---- ...709_create_refinerycms_resources_schema.rb | 21 -- ...4710_create_refinerycms_settings_schema.rb | 26 -- ...529_add_value_type_to_refinery_settings.rb | 13 - ...5252_add_missing_indexes_to_roles_users.rb | 11 - ...1206013505_change_to_devise_users_table.rb | 31 --- ...216194133_remove_cached_slug_from_pages.rb | 17 -- .../20101217113424_add_locale_to_slugs.rb | 15 -- .../20101217113425_translate_page_plugin.rb | 40 --- ...184757_add_remember_created_at_to_users.rb | 7 - ...move_duplicate_user_image_sizes_setting.rb | 22 -- ...7025652_translate_custom_title_on_pages.rb | 41 --- ...540_remove_translated_fields_from_pages.rb | 17 -- ...5213325_remove_password_salt_from_users.rb | 17 -- .../migrate/20110329222114_create_seo_meta.rb | 86 ------- ...10714071142_create_add_template_columns.rb | 11 - ...stom_slug_to_refinery_page_translations.rb | 11 - ...m_title_to_menu_title_in_refinery_pages.rb | 15 -- spec/dummy/db/schema.rb | 240 ------------------ spec/dummy/db/seeds/pages.rb | 55 ---- spec/dummy/lib/assets/.gitkeep | 0 spec/dummy/log/.gitkeep | 0 spec/dummy/public/404.html | 26 -- spec/dummy/public/422.html | 26 -- spec/dummy/public/500.html | 26 -- spec/dummy/public/favicon.ico | 0 spec/dummy/script/rails | 6 - spec/dummy/version.rb | 5 - 68 files changed, 1770 deletions(-) delete mode 100644 spec/dummy/.gitignore delete mode 100644 spec/dummy/Rakefile delete mode 100644 spec/dummy/app/assets/images/.gitkeep delete mode 100644 spec/dummy/app/assets/javascripts/admin.js delete mode 100644 spec/dummy/app/assets/javascripts/application.js delete mode 100644 spec/dummy/app/assets/stylesheets/application.css delete mode 100644 spec/dummy/app/assets/stylesheets/application.css.backup delete mode 100644 spec/dummy/app/assets/stylesheets/formatting.css delete mode 100644 spec/dummy/app/assets/stylesheets/home.css delete mode 100644 spec/dummy/app/assets/stylesheets/theme.css delete mode 100644 spec/dummy/app/controllers/application_controller.rb delete mode 100644 spec/dummy/app/helpers/application_helper.rb delete mode 100644 spec/dummy/app/mailers/.gitkeep delete mode 100644 spec/dummy/app/models/.gitkeep delete mode 100644 spec/dummy/app/views/layouts/application.html.erb.backup delete mode 100644 spec/dummy/app/views/sitemap/index.xml.builder delete mode 100644 spec/dummy/config.ru delete mode 100644 spec/dummy/config/application.rb delete mode 100644 spec/dummy/config/boot.rb delete mode 100644 spec/dummy/config/database.yml delete mode 100644 spec/dummy/config/database.yml.mysql delete mode 100644 spec/dummy/config/database.yml.postgresql delete mode 100644 spec/dummy/config/database.yml.sqlite3 delete mode 100644 spec/dummy/config/environment.rb delete mode 100644 spec/dummy/config/environments/development.rb delete mode 100644 spec/dummy/config/environments/production.rb delete mode 100644 spec/dummy/config/environments/test.rb delete mode 100644 spec/dummy/config/initializers/backtrace_silencers.rb delete mode 100644 spec/dummy/config/initializers/devise.rb delete mode 100644 spec/dummy/config/initializers/inflections.rb delete mode 100644 spec/dummy/config/initializers/mime_types.rb delete mode 100644 spec/dummy/config/initializers/secret_token.rb delete mode 100644 spec/dummy/config/initializers/session_store.rb delete mode 100644 spec/dummy/config/initializers/wrap_parameters.rb delete mode 100644 spec/dummy/config/locales/en.yml delete mode 100644 spec/dummy/config/routes.rb delete mode 100644 spec/dummy/db/migrate/.gitkeep delete mode 100644 spec/dummy/db/migrate/20100913234705_create_refinerycms_authentication_schema.rb delete mode 100644 spec/dummy/db/migrate/20100913234706_create_refinerycms_core_schema.rb delete mode 100644 spec/dummy/db/migrate/20100913234707_create_refinerycms_images_schema.rb delete mode 100644 spec/dummy/db/migrate/20100913234708_create_refinerycms_pages_schema.rb delete mode 100644 spec/dummy/db/migrate/20100913234709_create_refinerycms_resources_schema.rb delete mode 100644 spec/dummy/db/migrate/20100913234710_create_refinerycms_settings_schema.rb delete mode 100644 spec/dummy/db/migrate/20100926142529_add_value_type_to_refinery_settings.rb delete mode 100644 spec/dummy/db/migrate/20100929035252_add_missing_indexes_to_roles_users.rb delete mode 100644 spec/dummy/db/migrate/20101206013505_change_to_devise_users_table.rb delete mode 100644 spec/dummy/db/migrate/20101216194133_remove_cached_slug_from_pages.rb delete mode 100644 spec/dummy/db/migrate/20101217113424_add_locale_to_slugs.rb delete mode 100644 spec/dummy/db/migrate/20101217113425_translate_page_plugin.rb delete mode 100644 spec/dummy/db/migrate/20110106184757_add_remember_created_at_to_users.rb delete mode 100644 spec/dummy/db/migrate/20110117053357_remove_duplicate_user_image_sizes_setting.rb delete mode 100644 spec/dummy/db/migrate/20110307025652_translate_custom_title_on_pages.rb delete mode 100644 spec/dummy/db/migrate/20110314213540_remove_translated_fields_from_pages.rb delete mode 100644 spec/dummy/db/migrate/20110325213325_remove_password_salt_from_users.rb delete mode 100644 spec/dummy/db/migrate/20110329222114_create_seo_meta.rb delete mode 100644 spec/dummy/db/migrate/20110714071142_create_add_template_columns.rb delete mode 100644 spec/dummy/db/migrate/20110810070753_add_custom_slug_to_refinery_page_translations.rb delete mode 100644 spec/dummy/db/migrate/20110812055013_rename_custom_title_to_menu_title_in_refinery_pages.rb delete mode 100644 spec/dummy/db/schema.rb delete mode 100644 spec/dummy/db/seeds/pages.rb delete mode 100644 spec/dummy/lib/assets/.gitkeep delete mode 100644 spec/dummy/log/.gitkeep delete mode 100644 spec/dummy/public/404.html delete mode 100644 spec/dummy/public/422.html delete mode 100644 spec/dummy/public/500.html delete mode 100644 spec/dummy/public/favicon.ico delete mode 100755 spec/dummy/script/rails delete mode 100644 spec/dummy/version.rb diff --git a/spec/dummy/.gitignore b/spec/dummy/.gitignore deleted file mode 100644 index c698a36..0000000 --- a/spec/dummy/.gitignore +++ /dev/null @@ -1,167 +0,0 @@ -.bundle -db/*.sqlite3 -log/*.log -tmp/ -# Rails -.bundle -db/*.sqlite3 -db/*.sqlite3-journal -*.log -tmp -tmp/**/* -config/memcached.yml -config/vagrant.yml -config/mogilefs.yml -config/resque.yml -config/app_config.yml -config/database.yml -config/unicorn.rb -bin/* - -# Documentation -doc/api -doc/app -.yardoc -.yardopts - -# Public Uploads -public/system/* -public/themes/* - -# Public Cache -public/javascripts/cache -public/stylesheets/cache -public/*.html -public/refinery/cache - -# Vendor Cache -vendor/cache - -# Acts as Indexed -index/**/* - -# Refinery Specific -*.tmproj -*.autobackupbyrefinery.* -refinerycms-*.gem -.autotest - -# Mac -.DS_Store - -# Windows -Thumbs.db - -# NetBeans -nbproject - -# Eclipse -.project - -# Redcar -.redcar - -# Rubinius -*.rbc - -# Vim -*.swp -*.swo - -# RubyMine -.idea - -# E-texteditor -.eprj - -# Backup -*~ - -# Capybara Bug -capybara-*html - -# sass -.sass-cache -.sass-cache/* - -# vagrant -.vagrant - -# chef -.chef -# Rails -.bundle -db/*.sqlite3 -db/*.sqlite3-journal -*.log -tmp -tmp/**/* - -# Documentation -doc/api -doc/app -.yardoc -.yardopts -coverage - -# Public Uploads -public/system/* -public/themes/* - -# Public Cache -public/javascripts/cache -public/stylesheets/cache - -# Vendor Cache -vendor/cache - -# Acts as Indexed -index/**/* - -# Refinery Specific -*.tmproj -*.autobackupbyrefinery.* -refinerycms-*.gem -.autotest - -# Mac -.DS_Store - -# Windows -Thumbs.db - -# NetBeans -nbproject - -# Eclipse -.project - -# Redcar -.redcar - -# Rubinius -*.rbc - -# Vim -*.swp -*.swo - -# RubyMine -.idea - -# E-texteditor -.eprj - -# Backup -*~ - -# Capybara Bug -capybara-*html - -# sass -.sass-cache -.sass-cache/* - -#rvm -.rvmrc -.rvmrc.* diff --git a/spec/dummy/Rakefile b/spec/dummy/Rakefile deleted file mode 100644 index 852eb68..0000000 --- a/spec/dummy/Rakefile +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env rake -# Add your own tasks in files placed in lib/tasks ending in .rake, -# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. - -unless File.exist?(db_yml = File.expand_path('../config/database.yml', __FILE__)) - require 'fileutils' - FileUtils.cp "#{db_yml}.sqlite3", db_yml - puts "Copied #{db_yml}.sqlite3 to #{db_yml}" -end - -require File.expand_path('../config/application', __FILE__) - -Dummy::Application.load_tasks diff --git a/spec/dummy/app/assets/images/.gitkeep b/spec/dummy/app/assets/images/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/spec/dummy/app/assets/javascripts/admin.js b/spec/dummy/app/assets/javascripts/admin.js deleted file mode 100644 index 23c4fb9..0000000 --- a/spec/dummy/app/assets/javascripts/admin.js +++ /dev/null @@ -1,7 +0,0 @@ -// Use this to customize the wymeditor boot process -// Just mirror the options specified in boot_wym.js with the new options here. -// This will completely override anything specified in boot_wym.js for that key. -// e.g. skin: 'something_else' -var custom_wymeditor_boot_options = { - -}; \ No newline at end of file diff --git a/spec/dummy/app/assets/javascripts/application.js b/spec/dummy/app/assets/javascripts/application.js deleted file mode 100644 index 37c7bfc..0000000 --- a/spec/dummy/app/assets/javascripts/application.js +++ /dev/null @@ -1,9 +0,0 @@ -// This is a manifest file that'll be compiled into including all the files listed below. -// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically -// be included in the compiled file accessible from http://example.com/assets/application.js -// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the -// the compiled file. -// -//= require jquery -//= require jquery_ujs -//= require_tree . diff --git a/spec/dummy/app/assets/stylesheets/application.css b/spec/dummy/app/assets/stylesheets/application.css deleted file mode 100644 index 8b13789..0000000 --- a/spec/dummy/app/assets/stylesheets/application.css +++ /dev/null @@ -1 +0,0 @@ - diff --git a/spec/dummy/app/assets/stylesheets/application.css.backup b/spec/dummy/app/assets/stylesheets/application.css.backup deleted file mode 100644 index 8b13789..0000000 --- a/spec/dummy/app/assets/stylesheets/application.css.backup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/spec/dummy/app/assets/stylesheets/formatting.css b/spec/dummy/app/assets/stylesheets/formatting.css deleted file mode 100644 index 1132188..0000000 --- a/spec/dummy/app/assets/stylesheets/formatting.css +++ /dev/null @@ -1,4 +0,0 @@ -/* - Override default refinery formatting below. - Formatting applies to backend WYSIWYG editors and all frontend. -*/ \ No newline at end of file diff --git a/spec/dummy/app/assets/stylesheets/home.css b/spec/dummy/app/assets/stylesheets/home.css deleted file mode 100644 index 824db99..0000000 --- a/spec/dummy/app/assets/stylesheets/home.css +++ /dev/null @@ -1,4 +0,0 @@ -/* - Override default refinery homepage styles here. - These only apply to the homepage of your site. -*/ \ No newline at end of file diff --git a/spec/dummy/app/assets/stylesheets/theme.css b/spec/dummy/app/assets/stylesheets/theme.css deleted file mode 100644 index 8205050..0000000 --- a/spec/dummy/app/assets/stylesheets/theme.css +++ /dev/null @@ -1,4 +0,0 @@ -/* - Override default refinery 'theme' styles here. - These only apply when using custom WYMeditor CSS. -*/ \ No newline at end of file diff --git a/spec/dummy/app/controllers/application_controller.rb b/spec/dummy/app/controllers/application_controller.rb deleted file mode 100644 index e8065d9..0000000 --- a/spec/dummy/app/controllers/application_controller.rb +++ /dev/null @@ -1,3 +0,0 @@ -class ApplicationController < ActionController::Base - protect_from_forgery -end diff --git a/spec/dummy/app/helpers/application_helper.rb b/spec/dummy/app/helpers/application_helper.rb deleted file mode 100644 index de6be79..0000000 --- a/spec/dummy/app/helpers/application_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module ApplicationHelper -end diff --git a/spec/dummy/app/mailers/.gitkeep b/spec/dummy/app/mailers/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/spec/dummy/app/models/.gitkeep b/spec/dummy/app/models/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/spec/dummy/app/views/layouts/application.html.erb.backup b/spec/dummy/app/views/layouts/application.html.erb.backup deleted file mode 100644 index 9a8a761..0000000 --- a/spec/dummy/app/views/layouts/application.html.erb.backup +++ /dev/null @@ -1,14 +0,0 @@ - - - - Dummy - <%= stylesheet_link_tag "application" %> - <%= javascript_include_tag "application" %> - <%= csrf_meta_tags %> - - - -<%= yield %> - - - diff --git a/spec/dummy/app/views/sitemap/index.xml.builder b/spec/dummy/app/views/sitemap/index.xml.builder deleted file mode 100644 index 8e89852..0000000 --- a/spec/dummy/app/views/sitemap/index.xml.builder +++ /dev/null @@ -1,25 +0,0 @@ -xml.instruct! - -xml.urlset "xmlns" => "http://www.sitemaps.org/schemas/sitemap/0.9" do - - @locales.each do |locale| - ::I18n.locale = locale - ::Refinery::Page.live.in_menu.includes(:parts).each do |page| - # exclude sites that are external to our own domain. - page_url = if page.url.is_a?(Hash) - # This is how most pages work without being overriden by link_url - page.url.merge({:only_path => false}) - elsif page.url.to_s !~ /^http/ - # handle relative link_url addresses. - [request.protocol, request.host_with_port, page.url].join - end - - # Add XML entry only if there is a valid page_url found above. - xml.url do - xml.loc url_for(page_url) - xml.lastmod page.updated_at.to_date - end if page_url.present? and page.show_in_menu? - end - end - -end diff --git a/spec/dummy/config.ru b/spec/dummy/config.ru deleted file mode 100644 index 1989ed8..0000000 --- a/spec/dummy/config.ru +++ /dev/null @@ -1,4 +0,0 @@ -# This file is used by Rack-based servers to start the application. - -require ::File.expand_path('../config/environment', __FILE__) -run Dummy::Application diff --git a/spec/dummy/config/application.rb b/spec/dummy/config/application.rb deleted file mode 100644 index e67cf82..0000000 --- a/spec/dummy/config/application.rb +++ /dev/null @@ -1,48 +0,0 @@ -require File.expand_path('../boot', __FILE__) - -require 'rails/all' - -require 'bundler/setup' - -# If you have a Gemfile, require the default gems, the ones in the -# current environment and also include :assets gems if in development -# or test environments. -Bundler.require *Rails.groups(:assets) if defined?(Bundler) - -require 'refinerycms-blog' - -module Dummy - class Application < Rails::Application - # Settings in config/environments/* take precedence over those specified here. - # Application configuration should go into files in config/initializers - # -- all .rb files in that directory are automatically loaded. - - # Custom directories with classes and modules you want to be autoloadable. - # config.autoload_paths += %W(#{config.root}/extras) - - # Only load the plugins named here, in the order given (default is alphabetical). - # :all can be used as a placeholder for all plugins not explicitly named. - # config.plugins = [ :exception_notification, :ssl_requirement, :all ] - - # Activate observers that should always be running. - # config.active_record.observers = :cacher, :garbage_collector, :forum_observer - - # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. - # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. - # config.time_zone = 'Central Time (US & Canada)' - - # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. - # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] - # config.i18n.default_locale = :de - - # Configure the default encoding used in templates for Ruby 1.9. - config.encoding = "utf-8" - - # Configure sensitive parameters which will be filtered from the log file. - config.filter_parameters += [:password] - - # Enable the asset pipeline - config.assets.enabled = true - end -end - diff --git a/spec/dummy/config/boot.rb b/spec/dummy/config/boot.rb deleted file mode 100644 index eba0681..0000000 --- a/spec/dummy/config/boot.rb +++ /dev/null @@ -1,10 +0,0 @@ -require 'rubygems' -gemfile = File.expand_path('../../../../Gemfile', __FILE__) - -if File.exist?(gemfile) - ENV['BUNDLE_GEMFILE'] = gemfile - require 'bundler' - Bundler.setup -end - -$:.unshift File.expand_path('../../../../lib', __FILE__) \ No newline at end of file diff --git a/spec/dummy/config/database.yml b/spec/dummy/config/database.yml deleted file mode 100644 index c2da158..0000000 --- a/spec/dummy/config/database.yml +++ /dev/null @@ -1,26 +0,0 @@ -# SQLite version 3.x -development: - adapter: <%= "jdbc" if defined?(JRUBY_PLATFORM) %>sqlite3 - database: db/development.sqlite3 - timeout: 5000 - -# Warning: The database defined as 'test' will be erased and -# re-generated from your development database when you run 'rake'. -# Do not set this db to the same as development or production. -test: - adapter: <%= "jdbc" if defined?(JRUBY_PLATFORM) %>sqlite3 - database: db/test.sqlite3 - timeout: 5000 - -# Warning: The database defined as 'cucumber' will be erased and -# re-generated from your development database when you run 'rake'. -# Do not set this db to the same as development or production. -cucumber: - adapter: <%= "jdbc" if defined?(JRUBY_PLATFORM) %>sqlite3 - database: db/cucumber.sqlite3 - timeout: 5000 - -production: - adapter: <%= "jdbc" if defined?(JRUBY_PLATFORM) %>sqlite3 - database: db/production.sqlite3 - timeout: 5000 \ No newline at end of file diff --git a/spec/dummy/config/database.yml.mysql b/spec/dummy/config/database.yml.mysql deleted file mode 100644 index 75cca95..0000000 --- a/spec/dummy/config/database.yml.mysql +++ /dev/null @@ -1,20 +0,0 @@ -development: &development - adapter: mysql2 - host: localhost - username: root - password: - database: your_local_database - -test: &test - adapter: mysql2 - host: localhost - username: root - password: - database: your_test_database - -production: &production - adapter: mysql2 - host: localhost - database: your_production_database - username: your_production_database_login - password: your_production_database_password diff --git a/spec/dummy/config/database.yml.postgresql b/spec/dummy/config/database.yml.postgresql deleted file mode 100644 index 2146d1f..0000000 --- a/spec/dummy/config/database.yml.postgresql +++ /dev/null @@ -1,55 +0,0 @@ -# PostgreSQL. Versions 7.4 and 8.x are supported. -# -# Install the pg driver: -# gem install pg -# On Mac OS X with macports: -# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config -# On Windows: -# gem install pg -# Choose the win32 build. -# Install PostgreSQL and put its /bin directory on your path. -# -# Configure Using Gemfile -# gem 'pg' -# -development: - adapter: postgresql - encoding: unicode - database: refinery_database_development - pool: 5 - username: postgres - password: postgres - - # Connect on a TCP socket. Omitted by default since the client uses a - # domain socket that doesn't need configuration. Windows does not have - # domain sockets, so uncomment these lines. - #host: localhost - #port: 5432 - - # Schema search path. The server defaults to $user,public - #schema_search_path: myapp,sharedapp,public - - # Minimum log levels, in increasing order: - # debug5, debug4, debug3, debug2, debug1, - # log, notice, warning, error, fatal, and panic - # The server defaults to notice. - #min_messages: warning - -# Warning: The database defined as "test" will be erased and -# re-generated from your development database when you run "rake". -# Do not set this db to the same as development or production. -test: - adapter: postgresql - encoding: unicode - database: refinery_database_test - pool: 5 - username: postgres - password: postgres - -production: - adapter: postgresql - encoding: unicode - database: refinery_database_production - pool: 5 - username: postgres - password: postgres diff --git a/spec/dummy/config/database.yml.sqlite3 b/spec/dummy/config/database.yml.sqlite3 deleted file mode 100644 index c2da158..0000000 --- a/spec/dummy/config/database.yml.sqlite3 +++ /dev/null @@ -1,26 +0,0 @@ -# SQLite version 3.x -development: - adapter: <%= "jdbc" if defined?(JRUBY_PLATFORM) %>sqlite3 - database: db/development.sqlite3 - timeout: 5000 - -# Warning: The database defined as 'test' will be erased and -# re-generated from your development database when you run 'rake'. -# Do not set this db to the same as development or production. -test: - adapter: <%= "jdbc" if defined?(JRUBY_PLATFORM) %>sqlite3 - database: db/test.sqlite3 - timeout: 5000 - -# Warning: The database defined as 'cucumber' will be erased and -# re-generated from your development database when you run 'rake'. -# Do not set this db to the same as development or production. -cucumber: - adapter: <%= "jdbc" if defined?(JRUBY_PLATFORM) %>sqlite3 - database: db/cucumber.sqlite3 - timeout: 5000 - -production: - adapter: <%= "jdbc" if defined?(JRUBY_PLATFORM) %>sqlite3 - database: db/production.sqlite3 - timeout: 5000 \ No newline at end of file diff --git a/spec/dummy/config/environment.rb b/spec/dummy/config/environment.rb deleted file mode 100644 index 3da5eb9..0000000 --- a/spec/dummy/config/environment.rb +++ /dev/null @@ -1,5 +0,0 @@ -# Load the rails application -require File.expand_path('../application', __FILE__) - -# Initialize the rails application -Dummy::Application.initialize! diff --git a/spec/dummy/config/environments/development.rb b/spec/dummy/config/environments/development.rb deleted file mode 100644 index 8604338..0000000 --- a/spec/dummy/config/environments/development.rb +++ /dev/null @@ -1,31 +0,0 @@ -Dummy::Application.configure do - # Settings specified here will take precedence over those in config/application.rb - - # In the development environment your application's code is reloaded on - # every request. This slows down response time but is perfect for development - # since you don't have to restart the web server when you make code changes. - config.cache_classes = false - - # Log error messages when you accidentally call methods on nil. - config.whiny_nils = true - - # Show full error reports and disable caching - config.consider_all_requests_local = true - config.action_controller.perform_caching = false - - # Don't care if the mailer can't send - config.action_mailer.raise_delivery_errors = false - - # Print deprecation notices to the Rails logger - config.active_support.deprecation = :log - - # Only use best-standards-support built into browsers - config.action_dispatch.best_standards_support = :builtin - - # Do not compress assets - config.assets.compress = false -end -Refinery.rescue_not_found = false -# When true will use Amazon's Simple Storage Service on your production machine -# instead of the default file system for resources and images -Refinery.s3_backend = !(ENV['S3_KEY'].nil? || ENV['S3_SECRET'].nil?) diff --git a/spec/dummy/config/environments/production.rb b/spec/dummy/config/environments/production.rb deleted file mode 100644 index 17a630b..0000000 --- a/spec/dummy/config/environments/production.rb +++ /dev/null @@ -1,55 +0,0 @@ -Dummy::Application.configure do - # Settings specified here will take precedence over those in config/application.rb - - # Code is not reloaded between requests - config.cache_classes = true - - # Full error reports are disabled and caching is turned on - config.consider_all_requests_local = false - config.action_controller.perform_caching = true - - # Disable Rails's static asset server (Apache or nginx will already do this) - config.serve_static_assets = true # Refinery CMS requires this to be true - - # Compress JavaScripts and CSS - config.assets.compress = true - - # Specifies the header that your server uses for sending files - # (comment out if your front-end server doesn't support this) - config.action_dispatch.x_sendfile_header = "X-Sendfile" # Use 'X-Accel-Redirect' for nginx - - # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. - # config.force_ssl = true - - # See everything in the log (default is :info) - # config.log_level = :debug - - # Use a different logger for distributed setups - # config.logger = SyslogLogger.new - - # Use a different cache store in production - # config.cache_store = :mem_cache_store - - # Enable serving of images, stylesheets, and JavaScripts from an asset server - # config.action_controller.asset_host = "http://assets.example.com" - - # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) - # config.assets.precompile += %w( search.js ) - - # Disable delivery errors, bad email addresses will be ignored - # config.action_mailer.raise_delivery_errors = false - - # Enable threaded mode - # config.threadsafe! - - # Enable locale fallbacks for I18n (makes lookups for any locale fall back to - # the I18n.default_locale when a translation can not be found) - config.i18n.fallbacks = true - - # Send deprecation notices to registered listeners - config.active_support.deprecation = :notify -end -Refinery.rescue_not_found = true -# When true will use Amazon's Simple Storage Service on your production machine -# instead of the default file system for resources and images -Refinery.s3_backend = !(ENV['S3_KEY'].nil? || ENV['S3_SECRET'].nil?) diff --git a/spec/dummy/config/environments/test.rb b/spec/dummy/config/environments/test.rb deleted file mode 100644 index 9e84bae..0000000 --- a/spec/dummy/config/environments/test.rb +++ /dev/null @@ -1,43 +0,0 @@ -Dummy::Application.configure do - # Settings specified here will take precedence over those in config/application.rb - - # The test environment is used exclusively to run your application's - # test suite. You never need to work with it otherwise. Remember that - # your test database is "scratch space" for the test suite and is wiped - # and recreated between test runs. Don't rely on the data there! - config.cache_classes = false - - # Configure static asset server for tests with Cache-Control for performance - config.serve_static_assets = true - config.static_cache_control = "public, max-age=3600" - - # Log error messages when you accidentally call methods on nil - config.whiny_nils = true - - # Show full error reports and disable caching - config.consider_all_requests_local = true - config.action_controller.perform_caching = false - - # Raise exceptions instead of rendering exception templates - config.action_dispatch.show_exceptions = false - - # Disable request forgery protection in test environment - config.action_controller.allow_forgery_protection = false - - # Tell Action Mailer not to deliver emails to the real world. - # The :test delivery method accumulates sent emails in the - # ActionMailer::Base.deliveries array. - config.action_mailer.delivery_method = :test - - # Use SQL instead of Active Record's schema dumper when creating the test database. - # This is necessary if your schema can't be completely dumped by the schema dumper, - # like if you have constraints or database-specific column types - # config.active_record.schema_format = :sql - - # Print deprecation notices to the stderr - config.active_support.deprecation = :stderr -end -Refinery.rescue_not_found = false -# When true will use Amazon's Simple Storage Service on your production machine -# instead of the default file system for resources and images -Refinery.s3_backend = !(ENV['S3_KEY'].nil? || ENV['S3_SECRET'].nil?) diff --git a/spec/dummy/config/initializers/backtrace_silencers.rb b/spec/dummy/config/initializers/backtrace_silencers.rb deleted file mode 100644 index 59385cd..0000000 --- a/spec/dummy/config/initializers/backtrace_silencers.rb +++ /dev/null @@ -1,7 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. -# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } - -# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. -# Rails.backtrace_cleaner.remove_silencers! diff --git a/spec/dummy/config/initializers/devise.rb b/spec/dummy/config/initializers/devise.rb deleted file mode 100644 index 0d00106..0000000 --- a/spec/dummy/config/initializers/devise.rb +++ /dev/null @@ -1,144 +0,0 @@ -require 'devise' - -# Use this hook to configure devise mailer, warden hooks and so forth. The first -# four configuration values can also be set straight in your models. -::Devise.setup do |config| - # ==> Mailer Configuration - # Configure the e-mail address which will be shown in DeviseMailer. - # config.mailer_sender = "please-change-me@config-initializers-devise.com" - - # Configure the class responsible to send e-mails. - # config.mailer = "::Devise::Mailer" - - # ==> ORM configuration - # Load and configure the ORM. Supports :active_record (default) and - # :mongoid (bson_ext recommended) by default. Other ORMs may be - # available as additional gems. - require 'devise/orm/active_record' - - # ==> Configuration for any authentication mechanism - # Configure which keys are used when authenticating an user. By default is - # just :email. You can configure it to use [:username, :subdomain], so for - # authenticating an user, both parameters are required. Remember that those - # parameters are used only when authenticating and not when retrieving from - # session. If you need permissions, you should implement that in a before filter. - config.authentication_keys = [ :login ] - - # Tell if authentication through request.params is enabled. True by default. - # config.params_authenticatable = true - - # Tell if authentication through HTTP Basic Auth is enabled. False by default. - # config.http_authenticatable = false - - # Set this to true to use Basic Auth for AJAX requests. True by default. - # config.http_authenticatable_on_xhr = true - - # The realm used in Http Basic Authentication - # config.http_authentication_realm = "Application" - - # ==> Configuration for :database_authenticatable - # For bcrypt, this is the cost for hashing the password and defaults to 10. If - # using other encryptors, it sets how many times you want the password re-encrypted. - # config.stretches = 20 - - # Define which will be the encryption algorithm. Devise also supports encryptors - # from others authentication tools as :clearance_sha1, :authlogic_sha512 (then - # you should set stretches above to 20 for default behavior) and :restful_authentication_sha1 - # (then you should set stretches to 10, and copy REST_AUTH_SITE_KEY to pepper) - # config.encryptor = :bcrypt - - # Setup a pepper to generate the encrypted password. - # config.pepper = "2e20a8abdd34d729ba6d05f679e513cfea9fbb1e83c81f84b29e9e4fdbd4ee59b56a32200064082a15a72b05a4d4a6a2c3784a09c0554b3a47a67cc8333ccbc7" - - # ==> Configuration for :confirmable - # The time you want to give your user to confirm his account. During this time - # he will be able to access your application without confirming. Default is nil. - # When confirm_within is zero, the user won't be able to sign in without confirming. - # You can use this to let your user access some features of your application - # without confirming the account, but blocking it after a certain period - # (ie 2 days). - # config.confirm_within = 2.days - - # ==> Configuration for :rememberable - # The time the user will be remembered without asking for credentials again. - # config.remember_for = 2.weeks - - # If true, a valid remember token can be re-used between multiple browsers. - # config.remember_across_browsers = true - - # If true, extends the user's remember period when remembered via cookie. - # config.extend_remember_period = false - - # ==> Configuration for :validatable - # Range for password length - config.password_length = 4..20 - - # Regex to use to validate the email address - # config.email_regexp = /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i - - # ==> Configuration for :timeoutable - # The time you want to timeout the user session without activity. After this - # time the user will be asked for credentials again. - # config.timeout_in = 10.minutes - - # ==> Configuration for :lockable - # Defines which strategy will be used to lock an account. - # :failed_attempts = Locks an account after a number of failed attempts to sign in. - # :none = No lock strategy. You should handle locking by yourself. - # config.lock_strategy = :failed_attempts - - # Defines which strategy will be used to unlock an account. - # :email = Sends an unlock link to the user email - # :time = Re-enables login after a certain amount of time (see :unlock_in below) - # :both = Enables both strategies - # :none = No unlock strategy. You should handle unlocking by yourself. - # config.unlock_strategy = :both - - # Number of authentication tries before locking an account if lock_strategy - # is failed attempts. - # config.maximum_attempts = 20 - - # Time interval to unlock the account if :time is enabled as unlock_strategy. - # config.unlock_in = 1.hour - - # ==> Configuration for :token_authenticatable - # Defines name of the authentication token params key - # config.token_authentication_key = :auth_token - - # ==> Scopes configuration - # Turn scoped views on. Before rendering "sessions/new", it will first check for - # "users/sessions/new". It's turned off by default because it's slower if you - # are using only default views. - # config.scoped_views = true - - # Configure the default scope given to Warden. By default it's the first - # devise role declared in your routes. - # config.default_scope = :user - - # Configure sign_out behavior. - # By default sign_out is scoped (i.e. /users/sign_out affects only :user scope). - # In case of sign_out_all_scopes set to true any logout action will sign out all active scopes. - # config.sign_out_all_scopes = false - - # ==> Navigation configuration - # Lists the formats that should be treated as navigational. Formats like - # :html, should redirect to the sign in page when the user does not have - # access, but formats like :xml or :json, should return 401. - # If you have any extra navigational formats, like :iphone or :mobile, you - # should add them to the navigational formats lists. Default is [:html] - # config.navigational_formats = [:html, :iphone] - - # ==> Warden configuration - # If you want to use other strategies, that are not (yet) supported by Devise, - # you can configure them inside the config.warden block. The example below - # allows you to setup OAuth, using http://github.com/roman/warden_oauth - # - # config.warden do |manager| - # manager.oauth(:twitter) do |twitter| - # twitter.consumer_secret = - # twitter.consumer_key = - # twitter.options :site => 'http://twitter.com' - # end - # manager.default_strategies(:scope => :user).unshift :twitter_oauth - # end -end diff --git a/spec/dummy/config/initializers/inflections.rb b/spec/dummy/config/initializers/inflections.rb deleted file mode 100644 index 9e8b013..0000000 --- a/spec/dummy/config/initializers/inflections.rb +++ /dev/null @@ -1,10 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Add new inflection rules using the following format -# (all these examples are active by default): -# ActiveSupport::Inflector.inflections do |inflect| -# inflect.plural /^(ox)$/i, '\1en' -# inflect.singular /^(ox)en/i, '\1' -# inflect.irregular 'person', 'people' -# inflect.uncountable %w( fish sheep ) -# end diff --git a/spec/dummy/config/initializers/mime_types.rb b/spec/dummy/config/initializers/mime_types.rb deleted file mode 100644 index 72aca7e..0000000 --- a/spec/dummy/config/initializers/mime_types.rb +++ /dev/null @@ -1,5 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Add new mime types for use in respond_to blocks: -# Mime::Type.register "text/richtext", :rtf -# Mime::Type.register_alias "text/html", :iphone diff --git a/spec/dummy/config/initializers/secret_token.rb b/spec/dummy/config/initializers/secret_token.rb deleted file mode 100644 index 7a99397..0000000 --- a/spec/dummy/config/initializers/secret_token.rb +++ /dev/null @@ -1,7 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Your secret key for verifying the integrity of signed cookies. -# If you change this key, all old signed cookies will become invalid! -# Make sure the secret is at least 30 characters and all random, -# no regular words or you'll be exposed to dictionary attacks. -Dummy::Application.config.secret_token = '75470fb2f9c361e0509af41d5835fdb3fee2e588a44c68596c6201976f994e0689c434b6e8360dbc45c0d424c1811a5cf1e3f4f0550be9b784fed60fb4e5d29d' diff --git a/spec/dummy/config/initializers/session_store.rb b/spec/dummy/config/initializers/session_store.rb deleted file mode 100644 index aa2f512..0000000 --- a/spec/dummy/config/initializers/session_store.rb +++ /dev/null @@ -1,8 +0,0 @@ -# Be sure to restart your server when you modify this file. - -Dummy::Application.config.session_store :cookie_store, :key => '_dummy_session' - -# Use the database for sessions instead of the cookie-based default, -# which shouldn't be used to store highly confidential information -# (create the session table with "rails generate session_migration") -# Dummy::Application.config.session_store :active_record_store diff --git a/spec/dummy/config/initializers/wrap_parameters.rb b/spec/dummy/config/initializers/wrap_parameters.rb deleted file mode 100644 index 71b88b0..0000000 --- a/spec/dummy/config/initializers/wrap_parameters.rb +++ /dev/null @@ -1,12 +0,0 @@ -# Be sure to restart your server when you modify this file. -# -# This file contains settings for ActionController::ParamsWrapper which -# is enabled by default. - -# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. -ActionController::Base.wrap_parameters :format => [:json] - -# Disable root element in JSON by default. -if defined?(ActiveRecord) - ActiveRecord::Base.include_root_in_json = false -end diff --git a/spec/dummy/config/locales/en.yml b/spec/dummy/config/locales/en.yml deleted file mode 100644 index 179c14c..0000000 --- a/spec/dummy/config/locales/en.yml +++ /dev/null @@ -1,5 +0,0 @@ -# Sample localization file for English. Add more files in this directory for other locales. -# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. - -en: - hello: "Hello world" diff --git a/spec/dummy/config/routes.rb b/spec/dummy/config/routes.rb deleted file mode 100644 index bb509f2..0000000 --- a/spec/dummy/config/routes.rb +++ /dev/null @@ -1,58 +0,0 @@ -Dummy::Application.routes.draw do - # The priority is based upon order of creation: - # first created -> highest priority. - - # Sample of regular route: - # match 'products/:id' => 'catalog#view' - # Keep in mind you can assign values other than :controller and :action - - # Sample of named route: - # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase - # This route can be invoked with purchase_url(:id => product.id) - - # Sample resource route (maps HTTP verbs to controller actions automatically): - # resources :products - - # Sample resource route with options: - # resources :products do - # member do - # get 'short' - # post 'toggle' - # end - # - # collection do - # get 'sold' - # end - # end - - # Sample resource route with sub-resources: - # resources :products do - # resources :comments, :sales - # resource :seller - # end - - # Sample resource route with more complex sub-resources - # resources :products do - # resources :comments - # resources :sales do - # get 'recent', :on => :collection - # end - # end - - # Sample resource route within a namespace: - # namespace :admin do - # # Directs /admin/products/* to Admin::ProductsController - # # (app/controllers/admin/products_controller.rb) - # resources :products - # end - - # You can have the root of your site routed with "root" - # just remember to delete public/index.html. - # root :to => 'welcome#index' - - # See how all your routes lay out with "rake routes" - - # This is a legacy wild controller route that's not recommended for RESTful applications. - # Note: This route will make all actions in every controller accessible via GET requests. - # match ':controller(/:action(/:id(.:format)))' -end diff --git a/spec/dummy/db/migrate/.gitkeep b/spec/dummy/db/migrate/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/spec/dummy/db/migrate/20100913234705_create_refinerycms_authentication_schema.rb b/spec/dummy/db/migrate/20100913234705_create_refinerycms_authentication_schema.rb deleted file mode 100644 index f9b6c2e..0000000 --- a/spec/dummy/db/migrate/20100913234705_create_refinerycms_authentication_schema.rb +++ /dev/null @@ -1,48 +0,0 @@ -class CreateRefinerycmsAuthenticationSchema < ActiveRecord::Migration - def self.up - # Postgres apparently requires the roles_users table to exist before creating the roles table. - create_table ::Refinery::RolesUsers.table_name, :id => false, :force => true do |t| - t.integer "user_id" - t.integer "role_id" - end unless ::Refinery::RolesUsers.table_exists? - - create_table ::Refinery::Role.table_name, :force => true do |t| - t.string "title" - end unless ::Refinery::Role.table_exists? - - unless ::Refinery::UserPlugin.table_exists? - create_table ::Refinery::UserPlugin.table_name, :force => true do |t| - t.integer "user_id" - t.string "name" - t.integer "position" - end - - add_index ::Refinery::UserPlugin.table_name, ["name"], :name => "index_#{::Refinery::UserPlugin.table_name}_on_title" - add_index ::Refinery::UserPlugin.table_name, ["user_id", "name"], :name => "index_unique_#{::Refinery::UserPlugin.table_name}", :unique => true - - end - - unless ::Refinery::User.table_exists? - create_table ::Refinery::User.table_name, :force => true do |t| - t.string "login", :null => false - t.string "email", :null => false - t.string "crypted_password", :null => false - t.string "password_salt", :null => false - t.string "persistence_token" - t.datetime "created_at" - t.datetime "updated_at" - t.string "perishable_token" - end - - add_index ::Refinery::User.table_name, ["id"], :name => "index_#{::Refinery::User.table_name}_on_id" - end - end - - def self.down - [::User].reject{|m| - !(defined?(m) and m.respond_to?(:table_name)) - }.each do |model| - drop_table model.table_name if model.table_exists? if model.table_exists? - end - end -end diff --git a/spec/dummy/db/migrate/20100913234706_create_refinerycms_core_schema.rb b/spec/dummy/db/migrate/20100913234706_create_refinerycms_core_schema.rb deleted file mode 100644 index 5061efa..0000000 --- a/spec/dummy/db/migrate/20100913234706_create_refinerycms_core_schema.rb +++ /dev/null @@ -1,25 +0,0 @@ -class CreateRefinerycmsCoreSchema < ActiveRecord::Migration - def self.up - unless Slug.table_exists? - create_table ::Slug.table_name, :force => true do |t| - t.string "name" - t.integer "sluggable_id" - t.integer "sequence", :default => 1, :null => false - t.string "sluggable_type", :limit => 40 - t.string "scope", :limit => 40 - t.datetime "created_at" - end - - add_index ::Slug.table_name, ["name", "sluggable_type", "scope", "sequence"], :name => "index_#{::Slug.table_name}_on_n_s_s_and_s", :unique => true - add_index ::Slug.table_name, ["sluggable_id"], :name => "index_#{::Slug.table_name}_on_sluggable_id" - end - end - - def self.down - [::Slug].reject{|m| - !(defined?(m) and m.respond_to?(:table_name)) - }.each do |model| - drop_table model.table_name if model.table_exists? - end - end -end diff --git a/spec/dummy/db/migrate/20100913234707_create_refinerycms_images_schema.rb b/spec/dummy/db/migrate/20100913234707_create_refinerycms_images_schema.rb deleted file mode 100644 index 6c4e079..0000000 --- a/spec/dummy/db/migrate/20100913234707_create_refinerycms_images_schema.rb +++ /dev/null @@ -1,23 +0,0 @@ -class CreateRefinerycmsImagesSchema < ActiveRecord::Migration - def self.up - create_table ::Refinery::Image.table_name, :force => true do |t| - t.string "image_mime_type" - t.string "image_name" - t.integer "image_size" - t.integer "image_width" - t.integer "image_height" - t.datetime "created_at" - t.datetime "updated_at" - t.string "image_uid" - t.string "image_ext" - end unless ::Refinery::Image.table_exists? - end - - def self.down - [::Image].reject{|m| - !(defined?(m) and m.respond_to?(:table_name)) - }.each do |model| - drop_table model.table_name if model.table_exists? - end - end -end diff --git a/spec/dummy/db/migrate/20100913234708_create_refinerycms_pages_schema.rb b/spec/dummy/db/migrate/20100913234708_create_refinerycms_pages_schema.rb deleted file mode 100644 index 4458726..0000000 --- a/spec/dummy/db/migrate/20100913234708_create_refinerycms_pages_schema.rb +++ /dev/null @@ -1,56 +0,0 @@ -class CreateRefinerycmsPagesSchema < ActiveRecord::Migration - def self.up - unless ::Refinery::PagePart.table_exists? - create_table ::Refinery::PagePart.table_name, :force => true do |t| - t.integer "refinery_page_id" - t.string "title" - t.text "body" - t.integer "position" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index ::Refinery::PagePart.table_name, ["id"], :name => "index_#{::Refinery::PagePart.table_name}_on_id" - add_index ::Refinery::PagePart.table_name, ["refinery_page_id"], :name => "index_#{::Refinery::PagePart.table_name}_on_page_id" - end - - unless ::Refinery::Page.table_exists? - create_table ::Refinery::Page.table_name, :force => true do |t| - t.string "title" - t.integer "parent_id" - t.integer "position" - t.string "path" - t.datetime "created_at" - t.datetime "updated_at" - t.string "meta_keywords" - t.text "meta_description" - t.boolean "show_in_menu", :default => true - t.string "link_url" - t.string "menu_match" - t.boolean "deletable", :default => true - t.string "custom_title" - t.string "custom_title_type", :default => "none" - t.boolean "draft", :default => false - t.string "browser_title" - t.boolean "skip_to_first_child", :default => false - t.integer "lft" - t.integer "rgt" - t.integer "depth" - end - - add_index ::Refinery::Page.table_name, ["depth"], :name => "index_#{::Refinery::Page.table_name}_on_depth" - add_index ::Refinery::Page.table_name, ["id"], :name => "index_#{::Refinery::Page.table_name}_on_id" - add_index ::Refinery::Page.table_name, ["lft"], :name => "index_#{::Refinery::Page.table_name}_on_lft" - add_index ::Refinery::Page.table_name, ["parent_id"], :name => "index_#{::Refinery::Page.table_name}_on_parent_id" - add_index ::Refinery::Page.table_name, ["rgt"], :name => "index_#{::Refinery::Page.table_name}_on_rgt" - end - end - - def self.down - [::Page, ::Refinery::PagePart].reject{|m| - !(defined?(m) and m.respond_to?(:table_name)) - }.each do |model| - drop_table model.table_name if model.table_exists? - end - end -end diff --git a/spec/dummy/db/migrate/20100913234709_create_refinerycms_resources_schema.rb b/spec/dummy/db/migrate/20100913234709_create_refinerycms_resources_schema.rb deleted file mode 100644 index 360f469..0000000 --- a/spec/dummy/db/migrate/20100913234709_create_refinerycms_resources_schema.rb +++ /dev/null @@ -1,21 +0,0 @@ -class CreateRefinerycmsResourcesSchema < ActiveRecord::Migration - def self.up - create_table ::Refinery::Resource.table_name, :force => true do |t| - t.string "file_mime_type" - t.string "file_name" - t.integer "file_size" - t.datetime "created_at" - t.datetime "updated_at" - t.string "file_uid" - t.string "file_ext" - end unless ::Refinery::Resource.table_exists? - end - - def self.down - [::Resource].reject{|m| - !(defined?(m) and m.respond_to?(:table_name)) - }.each do |model| - drop_table model.table_name if model.table_exists? - end - end -end diff --git a/spec/dummy/db/migrate/20100913234710_create_refinerycms_settings_schema.rb b/spec/dummy/db/migrate/20100913234710_create_refinerycms_settings_schema.rb deleted file mode 100644 index 955389f..0000000 --- a/spec/dummy/db/migrate/20100913234710_create_refinerycms_settings_schema.rb +++ /dev/null @@ -1,26 +0,0 @@ -class CreateRefinerycmsSettingsSchema < ActiveRecord::Migration - def self.up - unless ::Refinery::Setting.table_exists? - create_table ::Refinery::Setting.table_name, :force => true do |t| - t.string "name" - t.text "value" - t.boolean "destroyable", :default => true - t.datetime "created_at" - t.datetime "updated_at" - t.string "scoping" - t.boolean "restricted", :default => false - t.string "callback_proc_as_string" - end - - add_index ::Refinery::Setting.table_name, ["name"], :name => "index_#{::Refinery::Setting.table_name}_on_name" - end - end - - def self.down - [::Refinery::Setting].reject{|m| - !(defined?(m) and m.respond_to?(:table_name)) - }.each do |model| - drop_table model.table_name if model.table_exists? - end - end -end diff --git a/spec/dummy/db/migrate/20100926142529_add_value_type_to_refinery_settings.rb b/spec/dummy/db/migrate/20100926142529_add_value_type_to_refinery_settings.rb deleted file mode 100644 index d13aa01..0000000 --- a/spec/dummy/db/migrate/20100926142529_add_value_type_to_refinery_settings.rb +++ /dev/null @@ -1,13 +0,0 @@ -class AddValueTypeToRefinerySettings < ActiveRecord::Migration - def self.up - add_column ::Refinery::Setting.table_name, :form_value_type, :string - - ::Refinery::Setting.reset_column_information - end - - def self.down - remove_column ::Refinery::Setting.table_name, :form_value_type - - ::Refinery::Setting.reset_column_information - end -end diff --git a/spec/dummy/db/migrate/20100929035252_add_missing_indexes_to_roles_users.rb b/spec/dummy/db/migrate/20100929035252_add_missing_indexes_to_roles_users.rb deleted file mode 100644 index e72d81f..0000000 --- a/spec/dummy/db/migrate/20100929035252_add_missing_indexes_to_roles_users.rb +++ /dev/null @@ -1,11 +0,0 @@ -class AddMissingIndexesToRolesUsers < ActiveRecord::Migration - def self.up - add_index ::Refinery::RolesUsers.table_name, [:role_id, :user_id] - add_index ::Refinery::RolesUsers.table_name, [:user_id, :role_id] - end - - def self.down - remove_index ::Refinery::RolesUsers.table_name, :column => [:role_id, :user_id] - remove_index ::Refinery::RolesUsers.table_name, :column => [:user_id, :role_id] - end -end diff --git a/spec/dummy/db/migrate/20101206013505_change_to_devise_users_table.rb b/spec/dummy/db/migrate/20101206013505_change_to_devise_users_table.rb deleted file mode 100644 index 8beef83..0000000 --- a/spec/dummy/db/migrate/20101206013505_change_to_devise_users_table.rb +++ /dev/null @@ -1,31 +0,0 @@ -class ChangeToDeviseUsersTable < ActiveRecord::Migration - def self.up - add_column ::Refinery::User.table_name, :current_sign_in_at, :datetime - add_column ::Refinery::User.table_name, :last_sign_in_at, :datetime - add_column ::Refinery::User.table_name, :current_sign_in_ip, :string - add_column ::Refinery::User.table_name, :last_sign_in_ip, :string - add_column ::Refinery::User.table_name, :sign_in_count, :integer - add_column ::Refinery::User.table_name, :remember_token, :string - add_column ::Refinery::User.table_name, :reset_password_token, :string - - rename_column ::Refinery::User.table_name, :crypted_password, :encrypted_password - rename_column ::Refinery::User.table_name, :login, :username - - ::Refinery::User.reset_column_information - end - - def self.down - remove_column ::Refinery::User.table_name, :current_sign_in_at - remove_column ::Refinery::User.table_name, :last_sign_in_at - remove_column ::Refinery::User.table_name, :current_sign_in_ip - remove_column ::Refinery::User.table_name, :last_sign_in_ip - remove_column ::Refinery::User.table_name, :sign_in_count - remove_column ::Refinery::User.table_name, :remember_token - remove_column ::Refinery::User.table_name, :reset_password_token - - rename_column ::Refinery::User.table_name, :encrypted_password, :crypted_password - rename_column ::Refinery::User.table_name, :username, :login - - ::Refinery::User.reset_column_information - end -end diff --git a/spec/dummy/db/migrate/20101216194133_remove_cached_slug_from_pages.rb b/spec/dummy/db/migrate/20101216194133_remove_cached_slug_from_pages.rb deleted file mode 100644 index 341bc8f..0000000 --- a/spec/dummy/db/migrate/20101216194133_remove_cached_slug_from_pages.rb +++ /dev/null @@ -1,17 +0,0 @@ -class RemoveCachedSlugFromPages < ActiveRecord::Migration - def self.up - if ::Refinery::Page.column_names.map(&:to_s).include?('cached_slug') - say_with_time("Removing cached_slug column from ::Refinery::Page table") do - remove_column ::Refinery::Page.table_name, :cached_slug - end - else - say "Nothing done, no cached_slug field found in ::Refinery::Page table" - end - - ::Refinery::Page.reset_column_information - end - - def self.down - # Don't add this column back, it breaks stuff. - end -end diff --git a/spec/dummy/db/migrate/20101217113424_add_locale_to_slugs.rb b/spec/dummy/db/migrate/20101217113424_add_locale_to_slugs.rb deleted file mode 100644 index 4b56f03..0000000 --- a/spec/dummy/db/migrate/20101217113424_add_locale_to_slugs.rb +++ /dev/null @@ -1,15 +0,0 @@ -class AddLocaleToSlugs < ActiveRecord::Migration - def self.up - add_column ::Slug.table_name, :locale, :string, :limit => 5 - - add_index ::Slug.table_name, :locale - - ::Slug.reset_column_information - end - - def self.down - remove_column :slugs, :locale - - ::Slug.reset_column_information - end -end diff --git a/spec/dummy/db/migrate/20101217113425_translate_page_plugin.rb b/spec/dummy/db/migrate/20101217113425_translate_page_plugin.rb deleted file mode 100644 index 1280e88..0000000 --- a/spec/dummy/db/migrate/20101217113425_translate_page_plugin.rb +++ /dev/null @@ -1,40 +0,0 @@ -class TranslatePagePlugin < ActiveRecord::Migration - def self.up - say_with_time("Creating ::Refinery::PagePart translation table") do - ::Refinery::PagePart.create_translation_table!({ - :body => :text - }, { - :migrate_data => true - }) - end - - say_with_time("Creating ::Refinery::Page translation table") do - ::Refinery::Page.create_translation_table!({ - :title => :string, - :meta_keywords => :string, - :meta_description => :text, - :browser_title => :string, - :custom_slug => :string, - :menu_title => :string - }, { - :migrate_data => true - }) - end - - puts "seeds pages" - if (seed_file = Rails.root.join('db', 'seeds', 'pages.rb')).file? - load seed_file.to_s unless ::Refinery::Page.where(:link_url => '/').any? - end - - say_with_time("Updating slugs") do - ::Slug.update_all(:locale => I18n.locale) - end - end - - def self.down - say_with_time("Dropping ::Refinery::Page and ::Refinery::PagePart translation tables") do - ::Refinery::Page.drop_translation_table! :migrate_data => true - ::Refinery::PagePart.drop_translation_table! :migrate_data => true - end - end -end diff --git a/spec/dummy/db/migrate/20110106184757_add_remember_created_at_to_users.rb b/spec/dummy/db/migrate/20110106184757_add_remember_created_at_to_users.rb deleted file mode 100644 index 78c9f68..0000000 --- a/spec/dummy/db/migrate/20110106184757_add_remember_created_at_to_users.rb +++ /dev/null @@ -1,7 +0,0 @@ -class AddRememberCreatedAtToUsers < ActiveRecord::Migration - def change - add_column ::Refinery::User.table_name, :remember_created_at, :datetime - - ::Refinery::User.reset_column_information - end -end diff --git a/spec/dummy/db/migrate/20110117053357_remove_duplicate_user_image_sizes_setting.rb b/spec/dummy/db/migrate/20110117053357_remove_duplicate_user_image_sizes_setting.rb deleted file mode 100644 index 9b6db2b..0000000 --- a/spec/dummy/db/migrate/20110117053357_remove_duplicate_user_image_sizes_setting.rb +++ /dev/null @@ -1,22 +0,0 @@ -class RemoveDuplicateUserImageSizesSetting < ActiveRecord::Migration - def self.up - if (settings = ::Refinery::Setting.where(:name => :user_image_sizes)).count > 1 - default_value = { :small => '110x110>', :medium => '225x255>', :large => '450x450>' } - - if (non_default_setting = settings.detect { |setting| setting[:value] != default_value }) - settings.detect { |setting| setting[:value] == default_value }.destroy - non_default_setting[:destroyable] = false - non_default_setting.save - else - settings.detect { |setting| setting[:destroyable] == true }.destroy - end - say "Removed duplicate user image sizes settings" - else - say "Nothing done, no duplicate settings found" - end - end - - def self.down - # there is no step down ... - end -end diff --git a/spec/dummy/db/migrate/20110307025652_translate_custom_title_on_pages.rb b/spec/dummy/db/migrate/20110307025652_translate_custom_title_on_pages.rb deleted file mode 100644 index 7d87d84..0000000 --- a/spec/dummy/db/migrate/20110307025652_translate_custom_title_on_pages.rb +++ /dev/null @@ -1,41 +0,0 @@ -class TranslateCustomTitleOnPages < ActiveRecord::Migration - def self.up - unless ::Refinery::Page.translation_class.column_names.map(&:to_sym).include?(:menu_title) - add_column ::Refinery::Page.translation_class.table_name, :menu_title, :string - - say_with_time("Re-save menu_title") do - ::Refinery::Page.all.each do |page| - say "updating menu_title field for page##{page.id}" - page.update_attribute(:menu_title, page.untranslated_attributes['menu_title']) - end - end - else - say "Nothing done, ::Refinery::Page.translation_class table already includes a menu_title field" - end - - ::Refinery::Page.translation_class.reset_column_information - end - - def self.down - say_with_time("Re-save menu_title") do - ::Refinery::Page.all.each do |page| - if page.attributes['menu_title'].nil? - say "Nothing done, page##{page.id} menu_title field is nil" - else - say "updating menu_title field for page #{page.id}" - ::Refinery::Page.update_all({ - :menu_title => page.attributes['menu_title'] - }, { - :id => page.id.to_s - }) - end - end - end - - remove_column ::Refinery::Page.translation_class.table_name, :menu_title - - ::Refinery::Page.translated_attribute_names.delete(:menu_title) - - ::Refinery::Page.translation_class.reset_column_information - end -end diff --git a/spec/dummy/db/migrate/20110314213540_remove_translated_fields_from_pages.rb b/spec/dummy/db/migrate/20110314213540_remove_translated_fields_from_pages.rb deleted file mode 100644 index 452daee..0000000 --- a/spec/dummy/db/migrate/20110314213540_remove_translated_fields_from_pages.rb +++ /dev/null @@ -1,17 +0,0 @@ -class RemoveTranslatedFieldsFromPages < ActiveRecord::Migration - def self.up - ::Refinery::Page.translated_attribute_names.map(&:to_sym).each do |column_name| - remove_column ::Refinery::Page.table_name, column_name if ::Refinery::Page.column_names.map(&:to_sym).include?(column_name) - end - - ::Refinery::Page.reset_column_information - end - - def self.down - ::Refinery::Page.translated_attribute_names.map(&:to_sym).each do |column_name| - add_column ::Refinery::Page.table_name, column_name, Page::Translation.columns.detect{|c| c.name.to_sym == column_name}.type - end - - ::Refinery::Page.reset_column_information - end -end diff --git a/spec/dummy/db/migrate/20110325213325_remove_password_salt_from_users.rb b/spec/dummy/db/migrate/20110325213325_remove_password_salt_from_users.rb deleted file mode 100644 index 4197125..0000000 --- a/spec/dummy/db/migrate/20110325213325_remove_password_salt_from_users.rb +++ /dev/null @@ -1,17 +0,0 @@ -class RemovePasswordSaltFromUsers < ActiveRecord::Migration - def self.up - remove_column ::Refinery::User.table_name, :password_salt - # Make the current password invalid :( - ::Refinery::User.all.each do |u| - u.update_attribute(:encrypted_password, u.encrypted_password[29..-1]) - end - - ::Refinery::User.reset_column_information - end - - def self.down - add_column ::Refinery::User.table_name, :password_salt, :string - - ::Refinery::User.reset_column_information - end -end diff --git a/spec/dummy/db/migrate/20110329222114_create_seo_meta.rb b/spec/dummy/db/migrate/20110329222114_create_seo_meta.rb deleted file mode 100644 index cb8c268..0000000 --- a/spec/dummy/db/migrate/20110329222114_create_seo_meta.rb +++ /dev/null @@ -1,86 +0,0 @@ -class CreateSeoMeta < ActiveRecord::Migration - - def self.up - create_table :seo_meta do |t| - t.integer :seo_meta_id - t.string :seo_meta_type - - t.string :browser_title - t.string :meta_keywords - t.text :meta_description - - t.timestamps - end - - add_index :seo_meta, :id - add_index :seo_meta, [:seo_meta_id, :seo_meta_type] - - # Grab the attributes of the records that currently exist - existing_translations = ::Refinery::Page.translation_class.all.map(&:attributes) - - # Remove columns - ::SeoMeta.attributes.keys.each do |field| - if ::Refinery::Page.translation_class.column_names.map(&:to_sym).include?(field) - remove_column ::Refinery::Page.translation_class.table_name, field - end - end - - # Reset column information because otherwise the old columns will still exist. - ::Refinery::Page.translation_class.reset_column_information - - # Re-attach seo_meta - ::Refinery::Page.translation_class.send :is_seo_meta - - # Migrate data - existing_translations.each do |translation| - ::Refinery::Page.translation_class.find(translation['id']).update_attributes( - ::SeoMeta.attributes.keys.inject({}) {|attributes, name| - attributes.merge(name => translation[name.to_s]) - } - ) - end - - # Reset column information again because otherwise the old columns will still exist. - ::Refinery::Page.reset_column_information - end - - def self.down - # Grab the attributes of the records that currently exist - existing_translations = ::Refinery::Page.translation_class.all.map(&:attributes) - - # Add columns back to your model - ::Refinery::SeoMeta.attributes.each do |field, field_type| - unless ::Refinery::Page.translation_class.column_names.map(&:to_sym).include?(field) - add_column ::Refinery::Page.translation_class.table_name, field, field_type - end - end - - # Reset column information because otherwise the new columns won't exist yet. - ::Refinery::Page.translation_class.reset_column_information - - # Migrate data - existing_translations.each do |translation| - ::Refinery::Page.translation_class.update_all( - ::Refinery::SeoMeta.attributes.keys.inject({}) {|attributes, name| - attributes.merge(name => translation[name.to_s]) - }, :id => translation['id'] - ) - end - - ::Refinery::SeoMeta.attributes.keys.each do |k| - ::Refinery::Page.translation_class.module_eval %{ - def #{k} - end - - def #{k}=(*args) - end - } - end - - # Reset column information again because otherwise the old columns will still exist. - ::Refinery::Page.reset_column_information - - drop_table :seo_meta - end - -end diff --git a/spec/dummy/db/migrate/20110714071142_create_add_template_columns.rb b/spec/dummy/db/migrate/20110714071142_create_add_template_columns.rb deleted file mode 100644 index eb98ed1..0000000 --- a/spec/dummy/db/migrate/20110714071142_create_add_template_columns.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateAddTemplateColumns < ActiveRecord::Migration - def self.up - add_column ::Refinery::Page.table_name, :view_template, :string - add_column ::Refinery::Page.table_name, :layout_template, :string - end - - def self.down - remove_column ::Refinery::Page.table_name, :layout_template - remove_column ::Refinery::Page.table_name, :view_template - end -end diff --git a/spec/dummy/db/migrate/20110810070753_add_custom_slug_to_refinery_page_translations.rb b/spec/dummy/db/migrate/20110810070753_add_custom_slug_to_refinery_page_translations.rb deleted file mode 100644 index 2feb837..0000000 --- a/spec/dummy/db/migrate/20110810070753_add_custom_slug_to_refinery_page_translations.rb +++ /dev/null @@ -1,11 +0,0 @@ -class AddCustomSlugToRefineryPageTranslations < ActiveRecord::Migration - def up - if ::Refinery::Page::Translation.column_names.map(&:to_sym).exclude?(:custom_slug) - add_column ::Refinery::Page::Translation.table_name, :custom_slug, :string, :default => nil - end - end - - def down - remove_column ::Refinery::Page::Translation.table_name, :custom_slug - end -end diff --git a/spec/dummy/db/migrate/20110812055013_rename_custom_title_to_menu_title_in_refinery_pages.rb b/spec/dummy/db/migrate/20110812055013_rename_custom_title_to_menu_title_in_refinery_pages.rb deleted file mode 100644 index 0ce6cb2..0000000 --- a/spec/dummy/db/migrate/20110812055013_rename_custom_title_to_menu_title_in_refinery_pages.rb +++ /dev/null @@ -1,15 +0,0 @@ -class RenameCustomTitleToMenuTitleInRefineryPages < ActiveRecord::Migration - def up - if ::Refinery::Page::Translation.column_names.map(&:to_sym).include?(:custom_title) - rename_column ::Refinery::Page::Translation.table_name, :custom_title, :menu_title - end - remove_column ::Refinery::Page.table_name, :custom_title_type - end - - def down - if ::Refinery::Page::Translation.column_names.map(&:to_sym).include?(:menu_title) - rename_column ::Refinery::Page::Translation.table_name, :menu_title, :custom_title - end - add_column ::Refinery::Page.table_name, :custom_title_type, :string - end -end diff --git a/spec/dummy/db/schema.rb b/spec/dummy/db/schema.rb deleted file mode 100644 index 2cf06e5..0000000 --- a/spec/dummy/db/schema.rb +++ /dev/null @@ -1,240 +0,0 @@ -# encoding: UTF-8 -# This file is auto-generated from the current state of the database. Instead -# of editing this file, please use the migrations feature of Active Record to -# incrementally modify your database, and then regenerate this schema definition. -# -# Note that this schema.rb definition is the authoritative source for your -# database schema. If you need to create the application database on another -# system, you should be using db:schema:load, not running all the migrations -# from scratch. The latter is a flawed and unsustainable approach (the more migrations -# you'll amass, the slower it'll run and the greater likelihood for issues). -# -# It's strongly recommended to check this file into your version control system. - -ActiveRecord::Schema.define(:version => 20110812055013) do - - create_table "refinery_blog_categories", :force => true do |t| - t.string "title" - t.datetime "created_at" - t.datetime "updated_at" - t.string "cached_slug" - end - - add_index "refinery_blog_categories", ["id"], :name => "index_refinery_blog_categories_on_id" - - create_table "refinery_blog_categories_blog_posts", :force => true do |t| - t.integer "blog_category_id" - t.integer "blog_post_id" - end - - add_index "refinery_blog_categories_blog_posts", ["blog_category_id", "blog_post_id"], :name => "index_blog_categories_blog_posts_on_bc_and_bp" - - create_table "refinery_blog_comments", :force => true do |t| - t.integer "blog_post_id" - t.boolean "spam" - t.string "name" - t.string "email" - t.text "body" - t.string "state" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "refinery_blog_comments", ["id"], :name => "index_refinery_blog_comments_on_id" - - create_table "refinery_blog_posts", :force => true do |t| - t.string "title" - t.text "body" - t.boolean "draft" - t.datetime "published_at" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "user_id" - t.string "cached_slug" - t.string "custom_url" - t.text "custom_teaser" - end - - add_index "refinery_blog_posts", ["id"], :name => "index_refinery_blog_posts_on_id" - - create_table "refinery_images", :force => true do |t| - t.string "image_mime_type" - t.string "image_name" - t.integer "image_size" - t.integer "image_width" - t.integer "image_height" - t.datetime "created_at" - t.datetime "updated_at" - t.string "image_uid" - t.string "image_ext" - end - - create_table "refinery_page_part_translations", :force => true do |t| - t.integer "refinery_page_part_id" - t.string "locale" - t.text "body" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "refinery_page_part_translations", ["refinery_page_part_id"], :name => "index_f9716c4215584edbca2557e32706a5ae084a15ef" - - create_table "refinery_page_parts", :force => true do |t| - t.integer "refinery_page_id" - t.string "title" - t.text "body" - t.integer "position" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "refinery_page_parts", ["id"], :name => "index_refinery_page_parts_on_id" - add_index "refinery_page_parts", ["refinery_page_id"], :name => "index_refinery_page_parts_on_page_id" - - create_table "refinery_page_translations", :force => true do |t| - t.integer "refinery_page_id" - t.string "locale" - t.string "title" - t.string "menu_title" - t.datetime "created_at" - t.datetime "updated_at" - t.string "custom_slug" - end - - add_index "refinery_page_translations", ["refinery_page_id"], :name => "index_d079468f88bff1c6ea81573a0d019ba8bf5c2902" - - create_table "refinery_pages", :force => true do |t| - t.integer "parent_id" - t.integer "position" - t.string "path" - t.datetime "created_at" - t.datetime "updated_at" - t.boolean "show_in_menu", :default => true - t.string "link_url" - t.string "menu_match" - t.boolean "deletable", :default => true - t.boolean "draft", :default => false - t.boolean "skip_to_first_child", :default => false - t.integer "lft" - t.integer "rgt" - t.integer "depth" - t.string "view_template" - t.string "layout_template" - end - - add_index "refinery_pages", ["depth"], :name => "index_refinery_pages_on_depth" - add_index "refinery_pages", ["id"], :name => "index_refinery_pages_on_id" - add_index "refinery_pages", ["lft"], :name => "index_refinery_pages_on_lft" - add_index "refinery_pages", ["parent_id"], :name => "index_refinery_pages_on_parent_id" - add_index "refinery_pages", ["rgt"], :name => "index_refinery_pages_on_rgt" - - create_table "refinery_resources", :force => true do |t| - t.string "file_mime_type" - t.string "file_name" - t.integer "file_size" - t.datetime "created_at" - t.datetime "updated_at" - t.string "file_uid" - t.string "file_ext" - end - - create_table "refinery_roles", :force => true do |t| - t.string "title" - end - - create_table "refinery_roles_users", :id => false, :force => true do |t| - t.integer "user_id" - t.integer "role_id" - end - - add_index "refinery_roles_users", ["role_id", "user_id"], :name => "index_refinery_roles_users_on_role_id_and_user_id" - add_index "refinery_roles_users", ["user_id", "role_id"], :name => "index_refinery_roles_users_on_user_id_and_role_id" - - create_table "refinery_settings", :force => true do |t| - t.string "name" - t.text "value" - t.boolean "destroyable", :default => true - t.datetime "created_at" - t.datetime "updated_at" - t.string "scoping" - t.boolean "restricted", :default => false - t.string "callback_proc_as_string" - t.string "form_value_type" - end - - add_index "refinery_settings", ["name"], :name => "index_refinery_settings_on_name" - - create_table "refinery_user_plugins", :force => true do |t| - t.integer "user_id" - t.string "name" - t.integer "position" - end - - add_index "refinery_user_plugins", ["name"], :name => "index_refinery_user_plugins_on_title" - add_index "refinery_user_plugins", ["user_id", "name"], :name => "index_unique_refinery_user_plugins", :unique => true - - create_table "refinery_users", :force => true do |t| - t.string "username", :null => false - t.string "email", :null => false - t.string "encrypted_password", :null => false - t.string "persistence_token" - t.datetime "created_at" - t.datetime "updated_at" - t.string "perishable_token" - t.datetime "current_sign_in_at" - t.datetime "last_sign_in_at" - t.string "current_sign_in_ip" - t.string "last_sign_in_ip" - t.integer "sign_in_count" - t.string "remember_token" - t.string "reset_password_token" - t.datetime "remember_created_at" - end - - add_index "refinery_users", ["id"], :name => "index_refinery_users_on_id" - - create_table "seo_meta", :force => true do |t| - t.integer "seo_meta_id" - t.string "seo_meta_type" - t.string "browser_title" - t.string "meta_keywords" - t.text "meta_description" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "seo_meta", ["id"], :name => "index_seo_meta_on_id" - add_index "seo_meta", ["seo_meta_id", "seo_meta_type"], :name => "index_seo_meta_on_seo_meta_id_and_seo_meta_type" - - create_table "slugs", :force => true do |t| - t.string "name" - t.integer "sluggable_id" - t.integer "sequence", :default => 1, :null => false - t.string "sluggable_type", :limit => 40 - t.string "scope", :limit => 40 - t.datetime "created_at" - t.string "locale", :limit => 5 - end - - add_index "slugs", ["locale"], :name => "index_slugs_on_locale" - add_index "slugs", ["name", "sluggable_type", "scope", "sequence"], :name => "index_slugs_on_n_s_s_and_s", :unique => true - add_index "slugs", ["sluggable_id"], :name => "index_slugs_on_sluggable_id" - - create_table "taggings", :force => true do |t| - t.integer "tag_id" - t.integer "taggable_id" - t.string "taggable_type" - t.integer "tagger_id" - t.string "tagger_type" - t.string "context" - t.datetime "created_at" - end - - add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id" - add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context" - - create_table "tags", :force => true do |t| - t.string "name" - end - -end diff --git a/spec/dummy/db/seeds/pages.rb b/spec/dummy/db/seeds/pages.rb deleted file mode 100644 index 62d4e8d..0000000 --- a/spec/dummy/db/seeds/pages.rb +++ /dev/null @@ -1,55 +0,0 @@ -module Refinery - ::Refinery::Page.reset_column_information - - page_position = -1 - - unless ::Refinery::Page.where(:menu_match => "^/$").any? - home_page = ::Refinery::Page.create!({:title => "Home", - :deletable => false, - :link_url => "/", - :menu_match => "^/$", - :position => (page_position += 1)}) - home_page.parts.create({ - :title => "Body", - :body => "

    Welcome to our site. This is just a place holder page while we gather our content.

    ", - :position => 0 - }) - home_page.parts.create({ - :title => "Side Body", - :body => "

    This is another block of content over here.

    ", - :position => 1 - }) - - home_page_position = -1 - page_not_found_page = home_page.children.create(:title => "Page not found", - :menu_match => "^/404$", - :show_in_menu => false, - :deletable => false, - :position => (home_page_position += 1)) - page_not_found_page.parts.create({ - :title => "Body", - :body => "

    Sorry, there was a problem...

    The page you requested was not found.

    Return to the home page

    ", - :position => 0 - }) - else - page_position += 1 - end - - unless ::Refinery::Page.by_title("About").any? - about_us_page = ::Refinery::Page.create(:title => "About", - :deletable => true, - :position => (page_position += 1)) - about_us_page.parts.create({ - :title => "Body", - :body => "

    This is just a standard text page example. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin metus dolor, hendrerit sit amet, aliquet nec, posuere sed, purus. Nullam et velit iaculis odio sagittis placerat. Duis metus tellus, pellentesque ut, luctus id, egestas a, lorem. Praesent vitae mauris. Aliquam sed nulla. Sed id nunc vitae leo suscipit viverra. Proin at leo ut lacus consequat rhoncus. In hac habitasse platea dictumst. Nunc quis tortor sed libero hendrerit dapibus.\n\nInteger interdum purus id erat. Duis nec velit vitae dolor mattis euismod. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Suspendisse pellentesque dignissim lacus. Nulla semper euismod arcu. Suspendisse egestas, erat a consectetur dapibus, felis orci cursus eros, et sollicitudin purus urna et metus. Integer eget est sed nunc euismod vestibulum. Integer nulla dui, tristique in, euismod et, interdum imperdiet, enim. Mauris at lectus. Sed egestas tortor nec mi.

    ", - :position => 0 - }) - about_us_page.parts.create({ - :title => "Side Body", - :body => "

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus fringilla nisi a elit. Duis ultricies orci ut arcu. Ut ac nibh. Duis blandit rhoncus magna. Pellentesque semper risus ut magna. Etiam pulvinar tellus eget diam. Morbi blandit. Donec pulvinar mauris at ligula. Sed pellentesque, ipsum id congue molestie, lectus risus egestas pede, ac viverra diam lacus ac urna. Aenean elit.

    ", - :position => 1 - }) - else - page_position += 1 - end -end diff --git a/spec/dummy/lib/assets/.gitkeep b/spec/dummy/lib/assets/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/spec/dummy/log/.gitkeep b/spec/dummy/log/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/spec/dummy/public/404.html b/spec/dummy/public/404.html deleted file mode 100644 index 9a48320..0000000 --- a/spec/dummy/public/404.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - The page you were looking for doesn't exist (404) - - - - - -
    -

    The page you were looking for doesn't exist.

    -

    You may have mistyped the address or the page may have moved.

    -
    - - diff --git a/spec/dummy/public/422.html b/spec/dummy/public/422.html deleted file mode 100644 index 83660ab..0000000 --- a/spec/dummy/public/422.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - The change you wanted was rejected (422) - - - - - -
    -

    The change you wanted was rejected.

    -

    Maybe you tried to change something you didn't have access to.

    -
    - - diff --git a/spec/dummy/public/500.html b/spec/dummy/public/500.html deleted file mode 100644 index b80307f..0000000 --- a/spec/dummy/public/500.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - We're sorry, but something went wrong (500) - - - - - -
    -

    We're sorry, but something went wrong.

    -

    We've been notified about this issue and we'll take a look at it shortly.

    -
    - - diff --git a/spec/dummy/public/favicon.ico b/spec/dummy/public/favicon.ico deleted file mode 100644 index e69de29..0000000 diff --git a/spec/dummy/script/rails b/spec/dummy/script/rails deleted file mode 100755 index f8da2cf..0000000 --- a/spec/dummy/script/rails +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env ruby -# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. - -APP_PATH = File.expand_path('../../config/application', __FILE__) -require File.expand_path('../../config/boot', __FILE__) -require 'rails/commands' diff --git a/spec/dummy/version.rb b/spec/dummy/version.rb deleted file mode 100644 index ed35a95..0000000 --- a/spec/dummy/version.rb +++ /dev/null @@ -1,5 +0,0 @@ -module Refinery - module TestApp - VERSION = "0.0.1" - end -end From db93751fd6b856a3eef79ddbd60d1251e6daa732 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Wed, 26 Oct 2011 13:12:26 -0700 Subject: [PATCH 343/494] Modify Rakefile to load engine tasks and testing railtie tasks --- Rakefile | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/Rakefile b/Rakefile index 0fb4407..8b8cb49 100644 --- a/Rakefile +++ b/Rakefile @@ -4,31 +4,12 @@ begin rescue LoadError puts 'You must `gem install bundler` and `bundle install` to run rake tasks' end -begin - require 'rdoc/task' -rescue LoadError - require 'rdoc/rdoc' - require 'rake/rdoctask' - RDoc::Task = Rake::RDocTask -end - -RDoc::Task.new(:rdoc) do |rdoc| - rdoc.rdoc_dir = 'rdoc' - rdoc.title = 'RefinerycmsBlog' - rdoc.options << '--line-numbers' - rdoc.rdoc_files.include('README.rdoc') - rdoc.rdoc_files.include('lib/**/*.rb') -end - -require 'rspec/core/rake_task' - -desc "Run specs" -RSpec::Core::RakeTask.new(:spec => 'refinery:testing:engine:init_test_database') APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__) -load 'rails/tasks/engine.rake' -load 'refinery/tasks/testing.rake' -Bundler::GemHelper.install_tasks +if File.exists?(APP_RAKEFILE) + load 'rails/tasks/engine.rake' +end -task :default => 'refinery:testing:engine:setup' +require "refinerycms-testing" +Refinery::Testing::Railtie.load_tasks From 993b4a8b1b8a994ad09f5d5be9cd2fdc7b44669c Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Wed, 26 Oct 2011 13:24:15 -0700 Subject: [PATCH 344/494] Update engine definition Isolate engine to Refinery add engine name Add initializer to register engine with Refinery Rename plugin init initializer to be more descriptive Update plugin initializer to conform to latest master of RefineryCMS --- lib/refinery/blog/engine.rb | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/refinery/blog/engine.rb b/lib/refinery/blog/engine.rb index f67d4ab..b335dbc 100644 --- a/lib/refinery/blog/engine.rb +++ b/lib/refinery/blog/engine.rb @@ -1,23 +1,32 @@ +require 'rails_autolink' + module Refinery module Blog class Engine < Rails::Engine - require 'rails_autolink' + include Refinery::Engine + + isolate_namespace Refinery + engine_name :refinery_resources config.to_prepare do require 'refinery/blog/tabs' end - initializer "init plugin", :after => :set_routes_reloader do |app| + initializer "register refinerycms_blog plugin", :after => :set_routes_reloader do |app| Refinery::Plugin.register do |plugin| plugin.pathname = root plugin.name = "refinerycms_blog" plugin.url = app.routes.url_helpers.refinery_admin_blog_posts_path plugin.menu_match = /^\/refinery\/blog\/?(posts|comments|categories)?/ plugin.activity = { - :class => Refinery::BlogPost + :class_name => :'refinery/blog_post' } end end + + config.after_initialize do + Refinery.register_engine(Refinery::Blog) + end end end end From 5dd11ffc617613ab8b21cd9e80b96810c43653d8 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Wed, 26 Oct 2011 13:29:01 -0700 Subject: [PATCH 345/494] Remove Refinery::Application route draw call, it no longer exists --- config/routes.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/routes.rb b/config/routes.rb index 6ba5186..2ed6e8d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,4 @@ -::Refinery::Application.routes.draw do +Rails.application.routes.draw do scope(:module => 'refinery') do scope(:path => 'blog', :module => 'blog') do root :to => 'posts#index', :as => 'blog_root' From 4ddc2b3754746bf21485e6fff5ca2bebc6aa47fe Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Wed, 26 Oct 2011 13:29:41 -0700 Subject: [PATCH 346/494] Add spec/dummy to git ignore file --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 271bed4..7acd8b2 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ doc/* *.autobackupbyrefinery.* /refinerycms-blog*.gem .autotest +spec/dummy # Mac .DS_Store From 0de4fd9582b4ee0f83172cb736c509f839dcbc3b Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Wed, 26 Oct 2011 13:50:26 -0700 Subject: [PATCH 347/494] Add ENGINE_ROOT constant to Rakefile for refinerycms-testing tasks --- Rakefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Rakefile b/Rakefile index 8b8cb49..5adcafe 100644 --- a/Rakefile +++ b/Rakefile @@ -5,6 +5,7 @@ rescue LoadError puts 'You must `gem install bundler` and `bundle install` to run rake tasks' end +ENGINE_ROOT = File.dirname(__FILE__) APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__) if File.exists?(APP_RAKEFILE) From 8cd4a282d8f1173f4d8df496c2dd2b61ad892292 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Thu, 27 Oct 2011 15:29:02 -0700 Subject: [PATCH 348/494] This is the blog engine... not hte resources engine.. --- lib/refinery/blog/engine.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/refinery/blog/engine.rb b/lib/refinery/blog/engine.rb index b335dbc..8ca1f0a 100644 --- a/lib/refinery/blog/engine.rb +++ b/lib/refinery/blog/engine.rb @@ -6,7 +6,7 @@ module Refinery include Refinery::Engine isolate_namespace Refinery - engine_name :refinery_resources + engine_name :refinery_blog config.to_prepare do require 'refinery/blog/tabs' From 5a958007c5c4b3ef4af001464d75c4c00adfe870 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Thu, 27 Oct 2011 18:12:32 -0700 Subject: [PATCH 349/494] Update blog generator to use Rails 3.1 base Seeds will now follow Rails 3.1 conventions --- Rakefile | 2 +- db/{seeds/refinerycms_blog.rb => seeds.rb} | 0 lib/generators/blog_generator.rb | 10 ---------- lib/generators/refinery/blog/blog_generator.rb | 16 ++++++++++++++++ lib/refinerycms-blog.rb | 3 ++- 5 files changed, 19 insertions(+), 12 deletions(-) rename db/{seeds/refinerycms_blog.rb => seeds.rb} (100%) delete mode 100644 lib/generators/blog_generator.rb create mode 100644 lib/generators/refinery/blog/blog_generator.rb diff --git a/Rakefile b/Rakefile index 5adcafe..8fb342e 100644 --- a/Rakefile +++ b/Rakefile @@ -5,7 +5,7 @@ rescue LoadError puts 'You must `gem install bundler` and `bundle install` to run rake tasks' end -ENGINE_ROOT = File.dirname(__FILE__) +ENGINE_PATH = File.dirname(__FILE__) APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__) if File.exists?(APP_RAKEFILE) diff --git a/db/seeds/refinerycms_blog.rb b/db/seeds.rb similarity index 100% rename from db/seeds/refinerycms_blog.rb rename to db/seeds.rb diff --git a/lib/generators/blog_generator.rb b/lib/generators/blog_generator.rb deleted file mode 100644 index 8b09bb7..0000000 --- a/lib/generators/blog_generator.rb +++ /dev/null @@ -1,10 +0,0 @@ -require 'refinery/generators' - -module ::Refinery - class BlogGenerator < ::Refinery::Generators::EngineInstaller - - source_root File.expand_path('../../../', __FILE__) - engine_name "refinerycms-blog" - - end -end diff --git a/lib/generators/refinery/blog/blog_generator.rb b/lib/generators/refinery/blog/blog_generator.rb new file mode 100644 index 0000000..34f6cd2 --- /dev/null +++ b/lib/generators/refinery/blog/blog_generator.rb @@ -0,0 +1,16 @@ +module Refinery + class BlogGenerator < Rails::Generators::Base + source_root File.expand_path('../templates', __FILE__) + + def append_load_seed_data + append_file 'db/seeds.rb', :verbose => true do + <<-EOH + +# Added by RefineryCMS Blog engine +Refinery::Blog::Engine.load_seed + EOH + end + end + + end +end diff --git a/lib/refinerycms-blog.rb b/lib/refinerycms-blog.rb index 135b3e1..88b8afc 100644 --- a/lib/refinerycms-blog.rb +++ b/lib/refinerycms-blog.rb @@ -3,9 +3,10 @@ require 'bundler' Bundler.require require 'filters_spam' -require File.expand_path('../generators/blog_generator', __FILE__) module Refinery + autoload :BlogGenerator, 'generators/refinery/blog/blog_generator' + module Blog autoload :Version, 'refinery/blog/version' autoload :Tab, 'refinery/blog/tabs' From 2b73c292c8aca776031fc31f5ebf94dce93bf0a0 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Thu, 27 Oct 2011 18:22:39 -0700 Subject: [PATCH 350/494] Seed data should not be loaded mid migration Column information is not totally generated and seed will be done at end of migration run --- db/migrate/20110803223522_create_blog_structure.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/db/migrate/20110803223522_create_blog_structure.rb b/db/migrate/20110803223522_create_blog_structure.rb index f6f5b2d..ee3fe01 100644 --- a/db/migrate/20110803223522_create_blog_structure.rb +++ b/db/migrate/20110803223522_create_blog_structure.rb @@ -36,8 +36,6 @@ class CreateBlogStructure < ActiveRecord::Migration end add_index Refinery::Categorization.table_name, [:blog_category_id, :blog_post_id], :name => 'index_blog_categories_blog_posts_on_bc_and_bp' - - load(File.expand_path('../../seeds/refinerycms_blog.rb', __FILE__)) end def down From 14daff297b2c3f2937ef6cf3e72b663903eec97a Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Thu, 27 Oct 2011 19:36:54 -0700 Subject: [PATCH 351/494] Refactor require layout to match other engines --- lib/refinery/blog.rb | 29 +++++++++++++++++++++++++++++ lib/refinery/blog/engine.rb | 3 ++- lib/refinerycms-blog.rb | 32 +------------------------------- 3 files changed, 32 insertions(+), 32 deletions(-) create mode 100644 lib/refinery/blog.rb diff --git a/lib/refinery/blog.rb b/lib/refinery/blog.rb new file mode 100644 index 0000000..af39967 --- /dev/null +++ b/lib/refinery/blog.rb @@ -0,0 +1,29 @@ +require 'refinerycms-core' +require 'filters_spam' +require 'rails_autolink' + +module Refinery + autoload :BlogGenerator, 'generators/refinery/blog/blog_generator' + + module Blog + require 'refinery/blog/engine' if defined?(Rails) + + autoload :Version, 'refinery/blog/version' + autoload :Tab, 'refinery/blog/tabs' + + class << self + attr_accessor :root + def root + @root ||= Pathname.new(File.expand_path('../../', __FILE__)) + end + + def version + ::Refinery::Blog::Version.to_s + end + + def factory_paths + @factory_paths ||= [ File.expand_path("../../spec/factories", __FILE__) ] + end + end + end +end diff --git a/lib/refinery/blog/engine.rb b/lib/refinery/blog/engine.rb index 8ca1f0a..078b97f 100644 --- a/lib/refinery/blog/engine.rb +++ b/lib/refinery/blog/engine.rb @@ -1,4 +1,5 @@ -require 'rails_autolink' +require 'refinerycms-blog' +require 'rails' module Refinery module Blog diff --git a/lib/refinerycms-blog.rb b/lib/refinerycms-blog.rb index 88b8afc..e08f070 100644 --- a/lib/refinerycms-blog.rb +++ b/lib/refinerycms-blog.rb @@ -1,31 +1 @@ -require 'rubygems' -require 'bundler' -Bundler.require - -require 'filters_spam' - -module Refinery - autoload :BlogGenerator, 'generators/refinery/blog/blog_generator' - - module Blog - autoload :Version, 'refinery/blog/version' - autoload :Tab, 'refinery/blog/tabs' - - class << self - attr_accessor :root - def root - @root ||= Pathname.new(File.expand_path('../../', __FILE__)) - end - - def version - ::Refinery::Blog::Version.to_s - end - - def factory_paths - @factory_paths ||= [ File.expand_path("../../spec/factories", __FILE__) ] - end - end - end -end - -require 'refinery/blog/engine' if defined?(Rails) +require 'refinery/blog' From e01e9ff9b72e7ea2a2dbb03f04169d54dbe60fdf Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Thu, 27 Oct 2011 19:37:38 -0700 Subject: [PATCH 352/494] Tabs are autoloaded, don't need to explicitly require --- lib/refinery/blog/engine.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/refinery/blog/engine.rb b/lib/refinery/blog/engine.rb index 078b97f..63b2793 100644 --- a/lib/refinery/blog/engine.rb +++ b/lib/refinery/blog/engine.rb @@ -8,10 +8,6 @@ module Refinery isolate_namespace Refinery engine_name :refinery_blog - - config.to_prepare do - require 'refinery/blog/tabs' - end initializer "register refinerycms_blog plugin", :after => :set_routes_reloader do |app| Refinery::Plugin.register do |plugin| From 4577f788e5163fc8ae8ab2d5514f18bc4afaef69 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Fri, 28 Oct 2011 12:13:16 -0700 Subject: [PATCH 353/494] No need to explicitly call load_factories for Refinery::Testing --- spec/support/refinery.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/spec/support/refinery.rb b/spec/support/refinery.rb index 575ac2b..d761787 100644 --- a/spec/support/refinery.rb +++ b/spec/support/refinery.rb @@ -1,7 +1,5 @@ require 'refinerycms-testing' -Refinery::Testing.load_factories - RSpec.configure do |config| config.extend Refinery::Testing::ControllerMacros::Authentication, :type => :controller config.extend Refinery::Testing::RequestMacros::Authentication, :type => :request From 3165574730abe9515061e07fbc43433a2e4a50ad Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Fri, 28 Oct 2011 12:14:03 -0700 Subject: [PATCH 354/494] Move blog tab accessor and class array to blog file from tab file --- lib/refinery/blog.rb | 8 +++++++- lib/refinery/blog/tabs.rb | 16 +++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/refinery/blog.rb b/lib/refinery/blog.rb index af39967..326e36a 100644 --- a/lib/refinery/blog.rb +++ b/lib/refinery/blog.rb @@ -12,10 +12,16 @@ module Refinery autoload :Tab, 'refinery/blog/tabs' class << self - attr_accessor :root + attr_writer :root + attr_writer :tabs + def root @root ||= Pathname.new(File.expand_path('../../', __FILE__)) end + + def tabs + @tabs ||= [] + end def version ::Refinery::Blog::Version.to_s diff --git a/lib/refinery/blog/tabs.rb b/lib/refinery/blog/tabs.rb index 083d50b..519b90e 100644 --- a/lib/refinery/blog/tabs.rb +++ b/lib/refinery/blog/tabs.rb @@ -1,11 +1,5 @@ module Refinery - module Blog - attr_accessor :tabs - - def self.tabs - @tabs ||= [] - end - + module Blog class Tab attr_accessor :name, :partial @@ -18,11 +12,11 @@ module Refinery raise "A tab MUST have a partial!: #{tab.inspect}" if tab.partial.blank? end - protected + protected - def initialize - ::Refinery::Blog.tabs << self # add me to the collection of registered page tabs - end + def initialize + ::Refinery::Blog.tabs << self # add me to the collection of registered page tabs + end end end end \ No newline at end of file From be06f1658db9094e74a7e4d86c6d11231a58a9a4 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Fri, 28 Oct 2011 12:32:22 -0700 Subject: [PATCH 355/494] Add rspec rake tasks --- Rakefile | 2 ++ tasks/rspec.rake | 6 ++++++ 2 files changed, 8 insertions(+) create mode 100644 tasks/rspec.rake diff --git a/Rakefile b/Rakefile index 8fb342e..320b14a 100644 --- a/Rakefile +++ b/Rakefile @@ -14,3 +14,5 @@ end require "refinerycms-testing" Refinery::Testing::Railtie.load_tasks + +load File.expand_path('../tasks/rspec.rake', __FILE__) diff --git a/tasks/rspec.rake b/tasks/rspec.rake new file mode 100644 index 0000000..a7a9ae0 --- /dev/null +++ b/tasks/rspec.rake @@ -0,0 +1,6 @@ +require 'rspec/core/rake_task' + +desc "Run specs" +RSpec::Core::RakeTask.new do |t| + t.pattern = "./spec" +end \ No newline at end of file From b1baeba3d24175ebf06c01093ebdcdea4bf51f15 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Fri, 28 Oct 2011 13:05:32 -0700 Subject: [PATCH 356/494] seo meta table migration removed We should not generate the seo meta table here - it is handled by refinerycms if the user wants it --- ...20110803223525_create_seo_meta_for_blog.rb | 25 ------------------- 1 file changed, 25 deletions(-) delete mode 100644 db/migrate/20110803223525_create_seo_meta_for_blog.rb diff --git a/db/migrate/20110803223525_create_seo_meta_for_blog.rb b/db/migrate/20110803223525_create_seo_meta_for_blog.rb deleted file mode 100644 index b1c3c31..0000000 --- a/db/migrate/20110803223525_create_seo_meta_for_blog.rb +++ /dev/null @@ -1,25 +0,0 @@ -class CreateSeoMetaForBlog < ActiveRecord::Migration - - def up - unless ::SeoMetum.table_exists? - create_table ::SeoMetum.table_name do |t| - t.integer :seo_meta_id - t.string :seo_meta_type - - t.string :browser_title - t.string :meta_keywords - t.text :meta_description - - t.timestamps - end - - add_index ::SeoMetum.table_name, :id - add_index ::SeoMetum.table_name, [:seo_meta_id, :seo_meta_type] - end - end - - def down - # can't drop the table because someone else might be using it. - end - -end From fd7ce5e692989e5fe76722291caffb4211fd0517 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Fri, 28 Oct 2011 13:07:27 -0700 Subject: [PATCH 357/494] Update readme on how to test --- readme.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/readme.md b/readme.md index b64e192..1f1ad5c 100644 --- a/readme.md +++ b/readme.md @@ -35,11 +35,14 @@ The version of Refinery to develop this engine against is defined in the gemspec ### Testing -Setup the test environment +Generate the dummy application to test against - $ bundle exec rake refinery:testing:engine:setup + $ bundle exec rake refinery:testing:dummy_app Run the test suite with [Guard](https://github.com/guard/guard) $ bundle exec guard start - \ No newline at end of file + +Or just with rake spec + + $ bundle exec rake spec From 151629f04486b534bf59162632fd03acdc1b5b41 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Fri, 28 Oct 2011 13:20:11 -0700 Subject: [PATCH 358/494] Update travis.yml to use dummy app for testing --- .travis.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 62468f8..cccb3ec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,6 @@ -script: "bundle exec rake && bundle exec rspec spec/" +before_script: + - "bundle exec rake refinery:testing:dummy_app" +script: "bundle exec rake spec" notifications: email: - parndt@gmail.com @@ -16,4 +18,4 @@ rvm: - rbx - rbx-2.0 - ree - - jruby \ No newline at end of file + - jruby From a85b7ffab0d5c6f6929145637e4f90225c37ccce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?U=C4=A3is=20Ozols?= Date: Fri, 4 Nov 2011 15:54:12 +0200 Subject: [PATCH 359/494] Specify correct path to factories. --- lib/refinery/blog.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/refinery/blog.rb b/lib/refinery/blog.rb index 326e36a..07ed824 100644 --- a/lib/refinery/blog.rb +++ b/lib/refinery/blog.rb @@ -28,7 +28,7 @@ module Refinery end def factory_paths - @factory_paths ||= [ File.expand_path("../../spec/factories", __FILE__) ] + @factory_paths ||= [ File.expand_path("../../../spec/factories", __FILE__) ] end end end From 9936281bb8bff96da4fb4405a9479f277f95efac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?U=C4=A3is=20Ozols?= Date: Sun, 6 Nov 2011 07:26:48 +0200 Subject: [PATCH 360/494] Regenerate gemspec. Closes #146. --- refinerycms-blog.gemspec | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index 817f6b5..22dfb6b 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -5,7 +5,7 @@ Gem::Specification.new do |s| s.name = %q{refinerycms-blog} s.version = %q{2.0.0} s.description = %q{A really straightforward open source Ruby on Rails blog engine designed for integration with RefineryCMS.} - s.date = %q{2011-10-11} + s.date = %q{2011-11-06} s.summary = %q{Ruby on Rails blogging engine for RefineryCMS.} s.email = %q{info@refinerycms.com} s.homepage = %q{http://refinerycms.com/blog} @@ -185,24 +185,25 @@ Gem::Specification.new do |s| db/migrate/20110803223522_create_blog_structure.rb db/migrate/20110803223523_add_user_id_to_blog_posts.rb db/migrate/20110803223524_acts_as_taggable_on_migration.rb - db/migrate/20110803223525_create_seo_meta_for_blog.rb db/migrate/20110803223526_add_cached_slugs.rb db/migrate/20110803223527_add_custom_url_field_to_blog_posts.rb db/migrate/20110803223528_add_custom_teaser_field_to_blog_posts.rb db/migrate/20110803223529_add_primary_key_to_categorizations.rb - db/seeds - db/seeds/refinerycms_blog.rb + db/seeds.rb Gemfile Guardfile lib lib/gemspec.rb lib/generators - lib/generators/blog_generator.rb + lib/generators/refinery + lib/generators/refinery/blog + lib/generators/refinery/blog/blog_generator.rb lib/refinery lib/refinery/blog lib/refinery/blog/engine.rb lib/refinery/blog/tabs.rb lib/refinery/blog/version.rb + lib/refinery/blog.rb lib/refinerycms-blog.rb Rakefile readme.md @@ -234,6 +235,8 @@ Gem::Specification.new do |s| spec/support/database_cleaner.rb spec/support/devise.rb spec/support/refinery.rb + tasks + tasks/rspec.rake todo.md ) end From d18364d359359fa6564ad187d7303f8c167154cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?U=C4=A3is=20Ozols?= Date: Sun, 6 Nov 2011 21:28:25 +0200 Subject: [PATCH 361/494] Use root menthod to set engine factory path. --- lib/refinery/blog.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/refinery/blog.rb b/lib/refinery/blog.rb index 07ed824..78e1bf5 100644 --- a/lib/refinery/blog.rb +++ b/lib/refinery/blog.rb @@ -28,7 +28,7 @@ module Refinery end def factory_paths - @factory_paths ||= [ File.expand_path("../../../spec/factories", __FILE__) ] + @factory_paths ||= [ root.join("spec/factories").to_s ] end end end From 36c005ecd112b76d3c9c2d7092f22d6e06755d73 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Wed, 9 Nov 2011 22:19:07 +1300 Subject: [PATCH 362/494] Refactored everything (models, helpers) into proper namespace of Refinery::Blog. Requires refinery commit 25162b585b9c4023d39fd1a9796140bfa4ecb909 --- .../admin/blog/categories_controller.rb | 2 +- .../admin/blog/comments_controller.rb | 12 +- .../refinery/admin/blog/posts_controller.rb | 25 +- .../admin/blog/settings_controller.rb | 12 +- .../refinery/blog/base_controller.rb | 2 +- .../refinery/blog/categories_controller.rb | 4 +- .../refinery/blog/posts_controller.rb | 14 +- .../refinery/blog/controller_helper.rb | 10 +- app/helpers/refinery/blog/posts_helper.rb | 51 ++++ app/helpers/refinery/blog_posts_helper.rb | 49 ---- app/mailers/refinery/blog/comment_mailer.rb | 6 +- app/models/refinery/blog/category.rb | 26 +++ app/models/refinery/blog/comment.rb | 125 ++++++++++ app/models/refinery/blog/post.rb | 114 +++++++++ app/models/refinery/blog_category.rb | 24 -- app/models/refinery/blog_comment.rb | 135 ----------- app/models/refinery/blog_post.rb | 112 --------- app/models/refinery/categorization.rb | 4 +- app/sweepers/refinery/blog_sweeper.rb | 14 +- .../refinery/admin/blog/_submenu.html.erb | 12 +- .../refinery/admin/blog/posts/_form.html.erb | 1 - .../refinery/blog/categories/show.html.erb | 2 +- .../blog/comment_mailer/notification.html.erb | 6 +- app/views/refinery/blog/posts/_post.html.erb | 2 +- app/views/refinery/blog/posts/show.html.erb | 6 +- .../refinery/blog/shared/_categories.html.erb | 2 +- app/views/refinery/blog/shared/_post.html.erb | 2 +- .../20110803223522_create_blog_structure.rb | 16 +- ...0110803223523_add_user_id_to_blog_posts.rb | 2 +- db/migrate/20110803223526_add_cached_slugs.rb | 4 +- ...3527_add_custom_url_field_to_blog_posts.rb | 2 +- ...8_add_custom_teaser_field_to_blog_posts.rb | 2 +- db/seeds.rb | 9 +- lib/refinery/blog.rb | 5 + lib/refinery/blog/engine.rb | 2 +- spec/factories/blog_categories.rb | 2 +- spec/factories/blog_comments.rb | 2 +- spec/factories/blog_posts.rb | 2 +- spec/models/refinery/blog/category_spec.rb | 42 ++++ spec/models/refinery/blog/comment_spec.rb | 19 ++ spec/models/refinery/blog/post_spec.rb | 220 ++++++++++++++++++ spec/models/refinery/blog_category_spec.rb | 42 ---- spec/models/refinery/blog_comment_spec.rb | 22 -- spec/models/refinery/blog_post_spec.rb | 218 ----------------- .../refinery/admin/blog/comments_spec.rb | 8 +- .../refinery/admin/blog/posts_spec.rb | 46 ++-- spec/requests/refinery/blog/posts_spec.rb | 4 +- 47 files changed, 725 insertions(+), 718 deletions(-) create mode 100644 app/helpers/refinery/blog/posts_helper.rb delete mode 100644 app/helpers/refinery/blog_posts_helper.rb create mode 100644 app/models/refinery/blog/category.rb create mode 100644 app/models/refinery/blog/comment.rb create mode 100644 app/models/refinery/blog/post.rb delete mode 100644 app/models/refinery/blog_category.rb delete mode 100644 app/models/refinery/blog_comment.rb delete mode 100644 app/models/refinery/blog_post.rb create mode 100644 spec/models/refinery/blog/category_spec.rb create mode 100644 spec/models/refinery/blog/comment_spec.rb create mode 100644 spec/models/refinery/blog/post_spec.rb delete mode 100644 spec/models/refinery/blog_category_spec.rb delete mode 100644 spec/models/refinery/blog_comment_spec.rb delete mode 100644 spec/models/refinery/blog_post_spec.rb diff --git a/app/controllers/refinery/admin/blog/categories_controller.rb b/app/controllers/refinery/admin/blog/categories_controller.rb index 12f22ce..0fe4eec 100644 --- a/app/controllers/refinery/admin/blog/categories_controller.rb +++ b/app/controllers/refinery/admin/blog/categories_controller.rb @@ -3,7 +3,7 @@ module Refinery module Blog class CategoriesController < ::Refinery::AdminController - crudify :'refinery/blog_category', + crudify :'refinery/blog/category', :title_attribute => :title, :order => 'title ASC' diff --git a/app/controllers/refinery/admin/blog/comments_controller.rb b/app/controllers/refinery/admin/blog/comments_controller.rb index a3df235..6c1417e 100644 --- a/app/controllers/refinery/admin/blog/comments_controller.rb +++ b/app/controllers/refinery/admin/blog/comments_controller.rb @@ -5,23 +5,23 @@ module Refinery cache_sweeper Refinery::BlogSweeper - crudify :'refinery/blog_comment', + crudify :'refinery/blog/comment', :title_attribute => :name, :order => 'published_at DESC' def index - @blog_comments = Refinery::BlogComment.unmoderated.page(params[:page]) + @blog_comments = Refinery::Blog::Comment.unmoderated.page(params[:page]) render :action => 'index' end def approved unless params[:id].present? - @blog_comments = Refinery::BlogComment.approved.page(params[:page]) + @blog_comments = Refinery::Blog::Comment.approved.page(params[:page]) render :action => 'index' else - @blog_comment = Refinery::BlogComment.find(params[:id]) + @blog_comment = Refinery::Blog::Comment.find(params[:id]) @blog_comment.approve! flash[:notice] = t('approved', :scope => 'refinery.admin.blog.comments', :author => @blog_comment.name) @@ -31,11 +31,11 @@ module Refinery def rejected unless params[:id].present? - @blog_comments = Refinery::BlogComment.rejected.page(params[:page]) + @blog_comments = Refinery::Blog::Comment.rejected.page(params[:page]) render :action => 'index' else - @blog_comment = Refinery::BlogComment.find(params[:id]) + @blog_comment = Refinery::Blog::Comment.find(params[:id]) @blog_comment.reject! flash[:notice] = t('rejected', :scope => 'refinery.admin.blog.comments', :author => @blog_comment.name) diff --git a/app/controllers/refinery/admin/blog/posts_controller.rb b/app/controllers/refinery/admin/blog/posts_controller.rb index 62b6949..aa40c85 100644 --- a/app/controllers/refinery/admin/blog/posts_controller.rb +++ b/app/controllers/refinery/admin/blog/posts_controller.rb @@ -2,20 +2,21 @@ module Refinery module Admin module Blog class PostsController < ::Refinery::AdminController - + cache_sweeper Refinery::BlogSweeper - crudify :'refinery/blog_post', + crudify :'refinery/blog/post', :title_attribute => :title, - :order => 'published_at DESC' - + :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 + before_filter :check_category_ids, :only => :update def uncategorized - @blog_posts = Refinery::BlogPost.uncategorized.page(params[:page]) + @blog_posts = Refinery::Blog::Post.uncategorized.page(params[:page]) end def tags @@ -31,7 +32,7 @@ module Refinery else '%' end - @tags = Refinery::BlogPost.tag_counts_on(:tags).where( + @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 @@ -39,19 +40,19 @@ module Refinery def create # if the position field exists, set this object as last object, given the conditions of this class. - if Refinery::BlogPost.column_names.include?("position") + if Refinery::Blog::Post.column_names.include?("position") params[:blog_post].merge!({ - :position => ((Refinery::BlogPost.maximum(:position, :conditions => "")||-1) + 1) + :position => ((Refinery::Blog::Post.maximum(:position, :conditions => "")||-1) + 1) }) end - if Refinery::BlogPost.column_names.include?("user_id") + if Refinery::Blog::Post.column_names.include?("user_id") params[:blog_post].merge!({ :user_id => current_refinery_user.id }) end - if (@blog_post = Refinery::BlogPost.create(params[:blog_post])).valid? + 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}'" @@ -85,7 +86,7 @@ module Refinery protected def find_all_categories - @blog_categories = Refinery::BlogCategory.find(:all) + @blog_categories = Refinery::Blog::Category.find(:all) end def check_category_ids diff --git a/app/controllers/refinery/admin/blog/settings_controller.rb b/app/controllers/refinery/admin/blog/settings_controller.rb index 1894ac6..ee71393 100644 --- a/app/controllers/refinery/admin/blog/settings_controller.rb +++ b/app/controllers/refinery/admin/blog/settings_controller.rb @@ -4,12 +4,12 @@ module Refinery class SettingsController < ::Refinery::AdminController def notification_recipients - @recipients = Refinery::BlogComment::Notification.recipients + @recipients = Refinery::Blog::Comment::Notification.recipients if request.post? - Refinery::BlogComment::Notification.recipients = params[:recipients] + Refinery::Blog::Comment::Notification.recipients = params[:recipients] flash[:notice] = t('updated', :scope => 'admin.blog.settings.notification_recipients', - :recipients => Refinery::BlogComment::Notification.recipients) + :recipients => Refinery::Blog::Comment::Notification.recipients) unless request.xhr? or from_dialog? redirect_back_or_default(admin_blog_posts_path) else @@ -20,7 +20,7 @@ module Refinery end def moderation - enabled = Refinery::BlogComment::Moderation.toggle! + enabled = Refinery::Blog::Comment::Moderation.toggle! unless request.xhr? redirect_back_or_default(admin_blog_posts_path) else @@ -30,7 +30,7 @@ module Refinery end def comments - enabled = Refinery::BlogComment.toggle! + enabled = Refinery::Blog::Comment.toggle! unless request.xhr? redirect_back_or_default(admin_blog_posts_path) else @@ -40,7 +40,7 @@ module Refinery end def teasers - enabled = Refinery::BlogPost.teaser_enabled_toggle! + enabled = Refinery::Blog::Post.teaser_enabled_toggle! unless request.xhr? redirect_back_or_default(admin_blog_posts_path) else diff --git a/app/controllers/refinery/blog/base_controller.rb b/app/controllers/refinery/blog/base_controller.rb index 01892d1..919c180 100644 --- a/app/controllers/refinery/blog/base_controller.rb +++ b/app/controllers/refinery/blog/base_controller.rb @@ -4,7 +4,7 @@ module Refinery include ControllerHelper - helper :'refinery/blog_posts' + helper :'refinery/blog/posts' before_filter :find_page, :find_all_blog_categories protected diff --git a/app/controllers/refinery/blog/categories_controller.rb b/app/controllers/refinery/blog/categories_controller.rb index 80e54d9..60c8346 100644 --- a/app/controllers/refinery/blog/categories_controller.rb +++ b/app/controllers/refinery/blog/categories_controller.rb @@ -3,8 +3,8 @@ module Refinery class CategoriesController < BaseController def show - @category = Refinery::BlogCategory.find(params[:id]) - @blog_posts = @category.posts.live.includes(:comments, :categories).page(params[:page]) + @blog_category = Refinery::Blog::Category.find(params[:id]) + @blog_posts = @blog_category.posts.live.includes(:comments, :categories).page(params[:page]) end end diff --git a/app/controllers/refinery/blog/posts_controller.rb b/app/controllers/refinery/blog/posts_controller.rb index 7b09329..d3cd7a1 100644 --- a/app/controllers/refinery/blog/posts_controller.rb +++ b/app/controllers/refinery/blog/posts_controller.rb @@ -12,7 +12,7 @@ module Refinery def index # Rss feeders are greedy. Let's give them every blog post instead of paginating. - (@blog_posts = Refinery::BlogPost.live.includes(:comments, :categories).all) if request.format.rss? + (@blog_posts = Refinery::Blog::Post.live.includes(:comments, :categories).all) if request.format.rss? respond_with (@blog_posts) do |format| format.html format.rss @@ -20,7 +20,7 @@ module Refinery end def show - @blog_comment = Refinery::BlogComment.new + @blog_comment = Refinery::Blog::Comment.new respond_with (@blog_post) do |format| format.html { present(@blog_post) } @@ -30,7 +30,7 @@ module Refinery def comment if (@blog_comment = @blog_post.comments.create(params[:blog_comment])).valid? - if Refinery::BlogComment::Moderation.enabled? or @blog_comment.ham? + if Refinery::Blog::Comment::Moderation.enabled? or @blog_comment.ham? begin Refinery::Blog::CommentMailer.notification(@blog_comment, request).deliver rescue @@ -38,7 +38,7 @@ module Refinery end end - if Refinery::BlogComment::Moderation.enabled? + if Refinery::Blog::Comment::Moderation.enabled? flash[:notice] = t('thank_you_moderated', :scope => 'refinery.blog.posts.comments') redirect_to main_app.blog_post_url(params[:id]) else @@ -56,12 +56,12 @@ module Refinery date = "#{params[:month]}/#{params[:year]}" @archive_date = Time.parse(date) @date_title = @archive_date.strftime('%B %Y') - @blog_posts = Refinery::BlogPost.live.by_archive(@archive_date).page(params[:page]) + @blog_posts = Refinery::Blog::Post.live.by_archive(@archive_date).page(params[:page]) else date = "01/#{params[:year]}" @archive_date = Time.parse(date) @date_title = @archive_date.strftime('%Y') - @blog_posts = Refinery::BlogPost.live.by_year(@archive_date).page(params[:page]) + @blog_posts = Refinery::Blog::Post.live.by_year(@archive_date).page(params[:page]) end respond_with (@blog_posts) end @@ -69,7 +69,7 @@ module Refinery def tagged @tag = ActsAsTaggableOn::Tag.find(params[:tag_id]) @tag_name = @tag.name - @blog_posts = Refinery::BlogPost.tagged_with(@tag_name).page(params[:page]) + @blog_posts = Refinery::Blog::Post.tagged_with(@tag_name).page(params[:page]) end end end diff --git a/app/helpers/refinery/blog/controller_helper.rb b/app/helpers/refinery/blog/controller_helper.rb index c1c2a6a..035275c 100644 --- a/app/helpers/refinery/blog/controller_helper.rb +++ b/app/helpers/refinery/blog/controller_helper.rb @@ -5,9 +5,9 @@ module Refinery protected def find_blog_post - unless (@blog_post = Refinery::BlogPost.find(params[:id])).try(:live?) + unless (@blog_post = Refinery::Blog::Post.find(params[:id])).try(:live?) if refinery_user? and current_refinery_user.authorized_plugins.include?("refinerycms_blog") - @blog_post = Refinery::BlogPost.find(params[:id]) + @blog_post = Refinery::Blog::Post.find(params[:id]) else error_404 end @@ -15,15 +15,15 @@ module Refinery end def find_all_blog_posts - @blog_posts = Refinery::BlogPost.live.includes(:comments, :categories).page(params[:page]) + @blog_posts = Refinery::Blog::Post.live.includes(:comments, :categories).page(params[:page]) end def find_tags - @tags = Refinery::BlogPost.tag_counts_on(:tags) + @tags = Refinery::Blog::Post.tag_counts_on(:tags) end def find_all_blog_categories - @blog_categories = Refinery::BlogCategory.all + @blog_categories = Refinery::Blog::Category.all end end end diff --git a/app/helpers/refinery/blog/posts_helper.rb b/app/helpers/refinery/blog/posts_helper.rb new file mode 100644 index 0000000..418f360 --- /dev/null +++ b/app/helpers/refinery/blog/posts_helper.rb @@ -0,0 +1,51 @@ +module Refinery + module Blog + module PostsHelper + def blog_archive_widget + posts = Refinery::Blog::Post.select('published_at').all_previous + return nil if posts.blank? + + render :partial => "/refinery/blog/widgets/blog_archive", :locals => { :posts => posts } + end + alias_method :blog_archive_list, :blog_archive_widget + + def next_or_previous?(post) + post.next.present? or post.prev.present? + end + + def blog_post_teaser_enabled? + Refinery::Blog::Post.teasers_enabled? + end + + def blog_post_teaser(post) + if post.respond_to?(:custom_teaser) && post.custom_teaser.present? + post.custom_teaser.html_safe + else + truncate(post.body, { + :length => Refinery::Setting.find_or_set(:blog_post_teaser_length, 250), + :preserve_html_tags => true + }).html_safe + end + end + + def archive_link(post) + if post.published_at >= Time.now.end_of_year.advance(:years => -3) + post_date = post.published_at.strftime('%m/%Y') + year = post_date.split('/')[1] + month = post_date.split('/')[0] + count = Blog::Post.by_archive(Time.parse(post_date)).size + text = t("date.month_names")[month.to_i] + " #{year} (#{count})" + + link_to(text, main_app.archive_blog_posts_path(:year => year, :month => month)) + else + post_date = post.published_at.strftime('01/%Y') + year = post_date.split('/')[1] + count = Refinery::Blog::Post.by_year(Time.parse(post_date)).size + text = "#{year} (#{count})" + + link_to(text, main_app.archive_blog_posts_path(:year => year)) + end + end + end + end +end \ No newline at end of file diff --git a/app/helpers/refinery/blog_posts_helper.rb b/app/helpers/refinery/blog_posts_helper.rb deleted file mode 100644 index bfc3f40..0000000 --- a/app/helpers/refinery/blog_posts_helper.rb +++ /dev/null @@ -1,49 +0,0 @@ -module Refinery - module BlogPostsHelper - def blog_archive_widget - posts = Refinery::BlogPost.select('published_at').all_previous - return nil if posts.blank? - - render :partial => "/refinery/blog/widgets/blog_archive", :locals => { :posts => posts } - end - alias_method :blog_archive_list, :blog_archive_widget - - def next_or_previous?(post) - post.next.present? or post.prev.present? - end - - def blog_post_teaser_enabled? - Refinery::BlogPost.teasers_enabled? - end - - def blog_post_teaser(post) - if post.respond_to?(:custom_teaser) && post.custom_teaser.present? - post.custom_teaser.html_safe - else - truncate(post.body, { - :length => Refinery::Setting.find_or_set(:blog_post_teaser_length, 250), - :preserve_html_tags => true - }).html_safe - end - end - - def archive_link(post) - if post.published_at >= Time.now.end_of_year.advance(:years => -3) - post_date = post.published_at.strftime('%m/%Y') - year = post_date.split('/')[1] - month = post_date.split('/')[0] - count = BlogPost.by_archive(Time.parse(post_date)).size - text = t("date.month_names")[month.to_i] + " #{year} (#{count})" - - link_to(text, main_app.archive_blog_posts_path(:year => year, :month => month)) - else - post_date = post.published_at.strftime('01/%Y') - year = post_date.split('/')[1] - count = Refinery::BlogPost.by_year(Time.parse(post_date)).size - text = "#{year} (#{count})" - - link_to(text, main_app.archive_blog_posts_path(:year => year)) - end - end - end -end diff --git a/app/mailers/refinery/blog/comment_mailer.rb b/app/mailers/refinery/blog/comment_mailer.rb index f36ea29..dabc9e6 100644 --- a/app/mailers/refinery/blog/comment_mailer.rb +++ b/app/mailers/refinery/blog/comment_mailer.rb @@ -3,11 +3,11 @@ module Refinery class CommentMailer < ActionMailer::Base def notification(comment, request) - subject BlogComment::Notification.subject - recipients BlogComment::Notification.recipients + subject Blog::Comment::Notification.subject + recipients Blog::Comment::Notification.recipients from "\"#{RefinerySetting[:site_name]}\" " sent_on Time.now - @comment = comment + @blog_comment = comment end end diff --git a/app/models/refinery/blog/category.rb b/app/models/refinery/blog/category.rb new file mode 100644 index 0000000..dc85b50 --- /dev/null +++ b/app/models/refinery/blog/category.rb @@ -0,0 +1,26 @@ +module Refinery + module Blog + class Category < ActiveRecord::Base + + has_many :categorizations, :dependent => :destroy, :foreign_key => :blog_category_id + has_many :posts, :through => :categorizations, :source => :blog_post + + acts_as_indexed :fields => [:title] + + validates :title, :presence => true, :uniqueness => true + + has_friendly_id :title, :use_slug => true, + :default_locale => (::Refinery::I18n.default_frontend_locale rescue :en), + :approximate_ascii => Refinery::Setting.find_or_set(:approximate_ascii, false, :scoping => 'blog'), + :strip_non_ascii => Refinery::Setting.find_or_set(:strip_non_ascii, false, :scoping => 'blog') + + def post_count + posts.select(&:live?).count + end + + # how many items to show per page + self.per_page = Refinery::Setting.find_or_set(:blog_posts_per_page, 10) + + end + end +end \ No newline at end of file diff --git a/app/models/refinery/blog/comment.rb b/app/models/refinery/blog/comment.rb new file mode 100644 index 0000000..55a67ba --- /dev/null +++ b/app/models/refinery/blog/comment.rb @@ -0,0 +1,125 @@ +module Refinery + module Blog + class Comment < ActiveRecord::Base + + attr_accessible :name, :email, :message + + filters_spam :author_field => :name, + :email_field => :email, + :message_field => :body + + belongs_to :post, :class_name => 'Refinery::Blog::Post', :foreign_key => 'blog_post_id' + + acts_as_indexed :fields => [:name, :email, :message] + + alias_attribute :message, :body + + validates :name, :message, :presence => true + validates :email, :format => { :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i } + + scope :unmoderated, :conditions => {:state => nil} + scope :approved, :conditions => {:state => 'approved'} + scope :rejected, :conditions => {:state => 'rejected'} + + self.per_page = Refinery::Setting.find_or_set(:blog_comments_per_page, 10) + + def avatar_url(options = {}) + options = {:size => 60} + require 'digest/md5' + size = ("?s=#{options[:size]}" if options[:size]) + "http://gravatar.com/avatar/#{Digest::MD5.hexdigest(self.email.to_s.strip.downcase)}#{size}.jpg" + end + + def approve! + self.update_attribute(:state, 'approved') + end + + def reject! + self.update_attribute(:state, 'rejected') + end + + def rejected? + self.state == 'rejected' + end + + def approved? + self.state == 'approved' + end + + def unmoderated? + self.state.nil? + end + + def self.toggle! + currently = Refinery::Setting.find_or_set(:comments_allowed, true, { + :scoping => 'blog' + }) + Refinery::Setting.set(:comments_allowed, {:value => !currently, :scoping => 'blog'}) + end + + before_create do |comment| + unless Moderation.enabled? + comment.state = comment.ham? ? 'approved' : 'rejected' + end + end + + module Moderation + class << self + def enabled? + Refinery::Setting.find_or_set(:comment_moderation, true, { + :scoping => 'blog', + :restricted => false + }) + end + + def toggle! + new_value = { + :value => !Blog::Comment::Moderation.enabled?, + :scoping => 'blog', + :restricted => false + } + Refinery::Setting.set(:comment_moderation, new_value) + end + end + end + + module Notification + class << self + def recipients + Refinery::Setting.find_or_set(:comment_notification_recipients, (Refinery::Role[:refinery].users.first.email rescue ''), + { + :scoping => 'blog', + :restricted => false + }) + end + + def recipients=(emails) + new_value = { + :value => emails, + :scoping => 'blog', + :restricted => false + } + Refinery::Setting.set(:comment_notification_recipients, new_value) + end + + def subject + Refinery::Setting.find_or_set(:comment_notification_subject, "New inquiry from your website", { + :scoping => 'blog', + :restricted => false + }) + end + + def subject=(subject_line) + new_value = { + :value => subject_line, + :scoping => 'blog', + :restricted => false + } + Refinery::Setting.set(:comment_notification_subject, new_value) + end + end + end + + end + end +end \ No newline at end of file diff --git a/app/models/refinery/blog/post.rb b/app/models/refinery/blog/post.rb new file mode 100644 index 0000000..883f4fc --- /dev/null +++ b/app/models/refinery/blog/post.rb @@ -0,0 +1,114 @@ +require 'acts-as-taggable-on' +require 'seo_meta' + +module Refinery + module Blog + class Post < ActiveRecord::Base + + is_seo_meta if self.table_exists? + + default_scope :order => 'published_at DESC' + #.first & .last will be reversed -- consider a with_exclusive_scope on these? + + belongs_to :author, :class_name => 'Refinery::User', :foreign_key => :user_id, :readonly => true + + has_many :comments, :class_name => 'Refinery::Blog::Comment', :dependent => :destroy, :foreign_key => :blog_post_id + acts_as_taggable + + has_many :categorizations, :dependent => :destroy, :foreign_key => :blog_post_id + has_many :categories, :through => :categorizations, :source => :blog_category + + acts_as_indexed :fields => [:title, :body] + + validates :title, :presence => true, :uniqueness => true + validates :body, :presence => true + + has_friendly_id :friendly_id_source, :use_slug => true, + :default_locale => (::Refinery::I18n.default_frontend_locale rescue :en), + :approximate_ascii => Refinery::Setting.find_or_set(:approximate_ascii, false, :scoping => 'blog'), + :strip_non_ascii => Refinery::Setting.find_or_set(:strip_non_ascii, false, :scoping => 'blog') + + scope :by_archive, lambda { |archive_date| + where(['published_at between ? and ?', archive_date.beginning_of_month, archive_date.end_of_month]) + } + + scope :by_year, lambda { |archive_year| + where(['published_at between ? and ?', archive_year.beginning_of_year, archive_year.end_of_year]) + } + + scope :all_previous, lambda { where(['published_at <= ?', Time.now.beginning_of_month]) } + + scope :live, lambda { where( "published_at <= ? and draft = ?", Time.now, false) } + + scope :previous, lambda { |i| where(["published_at < ? and draft = ?", i.published_at, false]).limit(1) } + + scope :uncategorized, lambda { + live.includes(:categories).where(:categories => { Refinery::Categorization.table_name => { :blog_category_id => nil } }) + } + + attr_accessible :title, :body, :custom_teaser, :tag_list, :draft, :published_at, :custom_url + attr_accessible :browser_title, :meta_keywords, :meta_description, :user_id, :category_ids + + self.per_page = Refinery::Setting.find_or_set(:blog_posts_per_page, 10) + + def next + self.class.next(self).first + end + + def prev + self.class.previous(self).first + end + + def live? + !draft and published_at <= Time.now + end + + def category_ids=(ids) + self.categories = ids.reject{|id| id.blank?}.collect {|c_id| + Refinery::Blog::Category.find(c_id.to_i) rescue nil + }.compact + end + + def friendly_id_source + custom_url.present? ? custom_url : title + end + + class << self + def next(current_record) + self.send(:with_exclusive_scope) do + where(["published_at > ? and draft = ?", current_record.published_at, false]).order("published_at ASC") + end + end + + def comments_allowed? + Refinery::Setting.find_or_set(:comments_allowed, true, :scoping => 'blog') + end + + def teasers_enabled? + Refinery::Setting.find_or_set(:teasers_enabled, true, :scoping => 'blog') + end + + def teaser_enabled_toggle! + currently = Refinery::Setting.find_or_set(:teasers_enabled, true, :scoping => 'blog') + Refinery::Setting.set(:teasers_enabled, :value => !currently, :scoping => 'blog') + end + end + + module ShareThis + DEFAULT_KEY = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" + + class << self + def key + Refinery::Setting.find_or_set(:share_this_key, Blog::Post::ShareThis::DEFAULT_KEY, :scoping => 'blog') + end + + def enabled? + key = Blog::Post::ShareThis.key + key.present? and key != Blog::Post::ShareThis::DEFAULT_KEY + end + end + end + + end + end +end \ No newline at end of file diff --git a/app/models/refinery/blog_category.rb b/app/models/refinery/blog_category.rb deleted file mode 100644 index 3f10d92..0000000 --- a/app/models/refinery/blog_category.rb +++ /dev/null @@ -1,24 +0,0 @@ -module Refinery - class BlogCategory < ActiveRecord::Base - - has_many :categorizations, :dependent => :destroy - has_many :posts, :through => :categorizations, :source => :blog_post - - acts_as_indexed :fields => [:title] - - validates :title, :presence => true, :uniqueness => true - - has_friendly_id :title, :use_slug => true, - :default_locale => (::Refinery::I18n.default_frontend_locale rescue :en), - :approximate_ascii => Refinery::Setting.find_or_set(:approximate_ascii, false, :scoping => 'blog'), - :strip_non_ascii => Refinery::Setting.find_or_set(:strip_non_ascii, false, :scoping => 'blog') - - def post_count - posts.select(&:live?).count - end - - # how many items to show per page - self.per_page = Refinery::Setting.find_or_set(:blog_posts_per_page, 10) - - end -end diff --git a/app/models/refinery/blog_comment.rb b/app/models/refinery/blog_comment.rb deleted file mode 100644 index f7c1c84..0000000 --- a/app/models/refinery/blog_comment.rb +++ /dev/null @@ -1,135 +0,0 @@ -module Refinery - class BlogComment < ActiveRecord::Base - - attr_accessible :name, :email, :message - - filters_spam :author_field => :name, - :email_field => :email, - :message_field => :body - - belongs_to :post, :class_name => 'Refinery::BlogPost', :foreign_key => 'blog_post_id' - - acts_as_indexed :fields => [:name, :email, :message] - - alias_attribute :message, :body - - validates :name, :message, :presence => true - validates :email, :format => { :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i } - - scope :unmoderated, :conditions => {:state => nil} - scope :approved, :conditions => {:state => 'approved'} - scope :rejected, :conditions => {:state => 'rejected'} - - self.per_page = Setting.find_or_set(:blog_comments_per_page, 10) - - def avatar_url(options = {}) - options = {:size => 60} - require 'digest/md5' - size = ("?s=#{options[:size]}" if options[:size]) - "http://gravatar.com/avatar/#{Digest::MD5.hexdigest(self.email.to_s.strip.downcase)}#{size}.jpg" - end - - def approve! - self.update_attribute(:state, 'approved') - end - - def reject! - self.update_attribute(:state, 'rejected') - end - - def rejected? - self.state == 'rejected' - end - - def approved? - self.state == 'approved' - end - - def unmoderated? - self.state.nil? - end - - def self.toggle! - currently = Refinery::Setting.find_or_set(:comments_allowed, true, { - :scoping => 'blog' - }) - Refinery::Setting.set(:comments_allowed, {:value => !currently, :scoping => 'blog'}) - end - - before_create do |comment| - unless Moderation.enabled? - comment.state = comment.ham? ? 'approved' : 'rejected' - end - end - - module Moderation - class << self - def enabled? - Refinery::Setting.find_or_set(:comment_moderation, true, { - :scoping => 'blog', - :restricted => false - }) - end - - def toggle! - new_value = { - :value => !BlogComment::Moderation.enabled?, - :scoping => 'blog', - :restricted => false - } - if Refinery::Setting.respond_to?(:set) - Refinery::Setting.set(:comment_moderation, new_value) - else - Refinery::Setting[:comment_moderation] = new_value - end - end - end - end - - module Notification - class << self - def recipients - Refinery::Setting.find_or_set(:comment_notification_recipients, (Refinery::Role[:refinery].users.first.email rescue ''), - { - :scoping => 'blog', - :restricted => false - }) - end - - def recipients=(emails) - new_value = { - :value => emails, - :scoping => 'blog', - :restricted => false - } - if Refinery::Setting.respond_to?(:set) - Refinery::Setting.set(:comment_notification_recipients, new_value) - else - Refinery::Setting[:comment_notification_recipients] = new_value - end - end - - def subject - Refinery::Setting.find_or_set(:comment_notification_subject, "New inquiry from your website", { - :scoping => 'blog', - :restricted => false - }) - end - - def subject=(subject_line) - new_value = { - :value => subject_line, - :scoping => 'blog', - :restricted => false - } - if Refinery::Setting.respond_to?(:set) - Refinery::Setting.set(:comment_notification_subject, new_value) - else - Refinery::Setting[:comment_notification_subject] = new_value - end - end - end - end - - end -end \ No newline at end of file diff --git a/app/models/refinery/blog_post.rb b/app/models/refinery/blog_post.rb deleted file mode 100644 index 8cd3dd9..0000000 --- a/app/models/refinery/blog_post.rb +++ /dev/null @@ -1,112 +0,0 @@ -require 'acts-as-taggable-on' -require 'seo_meta' - -module Refinery - class BlogPost < ActiveRecord::Base - - is_seo_meta if self.table_exists? - - default_scope :order => 'published_at DESC' - #.first & .last will be reversed -- consider a with_exclusive_scope on these? - - belongs_to :author, :class_name => 'Refinery::User', :foreign_key => :user_id, :readonly => true - - has_many :comments, :class_name => 'Refinery::BlogComment', :dependent => :destroy - acts_as_taggable - - has_many :categorizations, :dependent => :destroy - has_many :categories, :through => :categorizations, :source => :blog_category - - acts_as_indexed :fields => [:title, :body] - - validates :title, :presence => true, :uniqueness => true - validates :body, :presence => true - - has_friendly_id :friendly_id_source, :use_slug => true, - :default_locale => (::Refinery::I18n.default_frontend_locale rescue :en), - :approximate_ascii => Refinery::Setting.find_or_set(:approximate_ascii, false, :scoping => 'blog'), - :strip_non_ascii => Refinery::Setting.find_or_set(:strip_non_ascii, false, :scoping => 'blog') - - scope :by_archive, lambda { |archive_date| - where(['published_at between ? and ?', archive_date.beginning_of_month, archive_date.end_of_month]) - } - - scope :by_year, lambda { |archive_year| - where(['published_at between ? and ?', archive_year.beginning_of_year, archive_year.end_of_year]) - } - - scope :all_previous, lambda { where(['published_at <= ?', Time.now.beginning_of_month]) } - - scope :live, lambda { where( "published_at <= ? and draft = ?", Time.now, false) } - - scope :previous, lambda { |i| where(["published_at < ? and draft = ?", i.published_at, false]).limit(1) } - - scope :uncategorized, lambda { - live.includes(:categories).where(:categories => { Refinery::Categorization.table_name => { :blog_category_id => nil } }) - } - - attr_accessible :title, :body, :custom_teaser, :tag_list, :draft, :published_at, :custom_url - attr_accessible :browser_title, :meta_keywords, :meta_description, :user_id, :category_ids - - self.per_page = Refinery::Setting.find_or_set(:blog_posts_per_page, 10) - - def next - BlogPost.next(self).first - end - - def prev - BlogPost.previous(self).first - end - - def live? - !draft and published_at <= Time.now - end - - def category_ids=(ids) - self.categories = ids.reject{|id| id.blank?}.collect {|c_id| - Refinery::BlogCategory.find(c_id.to_i) rescue nil - }.compact - end - - def friendly_id_source - custom_url.present? ? custom_url : title - end - - class << self - def next(current_record) - self.send(:with_exclusive_scope) do - where(["published_at > ? and draft = ?", current_record.published_at, false]).order("published_at ASC") - end - end - - def comments_allowed? - Refinery::Setting.find_or_set(:comments_allowed, true, :scoping => 'blog') - end - - def teasers_enabled? - Refinery::Setting.find_or_set(:teasers_enabled, true, :scoping => 'blog') - end - - def teaser_enabled_toggle! - currently = Refinery::Setting.find_or_set(:teasers_enabled, true, :scoping => 'blog') - Refinery::Setting.set(:teasers_enabled, :value => !currently, :scoping => 'blog') - end - end - - module ShareThis - DEFAULT_KEY = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" - - class << self - def key - Refinery::Setting.find_or_set(:share_this_key, BlogPost::ShareThis::DEFAULT_KEY, :scoping => 'blog') - end - - def enabled? - key = BlogPost::ShareThis.key - key.present? and key != BlogPost::ShareThis::DEFAULT_KEY - end - end - end - - end -end diff --git a/app/models/refinery/categorization.rb b/app/models/refinery/categorization.rb index c4feaec..97f0928 100644 --- a/app/models/refinery/categorization.rb +++ b/app/models/refinery/categorization.rb @@ -2,8 +2,8 @@ module Refinery class Categorization < ActiveRecord::Base set_table_name 'refinery_blog_categories_blog_posts' - belongs_to :blog_post - belongs_to :blog_category + belongs_to :blog_post, :class_name => 'Refinery::Blog::Post', :foreign_key => :blog_post_id + belongs_to :blog_category, :class_name => 'Refinery::Blog::Category', :foreign_key => :blog_category_id end end \ No newline at end of file diff --git a/app/sweepers/refinery/blog_sweeper.rb b/app/sweepers/refinery/blog_sweeper.rb index ceed5fa..a58ac7e 100644 --- a/app/sweepers/refinery/blog_sweeper.rb +++ b/app/sweepers/refinery/blog_sweeper.rb @@ -1,26 +1,26 @@ module Refinery class BlogSweeper < ActionController::Caching::Sweeper - observe BlogPost, BlogComment - + observe Blog::Post, Blog::Comment + def after_create(record) expire_cache_for(record) end - + def after_update(record) expire_cache_for(record) end - + def after_destroy(record) expire_cache_for(record) end - + private - + def expire_cache_for(record) # TODO: Convert these to url helpers expire_page '/blog' expire_page '/blog/feed.rss' end - + end end diff --git a/app/views/refinery/admin/blog/_submenu.html.erb b/app/views/refinery/admin/blog/_submenu.html.erb index 799c101..2915610 100644 --- a/app/views/refinery/admin/blog/_submenu.html.erb +++ b/app/views/refinery/admin/blog/_submenu.html.erb @@ -26,11 +26,11 @@ :class => 'page_add_icon' %> - <% if Refinery::BlogPost.comments_allowed? %> + <% if Refinery::Blog::Post.comments_allowed? %>
    • <%= link_to t('.settings.comments'), main_app.comments_refinery_admin_blog_settings_path, - :class => "#{Refinery::BlogPost.comments_allowed? ? 'success' : 'failure'}_icon" %> + :class => "#{Refinery::Blog::Post.comments_allowed? ? 'success' : 'failure'}_icon" %>
    • <%= link_to t('.settings.moderation'), main_app.moderation_refinery_admin_blog_settings_path, - :class => "#{Refinery::BlogComment::Moderation.enabled? ? 'success' : 'failure'}_icon" %> + :class => "#{Refinery::Blog::Comment::Moderation.enabled? ? 'success' : 'failure'}_icon" %>
    • <%= link_to t('.settings.update_notified'), @@ -87,7 +87,7 @@
    • <%= link_to t('.settings.teasers'), - main_app.teasers_refinery_admin_blog_settings_path, :class => "#{Refinery::BlogPost.teasers_enabled? ? 'success' : 'failure'}_icon" %> + main_app.teasers_refinery_admin_blog_settings_path, :class => "#{Refinery::Blog::Post.teasers_enabled? ? 'success' : 'failure'}_icon" %>
    diff --git a/app/views/refinery/admin/blog/posts/_form.html.erb b/app/views/refinery/admin/blog/posts/_form.html.erb index 8a3b091..822ec8a 100644 --- a/app/views/refinery/admin/blog/posts/_form.html.erb +++ b/app/views/refinery/admin/blog/posts/_form.html.erb @@ -27,7 +27,6 @@
    - <% part_index = -1 %> <%= render :partial => 'form_part', :locals => { diff --git a/app/views/refinery/blog/categories/show.html.erb b/app/views/refinery/blog/categories/show.html.erb index adcf1aa..00d9596 100644 --- a/app/views/refinery/blog/categories/show.html.erb +++ b/app/views/refinery/blog/categories/show.html.erb @@ -1,4 +1,4 @@ -<% content_for :body_content_title, @category.title %> +<% content_for :body_content_title, @blog_category.title %> <% content_for :body_content_left do %> <% if @blog_posts.any? %> diff --git a/app/views/refinery/blog/comment_mailer/notification.html.erb b/app/views/refinery/blog/comment_mailer/notification.html.erb index 800f12c..0c7dcd4 100644 --- a/app/views/refinery/blog/comment_mailer/notification.html.erb +++ b/app/views/refinery/blog/comment_mailer/notification.html.erb @@ -4,10 +4,10 @@ <%=raw t('.comment_starts') %> -<%=raw t('.from') %>: <%= @comment.name %> -<%=raw t('.email') %>: <%= @comment.email %> +<%=raw t('.from') %>: <%= @blog_comment.name %> +<%=raw t('.email') %>: <%= @blog_comment.email %> <%=raw t('.message') %>: -<%=simple_format strip_tags(@comment.body) %> +<%=simple_format strip_tags(@blog_comment.body) %> <%=raw t('.comment_ends') %> diff --git a/app/views/refinery/blog/posts/_post.html.erb b/app/views/refinery/blog/posts/_post.html.erb index f86f63a..cbecc5f 100644 --- a/app/views/refinery/blog/posts/_post.html.erb +++ b/app/views/refinery/blog/posts/_post.html.erb @@ -23,7 +23,7 @@ <%= @blog_post.body.html_safe %> - <% if Refinery::BlogPost::ShareThis.enabled? %> + <% if Refinery::Blog::Post::ShareThis.enabled? %> <% end %> diff --git a/app/views/refinery/blog/posts/show.html.erb b/app/views/refinery/blog/posts/show.html.erb index 020c964..2ca168e 100644 --- a/app/views/refinery/blog/posts/show.html.erb +++ b/app/views/refinery/blog/posts/show.html.erb @@ -3,7 +3,7 @@ <%= render 'post' %>
    - <% if Refinery::BlogPost.comments_allowed? %> + <% if Refinery::Blog::Post.comments_allowed? %> <%= render 'comments'%> <% end %> <% end %> @@ -17,5 +17,5 @@ <%# enable AJAX'd post nav at your own risk until html5 history API implemented. %> <%#= javascript_include_tag('refinery/blog/frontend') %> - -<% end if Refinery::BlogPost::ShareThis.enabled? %> + +<% end if Refinery::Blog::Post::ShareThis.enabled? %> diff --git a/app/views/refinery/blog/shared/_categories.html.erb b/app/views/refinery/blog/shared/_categories.html.erb index 295cae0..1280cd2 100644 --- a/app/views/refinery/blog/shared/_categories.html.erb +++ b/app/views/refinery/blog/shared/_categories.html.erb @@ -2,7 +2,7 @@

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

      <% @blog_categories.each do |category| %> - > + > <%= link_to "#{category.title} (#{category.post_count})", main_app.blog_category_path(category) %> <% end %> diff --git a/app/views/refinery/blog/shared/_post.html.erb b/app/views/refinery/blog/shared/_post.html.erb index 18271ec..c384bcb 100644 --- a/app/views/refinery/blog/shared/_post.html.erb +++ b/app/views/refinery/blog/shared/_post.html.erb @@ -33,7 +33,7 @@ <%= link_to t('read_more', :scope => 'refinery.blog.shared.posts'), main_app.blog_post_path(post) if blog_post_teaser_enabled? %>

    @@ -14,15 +14,15 @@ :class => 'page_copy_icon' %>
  • - <%= 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' %>
  • - <%= 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' %>
  • - <%= 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' %>
  • @@ -38,15 +38,15 @@ :class => 'comments_icon' %>
  • - <%= 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' %>
  • - <%= 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' %>
  • - <%= 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' %>
  • @@ -58,36 +58,36 @@ :class => 'folder_icon' %>
  • - <%= 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' %>
  • - <%= 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' %>
    • - <%= 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" %>
    • - <%= 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" %>
    • <%= 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' %>
    • <%= 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" %>
    diff --git a/app/views/refinery/admin/blog/categories/_category.html.erb b/app/views/refinery/blog/admin/categories/_category.html.erb similarity index 88% rename from app/views/refinery/admin/blog/categories/_category.html.erb rename to 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 @@ <%= 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 similarity index 100% rename from app/views/refinery/admin/blog/categories/_form.html.erb rename to 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 similarity index 100% rename from app/views/refinery/admin/blog/categories/_sortable_list.html.erb rename to 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 similarity index 100% rename from app/views/refinery/admin/blog/categories/edit.html.erb rename to 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 similarity index 100% rename from app/views/refinery/admin/blog/categories/index.html.erb rename to 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 similarity index 100% rename from app/views/refinery/admin/blog/categories/new.html.erb rename to 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 similarity index 86% rename from app/views/refinery/admin/blog/comments/_comment.html.erb rename to 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? %> diff --git a/app/views/refinery/admin/blog/comments/_sortable_list.html.erb b/app/views/refinery/blog/admin/comments/_sortable_list.html.erb similarity index 100% rename from app/views/refinery/admin/blog/comments/_sortable_list.html.erb rename to 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 similarity index 100% rename from app/views/refinery/admin/blog/comments/index.html.erb rename to 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 similarity index 83% rename from app/views/refinery/admin/blog/comments/show.html.erb rename to 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 @@

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

    • - <%= 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" %>
    • - <%= 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? %>
    • - <%= 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? %>
    diff --git a/app/views/refinery/admin/blog/posts/_form.html.erb b/app/views/refinery/blog/admin/posts/_form.html.erb similarity index 98% rename from app/views/refinery/admin/blog/posts/_form.html.erb rename to 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 similarity index 100% rename from app/views/refinery/admin/blog/posts/_form_part.html.erb rename to 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 similarity index 91% rename from app/views/refinery/admin/blog/posts/_post.html.erb rename to 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 similarity index 100% rename from app/views/refinery/admin/blog/posts/_sortable_list.html.erb rename to 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 similarity index 100% rename from app/views/refinery/admin/blog/posts/_teaser_part.html.erb rename to 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 similarity index 100% rename from app/views/refinery/admin/blog/posts/edit.html.erb rename to 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 similarity index 100% rename from app/views/refinery/admin/blog/posts/index.html.erb rename to 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 similarity index 100% rename from app/views/refinery/admin/blog/posts/new.html.erb rename to 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 similarity index 100% rename from app/views/refinery/admin/blog/posts/uncategorized.html.erb rename to 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 similarity index 100% rename from app/views/refinery/admin/blog/settings/notification_recipients.html.erb rename to 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 similarity index 100% rename from spec/requests/refinery/admin/menu_spec.rb rename to 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 From b1e4fd00943a160f3eb6ce242463c0cc07a406fc Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Tue, 17 Jan 2012 16:56:03 +1300 Subject: [PATCH 390/494] Fixed namespacing for Refinery conventions. --- Gemfile | 8 +++- Rakefile | 2 +- .../blog/admin/comments_controller.rb | 18 ++++----- .../refinery/blog/admin/posts_controller.rb | 18 ++++----- .../blog/admin/settings_controller.rb | 10 ++--- ...{base_controller.rb => blog_controller.rb} | 4 +- .../refinery/blog/categories_controller.rb | 6 +-- .../refinery/blog/posts_controller.rb | 34 ++++++++--------- .../refinery/blog/controller_helper.rb | 9 ++--- app/mailers/refinery/blog/comment_mailer.rb | 2 +- .../blog/admin/categories/_form.html.erb | 4 +- .../admin/categories/_sortable_list.html.erb | 2 +- .../blog/admin/categories/index.html.erb | 14 +++---- .../blog/admin/comments/_comment.html.erb | 2 +- .../admin/comments/_sortable_list.html.erb | 2 +- .../blog/admin/comments/index.html.erb | 16 ++++---- .../blog/admin/comments/show.html.erb | 20 +++++----- .../refinery/blog/admin/posts/_form.html.erb | 38 ++++++++----------- .../refinery/blog/admin/posts/_post.html.erb | 2 +- .../blog/admin/posts/_sortable_list.html.erb | 2 +- .../blog/admin/posts/_teaser_part.html.erb | 4 +- .../refinery/blog/admin/posts/index.html.erb | 14 +++---- .../blog/admin/posts/uncategorized.html.erb | 12 +++--- .../settings/notification_recipients.html.erb | 2 +- .../refinery/blog/categories/show.html.erb | 8 ++-- .../blog/comment_mailer/notification.html.erb | 6 +-- .../refinery/blog/posts/_comments.html.erb | 4 +- app/views/refinery/blog/posts/_nav.html.erb | 14 +++---- app/views/refinery/blog/posts/_post.html.erb | 18 ++++----- .../refinery/blog/posts/archive.html.erb | 4 +- app/views/refinery/blog/posts/index.html.erb | 6 +-- .../refinery/blog/posts/index.rss.builder | 6 +-- app/views/refinery/blog/posts/tagged.html.erb | 6 +-- .../refinery/blog/shared/_categories.html.erb | 8 ++-- app/views/refinery/blog/shared/_post.html.erb | 8 ++-- .../refinery/blog/shared/_posts.html.erb | 6 +-- .../refinery/blog/shared/_rss_feed.html.erb | 2 +- app/views/refinery/blog/shared/_tags.html.erb | 2 +- config/locales/bg.yml | 5 +-- config/locales/cs.yml | 5 +-- config/locales/de.yml | 5 +-- config/locales/en.yml | 7 ++-- config/locales/es.yml | 5 +-- config/locales/fr.yml | 5 +-- config/locales/it.yml | 5 +-- config/locales/ja.yml | 5 +-- config/locales/nb.yml | 4 +- config/locales/nl.yml | 5 +-- config/locales/pl.yml | 5 +-- config/locales/pt-BR.yml | 5 +-- config/locales/ru.yml | 5 +-- config/locales/sk.yml | 5 +-- config/locales/zh-CN.yml | 5 +-- config/routes.rb | 25 +++++++----- lib/refinery/blog/engine.rb | 2 +- refinerycms-blog.gemspec | 4 +- spec/lib/refinery/blog/engine_spec.rb | 6 +-- spec/models/refinery/blog/post_spec.rb | 26 ++++++------- .../refinery/blog/admin/comments_spec.rb | 5 --- .../refinery/blog/admin/posts_spec.rb | 10 ++--- .../requests/refinery/blog/categories_spec.rb | 15 ++++---- spec/requests/refinery/blog/posts_spec.rb | 29 ++++++-------- 62 files changed, 259 insertions(+), 282 deletions(-) rename app/controllers/refinery/blog/{base_controller.rb => blog_controller.rb} (83%) diff --git a/Gemfile b/Gemfile index 84ec8dc..e55a3f3 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,13 @@ source "http://rubygems.org" gemspec -gem 'refinerycms', :git => 'git://github.com/resolve/refinerycms.git' +git 'git://github.com/resolve/refinerycms.git' do + gem 'refinerycms' + + group :development, :test do + gem 'refinerycms-testing' + end +end group :development, :test do require 'rbconfig' diff --git a/Rakefile b/Rakefile index de282bd..743f388 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/blog/admin/comments_controller.rb b/app/controllers/refinery/blog/admin/comments_controller.rb index 3128e97..f9addaa 100644 --- a/app/controllers/refinery/blog/admin/comments_controller.rb +++ b/app/controllers/refinery/blog/admin/comments_controller.rb @@ -10,20 +10,20 @@ module Refinery :order => 'published_at DESC' def index - @blog_comments = Refinery::Blog::Comment.unmoderated.page(params[:page]) + @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]) + @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) + @comment = Refinery::Blog::Comment.find(params[:id]) + @comment.approve! + flash[:notice] = t('approved', :scope => 'refinery.blog.admin.comments', :author => @comment.name) redirect_to main_app.url_for(:action => params[:return_to] || 'index') end @@ -31,13 +31,13 @@ module Refinery def rejected unless params[:id].present? - @blog_comments = Refinery::Blog::Comment.rejected.page(params[:page]) + @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) + @comment = Refinery::Blog::Comment.find(params[:id]) + @comment.reject! + flash[:notice] = t('rejected', :scope => 'refinery.blog.admin.comments', :author => @comment.name) redirect_to main_app.url_for(:action => params[:return_to] || 'index') end diff --git a/app/controllers/refinery/blog/admin/posts_controller.rb b/app/controllers/refinery/blog/admin/posts_controller.rb index 04ee663..2ed2b98 100644 --- a/app/controllers/refinery/blog/admin/posts_controller.rb +++ b/app/controllers/refinery/blog/admin/posts_controller.rb @@ -16,7 +16,7 @@ module Refinery before_filter :check_category_ids, :only => :update def uncategorized - @blog_posts = Refinery::Blog::Post.uncategorized.page(params[:page]) + @posts = Refinery::Blog::Post.uncategorized.page(params[:page]) end def tags @@ -35,21 +35,21 @@ module Refinery end def new - @blog_post = ::Refinery::Blog::Post.new(:author => current_refinery_user) + @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!({ + params[:post].merge!({ :position => ((Refinery::Blog::Post.maximum(:position, :conditions => "")||-1) + 1) }) end - if (@blog_post = Refinery::Blog::Post.create(params[:blog_post])).valid? + if (@post = Refinery::Blog::Post.create(params[:post])).valid? (request.xhr? ? flash.now : flash).notice = t( 'refinery.crudify.created', - :what => "'#{@blog_post.title}'" + :what => "'#{@post.title}'" ) unless from_dialog? @@ -63,7 +63,7 @@ module Refinery end end else - render :text => "" + render :text => "" end else unless request.xhr? @@ -71,7 +71,7 @@ module Refinery else render :partial => "/refinery/admin/error_messages", :locals => { - :object => @blog_post, + :object => @post, :include_object_name => true } end @@ -80,11 +80,11 @@ module Refinery protected def find_all_categories - @blog_categories = Refinery::Blog::Category.find(:all) + @categories = Refinery::Blog::Category.find(:all) end def check_category_ids - params[:blog_post][:category_ids] ||= [] + params[:post][:category_ids] ||= [] end end end diff --git a/app/controllers/refinery/blog/admin/settings_controller.rb b/app/controllers/refinery/blog/admin/settings_controller.rb index afa6b2b..34a8d00 100644 --- a/app/controllers/refinery/blog/admin/settings_controller.rb +++ b/app/controllers/refinery/blog/admin/settings_controller.rb @@ -11,9 +11,9 @@ module Refinery flash[:notice] = t('updated', :scope => 'admin.blog.settings.notification_recipients', :recipients => Refinery::Blog::Comment::Notification.recipients) unless request.xhr? or from_dialog? - redirect_back_or_default(admin_blog_posts_path) + redirect_back_or_default(refinery_blog_admin_posts_path) else - render :text => "", + render :text => "", :layout => false end end @@ -22,7 +22,7 @@ module Refinery def moderation enabled = Refinery::Blog::Comment::Moderation.toggle! unless request.xhr? - redirect_back_or_default(admin_blog_posts_path) + redirect_back_or_default(refinery_blog_admin_posts_path) else render :json => {:enabled => enabled}, :layout => false @@ -32,7 +32,7 @@ module Refinery def comments enabled = Refinery::Blog::Comment.toggle! unless request.xhr? - redirect_back_or_default(admin_blog_posts_path) + redirect_back_or_default(refinery_blog_admin_posts_path) else render :json => {:enabled => enabled}, :layout => false @@ -42,7 +42,7 @@ module Refinery def teasers enabled = Refinery::Blog::Post.teaser_enabled_toggle! unless request.xhr? - redirect_back_or_default(admin_blog_posts_path) + redirect_back_or_default(refinery_blog_admin_posts_path) else render :json => {:enabled => enabled}, :layout => false diff --git a/app/controllers/refinery/blog/base_controller.rb b/app/controllers/refinery/blog/blog_controller.rb similarity index 83% rename from app/controllers/refinery/blog/base_controller.rb rename to app/controllers/refinery/blog/blog_controller.rb index 919c180..54a8b03 100644 --- a/app/controllers/refinery/blog/base_controller.rb +++ b/app/controllers/refinery/blog/blog_controller.rb @@ -1,7 +1,7 @@ module Refinery module Blog - class BaseController < ::ApplicationController - + class BlogController < ::ApplicationController + include ControllerHelper helper :'refinery/blog/posts' diff --git a/app/controllers/refinery/blog/categories_controller.rb b/app/controllers/refinery/blog/categories_controller.rb index 60c8346..467726e 100644 --- a/app/controllers/refinery/blog/categories_controller.rb +++ b/app/controllers/refinery/blog/categories_controller.rb @@ -1,10 +1,10 @@ module Refinery module Blog - class CategoriesController < BaseController + class CategoriesController < BlogController def show - @blog_category = Refinery::Blog::Category.find(params[:id]) - @blog_posts = @blog_category.posts.live.includes(:comments, :categories).page(params[:page]) + @category = Refinery::Blog::Category.find(params[:id]) + @posts = @category.posts.live.includes(:comments, :categories).page(params[:page]) end end diff --git a/app/controllers/refinery/blog/posts_controller.rb b/app/controllers/refinery/blog/posts_controller.rb index 1c8cffd..d680150 100644 --- a/app/controllers/refinery/blog/posts_controller.rb +++ b/app/controllers/refinery/blog/posts_controller.rb @@ -1,6 +1,6 @@ module Refinery module Blog - class PostsController < BaseController + class PostsController < BlogController caches_page :index @@ -12,41 +12,41 @@ module Refinery def index # Rss feeders are greedy. Let's give them every blog post instead of paginating. - (@blog_posts = Refinery::Blog::Post.live.includes(:comments, :categories).all) if request.format.rss? - respond_with (@blog_posts) do |format| + (@posts = Post.live.includes(:comments, :categories).all) if request.format.rss? + respond_with (@posts) do |format| format.html format.rss end end def show - @blog_comment = Refinery::Blog::Comment.new + @comment = Comment.new @canonical = url_for(:locale => ::Refinery::I18n.default_frontend_locale) if canonical? - respond_with (@blog_post) do |format| - format.html { present(@blog_post) } + respond_with (@post) do |format| + format.html { present(@post) } format.js { render :partial => 'post', :layout => false } end end def comment - if (@blog_comment = @blog_post.comments.create(params[:blog_comment])).valid? - if Refinery::Blog::Comment::Moderation.enabled? or @blog_comment.ham? + if (@comment = @post.comments.create(params[comment])).valid? + if Comment::Moderation.enabled? or @comment.ham? begin - Refinery::Blog::CommentMailer.notification(@blog_comment, request).deliver + CommentMailer.notification(@comment, request).deliver rescue logger.warn "There was an error delivering a blog comment notification.\n#{$!}\n" end end - if Refinery::Blog::Comment::Moderation.enabled? + if Comment::Moderation.enabled? flash[:notice] = t('thank_you_moderated', :scope => 'refinery.blog.posts.comments') - redirect_to main_app.blog_post_url(params[:id]) + redirect_to main_app.refinery_blog_post_url(params[:id]) else flash[:notice] = t('thank_you', :scope => 'refinery.blog.posts.comments') - redirect_to main_app.blog_post_url(params[:id], - :anchor => "comment-#{@blog_comment.to_param}") + redirect_to main_app.refinery_blog_post_url(params[:id], + :anchor => "comment-#{@comment.to_param}") end else render :action => 'show' @@ -58,20 +58,20 @@ module Refinery date = "#{params[:month]}/#{params[:year]}" @archive_date = Time.parse(date) @date_title = @archive_date.strftime('%B %Y') - @blog_posts = Refinery::Blog::Post.live.by_archive(@archive_date).page(params[:page]) + @posts = Post.live.by_archive(@archive_date).page(params[:page]) else date = "01/#{params[:year]}" @archive_date = Time.parse(date) @date_title = @archive_date.strftime('%Y') - @blog_posts = Refinery::Blog::Post.live.by_year(@archive_date).page(params[:page]) + @posts = Post.live.by_year(@archive_date).page(params[:page]) end - respond_with (@blog_posts) + respond_with (@posts) end def tagged @tag = ActsAsTaggableOn::Tag.find(params[:tag_id]) @tag_name = @tag.name - @blog_posts = Refinery::Blog::Post.tagged_with(@tag_name).page(params[:page]) + @posts = Post.tagged_with(@tag_name).page(params[:page]) end def canonical? diff --git a/app/helpers/refinery/blog/controller_helper.rb b/app/helpers/refinery/blog/controller_helper.rb index 035275c..bf4926b 100644 --- a/app/helpers/refinery/blog/controller_helper.rb +++ b/app/helpers/refinery/blog/controller_helper.rb @@ -5,9 +5,9 @@ module Refinery protected def find_blog_post - unless (@blog_post = Refinery::Blog::Post.find(params[:id])).try(:live?) + unless (@post = Refinery::Blog::Post.find(params[:id])).try(:live?) if refinery_user? and current_refinery_user.authorized_plugins.include?("refinerycms_blog") - @blog_post = Refinery::Blog::Post.find(params[:id]) + @post = Refinery::Blog::Post.find(params[:id]) else error_404 end @@ -15,15 +15,14 @@ module Refinery end def find_all_blog_posts - @blog_posts = Refinery::Blog::Post.live.includes(:comments, :categories).page(params[:page]) + @posts = Refinery::Blog::Post.live.includes(:comments, :categories).page(params[:page]) end def find_tags @tags = Refinery::Blog::Post.tag_counts_on(:tags) end - def find_all_blog_categories - @blog_categories = Refinery::Blog::Category.all + @categories = Refinery::Blog::Category.all end end end diff --git a/app/mailers/refinery/blog/comment_mailer.rb b/app/mailers/refinery/blog/comment_mailer.rb index 6f17f81..5b0ce7a 100644 --- a/app/mailers/refinery/blog/comment_mailer.rb +++ b/app/mailers/refinery/blog/comment_mailer.rb @@ -3,7 +3,7 @@ module Refinery class CommentMailer < ActionMailer::Base def notification(comment, request) - @blog_comment = comment + @comment = comment mail :subject => Blog::Comment::Notification.subject, :recipients => Blog::Comment::Notification.recipients, :from => "\"#{Refinery::Core.config.site_name}\" " diff --git a/app/views/refinery/blog/admin/categories/_form.html.erb b/app/views/refinery/blog/admin/categories/_form.html.erb index a5d3de3..90eed5d 100644 --- a/app/views/refinery/blog/admin/categories/_form.html.erb +++ b/app/views/refinery/blog/admin/categories/_form.html.erb @@ -1,4 +1,4 @@ -<%= form_for [main_app, :refinery_admin, @blog_category] do |f| -%> +<%= form_for [main_app, :refinery_admin, @category] do |f| -%> <%= render :partial => "/refinery/admin/error_messages", :locals => { :object => f.object, @@ -14,6 +14,6 @@ :locals => { :f => f, :continue_editing => false, - :delete_title => t('delete', :scope => 'refinery.admin.blog.categories.category') + :delete_title => t('delete', :scope => 'refinery.blog.admin.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 index f4e8641..8040dc0 100644 --- a/app/views/refinery/blog/admin/categories/_sortable_list.html.erb +++ b/app/views/refinery/blog/admin/categories/_sortable_list.html.erb @@ -1,5 +1,5 @@
      - <%= render :partial => 'category', :collection => @blog_categories %> + <%= render :partial => 'category', :collection => @categories %>
    <%= render :partial => "/refinery/admin/sortable_list", :locals => { diff --git a/app/views/refinery/blog/admin/categories/index.html.erb b/app/views/refinery/blog/admin/categories/index.html.erb index 4ad59ab..2e4313e 100644 --- a/app/views/refinery/blog/admin/categories/index.html.erb +++ b/app/views/refinery/blog/admin/categories/index.html.erb @@ -1,25 +1,25 @@ -<%= render :partial => '/refinery/admin/blog/submenu' %> +<%= render :partial => '/refinery/blog/admin/submenu' %>
    <% if searching? %>

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

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

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

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

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

    <% end %> diff --git a/app/views/refinery/blog/admin/comments/_comment.html.erb b/app/views/refinery/blog/admin/comments/_comment.html.erb index 51f2996..f4a7a16 100644 --- a/app/views/refinery/blog/admin/comments/_comment.html.erb +++ b/app/views/refinery/blog/admin/comments/_comment.html.erb @@ -5,7 +5,7 @@ <%= link_to refinery_icon_tag("application_go.png"), - main_app.blog_post_path(comment.post, :anchor => "comment-#{comment.to_param}"), + main_app.refinery_blog_post_path(comment.post, :anchor => "comment-#{comment.to_param}"), :title => t('.view_live_html'), :target => "_blank" unless comment.unmoderated? %> <%= link_to refinery_icon_tag('zoom.png'), main_app.refinery_blog_admin_comment_path(comment), diff --git a/app/views/refinery/blog/admin/comments/_sortable_list.html.erb b/app/views/refinery/blog/admin/comments/_sortable_list.html.erb index f781ba1..9f8bbbc 100644 --- a/app/views/refinery/blog/admin/comments/_sortable_list.html.erb +++ b/app/views/refinery/blog/admin/comments/_sortable_list.html.erb @@ -1,5 +1,5 @@
      - <%= render :partial => 'comment', :collection => @blog_comments %> + <%= render :partial => 'comment', :collection => @comments %>
    <%= render :partial => "/refinery/admin/sortable_list", :locals => { diff --git a/app/views/refinery/blog/admin/comments/index.html.erb b/app/views/refinery/blog/admin/comments/index.html.erb index 059ef59..991980d 100644 --- a/app/views/refinery/blog/admin/comments/index.html.erb +++ b/app/views/refinery/blog/admin/comments/index.html.erb @@ -1,26 +1,26 @@ -<%= render :partial => '/refinery/admin/blog/submenu' %> +<%= render :partial => '/refinery/blog/admin/submenu' %>
    <% if searching? %>

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

    - <% if @blog_comments.any? %> - <%= will_paginate @blog_comments %> + <% if @comments.any? %> + <%= will_paginate @comments %>
      <%= render :partial => "blog_comments", - :collection => @blog_comments %> + :collection => @comments %>
    - <%= will_paginate @blog_comments %> + <%= will_paginate @comments %> <% else %>

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

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

    <%= t('.no_items_yet', diff --git a/app/views/refinery/blog/admin/comments/show.html.erb b/app/views/refinery/blog/admin/comments/show.html.erb index 2aa75f1..df04b3e 100644 --- a/app/views/refinery/blog/admin/comments/show.html.erb +++ b/app/views/refinery/blog/admin/comments/show.html.erb @@ -1,7 +1,7 @@

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

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

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

      @@ -9,12 +9,12 @@ <%= link_to t('.back'), main_app.refinery_blog_admin_comments_path, :class => "back_icon" %>
    • - <%= 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? %> + <%= link_to t('.reject'), main_app.rejected_refinery_blog_admin_comment_path(@comment, :return_to => 'rejected'), + :class => 'comment_cross_icon' unless @comment.rejected? %>
    • - <%= 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? %> + <%= link_to t('.approve'), main_app.approved_refinery_blog_admin_comment_path(@comment, :return_to => 'approved'), + :class => 'comment_tick_icon' unless @comment.approved? %>
    @@ -26,8 +26,8 @@ <%= t('.blog_post') %> - <%= link_to @blog_comment.post.title, - main_app.blog_post_path(@blog_comment.post, :anchor => "comment-#{@blog_comment.to_param}"), + <%= link_to @comment.post.title, + main_app.refinery_blog_post_path(@comment.post, :anchor => "comment-#{@comment.to_param}"), :target => '_blank' %> @@ -36,7 +36,7 @@ <%= t('.from') %> - <%= @blog_comment.name %> [<%= mail_to @blog_comment.email, @blog_comment.email, {:title => t('.click_to_email')} %>] + <%= @comment.name %> [<%= mail_to @comment.email, @comment.email, {:title => t('.click_to_email')} %>] @@ -44,7 +44,7 @@ <%= t('.date') %> - <%= l(Date.parse(@blog_comment.created_at.to_s), :format => :long) %> + <%= l(Date.parse(@comment.created_at.to_s), :format => :long) %> @@ -53,7 +53,7 @@

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

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

    ") %>

    diff --git a/app/views/refinery/blog/admin/posts/_form.html.erb b/app/views/refinery/blog/admin/posts/_form.html.erb index 656c9c6..a33baeb 100644 --- a/app/views/refinery/blog/admin/posts/_form.html.erb +++ b/app/views/refinery/blog/admin/posts/_form.html.erb @@ -1,4 +1,4 @@ -<%= form_for [main_app, :refinery_admin, @blog_post] do |f| -%> +<%= form_for [main_app, :refinery_blog_admin, @post] do |f| -%> <%= render :partial => "/refinery/admin/error_messages", :locals => { :object => f.object, @@ -25,33 +25,25 @@ <% 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) -%> + <%= render 'form_part', :f => f, :part_index => (part_index += 1) -%> + <%= render 'teaser_part', :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} %> + <%= render tab.partial, :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'), "#", @@ -65,14 +57,14 @@

    <%= render :partial => "/refinery/admin/form_actions", :locals => { :f => f, :continue_editing => true, - :delete_title => t('delete', :scope => 'refinery.admin.blog.posts.post') + :delete_title => t('delete', :scope => 'refinery.blog.admin.posts.post') } %> <% end -%> diff --git a/app/views/refinery/blog/admin/posts/_post.html.erb b/app/views/refinery/blog/admin/posts/_post.html.erb index c8baa80..887c830 100644 --- a/app/views/refinery/blog/admin/posts/_post.html.erb +++ b/app/views/refinery/blog/admin/posts/_post.html.erb @@ -7,7 +7,7 @@ - <%= link_to refinery_icon_tag("application_go.png"), main_app.blog_post_path(post), + <%= link_to refinery_icon_tag("application_go.png"), main_app.refinery_blog_post_path(post), :title => t('.view_live_html'), :target => "_blank" %> <%= link_to refinery_icon_tag("application_edit.png"), main_app.edit_refinery_blog_admin_post_path(post), diff --git a/app/views/refinery/blog/admin/posts/_sortable_list.html.erb b/app/views/refinery/blog/admin/posts/_sortable_list.html.erb index 18d12cc..471d4f0 100644 --- a/app/views/refinery/blog/admin/posts/_sortable_list.html.erb +++ b/app/views/refinery/blog/admin/posts/_sortable_list.html.erb @@ -1,5 +1,5 @@
      - <%= render :partial => 'post', :collection => @blog_posts %> + <%= render :partial => 'post', :collection => @posts %>
    <%= render :partial => "/refinery/admin/sortable_list", :locals => { diff --git a/app/views/refinery/blog/admin/posts/_teaser_part.html.erb b/app/views/refinery/blog/admin/posts/_teaser_part.html.erb index dc9186a..461a10c 100644 --- a/app/views/refinery/blog/admin/posts/_teaser_part.html.erb +++ b/app/views/refinery/blog/admin/posts/_teaser_part.html.erb @@ -2,9 +2,9 @@ <%= f.text_area :custom_teaser, :rows => 20, :class => 'wymeditor widest' -%>

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

    diff --git a/app/views/refinery/blog/admin/posts/index.html.erb b/app/views/refinery/blog/admin/posts/index.html.erb index 922353c..8db926a 100644 --- a/app/views/refinery/blog/admin/posts/index.html.erb +++ b/app/views/refinery/blog/admin/posts/index.html.erb @@ -1,26 +1,26 @@ -<%= render :partial => '/refinery/admin/blog/submenu' %> +<%= render :partial => '/refinery/blog/admin/submenu' %>
    <% if searching? %>

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

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

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

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

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

    <% end %> diff --git a/app/views/refinery/blog/admin/posts/uncategorized.html.erb b/app/views/refinery/blog/admin/posts/uncategorized.html.erb index 030e789..1b3a512 100644 --- a/app/views/refinery/blog/admin/posts/uncategorized.html.erb +++ b/app/views/refinery/blog/admin/posts/uncategorized.html.erb @@ -1,21 +1,21 @@ -<%= render :partial => '/refinery/admin/blog/submenu' %> +<%= render :partial => '/refinery/blog/admin/submenu' %>
    <% if searching? %>

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

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

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

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

    diff --git a/app/views/refinery/blog/admin/settings/notification_recipients.html.erb b/app/views/refinery/blog/admin/settings/notification_recipients.html.erb index d321ded..af2650d 100644 --- a/app/views/refinery/blog/admin/settings/notification_recipients.html.erb +++ b/app/views/refinery/blog/admin/settings/notification_recipients.html.erb @@ -18,7 +18,7 @@ :locals => { :f => nil, :continue_editing => false, - :cancel_url => admin_blog_posts_url, + :cancel_url => refinery_blog_admin_posts_url, :hide_delete => true } %> <% end %> diff --git a/app/views/refinery/blog/categories/show.html.erb b/app/views/refinery/blog/categories/show.html.erb index 00d9596..aa4abaf 100644 --- a/app/views/refinery/blog/categories/show.html.erb +++ b/app/views/refinery/blog/categories/show.html.erb @@ -1,10 +1,10 @@ -<% content_for :body_content_title, @blog_category.title %> +<% content_for :body_content_title, @category.title %> <% content_for :body_content_left do %> - <% if @blog_posts.any? %> + <% if @posts.any? %>

    - <%= render :partial => "/refinery/blog/shared/post", :collection => @blog_posts %> - <%= will_paginate @blog_posts %> + <%= render :partial => "/refinery/blog/shared/post", :collection => @posts %> + <%= will_paginate @posts %>
    <% else %>

    diff --git a/app/views/refinery/blog/comment_mailer/notification.html.erb b/app/views/refinery/blog/comment_mailer/notification.html.erb index cfadb67..a129d34 100644 --- a/app/views/refinery/blog/comment_mailer/notification.html.erb +++ b/app/views/refinery/blog/comment_mailer/notification.html.erb @@ -4,10 +4,10 @@ <%=raw t('.comment_starts') %> -<%=raw t('.from') %>: <%= @blog_comment.name %> -<%=raw t('.email') %>: <%= @blog_comment.email %> +<%=raw t('.from') %>: <%= @comment.name %> +<%=raw t('.email') %>: <%= @comment.email %> <%=raw t('.message') %>: -<%=simple_format strip_tags(@blog_comment.body) %> +<%=simple_format strip_tags(@comment.body) %> <%=raw t('.comment_ends') %> diff --git a/app/views/refinery/blog/posts/_comments.html.erb b/app/views/refinery/blog/posts/_comments.html.erb index 9bc0a13..a34d106 100644 --- a/app/views/refinery/blog/posts/_comments.html.erb +++ b/app/views/refinery/blog/posts/_comments.html.erb @@ -1,6 +1,6 @@

    +
    + + <%= f.label :source_url_title, t('.source_url_title') %> + <%= refinery_help_tag t('.source_url_title_help') %> + + <%= f.text_field :source_url_title, :class => "widest" %> +
    + +
    + + <%= f.label :source_url, t('.source_url') %> + <%= refinery_help_tag t('.source_url_help') %> + + <%= f.text_field :source_url, :class => "widest" %> +
    +
    <%= f.label :user_id, t('.author') %> diff --git a/app/views/refinery/blog/posts/_post.html.erb b/app/views/refinery/blog/posts/_post.html.erb index 020ba41..77e43ff 100644 --- a/app/views/refinery/blog/posts/_post.html.erb +++ b/app/views/refinery/blog/posts/_post.html.erb @@ -10,7 +10,13 @@ - <%= "#{t('by', :scope => 'refinery.blog.posts.show')} #{@post.author.username}" if @post.author.present? %>. + <%= content_tag(:div, "#{t('by', :scope => 'refinery.blog.posts.show')} #{@post.author.username}", :class => "blog_author") if @post.author.present? %> + <% if @post.source_url.present? %> +
    + <%= "#{t('source', :scope => 'refinery.blog.posts.show')}: " %> + <%= link_to (@post.source_url_title.blank? ? @post.source_url : @post.source_url_title), @post.source_url %> +
    + <% end %> <% if (categories = @post.categories).any? %>