tb_blog 1.0.4 → 1.1.0
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 +6 -14
- data/Readme.markdown +3 -2
- data/app/assets/javascripts/admin/blog/application.js +1 -0
- data/app/assets/javascripts/{spud/admin → admin/blog}/post_categories.js +0 -3
- data/app/assets/javascripts/{spud/admin → admin/blog}/posts.js +0 -6
- data/app/controllers/{spud/admin → admin}/news_posts_controller.rb +13 -11
- data/app/controllers/{spud/admin → admin}/post_categories_controller.rb +9 -7
- data/app/controllers/{spud/admin → admin}/post_comments_controller.rb +6 -7
- data/app/controllers/{spud/admin → admin}/posts_controller.rb +14 -11
- data/app/controllers/blog/sitemaps_controller.rb +10 -0
- data/app/controllers/blog_controller.rb +25 -34
- data/app/controllers/news_controller.rb +5 -21
- data/app/helpers/admin/news_posts_helper.rb +2 -0
- data/app/helpers/admin/post_categories_helper.rb +2 -0
- data/app/helpers/admin/post_comments_helper.rb +3 -0
- data/app/helpers/{spud/admin → admin}/posts_helper.rb +1 -1
- data/app/helpers/blog/sitemaps_helper.rb +2 -0
- data/app/helpers/blog_helper.rb +0 -1
- data/app/models/spud_post.rb +30 -21
- data/app/models/spud_post_categories_post.rb +2 -3
- data/app/models/spud_post_category.rb +9 -2
- data/app/models/spud_post_comment.rb +1 -3
- data/app/models/spud_post_site.rb +0 -1
- data/app/views/admin/news_posts/edit.html.erb +3 -0
- data/app/views/admin/news_posts/index.html.erb +42 -0
- data/app/views/admin/news_posts/new.html.erb +3 -0
- data/app/views/{spud/admin → admin}/post_categories/_category.html.erb +2 -2
- data/app/views/{spud/admin → admin}/post_categories/_form.html.erb +1 -1
- data/app/views/{spud/admin → admin}/post_categories/index.html.erb +1 -1
- data/app/views/admin/post_categories/new.html.erb +1 -0
- data/app/views/{spud/admin → admin}/post_comments/index.html.erb +3 -3
- data/app/views/{spud/admin → admin}/posts/_category.html.erb +1 -1
- data/app/views/{spud/admin → admin}/posts/_form.html.erb +3 -3
- data/app/views/admin/posts/edit.html.erb +3 -0
- data/app/views/admin/posts/index.html.erb +48 -0
- data/app/views/admin/posts/new.html.erb +3 -0
- data/app/views/blog/_comment.html.erb +6 -4
- data/app/views/blog/_comment_form.html.erb +0 -2
- data/app/views/blog/index.html.erb +30 -28
- data/app/views/blog/show.html.erb +35 -31
- data/app/views/news/index.html.erb +26 -24
- data/app/views/news/show.html.erb +25 -21
- data/config/routes.rb +14 -15
- data/lib/spud_blog/configuration.rb +1 -2
- data/lib/spud_blog/engine.rb +13 -10
- data/lib/spud_blog/version.rb +1 -1
- data/lib/tb_blog.rb +1 -1
- data/spec/controllers/admin/posts_controller_spec.rb +5 -0
- data/spec/dummy/config/application.rb +5 -2
- data/spec/dummy/config/environments/production.rb +1 -1
- data/spec/dummy/config/environments/test.rb +5 -6
- data/spec/dummy/config/initializers/secret_token.rb +1 -0
- data/spec/dummy/db/migrate/20140110180411_create_spud_roles.tb_core.rb +11 -0
- data/spec/dummy/db/migrate/20140110180412_create_spud_permissions.tb_core.rb +11 -0
- data/spec/dummy/db/migrate/20140110180413_create_spud_role_permissions.tb_core.rb +12 -0
- data/spec/dummy/db/migrate/20140110180414_drop_spud_admin_permissions.tb_core.rb +16 -0
- data/spec/dummy/db/migrate/20140110180415_create_spud_permalinks.tb_permalinks.rb +12 -0
- data/spec/dummy/db/migrate/20140110180416_add_site_id_to_spud_permalinks.tb_permalinks.rb +7 -0
- data/spec/dummy/db/migrate/20140110180417_modify_site_id_for_spud_permalinks.tb_permalinks.rb +12 -0
- data/spec/dummy/db/migrate/20140110180418_create_spud_posts.tb_blog.rb +16 -0
- data/spec/dummy/db/migrate/20140110180419_create_spud_post_categories.tb_blog.rb +14 -0
- data/spec/dummy/db/migrate/20140110180420_create_spud_post_comments.tb_blog.rb +14 -0
- data/spec/dummy/db/migrate/20140110180421_add_url_to_spud_posts.tb_blog.rb +7 -0
- data/spec/dummy/db/migrate/20140110180422_add_url_to_spud_post_categories.tb_blog.rb +9 -0
- data/spec/dummy/db/migrate/20140110180423_add_is_news_to_spud_posts.tb_blog.rb +7 -0
- data/spec/dummy/db/migrate/20140110180424_add_meta_to_posts.tb_blog.rb +7 -0
- data/spec/dummy/db/migrate/20140110180425_add_comments_counter_to_spud_posts.tb_blog.rb +13 -0
- data/spec/dummy/db/migrate/20140110180426_create_spud_post_sites.tb_blog.rb +12 -0
- data/spec/dummy/db/migrate/20140110180427_add_spam_fields_to_spud_post_comments.tb_blog.rb +9 -0
- data/spec/dummy/db/migrate/20140110180428_add_permalink_to_spud_post_comments.tb_blog.rb +6 -0
- data/spec/dummy/db/migrate/20140110180429_add_nested_set_to_post_categories.tb_blog.rb +22 -0
- data/spec/dummy/db/migrate/20140110180430_add_content_format_to_spud_posts.tb_blog.rb +6 -0
- data/spec/dummy/db/migrate/20140110180431_add_content_processed_to_spud_post.tb_blog.rb +6 -0
- data/spec/dummy/db/migrate/20140113162805_create_tb_liquid_spud_liquid_tags.tb_liquid.rb +13 -0
- data/spec/dummy/db/schema.rb +100 -59
- metadata +123 -104
- data/app/assets/javascripts/spud/blog/sitemaps.js +0 -2
- data/app/assets/javascripts/spud/blog.js +0 -41
- data/app/assets/stylesheets/news.css +0 -4
- data/app/assets/stylesheets/spud/blog/sitemaps.css +0 -4
- data/app/assets/stylesheets/spud/blog/validity.css +0 -3
- data/app/controllers/spud/blog/sitemaps_controller.rb +0 -9
- data/app/helpers/spud/admin/news_posts_helper.rb +0 -2
- data/app/helpers/spud/admin/post_categories_helper.rb +0 -2
- data/app/helpers/spud/admin/post_comments_helper.rb +0 -3
- data/app/helpers/spud/blog/sitemaps_helper.rb +0 -2
- data/app/models/spud_post_category_sweeper.rb +0 -41
- data/app/models/spud_post_comment_sweeper.rb +0 -33
- data/app/models/spud_post_sweeper.rb +0 -47
- data/app/views/spud/admin/news_posts/edit.html.erb +0 -3
- data/app/views/spud/admin/news_posts/index.html.erb +0 -44
- data/app/views/spud/admin/news_posts/new.html.erb +0 -3
- data/app/views/spud/admin/post_categories/new.html.erb +0 -1
- data/app/views/spud/admin/posts/edit.html.erb +0 -3
- data/app/views/spud/admin/posts/index.html.erb +0 -49
- data/app/views/spud/admin/posts/new.html.erb +0 -3
- data/spec/controllers/spud/admin/posts_controller_spec.rb +0 -5
- data/spec/dummy/log/development.log +0 -263
- data/spec/dummy/log/test.log +0 -3339
- /data/app/assets/javascripts/{spud/admin → admin/blog}/post_comments.js +0 -0
- /data/app/assets/stylesheets/{spud/admin/posts.css.scss → admin/blog/application.css.scss} +0 -0
- /data/app/views/{spud/admin → admin}/post_categories/edit.html.erb +0 -0
- /data/app/views/{spud/blog → blog}/sitemaps/show.xml.builder +0 -0
@@ -0,0 +1,42 @@
|
|
1
|
+
<%= content_for :data_controls do %>
|
2
|
+
<%= link_to "Manage Categories", admin_post_categories_path, :class => 'btn spud_blog_manage_categories', :title => 'Manage Categories' %>
|
3
|
+
<%= link_to "New Post", new_admin_news_post_path, :class => "btn btn-primary", :title => "New Post" %>
|
4
|
+
<% end %>
|
5
|
+
|
6
|
+
<%=content_for :detail do %>
|
7
|
+
<table class="table table-striped">
|
8
|
+
<thead>
|
9
|
+
<tr>
|
10
|
+
<th>Title</th>
|
11
|
+
<th>Author</th>
|
12
|
+
<th>Published At</th>
|
13
|
+
<th> </th>
|
14
|
+
</tr>
|
15
|
+
</thead>
|
16
|
+
<tbody>
|
17
|
+
<% @posts.each do |post| %>
|
18
|
+
<tr>
|
19
|
+
<td>
|
20
|
+
<%= link_to post.title, news_post_path(post.url_name), :target => :blank %>
|
21
|
+
<% if !post.visible? %>
|
22
|
+
<span class="badge">Draft</span>
|
23
|
+
<% end %>
|
24
|
+
</td>
|
25
|
+
<td><%= post.author.full_name %></td>
|
26
|
+
<td><%= post.published_at.strftime('%m/%d/%Y') %></td>
|
27
|
+
<td class="text-right">
|
28
|
+
<%= link_to 'Edit', edit_admin_news_post_path(post), :class => 'btn btn-small' %>
|
29
|
+
<%= link_to 'Delete', admin_news_post_path(post), :method => :delete, :data => {:confirm => 'Are you sure you want to delete this post?'}, :class => 'btn btn-small btn-danger' %>
|
30
|
+
</td>
|
31
|
+
</tr>
|
32
|
+
<%end%>
|
33
|
+
</tbody>
|
34
|
+
</table>
|
35
|
+
<div class="spud_admin_pagination">
|
36
|
+
<%= will_paginate @posts %>
|
37
|
+
</div>
|
38
|
+
|
39
|
+
<script>
|
40
|
+
$(document).ready(spud.admin.post_categories.index);
|
41
|
+
</script>
|
42
|
+
<%end%>
|
@@ -3,8 +3,8 @@
|
|
3
3
|
<%= category.name %>
|
4
4
|
</span>
|
5
5
|
<span class="spud_blog_category_manager_item_actions">
|
6
|
-
<%= link_to 'Edit',
|
7
|
-
<%= link_to 'Delete',
|
6
|
+
<%= link_to 'Edit', edit_admin_post_category_path(category), :class => 'btn btn-mini spud_blog_category_edit' %>
|
7
|
+
<%= link_to 'Delete', admin_post_category_path(category), :class => 'btn btn-mini btn-danger spud_blog_category_delete' %>
|
8
8
|
</span>
|
9
9
|
<ul class="spud_blog_category_manager_item_children">
|
10
10
|
<% if @post_categories[category.id] %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= form_for @post_category, :url => (@post_category.new_record? ?
|
1
|
+
<%= form_for @post_category, :url => (@post_category.new_record? ? admin_post_categories_path : admin_post_category_path(@post_category)), :html => {:class => 'form-horizontal spud_post_category_form'} do |f| %>
|
2
2
|
|
3
3
|
<%= error_messages_for(f.object) %>
|
4
4
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<div class="spud_blog_category_manager">
|
2
|
-
<%= link_to "New Post Category",
|
2
|
+
<%= link_to "New Post Category", new_admin_post_category_path, :class => "btn btn-small btn-primary spud_blog_category_add_new", :title => "New Post Category" %>
|
3
3
|
<ul class="spud_blog_category_manager_list">
|
4
4
|
<% if @post_categories.length == 0 %>
|
5
5
|
<li class="spud_blog_category_manager_empty">You do not have any Post Categories at this time.</li>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render :partial => 'form', :locals => {:path => admin_post_categories_path} %>
|
@@ -40,12 +40,12 @@
|
|
40
40
|
</td>
|
41
41
|
<td class="spud-post-comment-actions">
|
42
42
|
<% if !comment.approved %>
|
43
|
-
<%= link_to 'Approve',
|
43
|
+
<%= link_to 'Approve', approve_admin_post_comment_path(comment), :class => 'btn btn-success btn-small' %>
|
44
44
|
<% end %>
|
45
45
|
<% if !comment.spam %>
|
46
|
-
<%= link_to 'Spam',
|
46
|
+
<%= link_to 'Spam', spam_admin_post_comment_path(comment), :class => 'btn btn-warning btn-small' %>
|
47
47
|
<% end %>
|
48
|
-
<%= link_to 'Delete',
|
48
|
+
<%= link_to 'Delete', admin_post_comment_path(comment), :method => :delete, :data => {:confirm => 'Are you sure you want to delete this comment?'}, :class => 'btn btn-danger btn-small' %>
|
49
49
|
</td>
|
50
50
|
</tr>
|
51
51
|
<%end%>
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<%= label_tag "spud_post_category_#{category.id}", category.name %>
|
4
4
|
<ul>
|
5
5
|
<% if @categories[category.id] %>
|
6
|
-
<%= render :partial => '/
|
6
|
+
<%= render :partial => '/admin/posts/category', :collection => @categories[category.id] %>
|
7
7
|
<% end %>
|
8
8
|
</ul>
|
9
9
|
<% end %>
|
@@ -20,7 +20,7 @@
|
|
20
20
|
<% if Spud::Blog.config.has_custom_fields %>
|
21
21
|
<fieldset>
|
22
22
|
<legend>Custom Fields</legend>
|
23
|
-
<%= render :partial => '/
|
23
|
+
<%= render :partial => '/admin/posts/custom_fields', :locals => {:f => f} %>
|
24
24
|
</fieldset>
|
25
25
|
<% end %>
|
26
26
|
|
@@ -98,10 +98,10 @@
|
|
98
98
|
|
99
99
|
<div class="spud_post_form_col">
|
100
100
|
<h4>Categories</h4>
|
101
|
-
<%= link_to 'Add Category',
|
101
|
+
<%= link_to 'Add Category', new_admin_post_category_path, :class => 'btn btn-mini spud_post_add_category' %>
|
102
102
|
<input type="hidden" name="spud_post[category_ids][]" value="" />
|
103
103
|
<ul class="spud_post_categories_form">
|
104
|
-
<%= render :partial => '/
|
104
|
+
<%= render :partial => '/admin/posts/category', :collection => @categories[nil] %>
|
105
105
|
</ul>
|
106
106
|
</div>
|
107
107
|
|
@@ -0,0 +1,48 @@
|
|
1
|
+
<%= content_for :data_controls do %>
|
2
|
+
<%= link_to "Manage Categories", admin_post_categories_path, :class => 'btn spud_blog_manage_categories', :title => 'Manage Categories' %>
|
3
|
+
<%= link_to "Manage Comments", admin_post_comments_path, :class => 'btn', :title => 'Manage Comments' %>
|
4
|
+
<%= link_to "New Post", new_admin_post_path, :class => "btn btn-primary", :title => "New Post" %>
|
5
|
+
<% end %>
|
6
|
+
|
7
|
+
<%=content_for :detail do %>
|
8
|
+
<table class="table table-striped">
|
9
|
+
<thead>
|
10
|
+
<tr>
|
11
|
+
<th>Title</th>
|
12
|
+
<th>Author</th>
|
13
|
+
<th>Published At</th>
|
14
|
+
<th>Comments Pending</th>
|
15
|
+
<th> </th>
|
16
|
+
</tr>
|
17
|
+
</thead>
|
18
|
+
<tbody>
|
19
|
+
<% @posts.each do |post| %>
|
20
|
+
<tr>
|
21
|
+
<td>
|
22
|
+
<%= link_to post.title, blog_post_path(post.url_name), :target => :blank %>
|
23
|
+
<% if !post.visible? %>
|
24
|
+
<span class="badge">Draft</span>
|
25
|
+
<% end %>
|
26
|
+
</td>
|
27
|
+
<td><%= post.author.full_name %></td>
|
28
|
+
<td><%= post.published_at.strftime('%m/%d/%Y') %></td>
|
29
|
+
<td>
|
30
|
+
<%= post.pending_comments.length %>
|
31
|
+
<%= link_to "Manage", admin_post_post_comments_path(:post_id => post.id), :class => 'spud-post-comments-manage' %>
|
32
|
+
</td>
|
33
|
+
<td class="text-right">
|
34
|
+
<%= link_to 'Edit', edit_admin_post_path(post), :class => 'btn btn-small' %>
|
35
|
+
<%= link_to 'Delete', admin_post_path(post), :method => :delete, :data => {:confirm => 'Are you sure you want to delete this post?'}, :class => 'btn btn-small btn-danger' %>
|
36
|
+
</td>
|
37
|
+
</tr>
|
38
|
+
<%end%>
|
39
|
+
</tbody>
|
40
|
+
</table>
|
41
|
+
<div class="spud_admin_pagination">
|
42
|
+
<%= will_paginate @posts %>
|
43
|
+
</div>
|
44
|
+
|
45
|
+
<script>
|
46
|
+
$(document).ready(spud.admin.post_categories.index);
|
47
|
+
</script>
|
48
|
+
<%end%>
|
@@ -1,35 +1,37 @@
|
|
1
|
-
<%
|
2
|
-
Blog | <%=current_site_name%>
|
3
|
-
<% end %>
|
1
|
+
<% @page_title = 'Blog' %>
|
4
2
|
|
5
3
|
<% content_for :head do %>
|
6
|
-
|
4
|
+
<%= spud_blog_rss_link %>
|
7
5
|
<% end %>
|
8
6
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
7
|
+
<% cache(cache_key_for_spud_collection(@posts, :cache_params => [:category_url_name, :archive_date, :page], :for_user => true)) do %>
|
8
|
+
<div id="spud_blog_filters">
|
9
|
+
<%= form_tag blog_path, :class => 'spud_blog_filter_form' do %>
|
10
|
+
<label>Category:</label>
|
11
|
+
<%= spud_post_category_select %>
|
12
|
+
<label>Month:</label>
|
13
|
+
<%= spud_post_archive_select %>
|
14
|
+
<input type="submit" value="Submit" />
|
15
|
+
<% end %>
|
16
|
+
</div>
|
18
17
|
|
19
|
-
<div id="spud_blog_posts">
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
</
|
18
|
+
<div id="spud_blog_posts">
|
19
|
+
<% if @posts.length > 0 %>
|
20
|
+
<% @posts.includes(:categories, :author).each do |post| %>
|
21
|
+
<% cache(post) do %>
|
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 %>
|
30
|
+
<% end %>
|
31
|
+
<% else %>
|
32
|
+
<p>No posts were found in this category</p>
|
33
|
+
<% end %>
|
34
|
+
</div>
|
35
|
+
<% end %>
|
34
36
|
|
35
37
|
<%= will_paginate @posts %>
|
@@ -1,37 +1,41 @@
|
|
1
|
-
<%
|
2
|
-
<%= @post.title %> | <%=current_site_name%>
|
3
|
-
<% end %>
|
1
|
+
<% @page_title = @post.title %>
|
4
2
|
|
5
3
|
<% content_for :head do %>
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
4
|
+
<% cache([@post, 'head']) do %>
|
5
|
+
<%= spud_blog_rss_link %>
|
6
|
+
<meta name="description" content="<%= @post.meta_description %>" />
|
7
|
+
<% if @post.meta_keywords.blank? %>
|
8
|
+
<meta name="keywords" content="<%= @post.categories.collect{ |c| c.name }.join(',') %>" />
|
9
|
+
<% else %>
|
10
|
+
<meta name="keywords" content="<%= @post.meta_keywords %>" />
|
11
|
+
<% end %>
|
12
|
+
<% end %>
|
13
13
|
<% end %>
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
</div>
|
15
|
+
<% cache(@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>
|
28
|
+
</div>
|
28
29
|
|
29
|
-
<% if @post.comments_enabled %>
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
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
|
+
<% cache(cache_key_for_spud_collection(@post.visible_comments, key:'comments')) do %>
|
36
|
+
<ul id="spud_blog_post_comments">
|
37
|
+
<%= render :partial => 'comment', :collection => @post.visible_comments %>
|
38
|
+
</ul>
|
39
|
+
<% end %>
|
40
|
+
<% end %>
|
37
41
|
<% end %>
|
@@ -1,35 +1,37 @@
|
|
1
|
-
<%
|
2
|
-
News | <%=current_site_name%>
|
3
|
-
<% end %>
|
1
|
+
<% @page_title = 'News' %>
|
4
2
|
|
5
3
|
<% content_for :head do %>
|
6
|
-
|
4
|
+
<%= spud_news_rss_link %>
|
7
5
|
<% end %>
|
8
6
|
|
7
|
+
<% cache(cache_key_for_spud_collection(@posts, :cache_params => [:category_url_name, :archive_date, :page], :for_user => true)) do %>
|
9
8
|
<div id="spud_news_filters">
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
9
|
+
<%= form_tag news_path, :class => 'spud_blog_filter_form' do %>
|
10
|
+
<label>Category:</label>
|
11
|
+
<%= spud_post_category_select %>
|
12
|
+
<label>Month:</label>
|
13
|
+
<%= spud_post_archive_select %>
|
14
|
+
<input type="submit" value="Submit" />
|
15
|
+
<% end %>
|
17
16
|
</div>
|
18
17
|
|
19
18
|
<div id="spud_news_posts">
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
19
|
+
<% if @posts.length > 0 %>
|
20
|
+
<% @posts.includes(:categories, :author).each do |post| %>
|
21
|
+
<% cache(post) do %>
|
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 %>
|
30
|
+
<% end %>
|
31
|
+
<% else %>
|
32
|
+
<p>No posts were found in this category</p>
|
33
|
+
<% end %>
|
33
34
|
</div>
|
35
|
+
<% end %>
|
34
36
|
|
35
37
|
<%= will_paginate @posts %>
|
@@ -1,27 +1,31 @@
|
|
1
1
|
<% content_for :title do %>
|
2
|
-
|
2
|
+
<%= @post.title %> | <%=current_site_name%>
|
3
3
|
<% end %>
|
4
4
|
|
5
5
|
<% content_for :head do %>
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
6
|
+
<% cache([@post, 'head']) do %>
|
7
|
+
<%= spud_news_rss_link %>
|
8
|
+
<meta name="description" content="<%= @post.meta_description %>" />
|
9
|
+
<% if @post.meta_keywords.blank? %>
|
10
|
+
<meta name="keywords" content="<%= @post.categories.collect{ |c| c.name }.join(',') %>" />
|
11
|
+
<% else %>
|
12
|
+
<meta name="keywords" content="<%= @post.meta_keywords %>" />
|
13
|
+
<% end %>
|
14
|
+
<% end %>
|
13
15
|
<% end %>
|
14
16
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
</div>
|
17
|
+
<% cache(@post) do %>
|
18
|
+
<div class="spud_news_post">
|
19
|
+
<h3><%= @post.title %></h3>
|
20
|
+
<h4>Posted by <%= @post.author.full_name %> on <%= @post.display_date %></h4>
|
21
|
+
<% if @post.categories.any? %>
|
22
|
+
<p id="spud_news_post_categories">
|
23
|
+
Filed under
|
24
|
+
<%= raw(@post.categories.collect{ |c| link_to c.name, news_category_path(c.url_name) }.join(', ')) %>
|
25
|
+
</p>
|
26
|
+
<% end %>
|
27
|
+
<div id="spud_news_post_content">
|
28
|
+
<%= raw @post.content_processed %>
|
29
|
+
</div>
|
30
|
+
</div>
|
31
|
+
<% end %>
|
data/config/routes.rb
CHANGED
@@ -1,22 +1,21 @@
|
|
1
1
|
Rails.application.routes.draw do
|
2
2
|
|
3
|
-
namespace :
|
4
|
-
|
5
|
-
|
6
|
-
resources :post_comments, :path => 'comments', :only => :index
|
7
|
-
end
|
8
|
-
resources :news_posts
|
9
|
-
resources :post_comments, :except => [:new, :create, :edit, :update] do
|
10
|
-
member do
|
11
|
-
get 'approve'
|
12
|
-
get 'spam'
|
13
|
-
end
|
14
|
-
end
|
15
|
-
resources :post_categories
|
3
|
+
namespace :admin do
|
4
|
+
resources :posts do
|
5
|
+
resources :post_comments, :path => 'comments', :only => :index
|
16
6
|
end
|
17
|
-
|
18
|
-
|
7
|
+
resources :news_posts
|
8
|
+
resources :post_comments, :except => [:new, :create, :edit, :update] do
|
9
|
+
member do
|
10
|
+
get 'approve'
|
11
|
+
get 'spam'
|
12
|
+
end
|
19
13
|
end
|
14
|
+
resources :post_categories
|
15
|
+
end
|
16
|
+
|
17
|
+
namespace :blog do
|
18
|
+
resource :sitemap, :only => "show"
|
20
19
|
end
|
21
20
|
|
22
21
|
if Spud::Blog.config.blog_enabled
|
@@ -5,7 +5,7 @@ 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,
|
8
|
+
:cache_mode,
|
9
9
|
:enable_rakismet, :enable_markdown, :default_comment_approval
|
10
10
|
)
|
11
11
|
self.base_layout = 'application'
|
@@ -18,7 +18,6 @@ module Spud
|
|
18
18
|
self.enable_sitemap = true
|
19
19
|
self.has_custom_fields = false
|
20
20
|
self.cache_mode = nil #options :full_page, :action
|
21
|
-
self.action_caching_duration = 3600
|
22
21
|
self.enable_rakismet = false
|
23
22
|
self.enable_markdown = false
|
24
23
|
self.default_comment_approval = true
|
data/lib/spud_blog/engine.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'tb_core'
|
2
2
|
require 'tb_permalinks'
|
3
|
+
require 'tb_liquid'
|
3
4
|
require 'awesome_nested_set'
|
4
5
|
require 'truncate_html'
|
5
|
-
require 'liquid'
|
6
6
|
|
7
7
|
module Spud
|
8
8
|
module Blog
|
@@ -17,9 +17,10 @@ module Spud
|
|
17
17
|
end
|
18
18
|
|
19
19
|
engine_name :tb_blog
|
20
|
+
|
20
21
|
initializer :admin do
|
21
22
|
if Spud::Blog.enable_sitemap == true
|
22
|
-
Spud::Core.config.sitemap_urls += [:
|
23
|
+
Spud::Core.config.sitemap_urls += [:blog_sitemap_url]
|
23
24
|
end
|
24
25
|
if Spud::Blog.config.blog_enabled
|
25
26
|
Spud::Core.config.admin_applications += [{
|
@@ -39,15 +40,17 @@ module Spud
|
|
39
40
|
end
|
40
41
|
end
|
41
42
|
initializer :assets do
|
42
|
-
|
43
|
-
Spud::Core.
|
44
|
-
Spud::Core.append_admin_stylesheets('spud/admin/posts')
|
45
|
-
end
|
46
|
-
initializer :associations do
|
47
|
-
SpudUser.class_eval do
|
48
|
-
has_many :posts, :class_name => 'SpudPost'
|
49
|
-
end
|
43
|
+
Spud::Core.append_admin_javascripts('admin/blog/application')
|
44
|
+
Spud::Core.append_admin_stylesheets('admin/blog/application')
|
50
45
|
end
|
46
|
+
|
47
|
+
# Triggers a I18n.enforce_available_locales deprecation warning. Why?
|
48
|
+
# initializer 'tb_blog.user_association', :after => 'tb_core.model_overrides' do
|
49
|
+
# SpudUser.class_eval do
|
50
|
+
# has_many :posts, :class_name => 'SpudPost'
|
51
|
+
# end
|
52
|
+
# end
|
53
|
+
|
51
54
|
initializer :news_layout do
|
52
55
|
if Spud::Core.config.news_layout.nil?
|
53
56
|
Spud::Core.config.news_layout = Spud::Core.config.base_layout
|
data/lib/spud_blog/version.rb
CHANGED
data/lib/tb_blog.rb
CHANGED
@@ -28,6 +28,7 @@ module Dummy
|
|
28
28
|
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
29
29
|
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
30
30
|
# config.i18n.default_locale = :de
|
31
|
+
config.i18n.enforce_available_locales = true
|
31
32
|
|
32
33
|
# Configure the default encoding used in templates for Ruby 1.9.
|
33
34
|
config.encoding = "utf-8"
|
@@ -46,12 +47,14 @@ module Dummy
|
|
46
47
|
# parameters by using an attr_accessible or attr_protected declaration.
|
47
48
|
# config.active_record.whitelist_attributes = true
|
48
49
|
|
49
|
-
# Enable the asset pipeline
|
50
|
-
config.assets.enabled = true
|
51
50
|
config.generators do |g|
|
52
51
|
g.test_framework :rspec
|
53
52
|
g.integration_tool :rspec
|
54
53
|
end
|
54
|
+
|
55
|
+
# Enable the asset pipeline
|
56
|
+
config.assets.enabled = true
|
57
|
+
|
55
58
|
# Version of your assets, change this if you want to expire all your assets
|
56
59
|
config.assets.version = '1.0'
|
57
60
|
end
|
@@ -56,7 +56,7 @@ Dummy::Application.configure do
|
|
56
56
|
|
57
57
|
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
58
58
|
# the I18n.default_locale when a translation can not be found)
|
59
|
-
config.i18n.fallbacks = true
|
59
|
+
# config.i18n.fallbacks = true
|
60
60
|
|
61
61
|
# Send deprecation notices to registered listeners
|
62
62
|
config.active_support.deprecation = :notify
|