spud_blog 0.9.11 → 1.0.0.rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 77a728504b7102e5895987df422949e3bead587b
4
+ data.tar.gz: 2f0b881a34f6c85002262f1fefac96c6cab7d4e8
5
+ SHA512:
6
+ metadata.gz: 8bfd01e3fd6a66af57ce7020627196353e4e602c7e8bc0fe2c75a6883aed05407b1067b2587584dbd770c08f0cae5dd97201762b4976f8d7002440fcd0f61914
7
+ data.tar.gz: f41987a796f9fe647814ca7d5a0cd6df19bdabaee85de4c2f59f3943d516d875644755db82be3b8461864b3e09f3eb5ff810e48cfce3e80a894ba7e9e7a90b4c
@@ -8,7 +8,7 @@ spud.admin.posts = new function(){
8
8
  var self = this;
9
9
 
10
10
  this.edit = function(){
11
- initDatePicker();
11
+ spud.admin.date_picker.init()
12
12
 
13
13
  $('body').on('click', '.spud_post_add_category', self.clickedPostAddCategory);
14
14
  $('body').on('click', '.save_post_category_button', self.submittedPostCategoryForm);
@@ -1,25 +1,24 @@
1
1
  class BlogController < ApplicationController
2
-
2
+ # include ActionController::Caching::Sweeping
3
3
  respond_to :html, :xml, :json, :rss
4
4
  layout Spud::Blog.base_layout
5
5
 
6
6
  before_filter :find_post, :only => :show
7
7
 
8
- caches_action :show, :index,
9
- :expires => Spud::Blog.config.action_caching_duration,
10
- :if => Proc.new{ |c|
11
- Spud::Blog.cache_mode == :action && !(c.params[:page] && c.params[:page].to_i > 1) && (SpudPost.where(:is_news => false).future_posts.count == 0)
12
- }
8
+ # caches_action :show, :index,
9
+ # :expires => Spud::Blog.config.action_caching_duration,
10
+ # :if => Proc.new{ |c|
11
+ # Spud::Blog.cache_mode == :action && !(c.params[:page] && c.params[:page].to_i > 1) && (SpudPost.where(:is_news => false).future_posts.count == 0)
12
+ # }
13
13
 
14
- after_filter :only => [:show, :index] do |c|
15
- if Spud::Blog.cache_mode == :full_page && !(c.params[:page] && c.params[:page].to_i > 1)
16
- if (SpudPost.where(:is_news => false).future_posts.count == 0)
17
- c.cache_page(nil, nil, false)
18
- end
19
- end
20
- end
14
+ # after_filter :only => [:show, :index] do |c|
15
+ # if Spud::Blog.cache_mode == :full_page && !(c.params[:page] && c.params[:page].to_i > 1)
16
+ # if (SpudPost.where(:is_news => false).future_posts.count == 0)
17
+ # c.cache_page(nil, nil, false)
18
+ # end
19
+ # end
20
+ # end
21
21
 
22
- cache_sweeper :spud_post_comment_sweeper, :only => [:create_comment]
23
22
 
24
23
  def index
25
24
  page = 1
@@ -110,7 +109,7 @@ class BlogController < ApplicationController
110
109
  flash[:error] = "Post not found!"
111
110
  redirect_to blog_path and return false
112
111
  end
113
- @comment = @post.comments.new(params[:spud_post_comment])
112
+ @comment = @post.comments.new(comment_params)
114
113
  @comment.user_agent = request.env["HTTP_USER_AGENT"]
115
114
  @comment.user_ip = request.remote_ip
116
115
  @comment.referrer = request.referrer
@@ -122,7 +121,7 @@ class BlogController < ApplicationController
122
121
  end
123
122
  end
124
123
 
125
- private
124
+ private
126
125
 
127
126
  def find_post
128
127
  @post = SpudPost.find_by_url_name(params[:id])
@@ -132,4 +131,8 @@ class BlogController < ApplicationController
132
131
  end
133
132
  end
134
133
 
134
+ def comment_params
135
+ params.require(:spud_post_comment).permit(:author,:content)
136
+ end
137
+
135
138
  end
@@ -5,7 +5,6 @@ class Spud::Admin::NewsPostsController < Spud::Admin::ApplicationController
5
5
  before_filter :find_post, :only => [:show, :edit, :update, :destroy]
6
6
  add_breadcrumb 'News Posts', :spud_admin_news_posts_path
7
7
  belongs_to_spud_app :news_posts
8
- cache_sweeper :spud_post_sweeper, :only => [:create, :update, :destroy]
9
8
 
10
9
  def index
11
10
  @posts = SpudPost.where(:is_news => true).order('published_at desc').includes(:comments).paginate(:page => params[:page], :per_page => 15)
@@ -20,7 +19,7 @@ class Spud::Admin::NewsPostsController < Spud::Admin::ApplicationController
20
19
  def update
21
20
  @categories = SpudPostCategory.grouped
22
21
  params[:spud_post][:spud_site_ids] ||= []
23
- if @post.update_attributes(params[:spud_post])
22
+ if @post.update_attributes(post_params)
24
23
  flash[:notice] = 'News Post was successfully updated.'
25
24
  end
26
25
  respond_with @post, :location => spud_admin_news_posts_path
@@ -35,7 +34,7 @@ class Spud::Admin::NewsPostsController < Spud::Admin::ApplicationController
35
34
  def create
36
35
  @categories = SpudPostCategory.grouped
37
36
  params[:spud_post][:spud_site_ids] ||= []
38
- @post = SpudPost.new(params[:spud_post])
37
+ @post = SpudPost.new(post_params)
39
38
  if @post.save
40
39
  flash[:notice] = 'News Post was successfully created.'
41
40
  end
@@ -59,4 +58,8 @@ class Spud::Admin::NewsPostsController < Spud::Admin::ApplicationController
59
58
  end
60
59
  end
61
60
 
61
+ def post_params
62
+ params.require(:spud_post).permit(:is_news,:published_at,:title,:content,:spud_user_id,:url_name,:visible,:comments_enabled,:meta_keywords,:meta_description,{:category_ids => []}, {:spud_site_ids => []}, :content_format)
63
+ end
64
+
62
65
  end
@@ -1,10 +1,13 @@
1
+ require 'actionpack/action_caching'
2
+ require 'actionpack/page_caching'
3
+
1
4
  class Spud::Admin::PostCategoriesController < Spud::Admin::ApplicationController
2
5
 
3
6
  layout false
4
7
  respond_to :html, :json
5
8
 
6
9
  before_filter :find_category, :only => [:show, :edit, :update, :destroy]
7
- cache_sweeper :spud_post_category_sweeper, :only => [:create, :update, :destroy]
10
+ # cache_sweeper :spud_post_category_sweeper, :only => [:create, :update, :destroy]
8
11
 
9
12
  def index
10
13
  @post_categories = SpudPostCategory.grouped
@@ -16,7 +19,7 @@ class Spud::Admin::PostCategoriesController < Spud::Admin::ApplicationController
16
19
  end
17
20
 
18
21
  def update
19
- if @post_category.update_attributes(params[:spud_post_category])
22
+ if @post_category.update_attributes(category_params)
20
23
  flash[:notice] = 'Post Category was successfully updated'
21
24
  respond_with @post_category, :location => spud_admin_post_categories_path
22
25
  else
@@ -30,7 +33,7 @@ class Spud::Admin::PostCategoriesController < Spud::Admin::ApplicationController
30
33
  end
31
34
 
32
35
  def create
33
- @post_category = SpudPostCategory.new(params[:spud_post_category])
36
+ @post_category = SpudPostCategory.new(category_params)
34
37
  if @post_category.save
35
38
  flash[:notice] = 'Post Category was successfully created'
36
39
  respond_with @post_category, :location => spud_admin_post_categories_path
@@ -49,11 +52,13 @@ class Spud::Admin::PostCategoriesController < Spud::Admin::ApplicationController
49
52
  end
50
53
  end
51
54
 
52
- private
55
+ private
53
56
 
54
57
  def find_category
55
58
  @post_category = SpudPostCategory.find(params[:id])
56
59
  end
57
60
 
58
-
61
+ def category_params
62
+ params.require(:spud_post_category).permit(:name, :url_name, :parent_id)
63
+ end
59
64
  end
@@ -1,3 +1,4 @@
1
+
1
2
  class Spud::Admin::PostCommentsController < Spud::Admin::ApplicationController
2
3
 
3
4
  respond_to :html, :xml, :json
@@ -1,3 +1,5 @@
1
+
2
+
1
3
  class Spud::Admin::PostsController < Spud::Admin::ApplicationController
2
4
 
3
5
  layout 'spud/admin/detail'
@@ -5,7 +7,6 @@ class Spud::Admin::PostsController < Spud::Admin::ApplicationController
5
7
  before_filter :find_post, :only => [:show, :edit, :update, :destroy]
6
8
  add_breadcrumb 'Blog Posts', :spud_admin_posts_path
7
9
  belongs_to_spud_app :blog_posts
8
- cache_sweeper :spud_post_sweeper, :only => [:create, :update, :destroy]
9
10
 
10
11
  def index
11
12
  @posts = SpudPost.where(:is_news => false).order('published_at desc').includes(:visible_comments, :spam_comments, :author).paginate(:page => params[:page], :per_page => 15)
@@ -20,7 +21,7 @@ class Spud::Admin::PostsController < Spud::Admin::ApplicationController
20
21
  def update
21
22
  @categories = SpudPostCategory.grouped
22
23
  params[:spud_post][:spud_site_ids] ||= []
23
- if @post.update_attributes(params[:spud_post])
24
+ if @post.update_attributes(post_params)
24
25
  flash[:notice] = 'Post was successfully updated.'
25
26
  end
26
27
  respond_with @post, :location => spud_admin_posts_path
@@ -35,7 +36,7 @@ class Spud::Admin::PostsController < Spud::Admin::ApplicationController
35
36
  def create
36
37
  @categories = SpudPostCategory.grouped
37
38
  params[:spud_post][:spud_site_ids] ||= []
38
- @post = SpudPost.new(params[:spud_post])
39
+ @post = SpudPost.new(post_params)
39
40
  if @post.save
40
41
  flash[:notice] = 'Post was successfully created.'
41
42
  end
@@ -49,7 +50,7 @@ class Spud::Admin::PostsController < Spud::Admin::ApplicationController
49
50
  respond_with @post, :location => spud_admin_posts_path
50
51
  end
51
52
 
52
- private
53
+ private
53
54
 
54
55
  def find_post
55
56
  @post = SpudPost.find(params[:id])
@@ -59,4 +60,9 @@ class Spud::Admin::PostsController < Spud::Admin::ApplicationController
59
60
  end
60
61
  end
61
62
 
63
+
64
+ def post_params
65
+ params.require(:spud_post).permit(:is_news,:published_at,:title,:content,:spud_user_id,:url_name,:visible,:comments_enabled,:meta_keywords,:meta_description,{:category_ids => []}, {:spud_site_ids => []}, :content_format)
66
+ end
67
+
62
68
  end
@@ -1,7 +1,5 @@
1
1
  class Spud::Blog::SitemapsController < Spud::ApplicationController
2
2
  respond_to :xml
3
- caches_action :show, :expires_in => 1.day, :if => Proc.new{ |c| Spud::Blog.cache_mode == :action }
4
- caches_page :show, :if => Proc.new{ |c| Spud::Blog.cache_mode == :full_page }
5
3
  def show
6
4
  @posts = SpudPost.publicly.all
7
5
  respond_with @pages
@@ -7,13 +7,13 @@ class SpudPost < ActiveRecord::Base
7
7
  :foreign_key => 'spud_post_id'
8
8
  belongs_to :author, :class_name => 'SpudUser', :foreign_key => 'spud_user_id'
9
9
  has_many :comments, :class_name => 'SpudPostComment'
10
- has_many :visible_comments, :class_name => 'SpudPostComment',:conditions => {:spam => [nil,false]}
11
- has_many :spam_comments, :class_name => "SpudPostComment", :conditions => {:spam => true}
10
+ has_many :visible_comments, -> { where spam: [nil,false]}, :class_name => 'SpudPostComment'
11
+ has_many :spam_comments, -> { where spam: true }, :class_name => "SpudPostComment"
12
12
  has_many :spud_permalinks,:as => :attachment
13
13
  has_many :spud_post_sites, :dependent => :destroy
14
14
 
15
- scope :publicly, where('visible = true AND published_at <= ?', Time.now.utc).order('published_at desc')
16
- scope :future_posts, where('visible = true AND published_at > ?', Time.now.utc)
15
+ scope :publicly, -> { where('visible = true AND published_at <= ?', Time.now.utc).order('published_at desc') }
16
+ scope :future_posts, -> { where('visible = true AND published_at > ?', Time.now.utc) }
17
17
  validates_presence_of :title, :content, :published_at, :spud_user_id, :url_name
18
18
  validates_uniqueness_of :url_name
19
19
  before_validation :set_url_name
@@ -21,7 +21,6 @@ class SpudPost < ActiveRecord::Base
21
21
 
22
22
  after_save :set_spud_site_ids
23
23
 
24
- attr_accessible :is_news,:published_at,:title,:content,:spud_user_id,:url_name,:visible,:comments_enabled,:meta_keywords,:meta_description,:category_ids, :spud_site_ids, :content_format
25
24
  attr_accessor :spud_site_ids
26
25
 
27
26
  def self.for_spud_site(spud_site_id)
@@ -101,12 +100,10 @@ class SpudPost < ActiveRecord::Base
101
100
  end
102
101
 
103
102
  def postprocess_content
104
- if self.content_format == 'Markdown'
105
- require 'redcarpet'
106
- renderer = Redcarpet::Render::HTML.new
107
- extensions = {fenced_code_blocks: true}
108
- redcarpet = Redcarpet::Markdown.new(renderer, extensions)
109
- self.content_processed = redcarpet.render self.content
103
+ rendererClass = Spud::Core.renderer(self.content_format)
104
+ if rendererClass
105
+ renderer = rendererClass.new()
106
+ self.content_processed = renderer.render self.content
110
107
  else
111
108
  self.content_processed = content
112
109
  end
@@ -1,5 +1,4 @@
1
1
  class SpudPostCategoriesPost < ActiveRecord::Base
2
- attr_accessible :spud_post_id, :spud_post_category_id
3
- belongs_to :spud_post
4
- belongs_to :spud_post_category
5
- end
2
+ belongs_to :spud_post,:touch => true
3
+ belongs_to :spud_post_category,:touch => true
4
+ end
@@ -1,7 +1,8 @@
1
1
  class SpudPostCategory < ActiveRecord::Base
2
2
  spud_searchable
3
3
  acts_as_nested_set
4
-
4
+ has_many :spud_post_categories_posts
5
+ # has_many :posts, :class_name => "SpudPost", :through => :spud_post_categories_posts
5
6
  has_and_belongs_to_many :posts,
6
7
  :class_name => 'SpudPost',
7
8
  :join_table => 'spud_post_categories_posts',
@@ -13,7 +14,6 @@ class SpudPostCategory < ActiveRecord::Base
13
14
 
14
15
  before_destroy :update_child_categories
15
16
 
16
- attr_accessible :name, :url_name, :parent_id
17
17
 
18
18
  # tell awesome_nested_set not to destroy descendants
19
19
  def skip_before_destroy
@@ -6,9 +6,9 @@ class SpudPostComment < ActiveRecord::Base
6
6
 
7
7
 
8
8
  validates_presence_of :author, :content
9
- belongs_to :post, :class_name => 'SpudPost', :foreign_key => 'spud_post_id', :counter_cache => :comments_count
9
+ belongs_to :post, :class_name => 'SpudPost', :foreign_key => 'spud_post_id', :counter_cache => :comments_count, :touch => true
10
10
 
11
- attr_accessible :author,:content,:spud_post_id,:referrer,:spam,:user_agent,:user_ip,:permalink
11
+ # attr_accessible :author,:content,:spud_post_id,:referrer,:spam,:user_agent,:user_ip,:permalink
12
12
 
13
13
 
14
14
  def rakismet_check_for_spam
@@ -1,9 +1,9 @@
1
1
  class SpudPostSite < ActiveRecord::Base
2
- attr_accessible :spud_post_id, :spud_site_id
3
- belongs_to :spud_post
2
+ # attr_accessible :spud_post_id, :spud_site_id
3
+ belongs_to :spud_post, :touch => :true
4
4
 
5
5
  def spud_site
6
6
  return Spud::Core.site_config_for_id(spud_site_id)
7
7
  end
8
-
8
+
9
9
  end
@@ -1,4 +1,4 @@
1
1
  <li>
2
2
  <h6>Posted by: <%= comment.author %></h6>
3
3
  <p><%= comment.content %></p>
4
- </li>
4
+ </li>
@@ -0,0 +1,9 @@
1
+ <% cache ["blog/index",post] do%>
2
+ <div class="spud_blog_post">
3
+ <h3><%= link_to post.title, blog_post_path(post.url_name) %></h3>
4
+ <h4>Posted by <%= post.author.full_name %> on <%= post.display_date %></h4>
5
+ <div class="spud_blog_post_content">
6
+ <%= truncate_html post.content_processed.html_safe, :length => 250 %>
7
+ </div>
8
+ </div>
9
+ <%end%>
@@ -18,15 +18,7 @@
18
18
 
19
19
  <div id="spud_blog_posts">
20
20
  <% if @posts.any? %>
21
- <% @posts.each do |post| %>
22
- <div class="spud_blog_post">
23
- <h3><%= link_to post.title, blog_post_path(post.url_name) %></h3>
24
- <h4>Posted by <%= post.author.full_name %> on <%= post.display_date %></h4>
25
- <div class="spud_blog_post_content">
26
- <%= truncate_html post.content_processed.html_safe, :length => 250 %>
27
- </div>
28
- </div>
29
- <% end %>
21
+ <%= render :partial => "post", :collection => @posts %>
30
22
  <% else %>
31
23
  <p>No posts were found in this category</p>
32
24
  <% end %>
@@ -12,26 +12,28 @@
12
12
  <% end %>
13
13
  <% end %>
14
14
 
15
- <div class="spud_blog_post">
16
- <h3><%= @post.title %></h3>
17
- <h4>Posted by <%= @post.author.full_name %> on <%= @post.display_date %></h4>
18
- <% if @post.categories.any? %>
19
- <p id="spud_blog_post_categories">
20
- Filed under
21
- <%= raw(@post.categories.collect{ |c| link_to c.name, blog_category_path(c.url_name) }.join(', ')) %>
22
- </p>
23
- <% end %>
24
- <div id="spud_blog_post_content">
25
- <%= raw @post.content_processed %>
15
+ <%cache ['blog/show', @post] do%>
16
+ <div class="spud_blog_post">
17
+ <h3><%= @post.title %></h3>
18
+ <h4>Posted by <%= @post.author.full_name %> on <%= @post.display_date %></h4>
19
+ <% if @post.categories.any? %>
20
+ <p id="spud_blog_post_categories">
21
+ Filed under
22
+ <%= raw(@post.categories.collect{ |c| link_to c.name, blog_category_path(c.url_name) }.join(', ')) %>
23
+ </p>
24
+ <% end %>
25
+ <div id="spud_blog_post_content">
26
+ <%= raw @post.content_processed %>
27
+ </div>
26
28
  </div>
27
- </div>
28
29
 
29
- <% if @post.comments_enabled %>
30
- <div class="spud_blog_post_comment">
31
- <h5>Post a Comment:</h5>
32
- <%= render 'comment_form' %>
33
- </div>
34
- <ul id="spud_blog_post_comments">
35
- <%= render :partial => 'comment', :collection => @post.visible_comments %>
36
- </ul>
37
- <% end %>
30
+ <% if @post.comments_enabled %>
31
+ <div class="spud_blog_post_comment">
32
+ <h5>Post a Comment:</h5>
33
+ <%= render 'comment_form' %>
34
+ </div>
35
+ <ul id="spud_blog_post_comments">
36
+ <%= render :partial => 'comment', :collection => @post.visible_comments %>
37
+ </ul>
38
+ <% end %>
39
+ <%end%>
@@ -0,0 +1,9 @@
1
+ <% cache ["news/index",post] do%>
2
+ <div class="spud_news_post">
3
+ <h3><%= link_to post.title, news_post_path(post.url_name) %></h3>
4
+ <h4>Posted by <%= post.author.full_name %> on <%= post.display_date %></h4>
5
+ <div class="spud_news_post_content">
6
+ <%= truncate_html post.content_processed.html_safe, :length => 250 %>
7
+ </div>
8
+ </div>
9
+ <%end%>
@@ -18,15 +18,7 @@
18
18
 
19
19
  <div id="spud_news_posts">
20
20
  <% if @posts.any? %>
21
- <% @posts.each do |post| %>
22
- <div class="spud_news_post">
23
- <h3><%= link_to post.title, news_post_path(post.url_name) %></h3>
24
- <h4>Posted by <%= post.author.full_name %> on <%= post.display_date %></h4>
25
- <div class="spud_news_post_content">
26
- <%= truncate_html post.content_processed.html_safe, :length => 250 %>
27
- </div>
28
- </div>
29
- <% end %>
21
+ <%= render :partial => "post", :collection => @posts %>
30
22
  <% else %>
31
23
  <p>No posts were found in this category</p>
32
24
  <% end %>
@@ -12,16 +12,18 @@
12
12
  <% end %>
13
13
  <% end %>
14
14
 
15
- <div class="spud_news_post">
16
- <h3><%= @post.title %></h3>
17
- <h4>Posted by <%= @post.author.full_name %> on <%= @post.display_date %></h4>
18
- <% if @post.categories.any? %>
19
- <p id="spud_news_post_categories">
20
- Filed under
21
- <%= raw(@post.categories.collect{ |c| link_to c.name, news_category_path(c.url_name) }.join(', ')) %>
22
- </p>
23
- <% end %>
24
- <div id="spud_news_post_content">
25
- <%= raw @post.content_processed %>
15
+ <%cache ['news/show', @post] do%>
16
+ <div class="spud_news_post">
17
+ <h3><%= @post.title %></h3>
18
+ <h4>Posted by <%= @post.author.full_name %> on <%= @post.display_date %></h4>
19
+ <% if @post.categories.any? %>
20
+ <p id="spud_news_post_categories">
21
+ Filed under
22
+ <%= raw(@post.categories.collect{ |c| link_to c.name, news_category_path(c.url_name) }.join(', ')) %>
23
+ </p>
24
+ <% end %>
25
+ <div id="spud_news_post_content">
26
+ <%= raw @post.content_processed %>
27
+ </div>
26
28
  </div>
27
- </div>
29
+ <%end%>
@@ -6,15 +6,13 @@
6
6
  <%= f.text_field :title, :class => "full-width",:placeholder=>"Enter title here" %>
7
7
  </div>
8
8
  </fieldset>
9
- <%if Spud::Blog.config.enable_markdown%>
10
9
  <div class="control-group">
11
10
  <div class="controls">
12
- <%=f.select :content_format,[["HTML"],["Markdown"]], {:include_blank => false}, :class => "pull-right", "data-formatter" => "spud_post_content"%>
11
+ <%=f.select :content_format,Spud::Core.renderers.collect { |k,v| [v[:description] || k, k]}, {:include_blank => false}, :class => "pull-right", "data-formatter" => "spud_post_content"%>
13
12
  </div>
14
13
  </div>
15
- <%end%>
16
14
  <div style="clear:both;">
17
- <%= f.text_area :content,:style => "width:100%;", :class => 'tinymce full-width', "data-format" => f.object.content_format%>
15
+ <%= f.text_area :content,:style => "width:100%;", :class => 'spud-formatted-editor full-width', "data-format" => f.object.content_format %>
18
16
  </div>
19
17
 
20
18
  <% if Spud::Blog.config.has_custom_fields %>
@@ -34,7 +34,7 @@
34
34
  Spam: <%=link_to post.spam_comments.count, spud_admin_post_post_comments_path(:post_id => post.id) %>
35
35
  </td>
36
36
  <td align="right">
37
- <%= link_to 'Delete', spud_admin_post_path(post), :method => :delete, :confirm => 'Are you sure you want to delete this post?', :class => 'btn btn-danger' %>
37
+ <%= link_to 'Delete', spud_admin_post_path(post), :method => :delete, :data => {:confirm => 'Are you sure you want to delete this post?'}, :class => 'btn btn-danger' %>
38
38
  </td>
39
39
  </tr>
40
40
  <%end%>
data/config/routes.rb CHANGED
@@ -20,7 +20,7 @@ Rails.application.routes.draw do
20
20
  end
21
21
 
22
22
  if Spud::Blog.config.blog_enabled
23
- scope Spud::Blog.config.blog_path do
23
+ scope (Spud::Blog.config.blog_path == '/' ? 'blog' : Spud::Blog.config.blog_path) do
24
24
 
25
25
  # Blog Post Categories
26
26
  get 'category/:category_url_name(/page/:page)',
@@ -57,7 +57,7 @@ Rails.application.routes.draw do
57
57
  end
58
58
 
59
59
  if Spud::Blog.config.news_enabled
60
- scope Spud::Blog.config.news_path do
60
+ scope (Spud::Blog.config.news_path == '/' ? 'news' : Spud::Blog.config.news_path) do
61
61
 
62
62
  # News Post Categories
63
63
  get 'category/:category_url_name(/page/:page)',
@@ -91,4 +91,9 @@ Rails.application.routes.draw do
91
91
  end
92
92
  end
93
93
 
94
+ if Spud::Blog.config.blog_path == '/'
95
+ root 'blog#index'
96
+ elsif Spud::Blog.config.news_path == '/'
97
+ root 'news#index'
98
+ end
94
99
  end
@@ -5,8 +5,8 @@ module Spud
5
5
  :base_layout, :news_layout, :blog_enabled,
6
6
  :news_enabled, :posts_per_page, :blog_path,
7
7
  :news_path, :enable_sitemap, :has_custom_fields,
8
- :cache_mode, :action_caching_duration,
9
- :enable_rakismet, :enable_markdown
8
+ :action_caching_duration,
9
+ :enable_rakismet
10
10
  )
11
11
  self.base_layout = 'application'
12
12
  self.news_layout = nil
@@ -17,9 +17,8 @@ module Spud
17
17
  self.news_path = 'news'
18
18
  self.enable_sitemap = true
19
19
  self.has_custom_fields = false
20
- self.cache_mode = nil #options :full_page, :action
20
+ # self.cache_mode = nil #options :full_page, :action #deprecated
21
21
  self.action_caching_duration = 3600
22
22
  self.enable_rakismet = false
23
- self.enable_markdown = false
24
23
  end
25
24
  end
@@ -1,5 +1,5 @@
1
1
  module Spud
2
2
  module Blog
3
- VERSION = "0.9.11"
3
+ VERSION = "1.0.0.rc1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,164 +1,186 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spud_blog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.11
5
- prerelease:
4
+ version: 1.0.0.rc1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Greg Woods
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-06-27 00:00:00.000000000 Z
11
+ date: 2014-01-05 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rails
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
21
- version: 3.2.1
19
+ version: 4.0.0
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
29
- version: 3.2.1
26
+ version: 4.0.0
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: spud_core
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ~>
36
32
  - !ruby/object:Gem::Version
37
- version: 0.9.10
33
+ version: 1.0.0.rc1
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ~>
44
39
  - !ruby/object:Gem::Version
45
- version: 0.9.10
40
+ version: 1.0.0.rc1
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: spud_permalinks
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ~>
52
46
  - !ruby/object:Gem::Version
53
- version: 0.9.0
47
+ version: 1.0.0.rc1
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ~>
60
53
  - !ruby/object:Gem::Version
61
- version: 0.9.0
54
+ version: 1.0.0.rc1
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: truncate_html
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - '>='
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: awesome_nested_set
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - '>='
84
74
  - !ruby/object:Gem::Version
85
75
  version: '0'
86
76
  type: :runtime
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - '>='
92
81
  - !ruby/object:Gem::Version
93
82
  version: '0'
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: redcarpet
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: actionpack-page_caching
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
100
102
  - !ruby/object:Gem::Version
101
103
  version: '0'
102
104
  type: :runtime
103
105
  prerelease: false
104
106
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
107
  requirements:
107
- - - ! '>='
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: actionpack-action_caching
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '>='
108
123
  - !ruby/object:Gem::Version
109
124
  version: '0'
110
125
  - !ruby/object:Gem::Dependency
111
126
  name: mysql2
112
127
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
128
  requirements:
115
129
  - - '='
116
130
  - !ruby/object:Gem::Version
117
- version: 0.3.11
131
+ version: 0.3.14
118
132
  type: :development
119
133
  prerelease: false
120
134
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
135
  requirements:
123
136
  - - '='
124
137
  - !ruby/object:Gem::Version
125
- version: 0.3.11
138
+ version: 0.3.14
139
+ - !ruby/object:Gem::Dependency
140
+ name: simplecov
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ~>
144
+ - !ruby/object:Gem::Version
145
+ version: 0.6.4
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ~>
151
+ - !ruby/object:Gem::Version
152
+ version: 0.6.4
126
153
  - !ruby/object:Gem::Dependency
127
154
  name: rspec
128
155
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
156
  requirements:
131
157
  - - '='
132
158
  - !ruby/object:Gem::Version
133
- version: 2.8.0
159
+ version: 2.14.0
134
160
  type: :development
135
161
  prerelease: false
136
162
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
163
  requirements:
139
164
  - - '='
140
165
  - !ruby/object:Gem::Version
141
- version: 2.8.0
166
+ version: 2.14.0
142
167
  - !ruby/object:Gem::Dependency
143
168
  name: rspec-rails
144
169
  requirement: !ruby/object:Gem::Requirement
145
- none: false
146
170
  requirements:
147
171
  - - '='
148
172
  - !ruby/object:Gem::Version
149
- version: 2.8.1
173
+ version: 2.14.0
150
174
  type: :development
151
175
  prerelease: false
152
176
  version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
177
  requirements:
155
178
  - - '='
156
179
  - !ruby/object:Gem::Version
157
- version: 2.8.1
180
+ version: 2.14.0
158
181
  - !ruby/object:Gem::Dependency
159
182
  name: shoulda
160
183
  requirement: !ruby/object:Gem::Requirement
161
- none: false
162
184
  requirements:
163
185
  - - ~>
164
186
  - !ruby/object:Gem::Version
@@ -166,7 +188,6 @@ dependencies:
166
188
  type: :development
167
189
  prerelease: false
168
190
  version_requirements: !ruby/object:Gem::Requirement
169
- none: false
170
191
  requirements:
171
192
  - - ~>
172
193
  - !ruby/object:Gem::Version
@@ -174,67 +195,45 @@ dependencies:
174
195
  - !ruby/object:Gem::Dependency
175
196
  name: factory_girl
176
197
  requirement: !ruby/object:Gem::Requirement
177
- none: false
178
198
  requirements:
179
- - - '='
199
+ - - ~>
180
200
  - !ruby/object:Gem::Version
181
- version: 2.5.0
201
+ version: '3.0'
182
202
  type: :development
183
203
  prerelease: false
184
204
  version_requirements: !ruby/object:Gem::Requirement
185
- none: false
186
205
  requirements:
187
- - - '='
206
+ - - ~>
188
207
  - !ruby/object:Gem::Version
189
- version: 2.5.0
208
+ version: '3.0'
190
209
  - !ruby/object:Gem::Dependency
191
- name: mocha
210
+ name: database_cleaner
192
211
  requirement: !ruby/object:Gem::Requirement
193
- none: false
194
212
  requirements:
195
213
  - - '='
196
214
  - !ruby/object:Gem::Version
197
- version: 0.10.3
215
+ version: 1.0.0.RC1
198
216
  type: :development
199
217
  prerelease: false
200
218
  version_requirements: !ruby/object:Gem::Requirement
201
- none: false
202
219
  requirements:
203
220
  - - '='
204
221
  - !ruby/object:Gem::Version
205
- version: 0.10.3
222
+ version: 1.0.0.RC1
206
223
  - !ruby/object:Gem::Dependency
207
- name: database_cleaner
224
+ name: mocha
208
225
  requirement: !ruby/object:Gem::Requirement
209
- none: false
210
226
  requirements:
211
227
  - - '='
212
228
  - !ruby/object:Gem::Version
213
- version: 0.7.1
229
+ version: 0.14.0
214
230
  type: :development
215
231
  prerelease: false
216
232
  version_requirements: !ruby/object:Gem::Requirement
217
- none: false
218
233
  requirements:
219
234
  - - '='
220
235
  - !ruby/object:Gem::Version
221
- version: 0.7.1
222
- - !ruby/object:Gem::Dependency
223
- name: simplecov
224
- requirement: !ruby/object:Gem::Requirement
225
- none: false
226
- requirements:
227
- - - ~>
228
- - !ruby/object:Gem::Version
229
- version: 0.6.4
230
- type: :development
231
- prerelease: false
232
- version_requirements: !ruby/object:Gem::Requirement
233
- none: false
234
- requirements:
235
- - - ~>
236
- - !ruby/object:Gem::Version
237
- version: 0.6.4
236
+ version: 0.14.0
238
237
  description: Spud blogging/news and rss engine.
239
238
  email:
240
239
  - greg@westlakedesign.com
@@ -270,16 +269,15 @@ files:
270
269
  - app/models/spud_post.rb
271
270
  - app/models/spud_post_categories_post.rb
272
271
  - app/models/spud_post_category.rb
273
- - app/models/spud_post_category_sweeper.rb
274
272
  - app/models/spud_post_comment.rb
275
- - app/models/spud_post_comment_sweeper.rb
276
273
  - app/models/spud_post_site.rb
277
- - app/models/spud_post_sweeper.rb
278
274
  - app/views/blog/_comment.html.erb
279
275
  - app/views/blog/_comment_form.html.erb
276
+ - app/views/blog/_post.html.erb
280
277
  - app/views/blog/index.html.erb
281
278
  - app/views/blog/index.rss.builder
282
279
  - app/views/blog/show.html.erb
280
+ - app/views/news/_post.html.erb
283
281
  - app/views/news/index.html.erb
284
282
  - app/views/news/index.rss.builder
285
283
  - app/views/news/show.html.erb
@@ -327,33 +325,26 @@ files:
327
325
  - test/unit/spud_post_site_test.rb
328
326
  homepage: http://github.com/davydotcom/spud_blog
329
327
  licenses: []
328
+ metadata: {}
330
329
  post_install_message:
331
330
  rdoc_options: []
332
331
  require_paths:
333
332
  - lib
334
333
  required_ruby_version: !ruby/object:Gem::Requirement
335
- none: false
336
334
  requirements:
337
- - - ! '>='
335
+ - - '>='
338
336
  - !ruby/object:Gem::Version
339
337
  version: '0'
340
- segments:
341
- - 0
342
- hash: -3315726289214796166
343
338
  required_rubygems_version: !ruby/object:Gem::Requirement
344
- none: false
345
339
  requirements:
346
- - - ! '>='
340
+ - - '>'
347
341
  - !ruby/object:Gem::Version
348
- version: '0'
349
- segments:
350
- - 0
351
- hash: -3315726289214796166
342
+ version: 1.3.1
352
343
  requirements: []
353
344
  rubyforge_project:
354
- rubygems_version: 1.8.25
345
+ rubygems_version: 2.0.5
355
346
  signing_key:
356
- specification_version: 3
347
+ specification_version: 4
357
348
  summary: Spud Blog Engine.
358
349
  test_files:
359
350
  - test/fixtures/spud_post_sites.yml
@@ -1,41 +0,0 @@
1
- class SpudPostCategorySweeper < ActionController::Caching::Sweeper
2
-
3
- observe SpudPostCategory
4
-
5
- def after_save(record)
6
- expire_cache_for(record)
7
- end
8
-
9
- def after_destroy(record)
10
- expire_cache_for(record)
11
- end
12
-
13
- private
14
-
15
- def expire_cache_for(record)
16
- if Spud::Blog.config.cache_mode = :action
17
- SpudPost.find_each do |p|
18
- if p.is_news && Spud::Blog.config.news_enabled
19
- expire_action news_post_url(p.url_name)
20
- elsif Spud::Blog.config.blog_enabled
21
- expire_action blog_post_url(p.url_name)
22
- end
23
- end
24
- expire_action news_url if Spud::Blog.config.news_enabled
25
- expire_action blog_url if Spud::Blog.config.blog_enabled
26
- expire_action spud_blog_sitemap_url
27
- end
28
- if Spud::Blog.config.cache_mode = :full_page
29
- SpudPost.find_each do |p|
30
- if p.is_news && Spud::Blog.config.news_enabled
31
- expire_page news_post_path(p.url_name)
32
- elsif Spud::Blog.config.blog_enabled
33
- expire_page blog_post_path(p.url_name)
34
- end
35
- end
36
- expire_page news_path if Spud::Blog.config.news_enabled
37
- expire_page blog_path if Spud::Blog.config.blog_enabled
38
- expire_page spud_blog_sitemap_path(:format => :xml)
39
- end
40
- end
41
- end
@@ -1,33 +0,0 @@
1
- class SpudPostCommentSweeper < ActionController::Caching::Sweeper
2
-
3
- observe SpudPostComment
4
-
5
- def after_save(record)
6
- expire_cache_for(record)
7
- end
8
-
9
- def after_destroy(record)
10
- expire_cache_for(record)
11
- end
12
-
13
- private
14
-
15
- def expire_cache_for(record)
16
- unless record.post.nil?
17
- if Spud::Blog.config.cache_mode == :action
18
- if record.post.is_news
19
- expire_action news_post_url(record.post.url_name)
20
- else
21
- expire_action blog_post_url(record.post.url_name)
22
- end
23
- end
24
- if Spud::Blog.config.cache_mode == :full_page
25
- if record.post.is_news
26
- expire_page news_post_path(record.post.url_name)
27
- else
28
- expire_page blog_post_path(record.post.url_name)
29
- end
30
- end
31
- end
32
- end
33
- end
@@ -1,47 +0,0 @@
1
- class SpudPostSweeper < ActionController::Caching::Sweeper
2
-
3
- observe SpudPost
4
-
5
- def after_create(record)
6
- expire_cache_for(record)
7
- end
8
-
9
- def before_update(record)
10
- expire_cache_for(record)
11
- end
12
-
13
- def after_destroy(record)
14
- expire_cache_for(record)
15
- end
16
-
17
- private
18
-
19
- def expire_cache_for(record)
20
- if Spud::Blog.config.cache_mode == :action
21
- expire_action spud_blog_sitemap_url
22
- if !record.is_news && Spud::Blog.config.blog_enabled
23
- expire_action blog_url
24
- expire_action blog_url(:format => :rss)
25
- expire_action blog_post_url(record.url_name)
26
- elsif Spud::Blog.config.news_enabled
27
- expire_action news_url
28
- expire_action news_url(:format => :rss)
29
- expire_action news_post_url(record.url_name)
30
- end
31
- end
32
- if Spud::Blog.config.cache_mode == :full_page
33
- expire_page spud_blog_sitemap_path(:format => :xml)
34
- if record.is_news && Spud::Blog.config.news_enabled
35
- expire_page news_path
36
- expire_page news_path(:format => :rss)
37
- expire_page news_post_path(record.url_name)
38
- elsif Spud::Blog.config.blog_enabled
39
- expire_page blog_path
40
- expire_page blog_path(:format => :rss)
41
- expire_page blog_post_path(record.url_name)
42
- end
43
- end
44
- # expire_page spud_sitemap_path(:format => :xml)
45
- end
46
-
47
- end