diff options
33 files changed, 346 insertions, 121 deletions
diff --git a/app/controllers/blog/posts_controller.rb b/app/controllers/blog/posts_controller.rb index 071bc68..95ccbbe 100644 --- a/app/controllers/blog/posts_controller.rb +++ b/app/controllers/blog/posts_controller.rb @@ -1,19 +1,32 @@ class Blog::PostsController < BlogController - before_filter :find_page before_filter :find_all_blog_posts, :except => [:archive] - before_filter :find_blog_post, :only => [:show, :comment] + before_filter :find_blog_post, :only => [:show, :comment, :update_nav] + + respond_to :html, :js, :rss if Rails.version >= '3.0.0' def index - respond_to do |format| - format.html - format.rss + if Rails.version < '3.0.0' + # TODO: respond_to block + else + respond_with (@blog_posts) do |format| + format.html + format.rss + end end end def show @blog_comment = BlogComment.new - present(@page) + + 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 end def comment @@ -50,6 +63,11 @@ 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 end protected @@ -64,9 +82,5 @@ protected :per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10) }) end - - def find_page - @page = Page.find_by_link_url('/blog') - end end diff --git a/app/helpers/blog_posts_helper.rb b/app/helpers/blog_posts_helper.rb index fb90e94..a74ec33 100644 --- a/app/helpers/blog_posts_helper.rb +++ b/app/helpers/blog_posts_helper.rb @@ -19,4 +19,8 @@ module BlogPostsHelper html += '</nav></section>' html.html_safe end + + def next_or_previous?(post) + post.next.present? or post.prev.present? + end end diff --git a/app/models/blog_comment.rb b/app/models/blog_comment.rb index b888e35..9b84ece 100644 --- a/app/models/blog_comment.rb +++ b/app/models/blog_comment.rb @@ -60,11 +60,16 @@ class BlogComment < ActiveRecord::Base end def toggle! - RefinerySetting[:comment_moderation] = { - :value => !self.enabled?, + new_value = { + :value => !BlogComment::Moderation.enabled?, :scoping => :blog, :restricted => false } + if RefinerySetting.respond_to?(:set) + RefinerySetting.set(:comment_moderation, new_value) + else + RefinerySetting[:comment_moderation] = new_value + end end end end @@ -80,11 +85,16 @@ class BlogComment < ActiveRecord::Base end def recipients=(emails) - RefinerySetting[:comment_notification_recipients] = { + new_value = { :value => emails, :scoping => :blog, :restricted => false } + if RefinerySetting.respond_to?(:set) + RefinerySetting.set(:comment_notification_recipients, new_value) + else + RefinerySetting[:comment_notification_recipients] = new_value + end end def subject @@ -95,11 +105,16 @@ class BlogComment < ActiveRecord::Base end def subject=(subject_line) - RefinerySetting[:comment_notification_subject] = { + new_value = { :value => subject_line, :scoping => :blog, :restricted => false } + if RefinerySetting.respond_to?(:set) + RefinerySetting.set(:comment_notification_subject, new_value) + else + RefinerySetting[:comment_notification_subject] = new_value + end end end end diff --git a/app/models/blog_post.rb b/app/models/blog_post.rb index 562a9b9..471be72 100644 --- a/app/models/blog_post.rb +++ b/app/models/blog_post.rb @@ -9,27 +9,41 @@ class BlogPost < ActiveRecord::Base validates_uniqueness_of :title has_friendly_id :title, :use_slug => true - - default_scope :order => "published_at DESC" 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]} } + 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] + where(['published_at between ? and ?', archive_date.beginning_of_month, archive_date.end_of_month]).order("published_at DESC") } end if Rails.version < '3.0.0' - named_scope :all_previous, :conditions => ['published_at <= ?', Time.now.beginning_of_month] + 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]) + scope :all_previous, where(['published_at <= ?', Time.now.beginning_of_month]).order("published_at DESC") end if Rails.version < '3.0.0' - named_scope :live, lambda { {:conditions => ["published_at < ? and draft = ?", Time.now, false]} } + 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 + + 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 :live, lambda { where( "published_at < ? and draft = ?", Time.now, false) } + 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 + + def next + self.class.next(self).first + end + + def prev + self.class.previous(self).first end def live? diff --git a/app/views/admin/blog/_submenu.html.erb b/app/views/admin/blog/_submenu.html.erb index c7da051..a966f5b 100644 --- a/app/views/admin/blog/_submenu.html.erb +++ b/app/views/admin/blog/_submenu.html.erb @@ -78,9 +78,12 @@ </ul> </nav> -<% content_for :head do %> - <%= stylesheet_link_tag 'refinery/refinerycms-blog' %> -<% end %> -<% content_for :javascripts do %> - <%= javascript_include_tag 'refinery/refinerycms-blog' %> -<% end %> +<% if Refinery.version < '0.9.9' %> + <% content_for :head do %> + <%= stylesheet_link_tag('refinery/refinerycms-blog') %> + <%# this javascript is not even required in >= 0.9.9 because we made this sort of menu core. %> + <%= javascript_link_tag('refinery/refinerycms-blog') %> + <% end %> +<% else %> + <% content_for :stylesheets, stylesheet_link_tag('refinery/refinerycms-blog')%> +<% end %>
\ No newline at end of file diff --git a/app/views/admin/blog/comments/show.html.erb b/app/views/admin/blog/comments/show.html.erb index 21cb405..82a5f6f 100644 --- a/app/views/admin/blog/comments/show.html.erb +++ b/app/views/admin/blog/comments/show.html.erb @@ -59,5 +59,8 @@ </tr> </table> </div> - -<% content_for :head, stylesheet_link_tag('refinery/refinerycms-blog') %> +<% 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 %>
\ No newline at end of file diff --git a/app/views/admin/blog/posts/_form.css.erb b/app/views/admin/blog/posts/_form.css.erb new file mode 100644 index 0000000..d6f2c20 --- /dev/null +++ b/app/views/admin/blog/posts/_form.css.erb @@ -0,0 +1,7 @@ +<style type='text/css'> + ul.blog_categories, ul.blog_categories li { + list-style: none; + margin: 0px; + padding: 0px; + } +</style>
\ No newline at end of file diff --git a/app/views/admin/blog/posts/_form.html.erb b/app/views/admin/blog/posts/_form.html.erb index 692dafa..5779e4c 100644 --- a/app/views/admin/blog/posts/_form.html.erb +++ b/app/views/admin/blog/posts/_form.html.erb @@ -57,27 +57,13 @@ :delete_title => t('admin.blog.posts.post.delete') } %> <% end -%> -<% content_for :head do %> - <style type='text/css'> - ul.blog_categories, ul.blog_categories li { - list-style: none; - margin: 0px; - padding: 0px; - } - </style> -<% end %> -<% content_for :javascripts do %> - <script type='text/javascript'> - $(document).ready(function(){ - $('#toggle_advanced_options').click(function(e){ - e.preventDefault(); - - $('#more_options').animate({opacity: 'toggle', height: 'toggle'}, 250); - $('html,body').animate({ - scrollTop: $('#toggle_advanced_options').parent().offset().top - }, 250); - }); - }); - </script> +<% 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 %> diff --git a/app/views/admin/blog/posts/_form.js.erb b/app/views/admin/blog/posts/_form.js.erb new file mode 100644 index 0000000..394975f --- /dev/null +++ b/app/views/admin/blog/posts/_form.js.erb @@ -0,0 +1,13 @@ +<script> + $(document).ready(function(){ + $('#toggle_advanced_options').click(function(e){ + e.preventDefault(); + + $('#more_options').animate({opacity: 'toggle', height: 'toggle'}, 250); + + $('html,body').animate({ + scrollTop: $('#toggle_advanced_options').parent().offset().top + }, 250); + }); + }); +</script>
\ No newline at end of file diff --git a/app/views/blog/categories/show.html.erb b/app/views/blog/categories/show.html.erb index 3b4a966..54b5169 100644 --- a/app/views/blog/categories/show.html.erb +++ b/app/views/blog/categories/show.html.erb @@ -17,4 +17,4 @@ <% end %> <%= render :partial => "/shared/content_page" %> -<% content_for :head, stylesheet_link_tag('refinerycms-blog') %>
\ No newline at end of file +<% content_for :stylesheets, stylesheet_link_tag('refinerycms-blog') %>
\ No newline at end of file diff --git a/app/views/blog/posts/_nav.html.erb b/app/views/blog/posts/_nav.html.erb new file mode 100644 index 0000000..309cd64 --- /dev/null +++ b/app/views/blog/posts/_nav.html.erb @@ -0,0 +1,13 @@ +<% if next_or_previous?(@blog_post) -%> + <nav id="next_prev_article"> + <% if @blog_post.next.present? -%> + <%= link_to raw(truncate(@blog_post.next.title) + " »"), @blog_post.next, :class => 'next', :"data-nav-url" => update_blog_nav_path(@blog_post.next) %> + <% end -%> + + <%= link_to 'Blog Home', blog_root_path, :class => 'home' %> + + <% if @blog_post.prev.present? -%> + <%= link_to "« ".html_safe + truncate(@blog_post.prev.title), @blog_post.prev, :class => 'prev', :"data-nav-url" => update_blog_nav_path(@blog_post.prev) %> + <% end -%> + </nav><!-- /next_prev_article --> +<% end -%>
\ No newline at end of file diff --git a/app/views/blog/posts/_post.html.erb b/app/views/blog/posts/_post.html.erb new file mode 100644 index 0000000..3af89a8 --- /dev/null +++ b/app/views/blog/posts/_post.html.erb @@ -0,0 +1,33 @@ +<% flash.each do |key, value| %> + <div id='flash' class="flash flash_<%= key %>"> + <%= value %> + </div> +<% end %> +<article id="blog_post"> + <header> + <h1><%= @blog_post.title %></h1> + <details> + <time datetime="<%= @blog_post.published_at.strftime('%Y-%m-%d') %>" class='posted_at'> + <%= t('blog.shared.posts.created_at', :when => @blog_post.published_at.strftime('%d %B %Y')) %>. + </time> + <% if (categories = @blog_post.categories).any? %> + <aside class='filed_in'> + <%= t('.filed_in') %> + <% categories.each_with_index do |category, index| %> + <%= link_to category.title, blog_category_url(category) -%><%= ',' if index < ((categories.length) - 1) %> + <% end %> + </aside> + <% end %> + </details> + </header> + <%= @blog_post.body.html_safe %> + + <% if BlogPost::ShareThis.enabled? %> + <span class="st_sharethis" displayText="ShareThis"></span> + <% end %> +</article> +<% if next_or_previous?(@blog_post) -%> + <nav id="next_prev_article"> + <%= render 'nav' %> + </nav><!-- /next_prev_article --> +<% end -%>
\ No newline at end of file diff --git a/app/views/blog/posts/archive.html.erb b/app/views/blog/posts/archive.html.erb index 8283f0a..a5354ab 100644 --- a/app/views/blog/posts/archive.html.erb +++ b/app/views/blog/posts/archive.html.erb @@ -16,4 +16,4 @@ <% end %> <%= render :partial => "/shared/content_page" %> -<% content_for :head, stylesheet_link_tag('refinerycms-blog') %>
\ No newline at end of file +<% content_for :stylesheets, stylesheet_link_tag('refinerycms-blog') %>
\ No newline at end of file diff --git a/app/views/blog/posts/index.html.erb b/app/views/blog/posts/index.html.erb index 9e63ac2..1d054e1 100644 --- a/app/views/blog/posts/index.html.erb +++ b/app/views/blog/posts/index.html.erb @@ -17,4 +17,4 @@ <% end %> <%= render :partial => "/shared/content_page" %> -<% content_for :head, stylesheet_link_tag('refinerycms-blog') %>
\ No newline at end of file +<% content_for :stylesheets, stylesheet_link_tag('refinerycms-blog') %>
\ No newline at end of file diff --git a/app/views/blog/posts/show.html.erb b/app/views/blog/posts/show.html.erb index d959956..603a44f 100644 --- a/app/views/blog/posts/show.html.erb +++ b/app/views/blog/posts/show.html.erb @@ -1,36 +1,8 @@ -<% content_for :javascripts do %> - <% if BlogPost::ShareThis.enabled? %> - <script src="http://w.sharethis.com/button/buttons.js"></script> - <script> - stLight.options({publisher:'<%= BlogPost::ShareThis.key %>'}); - </script> - <% end %> -<% end %> - <% content_for :body_content_left do %> - <article class="blog_post" id="show_blog_post"> - <header> - <h1><%= @blog_post.title %></h1> - <details> - <time datetime="<%= @blog_post.published_at.strftime('%Y-%m-%d') %>" class='posted_at'> - <%= t('blog.shared.posts.created_at', :when => @blog_post.published_at.strftime('%d %B %Y')) %>. - </time> - <% if (categories = @blog_post.categories).any? %> - <aside class='filed_in'> - <%= t('.filed_in') %> - <% categories.each_with_index do |category, index| %> - <%= link_to category.title, blog_category_url(category) -%><%= ',' if index < ((categories.length) - 1) %> - <% end %> - </aside> - <% end %> - </details> - </header> - <%= @blog_post.body.html_safe %> + <div id="show_blog_post"> + <%= render 'post' %> + </div> - <% if BlogPost::ShareThis.enabled? %> - <span class="st_sharethis" displayText="ShareThis"></span> - <% end %> - </article> <% if BlogPost.comments_allowed? %> <aside id="comments"> <h2><%= t('.comments.title') %></h2> @@ -92,4 +64,22 @@ <% end %> <%= render :partial => "/shared/content_page", :locals => { :remove_automatic_sections => true } %> -<% content_for :head, stylesheet_link_tag('refinerycms-blog') %> + +<% 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' %> + <%= javascript_include_tag('refinerycms-blog') %> + <% if BlogPost::ShareThis.enabled? %> + <script src="http://w.sharethis.com/button/buttons.js"></script> + <script>stLight.options({publisher:'<%= BlogPost::ShareThis.key %>'});</script> + <% 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 %> + <%= javascript_include_tag 'refinerycms-blog' %> + <script src="http://w.sharethis.com/button/buttons.js"></script> + <script>stLight.options({publisher:'<%= BlogPost::ShareThis.key %>'});</script> + <% end if BlogPost::ShareThis.enabled? %> +<% end %>
\ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 5653aac..01fb501 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -9,7 +9,7 @@ if Rails.version < '3.0.0' ## what is the rails2 syntax for this? sorry ;__; - # get 'archive/:year/:month', :on => :collection, :action => :archive, :as => 'archive' + # get 'archive/:year/:month', :to => 'posts#archive', :as => 'archive_blog_posts' end map.namespace(:admin, :path_prefix => 'refinery') do |admin| @@ -41,7 +41,7 @@ else 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', :action => :archive, :as => 'archive_blog_posts' + get 'archive/:year/:month', :to => 'posts#archive', :as => 'archive_blog_posts' end scope(:path => 'refinery', :as => 'admin', :module => 'admin') do diff --git a/spec/factories/blog_categories.rb b/features/support/factories/blog_categories.rb index 590e5b5..be28d88 100644 --- a/spec/factories/blog_categories.rb +++ b/features/support/factories/blog_categories.rb @@ -1,4 +1,4 @@ Factory.define(:blog_category) do |f| f.title "Shopping" - f.posts {|p| [p.association :post]} + f.posts {|p| [p.association(:post)]} end
\ No newline at end of file diff --git a/spec/factories/blog_comments.rb b/features/support/factories/blog_comments.rb index 93beaf3..93beaf3 100644 --- a/spec/factories/blog_comments.rb +++ b/features/support/factories/blog_comments.rb diff --git a/spec/factories/blog_posts.rb b/features/support/factories/blog_posts.rb index 6947e81..6947e81 100644 --- a/spec/factories/blog_posts.rb +++ b/features/support/factories/blog_posts.rb diff --git a/features/support/paths.rb b/features/support/paths.rb new file mode 100644 index 0000000..dbd04dd --- /dev/null +++ b/features/support/paths.rb @@ -0,0 +1,24 @@ +module NavigationHelpers + module Refinery + module Blog + def path_to(page_name) + case page_name + when /the list of blog posts/ + admin_blog_posts_path + when /the new blog posts? form/ + new_admin_blog_post_path + else + begin + if page_name =~ /the blog post titled "?([^\"]*)"?/ and (page = BlogPost.find_by_title($1)).present? + self.url_for(page.url) + else + nil + end + rescue + nil + end + end + end + end + end +end diff --git a/generators/refinery_blog/refinery_blog_generator.rb b/generators/refinerycms_blog/refinerycms_blog_generator.rb index 383d237..2945823 100644 --- a/generators/refinery_blog/refinery_blog_generator.rb +++ b/generators/refinerycms_blog/refinerycms_blog_generator.rb @@ -1,4 +1,4 @@ -class RefineryBlogGenerator < Rails::Generator::NamedBase +class RefinerycmsBlogGenerator < Rails::Generator::NamedBase def initialize(*runtime_args) # set argument for the user. @@ -7,7 +7,7 @@ class RefineryBlogGenerator < Rails::Generator::NamedBase end def banner - 'Usage: script/generate refinery_blog' + 'Usage: script/generate refinerycms_blog' end def manifest @@ -24,7 +24,7 @@ class RefineryBlogGenerator < Rails::Generator::NamedBase path = (%w(public) | image.split('public/').last.split('/'))[0...-1].join('/') m.template "../../../#{path}/#{image.split('/').last}", "#{path}/#{image.split('/').last}" end - + m.directory('db/seeds') m.template('db/seeds/seed.rb', 'db/seeds/refinerycms_blog.rb') diff --git a/generators/refinery_blog/templates/db/migrate/migration.rb b/generators/refinerycms_blog/templates/db/migrate/migration.rb index 5ba29c6..5ba29c6 100644 --- a/generators/refinery_blog/templates/db/migrate/migration.rb +++ b/generators/refinerycms_blog/templates/db/migrate/migration.rb diff --git a/generators/refinery_blog/templates/db/seeds/seed.rb b/generators/refinerycms_blog/templates/db/seeds/seed.rb index 228fc7b..228fc7b 100644 --- a/generators/refinery_blog/templates/db/seeds/seed.rb +++ b/generators/refinerycms_blog/templates/db/seeds/seed.rb diff --git a/lib/generators/refinery_blog/templates/db/migrate/migration_number_create_singular_name.rb b/lib/generators/refinerycms_blog/templates/db/migrate/migration_number_create_singular_name.rb index badb213..badb213 100644 --- a/lib/generators/refinery_blog/templates/db/migrate/migration_number_create_singular_name.rb +++ b/lib/generators/refinerycms_blog/templates/db/migrate/migration_number_create_singular_name.rb diff --git a/lib/generators/refinery_blog/templates/db/seeds/seed.rb b/lib/generators/refinerycms_blog/templates/db/seeds/seed.rb index f958fab..f958fab 100644 --- a/lib/generators/refinery_blog/templates/db/seeds/seed.rb +++ b/lib/generators/refinerycms_blog/templates/db/seeds/seed.rb diff --git a/lib/generators/refinery_blog_generator.rb b/lib/generators/refinerycms_blog_generator.rb index 4f0cbe6..ba21e9f 100644 --- a/lib/generators/refinery_blog_generator.rb +++ b/lib/generators/refinerycms_blog_generator.rb @@ -1,9 +1,9 @@ require 'rails/generators/migration' -class RefineryBlogGenerator < Rails::Generators::NamedBase +class RefinerycmsBlogGenerator < Rails::Generators::NamedBase include Rails::Generators::Migration - source_root File.expand_path('../refinery_blog/templates/', __FILE__) + source_root File.expand_path('../refinerycms_blog/templates/', __FILE__) argument :name, :type => :string, :default => 'blog_structure', :banner => '' def generate diff --git a/public/javascripts/refinerycms-blog.js b/public/javascripts/refinerycms-blog.js new file mode 100644 index 0000000..b94977c --- /dev/null +++ b/public/javascripts/refinerycms-blog.js @@ -0,0 +1,26 @@ +$(document).ready(function(){ + $('#show_blog_post').height($('#show_blog_post').height()); + + $('#next_prev_article a:not(".home")').live('click', function(){ + url = this.href + ".js"; + nav_url = $(this).attr('data-nav-url'); + $('#show_blog_post > *').fadeOut(); + $.ajax({ + url: url, + success: function(data) { + $('#show_blog_post').html(data); + new_height = 0; + $('#show_blog_post > *').each(function(){ + new_height += $(this).height() + }); + $('#show_blog_post').animate({ + height: new_height + }); + } + }); + $('html, body').animate({ + scrollTop: $('body').offset().top + }, 2000); + return false; + }) +})
\ No newline at end of file diff --git a/public/stylesheets/refinerycms-blog.css b/public/stylesheets/refinerycms-blog.css index 35c2ef5..73a4e42 100644 --- a/public/stylesheets/refinerycms-blog.css +++ b/public/stylesheets/refinerycms-blog.css @@ -22,4 +22,71 @@ display: block; padding-left: 25px; background: url('/images/refinerycms-blog/rss-feed.png') no-repeat; -}
\ No newline at end of file +} +#next_prev_article{ + overflow:hidden; + margin:10px 0; + position:relative; + height:30px; +} +#next_prev_article a{ + display:block; + width:33%; + height:30px; + line-height:30px; + position:absolute; + top:0; +} +#next_prev_article a.prev{ + left:0; +} +#next_prev_article a.home{ + left:33%; + text-align:center; +} +#next_prev_article a.next{ + text-align:right; + right:0; +} + +#message, .flash { + padding: 8px 8px 8px 30px; + margin-bottom: 15px; + position: relative; +} +.flash_notice, .flash_message { + border: 1px solid #00A017; + color: #00A017; + background: 7px 7px no-repeat url('/images/refinery/icons/accept.png') #E0F5E0; +} +.flash_notice, .flash_notice * { + color: #00A017; +} +.flash_error { + border: 1px solid #A00027; + color: #A00027; + background: 7px 7px no-repeat url('/images/refinery/icons/cancel.png') #FFB1B1; +} +.flash.flash_notice #flash_close, .flash.flash_error #flash_close { + text-transform: lowercase; +} +.flash.flash_message { + background: #E0F5E0; + padding: 9px; + position: relative; + margin-bottom: 32px; +} +.flash.flash_message h2 { + margin-top: 12px; +} +.flash_message, .flash_message * { + color: #262719; + font-size: 14px; +} +.flash a, .flash a:hover { + color: #e20003; + border-bottom-color: #e20003; +} +.flash.flash_error a, .flash.flash_error a:hover { + display: none; +} /* FLASH MESSAGES */ @@ -11,13 +11,17 @@ Options: Open up your ``Gemfile`` and add at the bottom this line - gem 'refinerycms-blog', '~> 1.0.rc16' + gem 'refinerycms-blog', '= 1.0.rc16' Now run ``bundle install`` -Next to install the blog plugin run: +Next to install the blog plugin run (for Rails 2): - ruby script/generate refinery_blog + ruby script/generate refinerycms_blog + +Or, for Rails 3: + + rails generate refinerycms_blog Finally migrate your database and you're done. diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index 3f9205c..accaaaf 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.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-15} + s.date = %q{2010-11-22} s.summary = %q{Ruby on Rails blogging engine for RefineryCMS.} s.email = %q{info@refinerycms.com} s.homepage = %q{http://refinerycms.com} @@ -52,7 +52,9 @@ Gem::Specification.new do |s| app/views/admin/blog/comments/index.html.erb app/views/admin/blog/comments/show.html.erb app/views/admin/blog/posts + 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/_post.html.erb app/views/admin/blog/posts/_sortable_list.html.erb app/views/admin/blog/posts/edit.html.erb @@ -67,6 +69,9 @@ Gem::Specification.new do |s| app/views/blog/comment_mailer/notification.html.erb app/views/blog/posts app/views/blog/posts/_comment.html.erb + app/views/blog/posts/_nav.html.erb + app/views/blog/posts/_post.html.erb + app/views/blog/posts/archive.html.erb app/views/blog/posts/index.html.erb app/views/blog/posts/index.rss.builder app/views/blog/posts/show.html.erb @@ -85,25 +90,25 @@ Gem::Specification.new do |s| Gemfile Gemfile.lock generators - generators/refinery_blog - generators/refinery_blog/refinery_blog_generator.rb - generators/refinery_blog/templates - generators/refinery_blog/templates/db - generators/refinery_blog/templates/db/migrate - generators/refinery_blog/templates/db/migrate/migration.rb - generators/refinery_blog/templates/db/seeds - generators/refinery_blog/templates/db/seeds/seed.rb + generators/refinerycms_blog + generators/refinerycms_blog/refinerycms_blog_generator.rb + generators/refinerycms_blog/templates + generators/refinerycms_blog/templates/db + generators/refinerycms_blog/templates/db/migrate + generators/refinerycms_blog/templates/db/migrate/migration.rb + generators/refinerycms_blog/templates/db/seeds + generators/refinerycms_blog/templates/db/seeds/seed.rb lib lib/gemspec.rb lib/generators - lib/generators/refinery_blog - lib/generators/refinery_blog/templates - lib/generators/refinery_blog/templates/db - lib/generators/refinery_blog/templates/db/migrate - lib/generators/refinery_blog/templates/db/migrate/migration_number_create_singular_name.rb - lib/generators/refinery_blog/templates/db/seeds - lib/generators/refinery_blog/templates/db/seeds/seed.rb - lib/generators/refinery_blog_generator.rb + lib/generators/refinerycms_blog + lib/generators/refinerycms_blog/templates + lib/generators/refinerycms_blog/templates/db + lib/generators/refinerycms_blog/templates/db/migrate + lib/generators/refinerycms_blog/templates/db/migrate/migration_number_create_singular_name.rb + lib/generators/refinerycms_blog/templates/db/seeds + lib/generators/refinerycms_blog/templates/db/seeds/seed.rb + lib/generators/refinerycms_blog_generator.rb lib/refinerycms-blog.rb public public/images @@ -126,6 +131,7 @@ Gem::Specification.new do |s| public/javascripts public/javascripts/refinery public/javascripts/refinery/refinerycms-blog.js + public/javascripts/refinerycms-blog.js public/stylesheets public/stylesheets/refinery public/stylesheets/refinery/refinerycms-blog.css diff --git a/spec/models/blog_categories_spec.rb b/spec/models/blog_categories_spec.rb index d97172c..90d9e22 100644 --- a/spec/models/blog_categories_spec.rb +++ b/spec/models/blog_categories_spec.rb @@ -1,20 +1,21 @@ require 'spec_helper' +Dir[File.expand_path('../../../features/support/factories/*.rb', __FILE__)].each{|factory| require factory} describe BlogCategory do context "wiring up" do - + before(:each) do @category = Factory(:blog_category) end - + it "saves" do @category.should_not be_nil end - + it "has a blog post" do BlogPost.last.categories.should include(@category) end - + end - + end
\ No newline at end of file diff --git a/spec/models/blog_comments_spec.rb b/spec/models/blog_comments_spec.rb index 145626d..7966b46 100644 --- a/spec/models/blog_comments_spec.rb +++ b/spec/models/blog_comments_spec.rb @@ -1,4 +1,5 @@ require 'spec_helper' +Dir[File.expand_path('../../../features/support/factories/*.rb', __FILE__)].each{|factory| require factory} describe BlogComment do diff --git a/spec/models/blog_posts_spec.rb b/spec/models/blog_posts_spec.rb index a334c73..3801de8 100644 --- a/spec/models/blog_posts_spec.rb +++ b/spec/models/blog_posts_spec.rb @@ -1,4 +1,5 @@ require 'spec_helper' +Dir[File.expand_path('../../../features/support/factories/*.rb', __FILE__)].each{|factory| require factory} describe BlogPost do context "wiring up" do |