Merged in Joe's and Steven's forks and updated for compatibility with < 0.9.9. Also, specs now work by including the factories and I have also laid the foundation for cucumber features. Fixed an issue where the javascript file was clashing with the same code we merged to core from this engine relating to submenus. Regenerated gemspec.
This commit is contained in:
commit
e5b9af1054
22 changed files with 152 additions and 78 deletions
|
@ -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
|
||||
|
|
|
@ -78,9 +78,12 @@
|
|||
</ul>
|
||||
|
||||
</nav>
|
||||
<% content_for :stylesheets 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 %>
|
|
@ -59,5 +59,8 @@
|
|||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<% 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 %>
|
7
app/views/admin/blog/posts/_form.css.erb
Normal file
7
app/views/admin/blog/posts/_form.css.erb
Normal file
|
@ -0,0 +1,7 @@
|
|||
<style type='text/css'>
|
||||
ul.blog_categories, ul.blog_categories li {
|
||||
list-style: none;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
</style>
|
|
@ -57,27 +57,13 @@
|
|||
:delete_title => t('admin.blog.posts.post.delete')
|
||||
} %>
|
||||
<% end -%>
|
||||
<% content_for :stylesheets do -%>
|
||||
<style type='text/css'>
|
||||
ul.blog_categories, ul.blog_categories li {
|
||||
list-style: none;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
</style>
|
||||
<% end -%>
|
||||
<% content_for :after_javascript_libraries 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 %>
|
13
app/views/admin/blog/posts/_form.js.erb
Normal file
13
app/views/admin/blog/posts/_form.js.erb
Normal file
|
@ -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>
|
|
@ -1,12 +1,3 @@
|
|||
<% content_for :after_javascript_libraries 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 %>
|
||||
<div id="show_blog_post">
|
||||
<%= render 'post' %>
|
||||
|
@ -73,5 +64,22 @@
|
|||
<% end %>
|
||||
|
||||
<%= 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' %>
|
||||
<%= 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 :javascripts, javascript_include_tag('jquery','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 %>
|
|
@ -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
|
24
features/support/paths.rb
Normal file
24
features/support/paths.rb
Normal file
|
@ -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
|
|
@ -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
|
|
@ -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
|
10
readme.md
10
readme.md
|
@ -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.
|
||||
|
||||
|
|
|
@ -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}
|
||||
|
@ -24,6 +24,8 @@ Gem::Specification.new do |s|
|
|||
app/controllers/blog/categories_controller.rb
|
||||
app/controllers/blog/posts_controller.rb
|
||||
app/controllers/blog_controller.rb
|
||||
app/helpers
|
||||
app/helpers/blog_posts_helper.rb
|
||||
app/mailers
|
||||
app/mailers/blog
|
||||
app/mailers/blog/comment_mailer.rb
|
||||
|
@ -50,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
|
||||
|
@ -65,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
|
||||
|
@ -83,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
|
||||
|
@ -124,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
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
require 'spec_helper'
|
||||
Dir[File.expand_path('../../../features/support/factories/*.rb', __FILE__)].each{|factory| require factory}
|
||||
|
||||
describe BlogCategory do
|
||||
context "wiring up" do
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
require 'spec_helper'
|
||||
Dir[File.expand_path('../../../features/support/factories/*.rb', __FILE__)].each{|factory| require factory}
|
||||
|
||||
describe BlogComment do
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue