spud_blog 0.1.3 → 0.2.1
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.
- data/app/assets/javascripts/news.js +2 -0
- data/app/assets/javascripts/spud/admin/news_posts.js +2 -0
- data/app/assets/stylesheets/news.css +4 -0
- data/app/assets/stylesheets/spud/admin/news_posts.css +4 -0
- data/app/controllers/blog_controller.rb +6 -6
- data/app/controllers/news_controller.rb +48 -0
- data/app/controllers/spud/admin/news_posts_controller.rb +54 -0
- data/app/controllers/spud/admin/posts_controller.rb +3 -3
- data/app/helpers/blog_helper.rb +7 -5
- data/app/helpers/news_helper.rb +2 -0
- data/app/helpers/spud/admin/news_posts_helper.rb +2 -0
- data/app/models/spud_post.rb +22 -5
- data/app/models/spud_post_category.rb +6 -1
- data/app/views/blog/index.html.erb +2 -2
- data/app/views/news/index.html.erb +33 -0
- data/app/views/news/show.html.erb +13 -0
- data/app/views/spud/admin/news_posts/edit.html.erb +3 -0
- data/app/views/spud/admin/news_posts/index.html.erb +31 -0
- data/app/views/spud/admin/news_posts/new.html.erb +3 -0
- data/app/views/spud/admin/posts/_category.html.erb +1 -1
- data/app/views/spud/admin/posts/_form.html.erb +4 -5
- data/app/views/spud/admin/posts/edit.html.erb +3 -1
- data/app/views/spud/admin/posts/new.html.erb +3 -1
- data/config/routes.rb +39 -10
- data/lib/spud_blog/configuration.rb +5 -1
- data/lib/spud_blog/engine.rb +17 -6
- metadata +19 -7
- data/app/views/spud/admin/posts/show.html.erb +0 -0
@@ -5,7 +5,7 @@ class BlogController < ApplicationController
|
|
5
5
|
layout Spud::Blog.base_layout
|
6
6
|
|
7
7
|
def index
|
8
|
-
@posts = SpudPost.
|
8
|
+
@posts = SpudPost.public_blog_posts(params[:page], Spud::Blog.config.posts_per_page)
|
9
9
|
respond_with @posts
|
10
10
|
end
|
11
11
|
|
@@ -16,20 +16,20 @@ class BlogController < ApplicationController
|
|
16
16
|
else
|
17
17
|
if request.post?
|
18
18
|
redirect_to blog_category_path(params[:category_url_name])
|
19
|
-
else
|
20
|
-
@posts = @post_category.
|
19
|
+
else
|
20
|
+
@posts = @post_category.posts_with_children.public_blog_posts(params[:page], Spud::Blog.config.posts_per_page)
|
21
21
|
respond_with @posts do |format|
|
22
22
|
format.html { render 'index' }
|
23
23
|
end
|
24
|
-
end
|
24
|
+
end
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
28
|
def archive
|
29
29
|
if request.post?
|
30
|
-
redirect_to blog_archive_path(params[:
|
30
|
+
redirect_to blog_archive_path(params[:archive_date])
|
31
31
|
else
|
32
|
-
@posts = SpudPost.
|
32
|
+
@posts = SpudPost.public_blog_posts(params[:page], Spud::Blog.config.posts_per_page).from_archive(params[:archive_date])
|
33
33
|
respond_with @posts do |format|
|
34
34
|
format.html { render 'index' }
|
35
35
|
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
class NewsController < ApplicationController
|
2
|
+
|
3
|
+
respond_to :html, :xml, :json
|
4
|
+
layout Spud::Blog.base_layout
|
5
|
+
|
6
|
+
def index
|
7
|
+
@posts = SpudPost.public_news_posts(params[:page], Spud::Blog.config.posts_per_page)
|
8
|
+
respond_with @posts
|
9
|
+
end
|
10
|
+
|
11
|
+
def category
|
12
|
+
@post_category = SpudPostCategory.find_by_url_name(params[:category_url_name])
|
13
|
+
if @post_category.nil?
|
14
|
+
redirect_to news_path
|
15
|
+
else
|
16
|
+
if request.post?
|
17
|
+
redirect_to news_category_path(params[:category_url_name])
|
18
|
+
else
|
19
|
+
@posts = @post_category.posts.public_news_posts(params[:page], Spud::Blog.config.posts_per_page)
|
20
|
+
respond_with @posts do |format|
|
21
|
+
format.html { render 'index' }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def archive
|
28
|
+
if request.post?
|
29
|
+
redirect_to news_archive_path(params[:archive_date])
|
30
|
+
else
|
31
|
+
@posts = SpudPost.public_news_posts(params[:page], Spud::Blog.config.posts_per_page).from_archive(params[:archive_date])
|
32
|
+
respond_with @posts do |format|
|
33
|
+
format.html { render 'index' }
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def show
|
39
|
+
@post = SpudPost.find_by_url_name(params[:id])
|
40
|
+
if @post.blank? || @post.is_private?
|
41
|
+
flash[:error] = "Post not found!"
|
42
|
+
redirect_to news_path and return false
|
43
|
+
else
|
44
|
+
respond_with @post
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
class Spud::Admin::NewsPostsController < Spud::Admin::ApplicationController
|
2
|
+
|
3
|
+
layout 'spud/admin/post'
|
4
|
+
respond_to :html, :xml, :json
|
5
|
+
before_filter :find_post, :only => [:show, :edit, :update, :destroy]
|
6
|
+
add_breadcrumb 'News Posts', :spud_admin_news_posts_path
|
7
|
+
|
8
|
+
belongs_to_spud_app :news_posts
|
9
|
+
|
10
|
+
def index
|
11
|
+
@posts = SpudPost.where(:is_news => true).order('published_at desc').includes(:comments).paginate(:page => params[:page], :per_page => 15)
|
12
|
+
respond_with @posts
|
13
|
+
end
|
14
|
+
|
15
|
+
def edit
|
16
|
+
@categories = SpudPostCategory.grouped
|
17
|
+
respond_with @post
|
18
|
+
end
|
19
|
+
|
20
|
+
def update
|
21
|
+
@categories = SpudPostCategory.grouped
|
22
|
+
flash[:notice] = 'News Post was successfully updated.' if @post.update_attributes(params[:spud_post])
|
23
|
+
respond_with @post, :location => spud_admin_news_posts_path
|
24
|
+
end
|
25
|
+
|
26
|
+
def new
|
27
|
+
@categories = SpudPostCategory.grouped
|
28
|
+
@post = SpudPost.new(:published_at => Date.today, :spud_user_id => current_user.id, :is_news => true, :comments_enabled => false)
|
29
|
+
respond_with @post
|
30
|
+
end
|
31
|
+
|
32
|
+
def create
|
33
|
+
@categories = SpudPostCategory.grouped
|
34
|
+
@post = SpudPost.new(params[:spud_post])
|
35
|
+
flash[:notice] = 'News Post was successfully created.' if @post.save
|
36
|
+
respond_with @post, :location => spud_admin_news_posts_path
|
37
|
+
end
|
38
|
+
|
39
|
+
def destroy
|
40
|
+
flash[:notice] = 'News Post was successfully deleted.' if @post.destroy
|
41
|
+
respond_with @post, :location => spud_admin_news_posts_path
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def find_post
|
47
|
+
@post = SpudPost.find(params[:id])
|
48
|
+
if @post.blank?
|
49
|
+
flash[:error] = 'News Post not found!'
|
50
|
+
redirect_to spud_admin_news_posts_path and return false
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
@@ -3,12 +3,12 @@ class Spud::Admin::PostsController < Spud::Admin::ApplicationController
|
|
3
3
|
layout 'spud/admin/post'
|
4
4
|
respond_to :html, :xml, :json
|
5
5
|
before_filter :find_post, :only => [:show, :edit, :update, :destroy]
|
6
|
-
add_breadcrumb 'Posts', :spud_admin_posts_path
|
6
|
+
add_breadcrumb 'Blog Posts', :spud_admin_posts_path
|
7
7
|
|
8
|
-
belongs_to_spud_app :
|
8
|
+
belongs_to_spud_app :blog_posts
|
9
9
|
|
10
10
|
def index
|
11
|
-
@posts = SpudPost.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).paginate(:page => params[:page], :per_page => 15)
|
12
12
|
respond_with @posts
|
13
13
|
end
|
14
14
|
|
data/app/helpers/blog_helper.rb
CHANGED
@@ -1,14 +1,16 @@
|
|
1
1
|
module BlogHelper
|
2
2
|
|
3
|
-
def
|
4
|
-
select_tag 'category_url_name',
|
3
|
+
def spud_post_category_select
|
4
|
+
select_tag 'category_url_name',
|
5
|
+
options_for_select(SpudPostCategory.options_for_categories(:value => :url_name), params[:category_url_name]),
|
6
|
+
:include_blank => true
|
5
7
|
end
|
6
8
|
|
7
|
-
def
|
9
|
+
def spud_post_archive_select
|
8
10
|
dates = SpudPost.months_with_public_posts
|
9
|
-
return select_tag '
|
11
|
+
return select_tag 'archive_date', options_for_select(SpudPost.months_with_public_posts.collect{ |d|
|
10
12
|
[d.strftime('%B %Y'), d.strftime('%Y-%b').downcase]
|
11
|
-
}, params[:
|
13
|
+
}, params[:archive_date]), :include_blank => true
|
12
14
|
end
|
13
15
|
|
14
16
|
end
|
data/app/models/spud_post.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
class SpudPost < ActiveRecord::Base
|
2
|
+
|
2
3
|
searchable
|
3
4
|
has_and_belongs_to_many :categories,
|
4
5
|
:class_name => 'SpudPostCategory',
|
@@ -11,10 +12,30 @@ class SpudPost < ActiveRecord::Base
|
|
11
12
|
validates_uniqueness_of :url_name
|
12
13
|
before_validation :set_url_name
|
13
14
|
|
14
|
-
def self.
|
15
|
+
def self.public_posts(page, per_page)
|
15
16
|
return where('visible = 1 AND published_at <= ?', DateTime.now).order('published_at desc').includes(:comments, :categories).paginate(:page => page, :per_page => per_page)
|
16
17
|
end
|
17
18
|
|
19
|
+
def self.public_blog_posts(page, per_page)
|
20
|
+
return self.public_posts(page, per_page).where(:is_news => false)
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.public_news_posts(page, per_page)
|
24
|
+
return self.public_posts(page, per_page).where(:is_news => true)
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.recent_posts(limit=5)
|
28
|
+
return where('visible = 1 AND published_at <= ?', DateTime.now).order('published_at desc').limit(limit)
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.recent_blog_posts(limit=5)
|
32
|
+
return self.recent_posts.where(:is_news => false)
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.recent_news_posts(limit=5)
|
36
|
+
return self.recent_posts.where(:is_news => true)
|
37
|
+
end
|
38
|
+
|
18
39
|
def self.from_archive(date_string)
|
19
40
|
begin
|
20
41
|
date = Date.strptime(date_string, "%Y-%b")
|
@@ -24,10 +45,6 @@ class SpudPost < ActiveRecord::Base
|
|
24
45
|
end
|
25
46
|
end
|
26
47
|
|
27
|
-
def self.recent_posts(limit=5)
|
28
|
-
return where('visible = 1 AND published_at <= ?', DateTime.now).order('published_at desc').limit(limit)
|
29
|
-
end
|
30
|
-
|
31
48
|
# Returns an array of Date objects for months with public posts
|
32
49
|
def self.months_with_public_posts
|
33
50
|
# Select
|
@@ -33,13 +33,18 @@ class SpudPostCategory < ActiveRecord::Base
|
|
33
33
|
collection[parent_id].each do |c|
|
34
34
|
if c.id != filter
|
35
35
|
list << [level.times.collect{ '- ' }.join('') + c.name, c[value]]
|
36
|
-
list += self.options_for_categories({:collection => collection, :parent_id => c.id, :level => level+1, :filter => filter})
|
36
|
+
list += self.options_for_categories({:collection => collection, :parent_id => c.id, :level => level+1, :filter => filter, :value => value})
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
40
40
|
return list
|
41
41
|
end
|
42
42
|
|
43
|
+
def posts_with_children
|
44
|
+
# TO DO: This should return all posts that belong to the instance category and all its child categories
|
45
|
+
return posts
|
46
|
+
end
|
47
|
+
|
43
48
|
private
|
44
49
|
|
45
50
|
def set_url_name
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<div id="spud_blog_categories">
|
2
2
|
<%= form_tag '/blog/category' do %>
|
3
3
|
<label>Filter By Category:</label>
|
4
|
-
<%=
|
4
|
+
<%= spud_post_category_select %>
|
5
5
|
<input type="submit" value="Submit" />
|
6
6
|
<% end %>
|
7
7
|
</div>
|
@@ -9,7 +9,7 @@
|
|
9
9
|
<div id="spud_blog_archive">
|
10
10
|
<%= form_tag '/blog/archive' do %>
|
11
11
|
<label>Filter By Month:</label>
|
12
|
-
<%=
|
12
|
+
<%= spud_post_archive_select %>
|
13
13
|
<input type="submit" value="Submit" />
|
14
14
|
<% end %>
|
15
15
|
</div>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<div id="spud_news_categories">
|
2
|
+
<%= form_tag '/news/category' do %>
|
3
|
+
<label>Filter By Category:</label>
|
4
|
+
<%= spud_post_category_select %>
|
5
|
+
<input type="submit" value="Submit" />
|
6
|
+
<% end %>
|
7
|
+
</div>
|
8
|
+
|
9
|
+
<div id="spud_news_archive">
|
10
|
+
<%= form_tag '/news/archive' do %>
|
11
|
+
<label>Filter By Month:</label>
|
12
|
+
<%= spud_post_archive_select %>
|
13
|
+
<input type="submit" value="Submit" />
|
14
|
+
<% end %>
|
15
|
+
</div>
|
16
|
+
|
17
|
+
<div id="spud_news_posts">
|
18
|
+
<% if @posts.any? %>
|
19
|
+
<% @posts.each do |post| %>
|
20
|
+
<div class="spud_news_post">
|
21
|
+
<h3><%= link_to post.title, news_post_path(post.url_name) %></h3>
|
22
|
+
<h4>Posted by <%= post.author.full_name %> on <%= post.display_date %></h4>
|
23
|
+
<div class="spud_news_post_content">
|
24
|
+
<%= raw post.content %>
|
25
|
+
</div>
|
26
|
+
</div>
|
27
|
+
<% end %>
|
28
|
+
<% else %>
|
29
|
+
<p>No posts were found in this category</p>
|
30
|
+
<% end %>
|
31
|
+
</div>
|
32
|
+
|
33
|
+
<%= will_paginate @posts %>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<div class="spud_news_post">
|
2
|
+
<h3><%= @post.title %></h3>
|
3
|
+
<h4>Posted by <%= @post.author.full_name %> on <%= @post.display_date %></h4>
|
4
|
+
<% if @post.categories.any? %>
|
5
|
+
<p id="spud_news_post_categories">
|
6
|
+
Filed under
|
7
|
+
<%= raw(@post.categories.collect{ |c| link_to c.name, news_category_path(c.url_name) }.join(', ')) %>
|
8
|
+
</p>
|
9
|
+
<% end %>
|
10
|
+
<div id="spud_news_post_content">
|
11
|
+
<%= raw @post.content %>
|
12
|
+
</div>
|
13
|
+
</div>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<%= content_for :data_controls do %>
|
2
|
+
<%= link_to "New Post", new_spud_admin_news_post_path, :class => "button", :title => "New Post" %>
|
3
|
+
<% end %>
|
4
|
+
|
5
|
+
<%=content_for :detail do %>
|
6
|
+
<table class="admin-table">
|
7
|
+
<thead>
|
8
|
+
<tr>
|
9
|
+
<th>Title</th>
|
10
|
+
<th>Author</th>
|
11
|
+
<th>Published At</th>
|
12
|
+
<th> </th>
|
13
|
+
</tr>
|
14
|
+
</thead>
|
15
|
+
<tbody>
|
16
|
+
<% @posts.each do |post| %>
|
17
|
+
<tr>
|
18
|
+
<td><%= link_to post.title, edit_spud_admin_news_post_path(post) %></td>
|
19
|
+
<td><%= post.author.full_name %></td>
|
20
|
+
<td><%= post.published_at.strftime('%m/%d/%Y') %></td>
|
21
|
+
<td align="right">
|
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
|
+
</td>
|
24
|
+
</tr>
|
25
|
+
<%end%>
|
26
|
+
</tbody>
|
27
|
+
</table>
|
28
|
+
<div class="spud_admin_pagination">
|
29
|
+
<%= will_paginate @posts %>
|
30
|
+
</div>
|
31
|
+
<%end%>
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<%= label_tag "spud_post_category_#{category.id}", category.name %>
|
4
4
|
<% if @categories[category.id] %>
|
5
5
|
<ul>
|
6
|
-
<%= render :partial => 'category', :collection => @categories[category.id] %>
|
6
|
+
<%= render :partial => '/spud/admin/posts/category', :collection => @categories[category.id] %>
|
7
7
|
</ul>
|
8
8
|
<% end %>
|
9
9
|
</li>
|
@@ -1,5 +1,3 @@
|
|
1
|
-
<%= form_for @post, :url => spud_admin_post_path(@post), :html => {:class => 'right_aligned_form'} do |f| %>
|
2
|
-
|
3
1
|
<% if @post.errors.any? %>
|
4
2
|
<div class="spud_admin_form_error_list">
|
5
3
|
<h4><%= pluralize(@post.errors.count, "error") %> prohibited you from saving this post:</h4>
|
@@ -26,7 +24,7 @@
|
|
26
24
|
<fieldset>
|
27
25
|
<legend>Categories</legend>
|
28
26
|
<ul id="spud_post_categories_form">
|
29
|
-
<%= render :partial => 'category', :collection => @categories[0] %>
|
27
|
+
<%= render :partial => '/spud/admin/posts/category', :collection => @categories[0] %>
|
30
28
|
</ul>
|
31
29
|
</fieldset>
|
32
30
|
|
@@ -41,20 +39,21 @@
|
|
41
39
|
<%= f.label :visible %>
|
42
40
|
<%= f.check_box :visible %>
|
43
41
|
</li>
|
42
|
+
<% unless @post.is_news %>
|
44
43
|
<li>
|
45
44
|
<%= f.label :comments_enabled %>
|
46
45
|
<%= f.check_box :comments_enabled %>
|
47
46
|
</li>
|
47
|
+
<% end %>
|
48
48
|
</ol>
|
49
49
|
</fieldset>
|
50
50
|
|
51
51
|
<fieldset class="submit">
|
52
|
+
<%= f.hidden_field :is_news %>
|
52
53
|
<%= f.hidden_field :spud_user_id %>
|
53
54
|
<%= f.submit 'Save Post', :class => "wymupdate"%> or <%= link_to "cancel",request.referer %>
|
54
55
|
</fieldset>
|
55
56
|
|
56
|
-
<% end %>
|
57
|
-
|
58
57
|
<script type="text/javascript">
|
59
58
|
$(document).ready(Spud.Admin.Posts.edit);
|
60
59
|
</script>
|
data/config/routes.rb
CHANGED
@@ -5,23 +5,52 @@ Rails.application.routes.draw do
|
|
5
5
|
resources :posts do
|
6
6
|
resources :post_comments, :path => 'comments', :only => :index
|
7
7
|
end
|
8
|
+
resources :news_posts
|
8
9
|
resources :post_comments, :except => :new
|
9
10
|
resources :post_categories
|
10
11
|
end
|
11
12
|
end
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
post 'blog/category', :controller => 'blog', :action => 'category'
|
14
|
+
if Spud::Blog.config.blog_enabled
|
15
|
+
scope Spud::Blog.config.blog_path do
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
# Blog Post Categories
|
18
|
+
get 'category/:category_url_name', :controller => 'blog', :action => 'category', :page => 1, :as => 'blog_category'
|
19
|
+
get 'category/:category_url_name/page/:page', :controller => 'blog', :action => 'category'
|
20
|
+
post 'category', :controller => 'blog', :action => 'category'
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
# Blog Post Archives
|
23
|
+
get 'archive/:archive_date', :controller => 'blog', :action => 'archive', :page => 1, :as => 'blog_archive'
|
24
|
+
get 'archive/:archive_date/page/:page', :controller => 'blog', :action => 'archive'
|
25
|
+
post 'archive', :controller => 'blog', :action => 'archive'
|
26
|
+
|
27
|
+
# Blog Posts
|
28
|
+
get '/', :controller => 'blog', :action => 'index', :page => 1, :as => 'blog'
|
29
|
+
get 'page/:page', :controller => 'blog', :action => 'index'
|
30
|
+
resources :blog_posts, :path => '/', :controller => 'blog', :only => [:show] do
|
31
|
+
post '/', :on => :member, :controller => 'blog', :action => 'create_comment'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
if Spud::Blog.config.news_enabled
|
37
|
+
scope Spud::Blog.config.news_path do
|
38
|
+
|
39
|
+
# News Post Categories
|
40
|
+
get 'category/:category_url_name', :controller => 'news', :action => 'category', :page => 1, :as => 'news_category'
|
41
|
+
get 'category/:category_url_name/page/:page', :controller => 'news', :action => 'category'
|
42
|
+
post 'category', :controller => 'news', :action => 'category'
|
43
|
+
|
44
|
+
# News Post Archives
|
45
|
+
get 'archive/:archive_date', :controller => 'news', :action => 'archive', :page => 1, :as => 'news_archive'
|
46
|
+
get 'archive/:archive_date/page/:page', :controller => 'news', :action => 'archive'
|
47
|
+
post 'archive', :controller => 'news', :action => 'archive'
|
48
|
+
|
49
|
+
# News Posts
|
50
|
+
get '/', :controller => 'news', :action => 'index', :page => 1, :as => 'news'
|
51
|
+
get 'page/:page', :controller => 'news', :action => 'index'
|
52
|
+
resources :news_posts, :path => '/', :controller => 'news', :only => [:show]
|
53
|
+
end
|
25
54
|
end
|
26
55
|
|
27
56
|
end
|
@@ -1,8 +1,12 @@
|
|
1
1
|
module Spud
|
2
2
|
module Blog
|
3
3
|
include ActiveSupport::Configurable
|
4
|
-
config_accessor :base_layout, :news_enabled
|
4
|
+
config_accessor :base_layout, :blog_enabled, :news_enabled, :posts_per_page, :blog_path, :news_path
|
5
5
|
self.base_layout = 'application'
|
6
6
|
self.news_enabled = false
|
7
|
+
self.blog_enabled = true
|
8
|
+
self.posts_per_page = 5
|
9
|
+
self.blog_path = 'blog'
|
10
|
+
self.news_path = 'news'
|
7
11
|
end
|
8
12
|
end
|
data/lib/spud_blog/engine.rb
CHANGED
@@ -5,16 +5,27 @@ module Spud
|
|
5
5
|
engine_name :spud_blog
|
6
6
|
initializer :admin do
|
7
7
|
Spud::Core.config.admin_applications += [{
|
8
|
-
:name => 'Posts',
|
9
|
-
:thumbnail => 'spud/admin/posts_thumb.png',
|
10
|
-
:url => '/spud/admin/posts',
|
11
|
-
:order => 1
|
12
|
-
},{
|
13
8
|
:name => 'Post Categories',
|
14
9
|
:thumbnail => 'spud/admin/posts_thumb.png',
|
15
10
|
:url => '/spud/admin/post_categories',
|
16
|
-
:order =>
|
11
|
+
:order => 3
|
17
12
|
}]
|
13
|
+
if Spud::Blog.config.blog_enabled
|
14
|
+
Spud::Core.config.admin_applications += [{
|
15
|
+
:name => 'Blog Posts',
|
16
|
+
:thumbnail => 'spud/admin/posts_thumb.png',
|
17
|
+
:url => '/spud/admin/posts',
|
18
|
+
:order => 1
|
19
|
+
}]
|
20
|
+
end
|
21
|
+
if Spud::Blog.config.news_enabled
|
22
|
+
Spud::Core.config.admin_applications += [{
|
23
|
+
:name => 'News Posts',
|
24
|
+
:thumbnail => 'spud/admin/posts_thumb.png',
|
25
|
+
:url => '/spud/admin/news_posts',
|
26
|
+
:order => 2
|
27
|
+
}]
|
28
|
+
end
|
18
29
|
end
|
19
30
|
initializer :assets do
|
20
31
|
Rails.application.config.assets.precompile += ['spud/admin/posts.css']
|
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.1
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-02-
|
12
|
+
date: 2012-02-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: spud_core
|
16
|
-
requirement: &
|
16
|
+
requirement: &70242391216500 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.5.2
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70242391216500
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: will_paginate
|
27
|
-
requirement: &
|
27
|
+
requirement: &70242391090040 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,24 +32,32 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70242391090040
|
36
36
|
description:
|
37
37
|
email: greg@westlakedesign.com
|
38
38
|
executables: []
|
39
39
|
extensions: []
|
40
40
|
extra_rdoc_files: []
|
41
41
|
files:
|
42
|
+
- app/assets/javascripts/news.js
|
43
|
+
- app/assets/javascripts/spud/admin/news_posts.js
|
42
44
|
- app/assets/javascripts/spud/admin/post_categories.js
|
43
45
|
- app/assets/javascripts/spud/admin/post_comments.js
|
44
46
|
- app/assets/javascripts/spud/admin/posts.js
|
47
|
+
- app/assets/stylesheets/news.css
|
48
|
+
- app/assets/stylesheets/spud/admin/news_posts.css
|
45
49
|
- app/assets/stylesheets/spud/admin/post_categories.css
|
46
50
|
- app/assets/stylesheets/spud/admin/post_comments.css
|
47
51
|
- app/assets/stylesheets/spud/admin/posts.css
|
48
52
|
- app/controllers/blog_controller.rb
|
53
|
+
- app/controllers/news_controller.rb
|
54
|
+
- app/controllers/spud/admin/news_posts_controller.rb
|
49
55
|
- app/controllers/spud/admin/post_categories_controller.rb
|
50
56
|
- app/controllers/spud/admin/post_comments_controller.rb
|
51
57
|
- app/controllers/spud/admin/posts_controller.rb
|
52
58
|
- app/helpers/blog_helper.rb
|
59
|
+
- app/helpers/news_helper.rb
|
60
|
+
- app/helpers/spud/admin/news_posts_helper.rb
|
53
61
|
- app/helpers/spud/admin/post_categories_helper.rb
|
54
62
|
- app/helpers/spud/admin/post_comments_helper.rb
|
55
63
|
- app/helpers/spud/admin/posts_helper.rb
|
@@ -61,6 +69,11 @@ files:
|
|
61
69
|
- app/views/blog/index.html.erb
|
62
70
|
- app/views/blog/show.html.erb
|
63
71
|
- app/views/layouts/spud/admin/post.html.erb
|
72
|
+
- app/views/news/index.html.erb
|
73
|
+
- app/views/news/show.html.erb
|
74
|
+
- app/views/spud/admin/news_posts/edit.html.erb
|
75
|
+
- app/views/spud/admin/news_posts/index.html.erb
|
76
|
+
- app/views/spud/admin/news_posts/new.html.erb
|
64
77
|
- app/views/spud/admin/post_categories/_form.html.erb
|
65
78
|
- app/views/spud/admin/post_categories/edit.html.erb
|
66
79
|
- app/views/spud/admin/post_categories/index.html.erb
|
@@ -71,7 +84,6 @@ files:
|
|
71
84
|
- app/views/spud/admin/posts/edit.html.erb
|
72
85
|
- app/views/spud/admin/posts/index.html.erb
|
73
86
|
- app/views/spud/admin/posts/new.html.erb
|
74
|
-
- app/views/spud/admin/posts/show.html.erb
|
75
87
|
- config/application.rb
|
76
88
|
- config/boot.rb
|
77
89
|
- config/routes.rb
|
File without changes
|