spud_blog 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/app/assets/images/spud/admin/news_thumb.png +0 -0
- data/app/assets/images/spud/admin/posts_thumb.png +0 -0
- data/app/assets/javascripts/spud/admin/posts.js +1 -1
- data/app/controllers/blog_controller.rb +16 -3
- data/app/controllers/news_controller.rb +8 -1
- data/app/controllers/spud/admin/news_posts_controller.rb +17 -3
- data/app/controllers/spud/admin/post_categories_controller.rb +17 -3
- data/app/controllers/spud/admin/posts_controller.rb +18 -4
- data/app/controllers/spud/blog/sitemaps_controller.rb +1 -1
- data/app/views/blog/index.html.erb +3 -0
- data/app/views/blog/index.rss.builder +18 -0
- data/app/views/news/index.html.erb +3 -0
- data/app/views/news/index.rss.builder +18 -0
- data/app/views/spud/admin/news_posts/index.html.erb +1 -1
- data/app/views/spud/admin/news_posts/new.html.erb +1 -1
- data/app/views/spud/admin/post_categories/_form.html.erb +1 -1
- data/app/views/spud/admin/post_categories/edit.html.erb +1 -1
- data/app/views/spud/admin/post_categories/new.html.erb +1 -1
- data/app/views/spud/admin/posts/_form.html.erb +10 -1
- data/app/views/spud/admin/posts/index.html.erb +1 -1
- data/app/views/spud/admin/posts/new.html.erb +1 -1
- data/lib/spud_blog/configuration.rb +5 -3
- data/lib/spud_blog/engine.rb +1 -1
- metadata +9 -16
Binary file
|
Binary file
|
@@ -11,7 +11,7 @@ Spud.Admin.Posts = new function(){
|
|
11
11
|
this.edit = function(){
|
12
12
|
$('input[type=submit],.close_dialog').button();
|
13
13
|
initDatePicker();
|
14
|
-
|
14
|
+
initTinyMCE();
|
15
15
|
$('#spud_post_new_category_form button').live('click', self.didSubmitCategory);
|
16
16
|
};
|
17
17
|
|
@@ -1,9 +1,17 @@
|
|
1
1
|
class BlogController < ApplicationController
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
|
4
|
+
respond_to :html, :xml, :json,:rss
|
5
|
+
|
5
6
|
layout Spud::Blog.base_layout
|
6
7
|
|
8
|
+
caches_action :show, :index,
|
9
|
+
:layout => false,
|
10
|
+
:expires => Spud::Blog.config.caching_expires_in,
|
11
|
+
:if => Proc.new{ |c|
|
12
|
+
Spud::Blog.config.caching_enabled && !(c.params[:page] && c.params[:page].to_i > 1)
|
13
|
+
}
|
14
|
+
|
7
15
|
def index
|
8
16
|
@posts = SpudPost.public_blog_posts(params[:page], Spud::Blog.config.posts_per_page)
|
9
17
|
respond_with @posts
|
@@ -42,6 +50,7 @@ class BlogController < ApplicationController
|
|
42
50
|
end
|
43
51
|
|
44
52
|
def show
|
53
|
+
find_post
|
45
54
|
if @post.comments_enabled
|
46
55
|
@comment = SpudPostComment.new(:spud_post_id => params[:id])
|
47
56
|
end
|
@@ -56,7 +65,11 @@ class BlogController < ApplicationController
|
|
56
65
|
redirect_to blog_path and return false
|
57
66
|
end
|
58
67
|
@comment = @post.comments.new(params[:spud_post_comment])
|
59
|
-
|
68
|
+
@comment.approved = true
|
69
|
+
if @comment.save
|
70
|
+
flash[:notice] = 'Your comment has been posted, however it will not appear until it is approved.'
|
71
|
+
expire_action blog_post_url(@post.url_name)
|
72
|
+
end
|
60
73
|
respond_with @comment do |format|
|
61
74
|
format.html { redirect_to blog_post_path(@post.url_name, :anchor => 'spud_post_comment_form') }
|
62
75
|
end
|
@@ -1,8 +1,15 @@
|
|
1
1
|
class NewsController < ApplicationController
|
2
2
|
|
3
|
-
respond_to :html, :xml, :json
|
3
|
+
respond_to :html, :xml, :json,:rss
|
4
4
|
layout Spud::Blog.news_layout
|
5
5
|
|
6
|
+
caches_action :show, :index,
|
7
|
+
:layout => false,
|
8
|
+
:expires => Spud::Blog.config.caching_expires_in,
|
9
|
+
:if => Proc.new{ |c|
|
10
|
+
Spud::Blog.config.caching_enabled && !(c.params[:page] && c.params[:page].to_i > 1)
|
11
|
+
}
|
12
|
+
|
6
13
|
def index
|
7
14
|
@posts = SpudPost.public_news_posts(params[:page], Spud::Blog.config.posts_per_page)
|
8
15
|
respond_with @posts
|
@@ -19,7 +19,10 @@ class Spud::Admin::NewsPostsController < Spud::Admin::ApplicationController
|
|
19
19
|
|
20
20
|
def update
|
21
21
|
@categories = SpudPostCategory.grouped
|
22
|
-
|
22
|
+
if @post.update_attributes(params[:spud_post])
|
23
|
+
flash[:notice] = 'News Post was successfully updated.'
|
24
|
+
expire_news_actions(@post)
|
25
|
+
end
|
23
26
|
respond_with @post, :location => spud_admin_news_posts_path
|
24
27
|
end
|
25
28
|
|
@@ -32,12 +35,18 @@ class Spud::Admin::NewsPostsController < Spud::Admin::ApplicationController
|
|
32
35
|
def create
|
33
36
|
@categories = SpudPostCategory.grouped
|
34
37
|
@post = SpudPost.new(params[:spud_post])
|
35
|
-
|
38
|
+
if @post.save
|
39
|
+
flash[:notice] = 'News Post was successfully created.'
|
40
|
+
expire_news_actions
|
41
|
+
end
|
36
42
|
respond_with @post, :location => spud_admin_news_posts_path
|
37
43
|
end
|
38
44
|
|
39
45
|
def destroy
|
40
|
-
|
46
|
+
if @post.destroy
|
47
|
+
flash[:notice] = 'News Post was successfully deleted.'
|
48
|
+
expire_news_actions(@post)
|
49
|
+
end
|
41
50
|
respond_with @post, :location => spud_admin_news_posts_path
|
42
51
|
end
|
43
52
|
|
@@ -51,4 +60,9 @@ class Spud::Admin::NewsPostsController < Spud::Admin::ApplicationController
|
|
51
60
|
end
|
52
61
|
end
|
53
62
|
|
63
|
+
def expire_news_actions
|
64
|
+
expire_action news_url
|
65
|
+
expire_action news_post_url(@post.url_name) unless @post.nil?
|
66
|
+
end
|
67
|
+
|
54
68
|
end
|
@@ -17,7 +17,10 @@ class Spud::Admin::PostCategoriesController < Spud::Admin::ApplicationController
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def update
|
20
|
-
|
20
|
+
if @post_category.update_attributes(params[:spud_post_category])
|
21
|
+
flash[:notice] = 'Post Category was successfully updated'
|
22
|
+
expire_post_actions
|
23
|
+
end
|
21
24
|
respond_with @post_category, :location => spud_admin_post_categories_path
|
22
25
|
end
|
23
26
|
|
@@ -28,12 +31,18 @@ class Spud::Admin::PostCategoriesController < Spud::Admin::ApplicationController
|
|
28
31
|
|
29
32
|
def create
|
30
33
|
@post_category = SpudPostCategory.new(params[:spud_post_category])
|
31
|
-
|
34
|
+
if @post_category.save
|
35
|
+
flash[:notice] = 'Post Category was successfully created'
|
36
|
+
expire_post_actions
|
37
|
+
end
|
32
38
|
respond_with @post_category, :location => spud_admin_post_categories_path
|
33
39
|
end
|
34
40
|
|
35
41
|
def destroy
|
36
|
-
|
42
|
+
if @post_category.destroy
|
43
|
+
flash[:notice] = 'Post Category was successfully deleted'
|
44
|
+
expire_post_actions
|
45
|
+
end
|
37
46
|
respond_with @post_category, :location => spud_admin_post_categories_path
|
38
47
|
end
|
39
48
|
|
@@ -43,4 +52,9 @@ class Spud::Admin::PostCategoriesController < Spud::Admin::ApplicationController
|
|
43
52
|
@post_category = SpudPostCategory.find(params[:id])
|
44
53
|
end
|
45
54
|
|
55
|
+
def expire_post_actions
|
56
|
+
expire_action news_url
|
57
|
+
expire_action blog_url
|
58
|
+
end
|
59
|
+
|
46
60
|
end
|
@@ -8,7 +8,7 @@ class Spud::Admin::PostsController < Spud::Admin::ApplicationController
|
|
8
8
|
belongs_to_spud_app :blog_posts
|
9
9
|
|
10
10
|
def index
|
11
|
-
@posts = SpudPost.where(:is_news => false).order('published_at desc').includes(:comments).paginate(:page => params[:page], :per_page => 15)
|
11
|
+
@posts = SpudPost.where(:is_news => false).order('published_at desc').includes(:comments, :author).paginate(:page => params[:page], :per_page => 15)
|
12
12
|
respond_with @posts
|
13
13
|
end
|
14
14
|
|
@@ -19,7 +19,10 @@ class Spud::Admin::PostsController < Spud::Admin::ApplicationController
|
|
19
19
|
|
20
20
|
def update
|
21
21
|
@categories = SpudPostCategory.grouped
|
22
|
-
|
22
|
+
if @post.update_attributes(params[:spud_post])
|
23
|
+
flash[:notice] = 'Post was successfully updated.'
|
24
|
+
expire_blog_actions
|
25
|
+
end
|
23
26
|
respond_with @post, :location => spud_admin_posts_path
|
24
27
|
end
|
25
28
|
|
@@ -32,12 +35,18 @@ class Spud::Admin::PostsController < Spud::Admin::ApplicationController
|
|
32
35
|
def create
|
33
36
|
@categories = SpudPostCategory.grouped
|
34
37
|
@post = SpudPost.new(params[:spud_post])
|
35
|
-
|
38
|
+
if @post.save
|
39
|
+
flash[:notice] = 'Post was successfully created.'
|
40
|
+
expire_blog_actions
|
41
|
+
end
|
36
42
|
respond_with @post, :location => spud_admin_posts_path
|
37
43
|
end
|
38
44
|
|
39
45
|
def destroy
|
40
|
-
|
46
|
+
if @post.destroy
|
47
|
+
flash[:notice] = 'Post was successfully deleted.'
|
48
|
+
expire_blog_actions
|
49
|
+
end
|
41
50
|
respond_with @post, :location => spud_admin_posts_path
|
42
51
|
end
|
43
52
|
|
@@ -51,4 +60,9 @@ class Spud::Admin::PostsController < Spud::Admin::ApplicationController
|
|
51
60
|
end
|
52
61
|
end
|
53
62
|
|
63
|
+
def expire_blog_actions
|
64
|
+
expire_action blog_url
|
65
|
+
expire_action blog_post_url(@post.url_name) unless @post.nil?
|
66
|
+
end
|
67
|
+
|
54
68
|
end
|
@@ -1,3 +1,6 @@
|
|
1
|
+
<%=content_for :head do%>
|
2
|
+
<link rel="alternate" type="application/rss+xml" title="<%=Spud::Core.site_name%> Blog RSS" href="<%=blog_url()%>" />
|
3
|
+
<%end%>
|
1
4
|
<div id="spud_blog_filters">
|
2
5
|
<%= form_tag blog_path, :class => 'spud_blog_filter_form' do %>
|
3
6
|
<label>Category:</label>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
xml.instruct! :xml, :version => "1.0"
|
2
|
+
xml.rss :version => "2.0" do
|
3
|
+
xml.channel do
|
4
|
+
xml.title "#{Spud::Core.site_name} Blog Articles"
|
5
|
+
xml.description "Blog articles for #{Spud::Core.site_name}"
|
6
|
+
xml.link news_url(:format => :rss)
|
7
|
+
|
8
|
+
for article in @posts
|
9
|
+
xml.item do
|
10
|
+
xml.title article.title
|
11
|
+
xml.description article.content
|
12
|
+
xml.pubDate article.created_at.to_s(:rfc822)
|
13
|
+
xml.link news_post_url(article.url_name)
|
14
|
+
xml.guid news_post_url(article.url_name)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -1,3 +1,6 @@
|
|
1
|
+
<%=content_for :head do%>
|
2
|
+
<link rel="alternate" type="application/rss+xml" title="<%=Spud::Core.site_name%> News RSS" href="<%=news_url()%>" />
|
3
|
+
<%end%>
|
1
4
|
<div id="spud_news_filters">
|
2
5
|
<%= form_tag news_path, :class => 'spud_blog_filter_form' do %>
|
3
6
|
<label>Category:</label>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
xml.instruct! :xml, :version => "1.0"
|
2
|
+
xml.rss :version => "2.0" do
|
3
|
+
xml.channel do
|
4
|
+
xml.title "#{Spud::Core.site_name} News"
|
5
|
+
xml.description "News articles for #{Spud::Core.site_name}"
|
6
|
+
xml.link news_url(:format => :rss)
|
7
|
+
|
8
|
+
for article in @posts
|
9
|
+
xml.item do
|
10
|
+
xml.title article.title
|
11
|
+
xml.description article.content
|
12
|
+
xml.pubDate article.created_at.to_s(:rfc822)
|
13
|
+
xml.link news_post_url(article.url_name)
|
14
|
+
xml.guid news_post_url(article.url_name)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -17,7 +17,7 @@
|
|
17
17
|
<tr>
|
18
18
|
<td><%= link_to post.title, edit_spud_admin_news_post_path(post) %></td>
|
19
19
|
<td><%= post.author.full_name %></td>
|
20
|
-
<td><%= post.published_at.strftime('%m/%d/%Y') %></td>
|
20
|
+
<td><%= link_to(post.published_at.strftime('%m/%d/%Y'), news_post_path(post.url_name)) %></td>
|
21
21
|
<td align="right">
|
22
22
|
<%= link_to 'Delete', spud_admin_news_post_path(post), :method => :delete, :confirm => 'Are you sure you want to delete this post?', :class => 'spud_admin_button_delete' %>
|
23
23
|
</td>
|
@@ -1,3 +1,3 @@
|
|
1
|
-
<%= form_for @post, :url =>
|
1
|
+
<%= form_for @post, :url => spud_admin_news_posts_path, :html => {:class => 'right_aligned_form'} do |f| %>
|
2
2
|
<%= render :partial => '/spud/admin/posts/form', :locals => {:f => f} %>
|
3
3
|
<% end %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= form_for @post_category, :url =>
|
1
|
+
<%= form_for @post_category, :url => path, :html => {:class => 'right_aligned_form'} do |f| %>
|
2
2
|
|
3
3
|
<% if @post_category.errors.any? %>
|
4
4
|
<div class="spud_admin_form_error_list">
|
@@ -1 +1 @@
|
|
1
|
-
<%= render 'form' %>
|
1
|
+
<%= render :partial => 'form', :locals => {:path => spud_admin_post_category_path(@post_category)} %>
|
@@ -1 +1 @@
|
|
1
|
-
<%= render 'form' %>
|
1
|
+
<%= render :partial => 'form', :locals => {:path => spud_admin_post_categories_path} %>
|
@@ -18,7 +18,7 @@
|
|
18
18
|
|
19
19
|
<div>
|
20
20
|
<%= f.label :content %>
|
21
|
-
<%= f.text_area :content, :class => 'wysiwym' %>
|
21
|
+
<%= f.text_area :content, :class => 'wysiwym tinymce' %>
|
22
22
|
</div>
|
23
23
|
|
24
24
|
<fieldset>
|
@@ -28,6 +28,15 @@
|
|
28
28
|
</ul>
|
29
29
|
</fieldset>
|
30
30
|
|
31
|
+
<% if Spud::Blog.config.has_custom_fields %>
|
32
|
+
<fieldset>
|
33
|
+
<legend>Custom Fields</legend>
|
34
|
+
<ol>
|
35
|
+
<%= render :partial => '/spud/admin/posts/custom_fields', :locals => {:f => f} %>
|
36
|
+
</ol>
|
37
|
+
</fieldset>
|
38
|
+
<% end %>
|
39
|
+
|
31
40
|
<fieldset>
|
32
41
|
<legend>Advanced</legend>
|
33
42
|
<ol>
|
@@ -18,7 +18,7 @@
|
|
18
18
|
<tr>
|
19
19
|
<td><%= link_to post.title, edit_spud_admin_post_path(post) %></td>
|
20
20
|
<td><%= post.author.full_name %></td>
|
21
|
-
<td><%= post.published_at.strftime('%m/%d/%Y') %></td>
|
21
|
+
<td><%= link_to(post.published_at.strftime('%m/%d/%Y'), blog_post_path(post.url_name)) %></td>
|
22
22
|
<td><%= post.comments.size %></td>
|
23
23
|
<td align="right">
|
24
24
|
<%= link_to 'Delete', spud_admin_post_path(post), :method => :delete, :confirm => 'Are you sure you want to delete this post?', :class => 'spud_admin_button_delete' %>
|
@@ -1,3 +1,3 @@
|
|
1
|
-
<%= form_for @post, :url =>
|
1
|
+
<%= form_for @post, :url => spud_admin_posts_path, :html => {:class => 'right_aligned_form'} do |f| %>
|
2
2
|
<%= render :partial => 'form', :locals => {:f => f} %>
|
3
3
|
<% end %>
|
@@ -1,8 +1,7 @@
|
|
1
1
|
module Spud
|
2
2
|
module Blog
|
3
3
|
include ActiveSupport::Configurable
|
4
|
-
config_accessor :base_layout,:news_layout, :blog_enabled, :news_enabled, :posts_per_page, :blog_path, :news_path
|
5
|
-
|
4
|
+
config_accessor :base_layout,:news_layout, :blog_enabled, :news_enabled, :posts_per_page, :blog_path, :news_path, :enable_sitemap, :has_custom_fields, :caching_enabled, :caching_expires_in
|
6
5
|
self.base_layout = 'application'
|
7
6
|
self.news_layout = nil
|
8
7
|
self.news_enabled = false
|
@@ -11,5 +10,8 @@ module Spud
|
|
11
10
|
self.blog_path = 'blog'
|
12
11
|
self.news_path = 'news'
|
13
12
|
self.enable_sitemap = true
|
13
|
+
self.has_custom_fields = false
|
14
|
+
self.caching_enabled = true
|
15
|
+
self.caching_expires_in = 1.hour
|
14
16
|
end
|
15
|
-
end
|
17
|
+
end
|
data/lib/spud_blog/engine.rb
CHANGED
@@ -24,7 +24,7 @@ module Spud
|
|
24
24
|
if Spud::Blog.config.news_enabled
|
25
25
|
Spud::Core.config.admin_applications += [{
|
26
26
|
:name => 'News Posts',
|
27
|
-
:thumbnail => 'spud/admin/
|
27
|
+
:thumbnail => 'spud/admin/news_thumb.png',
|
28
28
|
:url => '/spud/admin/news_posts',
|
29
29
|
:order => 2
|
30
30
|
}]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spud_blog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,36 +9,27 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-02-
|
12
|
+
date: 2012-02-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: spud_core
|
16
|
-
requirement: &
|
16
|
+
requirement: &70347903377340 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.
|
21
|
+
version: 0.6.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
25
|
-
- !ruby/object:Gem::Dependency
|
26
|
-
name: will_paginate
|
27
|
-
requirement: &70274549294060 !ruby/object:Gem::Requirement
|
28
|
-
none: false
|
29
|
-
requirements:
|
30
|
-
- - ! '>='
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: '0'
|
33
|
-
type: :runtime
|
34
|
-
prerelease: false
|
35
|
-
version_requirements: *70274549294060
|
24
|
+
version_requirements: *70347903377340
|
36
25
|
description:
|
37
26
|
email: greg@westlakedesign.com
|
38
27
|
executables: []
|
39
28
|
extensions: []
|
40
29
|
extra_rdoc_files: []
|
41
30
|
files:
|
31
|
+
- app/assets/images/spud/admin/news_thumb.png
|
32
|
+
- app/assets/images/spud/admin/posts_thumb.png
|
42
33
|
- app/assets/javascripts/spud/admin/news_posts.js
|
43
34
|
- app/assets/javascripts/spud/admin/post_categories.js
|
44
35
|
- app/assets/javascripts/spud/admin/post_comments.js
|
@@ -71,9 +62,11 @@ files:
|
|
71
62
|
- app/views/blog/_comment.html.erb
|
72
63
|
- app/views/blog/_comment_form.html.erb
|
73
64
|
- app/views/blog/index.html.erb
|
65
|
+
- app/views/blog/index.rss.builder
|
74
66
|
- app/views/blog/show.html.erb
|
75
67
|
- app/views/layouts/spud/admin/post.html.erb
|
76
68
|
- app/views/news/index.html.erb
|
69
|
+
- app/views/news/index.rss.builder
|
77
70
|
- app/views/news/show.html.erb
|
78
71
|
- app/views/spud/admin/news_posts/edit.html.erb
|
79
72
|
- app/views/spud/admin/news_posts/index.html.erb
|