refinerycms-blog 1.0.rc11 → 1.0.rc13
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/Gemfile.lock +2 -2
- data/app/controllers/admin/blog/comments_controller.rb +1 -1
- data/app/controllers/admin/blog/posts_controller.rb +1 -1
- data/app/models/blog_post.rb +1 -1
- data/app/views/blog/categories/show.html.erb +2 -2
- data/app/views/blog/posts/_comment.html.erb +9 -7
- data/app/views/blog/posts/index.html.erb +2 -2
- data/app/views/blog/posts/index.rss.builder +1 -1
- data/app/views/blog/posts/show.html.erb +62 -57
- data/app/views/blog/shared/_post.html.erb +22 -18
- data/config/routes.rb +2 -2
- data/generators/refinery_blog/refinery_blog_generator.rb +1 -1
- data/lib/generators/refinery_blog_generator.rb +2 -1
- data/lib/refinerycms-blog.rb +1 -1
- metadata +4 -4
data/Gemfile
CHANGED
@@ -1 +1 @@
|
|
1
|
-
gem 'filters_spam', '~> 0.
|
1
|
+
gem 'filters_spam', '~> 0.3'
|
data/Gemfile.lock
CHANGED
data/app/models/blog_post.rb
CHANGED
@@ -10,7 +10,7 @@ class BlogPost < ActiveRecord::Base
|
|
10
10
|
|
11
11
|
has_friendly_id :title, :use_slug => true
|
12
12
|
|
13
|
-
default_scope :order => "
|
13
|
+
default_scope :order => "published_at DESC"
|
14
14
|
|
15
15
|
if Rails.version < '3.0.0'
|
16
16
|
named_scope :live, lambda { {:conditions => ["published_at < ? and draft = ?", Time.now, false]} }
|
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
<% content_for :body_content_left do %>
|
4
4
|
<% if @category.posts.any? %>
|
5
|
-
<
|
5
|
+
<article id="blog_posts">
|
6
6
|
<%= render :partial => "/blog/shared/post", :collection => @category.posts %>
|
7
|
-
</
|
7
|
+
</article>
|
8
8
|
<% else %>
|
9
9
|
<p>
|
10
10
|
<%= t('.no_posts') %>
|
@@ -1,9 +1,11 @@
|
|
1
|
-
<
|
1
|
+
<article class='blog_comment_message' id='<%= "comment-#{comment.to_param}" %>'>
|
2
2
|
<p>
|
3
|
-
<%= comment.message.to_s
|
3
|
+
<%= simple_format auto_link(comment.message.to_s) %>
|
4
4
|
</p>
|
5
|
-
|
6
|
-
<p
|
7
|
-
|
8
|
-
|
9
|
-
</p>
|
5
|
+
<footer class='blog_comment_author'>
|
6
|
+
<p>
|
7
|
+
<%= t('blog.posts.comments.by', :who => comment.name) %>,
|
8
|
+
<%= t('blog.posts.comments.time_ago', :time => time_ago_in_words(comment.created_at)) %>
|
9
|
+
</p>
|
10
|
+
</footer>
|
11
|
+
</article>
|
@@ -1,9 +1,9 @@
|
|
1
1
|
<% content_for :body_content_left do %>
|
2
2
|
<%= @page[Page.default_parts.first.to_sym] %>
|
3
3
|
|
4
|
-
<
|
4
|
+
<section id="blog_posts">
|
5
5
|
<%= render :partial => "/blog/shared/post", :collection => @blog_posts %>
|
6
|
-
</
|
6
|
+
</section>
|
7
7
|
<% end %>
|
8
8
|
|
9
9
|
<% content_for :body_content_right do %>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<% content_for :head do %>
|
2
2
|
<% if BlogPost::ShareThis.enabled? %>
|
3
|
-
<script
|
4
|
-
<script
|
3
|
+
<script src="http://w.sharethis.com/button/buttons.js"></script>
|
4
|
+
<script>
|
5
5
|
stLight.options({publisher:'<%= BlogPost::ShareThis.key %>'});
|
6
6
|
</script>
|
7
7
|
<% end %>
|
@@ -10,68 +10,73 @@
|
|
10
10
|
<% content_for :body_content_title, @blog_post.title %>
|
11
11
|
|
12
12
|
<% content_for :body_content_left do %>
|
13
|
-
<
|
14
|
-
|
13
|
+
<article id="show_blog_post">
|
14
|
+
<header>
|
15
|
+
<p class='posted_at'>
|
16
|
+
<%= t('blog.shared.posts.created_at', :when => @blog_post.published_at.strftime('%d %B %Y')) %>.
|
15
17
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
<% if (categories = @blog_post.categories).any? %>
|
19
|
+
<span class='filed_in'>
|
20
|
+
<%= t('.filed_in') %>
|
21
|
+
<% categories.each_with_index do |category, index| %>
|
22
|
+
<%= link_to category.title, blog_category_url(category) -%><%= ',' if index < ((categories.length) - 1) %>
|
23
|
+
<% end %>
|
24
|
+
</span>
|
21
25
|
<% end %>
|
22
|
-
</span>
|
23
|
-
<% end %>
|
24
|
-
</p>
|
25
|
-
<%= @blog_post.body %>
|
26
|
-
|
27
|
-
<% if BlogPost::ShareThis.enabled? %>
|
28
|
-
<span class="st_sharethis" displayText="ShareThis"></span>
|
29
|
-
<% end %>
|
30
|
-
|
31
|
-
<% if BlogPost.comments_allowed? %>
|
32
|
-
<h2><%= t('.comments.title') %></h2>
|
33
|
-
|
34
|
-
<% if (comments = @blog_post.comments.approved).any? %>
|
35
|
-
<%= render :partial => "comment", :collection => comments %>
|
36
|
-
<% else %>
|
37
|
-
<p>
|
38
|
-
<%= t('blog.shared.comments.none') %>.
|
39
26
|
</p>
|
40
|
-
|
27
|
+
</header>
|
28
|
+
<%=raw @blog_post.body %>
|
41
29
|
|
42
|
-
<%
|
43
|
-
<
|
44
|
-
<%= value %>
|
45
|
-
</div>
|
30
|
+
<% if BlogPost::ShareThis.enabled? %>
|
31
|
+
<span class="st_sharethis" displayText="ShareThis"></span>
|
46
32
|
<% end %>
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
33
|
+
</article>
|
34
|
+
<% if BlogPost.comments_allowed? %>
|
35
|
+
<aside id="comments">
|
36
|
+
<h2><%= t('.comments.title') %></h2>
|
37
|
+
|
38
|
+
<% if (comments = @blog_post.comments.approved).any? %>
|
39
|
+
<%= render :partial => "comment", :collection => comments %>
|
52
40
|
<% else %>
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
:include_object_name => true
|
57
|
-
} %>
|
41
|
+
<p>
|
42
|
+
<%= t('blog.shared.comments.none') %>.
|
43
|
+
</p>
|
58
44
|
<% end %>
|
59
|
-
|
60
|
-
|
61
|
-
<%=
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
45
|
+
|
46
|
+
<% flash.each do |key, value| %>
|
47
|
+
<div id='flash' class="flash flash_<%= key %>">
|
48
|
+
<%= value %>
|
49
|
+
</div>
|
50
|
+
<% end %>
|
51
|
+
|
52
|
+
<h2><%= t('.comments.add') %></h2>
|
53
|
+
<% form_for [:blog_post, @blog_comment] do |f| %>
|
54
|
+
<% if Rails.version < '3.0.0'%>
|
55
|
+
<%= f.error_messages %>
|
56
|
+
<% else %>
|
57
|
+
<%= render :partial => "/shared/admin/error_messages",
|
58
|
+
:locals => {
|
59
|
+
:object => f.object,
|
60
|
+
:include_object_name => true
|
61
|
+
} %>
|
62
|
+
<% end %>
|
63
|
+
<div class='field'>
|
64
|
+
<%= f.label :name %>
|
65
|
+
<%= f.text_field :name %>
|
66
|
+
</div>
|
67
|
+
<div class='field'>
|
68
|
+
<%= f.label :email %>
|
69
|
+
<%= f.email_field :email %>
|
70
|
+
</div>
|
71
|
+
<div class='field message_field'>
|
72
|
+
<%= f.label :message %>
|
73
|
+
<%= f.text_area :message, :rows => 6 %>
|
74
|
+
</div>
|
75
|
+
<div class='field form-actions'>
|
76
|
+
<%= f.submit t('.submit') %>
|
77
|
+
</div>
|
78
|
+
<% end %>
|
79
|
+
</aside>
|
75
80
|
<% end %>
|
76
81
|
<% end %>
|
77
82
|
|
@@ -1,24 +1,28 @@
|
|
1
1
|
<% if post.live? %>
|
2
|
-
<
|
3
|
-
<
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
<article class="blog_post" id="<%= dom_id(post) %>">
|
3
|
+
<header>
|
4
|
+
<h1><%= link_to post.title, blog_post_url(post) %></h1>
|
5
|
+
<p class='posted_at'>
|
6
|
+
<%= t('blog.shared.posts.created_at', :when => post.published_at.strftime('%d %B %Y')) %>
|
7
|
+
</p>
|
8
|
+
</header>
|
9
|
+
<section class='clearfix'>
|
8
10
|
<%= truncate(post.body,
|
9
11
|
:length => RefinerySetting.find_or_set(:blog_post_teaser_length, 250),
|
10
12
|
:preserve_html_tags => true) %>
|
11
|
-
</
|
12
|
-
<
|
13
|
-
|
13
|
+
</section>
|
14
|
+
<footer>
|
15
|
+
<p>
|
16
|
+
<%= link_to t('blog.shared.posts.read_more'), blog_post_url(post) %>
|
14
17
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
18
|
+
<span class='comment_count'>
|
19
|
+
<% if post.comments.any? %>
|
20
|
+
(<%= pluralize(post.comments.count, t('blog.shared.comments.singular')) %>)
|
21
|
+
<% else %>
|
22
|
+
(<%= t('blog.shared.comments.none') %>)
|
23
|
+
<% end %>
|
24
|
+
</span>
|
25
|
+
</p>
|
26
|
+
</footer>
|
27
|
+
</article>
|
24
28
|
<% end %>
|
data/config/routes.rb
CHANGED
@@ -32,8 +32,8 @@ if Rails.version < '3.0.0'
|
|
32
32
|
else
|
33
33
|
Refinery::Application.routes.draw do
|
34
34
|
scope(:path => 'blog', :module => 'blog') do
|
35
|
-
root :to => 'posts#index'
|
36
|
-
match 'feed.rss', :to => 'posts#index.rss', :as => '
|
35
|
+
root :to => 'posts#index', :as => 'blog_root'
|
36
|
+
match 'feed.rss', :to => 'posts#index.rss', :as => 'blog_rss_feed'
|
37
37
|
match ':id', :to => 'posts#show', :as => 'blog_post'
|
38
38
|
match 'categories/:id', :to => 'categories#show', :as => 'blog_category'
|
39
39
|
match ':id/comments', :to => 'posts#comment', :as => 'blog_post_blog_comments'
|
@@ -37,7 +37,7 @@ class RefineryBlogGenerator < Rails::Generator::NamedBase
|
|
37
37
|
:attributes => [
|
38
38
|
Rails::Generator::GeneratedAttribute.new('title', 'string'),
|
39
39
|
Rails::Generator::GeneratedAttribute.new('body', 'text'),
|
40
|
-
Rails::Generator::GeneratedAttribute.new('draft', 'boolean')
|
40
|
+
Rails::Generator::GeneratedAttribute.new('draft', 'boolean'),
|
41
41
|
Rails::Generator::GeneratedAttribute.new('published_at', 'datetime')
|
42
42
|
], :id => true
|
43
43
|
},{
|
@@ -16,7 +16,8 @@ class RefineryBlogGenerator < Rails::Generators::NamedBase
|
|
16
16
|
:attributes => [
|
17
17
|
Rails::Generators::GeneratedAttribute.new('title', 'string'),
|
18
18
|
Rails::Generators::GeneratedAttribute.new('body', 'text'),
|
19
|
-
Rails::Generators::GeneratedAttribute.new('draft', 'boolean')
|
19
|
+
Rails::Generators::GeneratedAttribute.new('draft', 'boolean'),
|
20
|
+
Rails::Generators::GeneratedAttribute.new('published_at', 'datetime')
|
20
21
|
], :id => true
|
21
22
|
},{
|
22
23
|
:table_name => 'blog_comments',
|
data/lib/refinerycms-blog.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: refinerycms-blog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: -
|
4
|
+
hash: -398340062
|
5
5
|
prerelease: true
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- rc13
|
10
|
+
version: 1.0.rc13
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Resolve Digital
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-
|
19
|
+
date: 2010-10-05 00:00:00 +13:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|