refinerycms-blog 1.0.1 → 1.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/controllers/blog/posts_controller.rb +12 -4
- data/app/models/blog_comment.rb +3 -3
- data/app/models/blog_post.rb +7 -5
- data/app/views/admin/blog/categories/_form.html.erb +5 -1
- data/app/views/admin/blog/posts/_form.html.erb +5 -1
- data/app/views/blog/posts/show.html.erb +6 -3
- data/config/locales/en.yml +10 -10
- data/config/locales/it.yml +10 -10
- data/config/routes.rb +31 -25
- data/lib/gemspec.rb +1 -1
- data/lib/refinerycms-blog.rb +1 -1
- data/readme.md +9 -13
- metadata +4 -6
|
@@ -3,21 +3,29 @@ class Blog::PostsController < BlogController
|
|
|
3
3
|
before_filter :find_all_blog_posts, :except => [:archive]
|
|
4
4
|
before_filter :find_blog_post, :only => [:show, :comment, :update_nav]
|
|
5
5
|
|
|
6
|
+
respond_to :html, :js, :rss
|
|
7
|
+
|
|
6
8
|
def index
|
|
7
|
-
|
|
9
|
+
respond_with (@blog_posts) do |format|
|
|
10
|
+
format.html
|
|
11
|
+
format.rss
|
|
12
|
+
end
|
|
8
13
|
end
|
|
9
14
|
|
|
10
15
|
def show
|
|
11
16
|
@blog_comment = BlogComment.new
|
|
12
17
|
|
|
13
|
-
|
|
18
|
+
respond_with (@blog_post) do |format|
|
|
19
|
+
format.html { present(@page) }
|
|
20
|
+
format.js { render :partial => 'post', :layout => false }
|
|
21
|
+
end
|
|
14
22
|
end
|
|
15
23
|
|
|
16
24
|
def comment
|
|
17
25
|
if (@blog_comment = @blog_post.comments.create(params[:blog_comment])).valid?
|
|
18
26
|
if BlogComment::Moderation.enabled? or @blog_comment.ham?
|
|
19
27
|
begin
|
|
20
|
-
Blog::CommentMailer.
|
|
28
|
+
Blog::CommentMailer.notification(@blog_comment, request).deliver
|
|
21
29
|
rescue
|
|
22
30
|
logger.warn "There was an error delivering a blog comment notification.\n#{$!}\n"
|
|
23
31
|
end
|
|
@@ -43,7 +51,7 @@ class Blog::PostsController < BlogController
|
|
|
43
51
|
:page => params[:page],
|
|
44
52
|
:per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10)
|
|
45
53
|
})
|
|
46
|
-
|
|
54
|
+
respond_with (@blog_posts)
|
|
47
55
|
end
|
|
48
56
|
|
|
49
57
|
protected
|
data/app/models/blog_comment.rb
CHANGED
|
@@ -14,9 +14,9 @@ class BlogComment < ActiveRecord::Base
|
|
|
14
14
|
validates_format_of :email,
|
|
15
15
|
:with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
scope :unmoderated, :conditions => {:state => nil}
|
|
18
|
+
scope :approved, :conditions => {:state => 'approved'}
|
|
19
|
+
scope :rejected, :conditions => {:state => 'rejected'}
|
|
20
20
|
|
|
21
21
|
def approve!
|
|
22
22
|
self.update_attribute(:state, 'approved')
|
data/app/models/blog_post.rb
CHANGED
|
@@ -10,14 +10,16 @@ class BlogPost < ActiveRecord::Base
|
|
|
10
10
|
|
|
11
11
|
has_friendly_id :title, :use_slug => true
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
scope :by_archive, lambda { |archive_date|
|
|
14
|
+
where(['published_at between ? and ?', archive_date.beginning_of_month, archive_date.end_of_month]).order("published_at DESC")
|
|
15
|
+
}
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
scope :all_previous, where(['published_at <= ?', Time.now.beginning_of_month]).order("published_at DESC")
|
|
16
18
|
|
|
17
|
-
|
|
19
|
+
scope :live, lambda { where( "published_at < ? and draft = ?", Time.now, false).order("published_at DESC") }
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
scope :previous, lambda { |i| where(["published_at < ?", i.published_at]).order("published_at DESC").limit(1) }
|
|
22
|
+
scope :next, lambda { |i| where(["published_at > ?", i.published_at]).order("published_at ASC").limit(1) }
|
|
21
23
|
|
|
22
24
|
def next
|
|
23
25
|
self.class.next(self).first
|
|
@@ -23,15 +23,18 @@
|
|
|
23
23
|
|
|
24
24
|
<h2><%= t('.comments.add') %></h2>
|
|
25
25
|
<% form_for [:blog_post, @blog_comment] do |f| %>
|
|
26
|
-
<%=
|
|
27
|
-
|
|
26
|
+
<%= render :partial => "/shared/admin/error_messages",
|
|
27
|
+
:locals => {
|
|
28
|
+
:object => f.object,
|
|
29
|
+
:include_object_name => true
|
|
30
|
+
} %>
|
|
28
31
|
<div class='field'>
|
|
29
32
|
<%= f.label :name %>
|
|
30
33
|
<%= f.text_field :name %>
|
|
31
34
|
</div>
|
|
32
35
|
<div class='field'>
|
|
33
36
|
<%= f.label :email %>
|
|
34
|
-
<%= f.
|
|
37
|
+
<%= f.email_field :email %>
|
|
35
38
|
</div>
|
|
36
39
|
<div class='field message_field'>
|
|
37
40
|
<%= f.label :message %>
|
data/config/locales/en.yml
CHANGED
|
@@ -9,17 +9,17 @@ en:
|
|
|
9
9
|
edit: Edit this category
|
|
10
10
|
delete: Delete this category forever
|
|
11
11
|
index:
|
|
12
|
-
no_items_yet: 'There are no categories yet. Click "{
|
|
12
|
+
no_items_yet: 'There are no categories yet. Click "%{create}" to add your first category.'
|
|
13
13
|
comments:
|
|
14
|
-
approved: 'The comment from "{
|
|
14
|
+
approved: 'The comment from "%{author}" has been approved.'
|
|
15
15
|
comment:
|
|
16
16
|
view_live: View this comment live <br/><em>(opens in a new window)</em>
|
|
17
17
|
read: Read this comment
|
|
18
18
|
reject: Reject this comment
|
|
19
19
|
approve: Approve this comment
|
|
20
|
-
rejected: 'The comment from "{
|
|
20
|
+
rejected: 'The comment from "%{author}" has been rejected.'
|
|
21
21
|
index:
|
|
22
|
-
no_items_yet: 'There are no {
|
|
22
|
+
no_items_yet: 'There are no %{type} comments.'
|
|
23
23
|
show:
|
|
24
24
|
comment: Comment
|
|
25
25
|
blog_post: Blog Post
|
|
@@ -39,7 +39,7 @@ en:
|
|
|
39
39
|
save_as_draft: Save as Draft
|
|
40
40
|
published_at: Publish Date
|
|
41
41
|
index:
|
|
42
|
-
no_items_yet: 'There are no Blog Posts yet. Click "{
|
|
42
|
+
no_items_yet: 'There are no Blog Posts yet. Click "%{create}" to add your first blog post.'
|
|
43
43
|
post:
|
|
44
44
|
view_live: View this blog post live <br/><em>(opens in a new window)</em>
|
|
45
45
|
edit: Edit this blog post
|
|
@@ -50,7 +50,7 @@ en:
|
|
|
50
50
|
explanation: 'Every time someone comments on a blog post, Refinery sends out an email to say there is a new comment.'
|
|
51
51
|
hint: 'When a new comment is added, Refinery will send an email notification to you.'
|
|
52
52
|
example: "Enter your email address(es) like: jack@work.com, jill@office.com"
|
|
53
|
-
updated: 'Notification recipients have been set to "{
|
|
53
|
+
updated: 'Notification recipients have been set to "%{recipients}"'
|
|
54
54
|
submenu:
|
|
55
55
|
categories:
|
|
56
56
|
title: Categories
|
|
@@ -58,7 +58,7 @@ en:
|
|
|
58
58
|
new: Create new category
|
|
59
59
|
comments:
|
|
60
60
|
title: Comments
|
|
61
|
-
title_with_count: 'Comments ({
|
|
61
|
+
title_with_count: 'Comments (%{new_count} new)'
|
|
62
62
|
new: New
|
|
63
63
|
unmoderated: New
|
|
64
64
|
approved: Approved
|
|
@@ -90,7 +90,7 @@ en:
|
|
|
90
90
|
title: RSS Feed
|
|
91
91
|
posts:
|
|
92
92
|
other: Other Posts
|
|
93
|
-
created_at: 'Posted on {
|
|
93
|
+
created_at: 'Posted on %{when}'
|
|
94
94
|
read_more: Read more
|
|
95
95
|
comments:
|
|
96
96
|
singular: comment
|
|
@@ -101,8 +101,8 @@ en:
|
|
|
101
101
|
posts:
|
|
102
102
|
comment: comment
|
|
103
103
|
comments:
|
|
104
|
-
by: 'Posted by {
|
|
105
|
-
time_ago: '{
|
|
104
|
+
by: 'Posted by %{who}'
|
|
105
|
+
time_ago: '%{time} ago'
|
|
106
106
|
thank_you: 'Thank you for commenting.'
|
|
107
107
|
thank_you_moderated: 'Thank you for commenting. Your message has been placed in the moderation queue and will appear shortly.'
|
|
108
108
|
show:
|
data/config/locales/it.yml
CHANGED
|
@@ -9,17 +9,17 @@ it:
|
|
|
9
9
|
edit: Modifica questa categoria
|
|
10
10
|
delete: Elimina questa categoria per sempre
|
|
11
11
|
index:
|
|
12
|
-
no_items_yet: 'Nessuna categoria ancora presente. Fare click su "{
|
|
12
|
+
no_items_yet: 'Nessuna categoria ancora presente. Fare click su "%{create}" per aggiungere la tua prima categoria.'
|
|
13
13
|
comments:
|
|
14
|
-
approved: 'Il commento di "{
|
|
14
|
+
approved: 'Il commento di "%{author}" è stato approvato.'
|
|
15
15
|
comment:
|
|
16
16
|
view_live: Visualizza questo commento <em> <br/> live (si apre in una nuova finestra) </ em>
|
|
17
17
|
read: Leggi questo commento
|
|
18
18
|
reject: Rifiuta questo commento
|
|
19
19
|
approve: Approva questo commento
|
|
20
|
-
rejected: 'Il commento di "{
|
|
20
|
+
rejected: 'Il commento di "%{author}" è stato rifiutato.'
|
|
21
21
|
index:
|
|
22
|
-
no_items_yet: 'Non ci sono {
|
|
22
|
+
no_items_yet: 'Non ci sono %{type} commenti.'
|
|
23
23
|
show:
|
|
24
24
|
comment: Commento
|
|
25
25
|
blog_post: Messaggio del Blog
|
|
@@ -39,7 +39,7 @@ it:
|
|
|
39
39
|
save_as_draft: Salva come Bozza
|
|
40
40
|
published_at: Data di Pubblicazione
|
|
41
41
|
index:
|
|
42
|
-
no_items_yet: 'Non ci sono ancora Messaggi per questo Blog. Clicca "{
|
|
42
|
+
no_items_yet: 'Non ci sono ancora Messaggi per questo Blog. Clicca "%{create}" per aggiungere il tuo primo messaggio.'
|
|
43
43
|
post:
|
|
44
44
|
view_live: Visualizza questo messaggio live <br/><em>(si apre in una nuova finestra)</em>
|
|
45
45
|
edit: Modifica questo messaggio
|
|
@@ -50,7 +50,7 @@ it:
|
|
|
50
50
|
explanation: "Ogni volta che qualcuno commenta un messaggio del blog, Refinery invia una mail per avvisare che c'è un nuovo comemnto"
|
|
51
51
|
hint: 'Quando viene aggiunto un nuovo commento Refinery ti invierà una email di notifica.'
|
|
52
52
|
example: "Inserisci il tuo indirizzo email. È possibile insierire più indirizzi separati dalla virgola. Es: jack@work.com, jill@office.com"
|
|
53
|
-
updated: 'I destinatari delle notifiche sono stati impostati "{
|
|
53
|
+
updated: 'I destinatari delle notifiche sono stati impostati "%{recipients}"'
|
|
54
54
|
submenu:
|
|
55
55
|
categories:
|
|
56
56
|
title: Categorie
|
|
@@ -58,7 +58,7 @@ it:
|
|
|
58
58
|
new: Crea nuova categoria
|
|
59
59
|
comments:
|
|
60
60
|
title: Commenti
|
|
61
|
-
title_with_count: 'Comment1 ({
|
|
61
|
+
title_with_count: 'Comment1 (%{new_count} nuovi)'
|
|
62
62
|
new: Nuovo
|
|
63
63
|
unmoderated: Nuovo
|
|
64
64
|
approved: Approvato
|
|
@@ -79,7 +79,7 @@ it:
|
|
|
79
79
|
title: RSS Feed
|
|
80
80
|
posts:
|
|
81
81
|
other: Altri Messaggi
|
|
82
|
-
created_at: 'Pubblicato il {
|
|
82
|
+
created_at: 'Pubblicato il %{when}'
|
|
83
83
|
read_more: Per saperne di più
|
|
84
84
|
comments:
|
|
85
85
|
singular: commento
|
|
@@ -91,8 +91,8 @@ it:
|
|
|
91
91
|
posts:
|
|
92
92
|
comment: commento
|
|
93
93
|
comments:
|
|
94
|
-
by: 'Pubblicato da {
|
|
95
|
-
time_ago: '{
|
|
94
|
+
by: 'Pubblicato da %{who}'
|
|
95
|
+
time_ago: '%{time} fa'
|
|
96
96
|
thank_you: 'Grazie per aver scritto un commento.'
|
|
97
97
|
thank_you_moderated: 'Grazie per aver scritto un commento. Il tuo messaggio è stato inserito nella coda di moderazione e sarà visibile a breve.'
|
|
98
98
|
show:
|
data/config/routes.rb
CHANGED
|
@@ -1,33 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## TODO: what is the rails2 syntax for this? sorry ;__;
|
|
10
|
-
# get 'archive/:year/:month', :to => 'posts#archive', :as => 'archive_blog_posts'
|
|
1
|
+
Refinery::Application.routes.draw do
|
|
2
|
+
scope(:path => 'blog', :module => 'blog') do
|
|
3
|
+
root :to => 'posts#index', :as => 'blog_root'
|
|
4
|
+
match 'feed.rss', :to => 'posts#index.rss', :as => 'blog_rss_feed'
|
|
5
|
+
match ':id', :to => 'posts#show', :as => 'blog_post'
|
|
6
|
+
match 'categories/:id', :to => 'categories#show', :as => 'blog_category'
|
|
7
|
+
match ':id/comments', :to => 'posts#comment', :as => 'blog_post_blog_comments'
|
|
8
|
+
get 'archive/:year/:month', :to => 'posts#archive', :as => 'archive_blog_posts'
|
|
11
9
|
end
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
scope(:path => 'refinery', :as => 'admin', :module => 'admin') do
|
|
12
|
+
scope(:path => 'blog', :as => 'blog', :module => 'blog') do
|
|
13
|
+
root :to => 'posts#index'
|
|
14
|
+
resources :posts
|
|
15
|
+
|
|
16
|
+
resources :categories
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
resources :comments do
|
|
19
|
+
collection do
|
|
20
|
+
get :approved
|
|
21
|
+
get :rejected
|
|
22
|
+
end
|
|
23
|
+
member do
|
|
24
|
+
get :approved
|
|
25
|
+
get :rejected
|
|
26
|
+
end
|
|
27
|
+
end
|
|
18
28
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
:approved => :get,
|
|
24
|
-
:rejected => :get
|
|
25
|
-
}
|
|
29
|
+
resources :settings do
|
|
30
|
+
collection do
|
|
31
|
+
get :notification_recipients
|
|
32
|
+
post :notification_recipients
|
|
26
33
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
34
|
+
get :moderation
|
|
35
|
+
end
|
|
36
|
+
end
|
|
31
37
|
end
|
|
32
38
|
end
|
|
33
39
|
end
|
data/lib/gemspec.rb
CHANGED
|
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
|
|
|
17
17
|
s.homepage = %q{http://refinerycms.com}
|
|
18
18
|
s.authors = %w(Resolve\\ Digital Neoteric\\ Design)
|
|
19
19
|
s.require_paths = %w(lib)
|
|
20
|
-
s.add_dependency 'refinerycms', '
|
|
20
|
+
s.add_dependency 'refinerycms', '>= 0.9.8'
|
|
21
21
|
s.add_dependency 'filters_spam', '~> 0.2'
|
|
22
22
|
|
|
23
23
|
s.files = %w(
|
data/lib/refinerycms-blog.rb
CHANGED
data/readme.md
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
# Refinery CMS Blog
|
|
1
|
+
# Refinery CMS Blog
|
|
2
2
|
|
|
3
|
-
Simple blog engine for [Refinery CMS](http://refinerycms.com).
|
|
4
|
-
It supports posts, categories and comments.
|
|
3
|
+
Simple blog engine for [Refinery CMS](http://refinerycms.com). It supports posts, categories and comments.
|
|
5
4
|
|
|
6
|
-
Refinery CMS Blog supports Rails 3
|
|
5
|
+
Refinery CMS Blog supports Rails 2.3.x using the [Rails 2.3.x stable branch](http://github.com/resolve/refinerycms-blog/tree/rails2-stable).
|
|
7
6
|
|
|
8
7
|
Options:
|
|
9
8
|
|
|
@@ -12,23 +11,20 @@ Options:
|
|
|
12
11
|
|
|
13
12
|
## Requirements
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
and < 0.9.8 as it works only with the later versions of Rails 2 compatible RefineryCMS.
|
|
17
|
-
Also note that any version of this engine 1.1 or greater is not compatible with Rails 2 at all
|
|
18
|
-
and is meant for Rails 3 (Refinery CMS >= 0.9.8).
|
|
14
|
+
Refinery CMS version 0.9.8 or above.
|
|
19
15
|
|
|
20
|
-
|
|
16
|
+
## Install
|
|
21
17
|
|
|
22
18
|
Open up your ``Gemfile`` and add at the bottom this line:
|
|
23
19
|
|
|
24
|
-
gem 'refinerycms-blog', '~> 1.
|
|
20
|
+
gem 'refinerycms-blog', '~> 1.1'
|
|
25
21
|
|
|
26
22
|
Now, run ``bundle install``
|
|
27
23
|
|
|
28
|
-
Next, to install the blog plugin:
|
|
24
|
+
Next, to install the blog plugin run:
|
|
29
25
|
|
|
30
|
-
|
|
26
|
+
rails generate refinerycms_blog
|
|
31
27
|
|
|
32
28
|
Finally migrate your database and you're done.
|
|
33
29
|
|
|
34
|
-
rake db:migrate
|
|
30
|
+
rake db:migrate
|
metadata
CHANGED
|
@@ -4,9 +4,8 @@ version: !ruby/object:Gem::Version
|
|
|
4
4
|
prerelease: false
|
|
5
5
|
segments:
|
|
6
6
|
- 1
|
|
7
|
-
- 0
|
|
8
7
|
- 1
|
|
9
|
-
version: 1.
|
|
8
|
+
version: "1.1"
|
|
10
9
|
platform: ruby
|
|
11
10
|
authors:
|
|
12
11
|
- Resolve Digital
|
|
@@ -24,14 +23,13 @@ dependencies:
|
|
|
24
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
|
25
24
|
none: false
|
|
26
25
|
requirements:
|
|
27
|
-
- -
|
|
26
|
+
- - ">="
|
|
28
27
|
- !ruby/object:Gem::Version
|
|
29
28
|
segments:
|
|
30
29
|
- 0
|
|
31
30
|
- 9
|
|
32
|
-
-
|
|
33
|
-
|
|
34
|
-
version: 0.9.7.13
|
|
31
|
+
- 8
|
|
32
|
+
version: 0.9.8
|
|
35
33
|
type: :runtime
|
|
36
34
|
version_requirements: *id001
|
|
37
35
|
- !ruby/object:Gem::Dependency
|