refinerycms-blog 1.1 → 1.2
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/admin/blog/posts_controller.rb +53 -0
- data/app/controllers/admin/blog/settings_controller.rb +14 -2
- data/app/controllers/blog/posts_controller.rb +18 -7
- data/app/helpers/blog_posts_helper.rb +23 -7
- data/app/models/blog_category.rb +4 -11
- data/app/models/blog_comment.rb +11 -3
- data/app/models/blog_post.rb +35 -14
- data/app/models/categorization.rb +5 -0
- data/app/views/admin/blog/_submenu.html.erb +37 -27
- data/app/views/admin/blog/categories/_category.html.erb +3 -3
- data/app/views/admin/blog/categories/_form.html.erb +1 -1
- data/app/views/admin/blog/categories/index.html.erb +2 -6
- data/app/views/admin/blog/comments/_comment.html.erb +2 -2
- data/app/views/admin/blog/posts/_form.html.erb +1 -1
- data/app/views/admin/blog/posts/_post.html.erb +5 -5
- data/app/views/admin/blog/posts/index.html.erb +2 -6
- data/app/views/admin/blog/posts/uncategorized.html.erb +26 -0
- data/app/views/admin/blog/settings/notification_recipients.html.erb +1 -1
- data/app/views/blog/posts/_nav.html.erb +9 -11
- data/app/views/blog/posts/_post.html.erb +5 -7
- data/app/views/blog/posts/archive.html.erb +8 -6
- data/app/views/blog/posts/index.html.erb +10 -7
- data/app/views/blog/posts/show.html.erb +5 -4
- data/app/views/blog/shared/_categories.html.erb +10 -8
- data/app/views/blog/shared/_post.html.erb +9 -7
- data/app/views/blog/shared/_posts.html.erb +10 -8
- data/app/views/blog/shared/_rss_feed.html.erb +1 -1
- data/changelog.md +24 -0
- data/config/locales/de.yml +128 -0
- data/config/locales/en.yml +17 -3
- data/config/locales/es.yml +122 -0
- data/config/locales/fr.yml +125 -0
- data/config/locales/it.yml +1 -0
- data/config/locales/pl.yml +134 -0
- data/config/locales/pt-BR.yml +125 -0
- data/config/locales/ru.yml +125 -0
- data/config/routes.rb +5 -2
- data/features/authors.feature +15 -0
- data/features/support/factories/blog_categories.rb +1 -1
- data/features/support/factories/blog_posts.rb +3 -1
- data/features/support/step_definitions/authors_steps.rb +7 -0
- data/lib/gemspec.rb +1 -0
- data/lib/generators/refinerycms_blog/templates/db/migrate/migration_number_add_user_id_to_blog_posts.rb +11 -0
- data/lib/generators/refinerycms_blog_generator.rb +14 -7
- data/lib/refinerycms-blog.rb +2 -6
- data/public/javascripts/refinery/refinerycms-blog.js +3 -3
- data/spec/models/blog_categories_spec.rb +28 -8
- data/spec/models/blog_posts_spec.rb +167 -7
- metadata +16 -20
- data/Gemfile +0 -2
- data/Gemfile.lock +0 -11
@@ -0,0 +1,125 @@
|
|
1
|
+
pt-BR:
|
2
|
+
plugins:
|
3
|
+
refinerycms_blog:
|
4
|
+
title: Blog
|
5
|
+
admin:
|
6
|
+
blog:
|
7
|
+
categories:
|
8
|
+
category:
|
9
|
+
edit: Editar esta categoria
|
10
|
+
delete: Apagar esta categoria para sempre
|
11
|
+
index:
|
12
|
+
no_items_yet: 'Não há categorias ainda. Clique em "%{create}" para adicionar a primeira categoria.'
|
13
|
+
comments:
|
14
|
+
approved: 'O comentário de "%{author}" foi aprovado.'
|
15
|
+
comment:
|
16
|
+
view_live_html: Ver este comentário <br/><em>(será aberto em outra janela)</em>
|
17
|
+
read: Ler este comentário
|
18
|
+
reject: Rejeitar este comentário
|
19
|
+
approve: Aprovar este comentário
|
20
|
+
rejected: 'O comentário de "%{author}" foi rejeitado.'
|
21
|
+
index:
|
22
|
+
no_items_yet: 'Não há %{type} comentários.'
|
23
|
+
show:
|
24
|
+
comment: Comentário
|
25
|
+
blog_post: Post
|
26
|
+
from: Postado por
|
27
|
+
date: Postado em
|
28
|
+
message: Comentário
|
29
|
+
details: Detalhes
|
30
|
+
age: Idade
|
31
|
+
actions: Ações
|
32
|
+
back: Voltar para todos os comentários
|
33
|
+
reject: Rejeitar este comentário
|
34
|
+
approve: Aprovar este comentário
|
35
|
+
posts:
|
36
|
+
form:
|
37
|
+
advanced_options: Opções avançadas
|
38
|
+
toggle_advanced_options: Clique aqui para acessar as configurações de meta tag e menu
|
39
|
+
save_as_draft: Salvar como rascunho
|
40
|
+
published_at: Data de publicação
|
41
|
+
index:
|
42
|
+
no_items_yet: 'Ainda não há Posts no Blog. Clique em "%{create}" para adicionar o primeiro post.'
|
43
|
+
post:
|
44
|
+
view_live_html: Ver este comentário <br/><em>(será aberto em outra janela)</em>
|
45
|
+
edit: Editar este post
|
46
|
+
delete: Remover esse post para sempre
|
47
|
+
settings:
|
48
|
+
notification_recipients:
|
49
|
+
value: Enviar notificações para
|
50
|
+
explanation: 'Cada vez que alguém comenta em um post no blog, é enviado um e-mail para informar que há um novo comentário.'
|
51
|
+
hint: 'Quando um novo comentário é adicionado, será enviado uma notificação por e-mail para você.'
|
52
|
+
example: "Entre com o(s) seu(s) endereço(s) de email, como: jack@work.com, jill@office.com"
|
53
|
+
updated: 'As notificações foram enviadas para "%{recipients}"'
|
54
|
+
submenu:
|
55
|
+
categories:
|
56
|
+
title: Categorias
|
57
|
+
manage: Gerenciar
|
58
|
+
new: Criar nova categoria
|
59
|
+
comments:
|
60
|
+
title: Comentários
|
61
|
+
title_with_count: 'Comentários (%{new_count} novos)'
|
62
|
+
new: Novo
|
63
|
+
unmoderated: Novo
|
64
|
+
approved: Aprovado
|
65
|
+
rejected: Rejeitado
|
66
|
+
posts:
|
67
|
+
title: Posts
|
68
|
+
manage: Gerenciar posts
|
69
|
+
new: Criar novo post
|
70
|
+
settings:
|
71
|
+
title: Configurações
|
72
|
+
moderation: Moderação
|
73
|
+
update_notified: Quem receberá a notificação?
|
74
|
+
comments: Comentários
|
75
|
+
blog:
|
76
|
+
comment_mailer:
|
77
|
+
notification:
|
78
|
+
greeting: Olá
|
79
|
+
you_recieved_new_comment: Você acaba de receber um novo comentário em seu site.
|
80
|
+
comment_starts: --- Início do comentário ---
|
81
|
+
comment_ends: --- Fim do comentário ---
|
82
|
+
from: De
|
83
|
+
email: Email
|
84
|
+
message: Mensagem
|
85
|
+
closing_line: Atenciosamente
|
86
|
+
ps: P.S. Lembre-se que você pode ver todos os comentários em "Comentários" dentro da seção "Blog".
|
87
|
+
shared:
|
88
|
+
categories:
|
89
|
+
title: Categorias
|
90
|
+
rss_feed:
|
91
|
+
title: Feed RSS
|
92
|
+
subscribe: Assinar
|
93
|
+
posts:
|
94
|
+
other: Últimos posts
|
95
|
+
created_at: 'Postado em %{when}'
|
96
|
+
read_more: Continue lendo...
|
97
|
+
comments:
|
98
|
+
singular: comentário
|
99
|
+
none: não há comentários
|
100
|
+
archives: Arquivos
|
101
|
+
categories:
|
102
|
+
show:
|
103
|
+
no_posts: Não há posts aqui ainda.
|
104
|
+
posts:
|
105
|
+
comment: commentário
|
106
|
+
comments:
|
107
|
+
by: 'Postado por %{who}'
|
108
|
+
time_ago: '%{time} atrás'
|
109
|
+
thank_you: 'Obrigado por comentar.'
|
110
|
+
thank_you_moderated: 'Obrigado por comentar. Sua mensagem foi colocada na fila de moderação e será exibida em breve.'
|
111
|
+
index:
|
112
|
+
no_blog_articles_yet: Ainda não há artigos postados no blog.
|
113
|
+
show:
|
114
|
+
blog_home: Blog Home
|
115
|
+
comments:
|
116
|
+
title: Comentários
|
117
|
+
add: Fazer um comentário
|
118
|
+
other: Outros posts
|
119
|
+
filed_in: Arquivado em
|
120
|
+
submit: Enviar comentário
|
121
|
+
archive:
|
122
|
+
blog_archive_for: Arquivo do blog em %{date}
|
123
|
+
no_blog_articles_posted: Não há arquivos do blog em %{date}.
|
124
|
+
post:
|
125
|
+
filed_in: Arquivado em
|
@@ -0,0 +1,125 @@
|
|
1
|
+
ru:
|
2
|
+
plugins:
|
3
|
+
refinerycms_blog:
|
4
|
+
title: Блог
|
5
|
+
admin:
|
6
|
+
blog:
|
7
|
+
categories:
|
8
|
+
category:
|
9
|
+
edit: Редактировать эту категорию
|
10
|
+
delete: Удалить эту категорию навсегда
|
11
|
+
index:
|
12
|
+
no_items_yet: 'Категории пока не созданы. Нажмите "%{create}", чтобы добавить вашу первую категорию.'
|
13
|
+
comments:
|
14
|
+
approved: 'Комментарий от "%{author}" был опубликован.'
|
15
|
+
comment:
|
16
|
+
view_live_html: Посмотреть комментарий на сайте <br/><em>(откроется в новом окне)</em>
|
17
|
+
read: Прочитать комментарий
|
18
|
+
reject: Отклонить комментарий
|
19
|
+
approve: Принять комментарий
|
20
|
+
rejected: 'Комментарий от "%{author}" был отклонен.'
|
21
|
+
index:
|
22
|
+
no_items_yet: '%{type} комментарии: отсутствуют.'
|
23
|
+
show:
|
24
|
+
comment: Комментарий
|
25
|
+
blog_post: Запись в блоге
|
26
|
+
from: Опубликовал
|
27
|
+
date: Опубликовано
|
28
|
+
message: Комментарий
|
29
|
+
details: Детали
|
30
|
+
age: Возраст
|
31
|
+
actions: Действия
|
32
|
+
back: Вернуться к списку комментариев
|
33
|
+
reject: Отклонить этот комментарий
|
34
|
+
approve: Принять этот комментарий
|
35
|
+
posts:
|
36
|
+
form:
|
37
|
+
advanced_options: Дополнительные настройки
|
38
|
+
toggle_advanced_options: 'Нажмите, чтобы получить доступ к настройкам мета-тегов и меню'
|
39
|
+
save_as_draft: Сохранить как черновик
|
40
|
+
published_at: Дата публикации
|
41
|
+
index:
|
42
|
+
no_items_yet: 'Записи в блоге отстутствуют. Нажмите "%{create}", чтобы добавить первую запись.'
|
43
|
+
post:
|
44
|
+
view_live_html: Посмотреть запись на сайте <br/><em>(откроется в новом окне)</em>
|
45
|
+
edit: Редактировать запись
|
46
|
+
delete: Удалить запись
|
47
|
+
settings:
|
48
|
+
notification_recipients:
|
49
|
+
value: Отправлять уведомления
|
50
|
+
explanation: 'При появлении новых комментариев Refinery пришлет уведомление на email.'
|
51
|
+
hint: 'При появлении новых комментариев Refinery пришлет уведомление на email.'
|
52
|
+
example: "Введите адреса эл. почты, например: jack@work.com, jill@office.com"
|
53
|
+
updated: 'Получателем уведомлений является "%{recipients}"'
|
54
|
+
submenu:
|
55
|
+
categories:
|
56
|
+
title: Категории
|
57
|
+
manage: Редактировать категории
|
58
|
+
new: Создать новую категорию
|
59
|
+
comments:
|
60
|
+
title: Комментарии
|
61
|
+
title_with_count: 'Комментарии (%{new_count} новых)'
|
62
|
+
new: Новые
|
63
|
+
unmoderated: Новые
|
64
|
+
approved: Принятые
|
65
|
+
rejected: Отклоненные
|
66
|
+
posts:
|
67
|
+
title: Записи
|
68
|
+
manage: Редактировать записи
|
69
|
+
new: Создать новую запись
|
70
|
+
settings:
|
71
|
+
title: Настройки
|
72
|
+
moderation: Модерирование
|
73
|
+
update_notified: Настроить уведомления
|
74
|
+
comments: Комментарии
|
75
|
+
blog:
|
76
|
+
comment_mailer:
|
77
|
+
notification:
|
78
|
+
greeting: Здравствуйте
|
79
|
+
you_recieved_new_comment: Новый комментарий опубликован на вашем сайте.
|
80
|
+
comment_starts: --- начало комментария ---
|
81
|
+
comment_ends: --- конец комментария ---
|
82
|
+
from: От
|
83
|
+
email: Эл. почта
|
84
|
+
message: Сообщение
|
85
|
+
closing_line: С уважением
|
86
|
+
ps: P.S. Все комментарии находятся в разделе "Блог" Refinery CMS в подменю "Комментарии".
|
87
|
+
shared:
|
88
|
+
categories:
|
89
|
+
title: Категории
|
90
|
+
rss_feed:
|
91
|
+
title: RSS-лента
|
92
|
+
subscribe: Подписаться
|
93
|
+
posts:
|
94
|
+
other: Другие записи
|
95
|
+
created_at: 'Опубликовано %{when}'
|
96
|
+
read_more: Читать дальше
|
97
|
+
comments:
|
98
|
+
singular: комментарий
|
99
|
+
none: нет комментариев
|
100
|
+
archives: Архивы
|
101
|
+
categories:
|
102
|
+
show:
|
103
|
+
no_posts: Записей пока нет.
|
104
|
+
posts:
|
105
|
+
post:
|
106
|
+
filed_in: Категория
|
107
|
+
comment: комментарий
|
108
|
+
comments:
|
109
|
+
by: 'Опубликовал %{who}'
|
110
|
+
time_ago: '%{time} назад'
|
111
|
+
thank_you: 'Спасибо за комментарий.'
|
112
|
+
thank_you_moderated: 'Спасибо за комментарий. Ваше сообщение модерируется и скоро появится на сайте.'
|
113
|
+
index:
|
114
|
+
no_blog_articles_yet: Пока ни одной записи не опубликовано. Следите за новостями.
|
115
|
+
show:
|
116
|
+
blog_home: Вернуться к списку записей
|
117
|
+
comments:
|
118
|
+
title: Комментарии
|
119
|
+
add: Написать комментарий
|
120
|
+
other: Другие записи
|
121
|
+
filed_in: Категория
|
122
|
+
submit: Отправить комментарий
|
123
|
+
archive:
|
124
|
+
blog_archive_for: 'Архив %{date}'
|
125
|
+
no_blog_articles_posted: 'Ни одной записи за %{date} не опубликовано. Следите за новостями.'
|
data/config/routes.rb
CHANGED
@@ -5,13 +5,15 @@ Refinery::Application.routes.draw do
|
|
5
5
|
match ':id', :to => 'posts#show', :as => 'blog_post'
|
6
6
|
match 'categories/:id', :to => 'categories#show', :as => 'blog_category'
|
7
7
|
match ':id/comments', :to => 'posts#comment', :as => 'blog_post_blog_comments'
|
8
|
-
get 'archive/:year/:month', :to => 'posts#archive', :as => 'archive_blog_posts'
|
8
|
+
get 'archive/:year(/:month)', :to => 'posts#archive', :as => 'archive_blog_posts'
|
9
9
|
end
|
10
10
|
|
11
11
|
scope(:path => 'refinery', :as => 'admin', :module => 'admin') do
|
12
12
|
scope(:path => 'blog', :as => 'blog', :module => 'blog') do
|
13
13
|
root :to => 'posts#index'
|
14
|
-
resources :posts
|
14
|
+
resources :posts do
|
15
|
+
get 'uncategorized', :on => :collection
|
16
|
+
end
|
15
17
|
|
16
18
|
resources :categories
|
17
19
|
|
@@ -32,6 +34,7 @@ Refinery::Application.routes.draw do
|
|
32
34
|
post :notification_recipients
|
33
35
|
|
34
36
|
get :moderation
|
37
|
+
get :comments
|
35
38
|
end
|
36
39
|
end
|
37
40
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
@blog
|
2
|
+
Feature: Blog Post Authors
|
3
|
+
Blog posts can be assigned authors through the given user model
|
4
|
+
current_user is assumed through admin screens
|
5
|
+
|
6
|
+
Scenario: Saving a blog post in blog_posts#new associates the current_user as the author
|
7
|
+
Given I am a logged in refinery user
|
8
|
+
|
9
|
+
When I am on the new blog post form
|
10
|
+
And I fill in "Title" with "This is my blog post"
|
11
|
+
And I fill in "Body" with "And I love it"
|
12
|
+
And I press "Save"
|
13
|
+
|
14
|
+
Then there should be 1 blog post
|
15
|
+
And the blog post should belong to me
|
@@ -1,4 +1,6 @@
|
|
1
1
|
Factory.define(:post, :class => BlogPost) do |f|
|
2
|
-
f.title "Top
|
2
|
+
f.sequence(:title) { |n| "Top #{n} Shopping Centers in Chicago" }
|
3
3
|
f.body "These are the top ten shopping centers in Chicago. You're going to read a long blog post about them. Come to peace with it."
|
4
|
+
f.draft false
|
5
|
+
f.published_at Time.now
|
4
6
|
end
|
data/lib/gemspec.rb
CHANGED
@@ -41,14 +41,21 @@ class RefinerycmsBlogGenerator < Rails::Generators::NamedBase
|
|
41
41
|
Rails::Generators::GeneratedAttribute.new('blog_post_id', 'integer')
|
42
42
|
], :id => false
|
43
43
|
}]
|
44
|
-
|
45
|
-
|
46
|
-
|
44
|
+
unless Pathname.glob(Rails.root.join('db', 'migrate', "*_create_#{singular_name}.rb")).any?
|
45
|
+
next_migration_number = ActiveRecord::Generators::Base.next_migration_number(File.dirname(__FILE__))
|
46
|
+
template('db/migrate/migration_number_create_singular_name.rb',
|
47
|
+
Rails.root.join("db/migrate/#{next_migration_number}_create_#{singular_name}.rb"))
|
48
|
+
end
|
49
|
+
unless Pathname.glob(Rails.root.join('db', 'migrate', "*_add_user_id_to_blog_posts.rb")).any?
|
50
|
+
next_migration_number = ActiveRecord::Generators::Base.next_migration_number(File.dirname(__FILE__))
|
51
|
+
template('db/migrate/migration_number_add_user_id_to_blog_posts.rb',
|
52
|
+
Rails.root.join('db', 'migrate', "#{next_migration_number}_add_user_id_to_blog_posts.rb"))
|
53
|
+
end
|
47
54
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
55
|
+
puts "------------------------"
|
56
|
+
puts "Now run:"
|
57
|
+
puts "rake db:migrate"
|
58
|
+
puts "------------------------"
|
52
59
|
end
|
53
60
|
end
|
54
61
|
|
data/lib/refinerycms-blog.rb
CHANGED
@@ -1,8 +1,4 @@
|
|
1
|
-
|
2
|
-
# this will tell the user what to do
|
3
|
-
load(File.expand_path('../../Gemfile', __FILE__))
|
4
|
-
require 'filters_spam'
|
5
|
-
end
|
1
|
+
require 'filters_spam'
|
6
2
|
|
7
3
|
module Refinery
|
8
4
|
module Blog
|
@@ -42,7 +38,7 @@ module Refinery
|
|
42
38
|
|
43
39
|
class << self
|
44
40
|
def version
|
45
|
-
%q{1.
|
41
|
+
%q{1.2}
|
46
42
|
end
|
47
43
|
end
|
48
44
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
$(document).ready(function(){
|
2
|
-
$('nav#actions.multilist > ul:not(.search_list) li a[href$=' + window.location.pathname + ']')
|
2
|
+
$('nav#actions.multilist > ul:not(.search_list) li a[href$="' + window.location.pathname + '"]')
|
3
3
|
.parent().addClass('selected');
|
4
4
|
if($('nav#actions.multilist > ul:not(.search_list) li.selected').length == 0) {
|
5
5
|
$('nav#actions.multilist > ul:not(.search_list) li a:nth(1)').parent().addClass('selected');
|
@@ -15,9 +15,9 @@ $(document).ready(function(){
|
|
15
15
|
|
16
16
|
$('ul.collapsible_menu').each(function(i, ul) {
|
17
17
|
(first_li = $(this).children('li:first')).after(div=$("<div></div>"));
|
18
|
-
|
18
|
+
|
19
19
|
$("<span class='arrow'> </span>").appendTo(first_li)
|
20
|
-
|
20
|
+
|
21
21
|
if (($(this).children('li.selected')).length == 0) {
|
22
22
|
div.hide();
|
23
23
|
first_li.addClass("closed");
|
@@ -2,20 +2,40 @@ require 'spec_helper'
|
|
2
2
|
Dir[File.expand_path('../../../features/support/factories/*.rb', __FILE__)].each{|factory| require factory}
|
3
3
|
|
4
4
|
describe BlogCategory do
|
5
|
-
|
5
|
+
before(:each) do
|
6
|
+
@attr = { :title => "RefineryCMS" }
|
7
|
+
end
|
6
8
|
|
7
|
-
|
8
|
-
|
9
|
+
describe "validations" do
|
10
|
+
it "requires title" do
|
11
|
+
BlogCategory.new(@attr.merge(:title => "")).should_not be_valid
|
9
12
|
end
|
10
13
|
|
11
|
-
it "
|
12
|
-
@
|
14
|
+
it "won't allow duplicate titles" do
|
15
|
+
BlogCategory.create!(@attr)
|
16
|
+
BlogCategory.new(@attr).should_not be_valid
|
13
17
|
end
|
18
|
+
end
|
14
19
|
|
15
|
-
|
16
|
-
|
20
|
+
describe "blog posts association" do
|
21
|
+
it "has a posts attribute" do
|
22
|
+
BlogCategory.new.should respond_to(:posts)
|
17
23
|
end
|
18
|
-
|
24
|
+
|
25
|
+
it "returns posts by published_at date in descending order" do
|
26
|
+
@category = BlogCategory.create!(@attr)
|
27
|
+
@first_post = @category.posts.create!({ :title => "Breaking News: Joe Sak is hot stuff you guys!!", :body => "True story.", :published_at => Time.now.yesterday })
|
28
|
+
@latest_post = @category.posts.create!({ :title => "parndt is p. okay", :body => "For a kiwi.", :published_at => Time.now })
|
29
|
+
@category.posts.first.should == @latest_post
|
30
|
+
end
|
31
|
+
|
19
32
|
end
|
20
33
|
|
34
|
+
describe "#post_count" do
|
35
|
+
it "returns post count in category" do
|
36
|
+
Factory(:post, :categories => [Factory(:blog_category)])
|
37
|
+
Factory(:post, :categories => [Factory(:blog_category)])
|
38
|
+
BlogCategory.first.post_count.should == 2
|
39
|
+
end
|
40
|
+
end
|
21
41
|
end
|