refinerycms-blog 1.3.2 → 1.4.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.
Files changed (39) hide show
  1. data/app/controllers/blog/posts_controller.rb +14 -1
  2. data/app/models/blog_post.rb +15 -9
  3. data/app/models/categorization.rb +2 -0
  4. data/app/views/admin/blog/posts/_form.html.erb +8 -1
  5. data/app/views/blog/posts/_post.html.erb +2 -4
  6. data/app/views/blog/posts/archive.html.erb +1 -2
  7. data/app/views/blog/posts/index.html.erb +1 -0
  8. data/app/views/blog/posts/show.html.erb +1 -0
  9. data/app/views/blog/posts/tagged.html.erb +22 -0
  10. data/app/views/blog/shared/_post.html.erb +7 -3
  11. data/app/views/blog/shared/_tags.html.erb +8 -0
  12. data/changelog.md +6 -1
  13. data/config/locales/cs.yml +128 -0
  14. data/config/locales/en.yml +5 -0
  15. data/config/locales/nb.yml +7 -0
  16. data/config/locales/nl.yml +120 -10
  17. data/config/locales/pt-BR.yml +3 -0
  18. data/config/locales/sk.yml +128 -0
  19. data/config/locales/zh-CN.yml +128 -0
  20. data/config/routes.rb +2 -1
  21. data/db/migrate/3_acts_as_taggable_on_migration.rb +28 -0
  22. data/db/migrate/4_create_seo_meta_for_blog.rb +25 -0
  23. data/db/seeds/refinerycms_blog.rb +18 -14
  24. data/features/authors.feature +4 -4
  25. data/features/support/factories/blog_categories.rb +2 -1
  26. data/features/support/factories/blog_comments.rb +2 -4
  27. data/features/support/factories/blog_posts.rb +3 -0
  28. data/features/support/step_definitions/tags_steps.rb +11 -0
  29. data/features/tags.feature +26 -0
  30. data/lib/gemspec.rb +12 -6
  31. data/lib/refinery/blog/version.rb +17 -0
  32. data/lib/refinerycms-blog.rb +10 -9
  33. data/readme.md +1 -1
  34. data/spec/models/blog_category_spec.rb +41 -0
  35. data/spec/models/{blog_comments_spec.rb → blog_comment_spec.rb} +0 -0
  36. data/spec/models/blog_post_spec.rb +187 -0
  37. metadata +53 -10
  38. data/spec/models/blog_categories_spec.rb +0 -41
  39. data/spec/models/blog_posts_spec.rb +0 -176
@@ -40,6 +40,8 @@ pt-BR:
40
40
  published_at: Data de publicação
41
41
  index:
42
42
  no_items_yet: 'Ainda não há Posts no Blog. Clique em "%{create}" para adicionar o primeiro post.'
43
+ uncategorized:
44
+ no_items_yet: 'Ainda não há posts sem categoria.'
43
45
  post:
44
46
  view_live_html: 'Ver este comentário <br/><em>(será aberto em outra janela)</em>'
45
47
  edit: Editar este post
@@ -67,6 +69,7 @@ pt-BR:
67
69
  title: Posts
68
70
  manage: Gerenciar posts
69
71
  new: Criar novo post
72
+ uncategorized: Posts sem categoria
70
73
  settings:
71
74
  title: Configurações
72
75
  moderation: Moderação
@@ -0,0 +1,128 @@
1
+ sk:
2
+ plugins:
3
+ refinerycms_blog:
4
+ title: Blog
5
+ admin:
6
+ blog:
7
+ categories:
8
+ category:
9
+ edit: Upraviť kategóriu
10
+ delete: Zmazať kategóriu
11
+ index:
12
+ no_items_yet: 'Niesu tu žiadne kategórie. Klikni "%{create}" pre pridanie prvej.'
13
+ comments:
14
+ approved: 'Komentár od "%{author}" bol schválený.'
15
+ comment:
16
+ view_live_html: 'Zobraziť živý náhľad <br/><em>(otvorí nové okno)</em>'
17
+ read: Zobraziť komentár
18
+ reject: Zamietnuť komentár
19
+ approve: Schváliť
20
+ rejected: 'Komentár od "%{author}" bol zamietnutý.'
21
+ index:
22
+ no_items_yet: 'Niesu tu žiadne %{type} komentáre.'
23
+ show:
24
+ comment: Komentár
25
+ blog_post: Blog článok
26
+ from: Odoslal
27
+ date: Dátum
28
+ message: Správa
29
+ details: Detaily
30
+ age: Vek
31
+ actions: Akcie
32
+ back: Späť na zoznam komentárov.
33
+ reject: Zamietnuť komentár
34
+ approve: Schváliť komentár
35
+ posts:
36
+ form:
37
+ advanced_options: Pokročilé nastavenia
38
+ toggle_advanced_options: Klikni pre prístup k nastaveniam meta tagov a menu
39
+ save_as_draft: Uložiť ako koncept
40
+ published_at: Dátum publikovania
41
+ index:
42
+ no_items_yet: 'Niesu žiadne články na blogu. Klikni na "%{create}" pre pridanie prvého.'
43
+ uncategorized:
44
+ no_items_yet: 'Niesu žiadne nekategorizované články.'
45
+ post:
46
+ view_live_html: 'Zobraziť článok<br/><em>(otvorí ho v novom okne)</em>'
47
+ edit: Upraviť článok
48
+ delete: Zmazať článok
49
+ settings:
50
+ notification_recipients:
51
+ value: Poslať notifikáciu pre
52
+ explanation: 'Vždy keď niekto pridá komentár, Refinery pošle notifikáciu.'
53
+ hint: 'Vždy keď niekto pridá komentár, Refinery ti pošle notifikáciu.'
54
+ example: "Zadaj tvoju emailovú adresu(y) ako napríklad: jack@work.com, jill@office.com"
55
+ updated: 'Zoznam príjemcov notifikácií "%{recipients}"'
56
+ submenu:
57
+ categories:
58
+ title: Kategórie
59
+ manage: Spravovať
60
+ new: Nová kategória
61
+ comments:
62
+ title: Komentáre
63
+ title_with_count: 'Komentáre (%{new_count} nových)'
64
+ new: Nový
65
+ unmoderated: Nový
66
+ approved: Schválený
67
+ rejected: Zamietnutý
68
+ posts:
69
+ title: Články
70
+ manage: Spravovať články
71
+ new: Vytvoriť nový článok
72
+ uncategorized: Nekategorizované články
73
+ settings:
74
+ title: Nastavenia
75
+ moderation: Moderovanie
76
+ update_notified: Upraviť zoznam notifikovaných
77
+ comments: Komentáre
78
+ blog:
79
+ comment_mailer:
80
+ notification:
81
+ greeting: Ahoj
82
+ you_recieved_new_comment: Máš nový komentár na stránke
83
+ comment_starts: --- začiatok komentára ---
84
+ comment_ends: --- koniec komentára ---
85
+ from: Od
86
+ email: Email
87
+ message: Správa
88
+ closing_line: S pozdravom
89
+ ps: 'P.S. Všetky komentáre su uložené v sekcii "Blog" pod záložkou "Komentáre" v prípade ak by ich bolo potrebné zobraziť neskôr.'
90
+ shared:
91
+ categories:
92
+ title: Kategórie
93
+ rss_feed:
94
+ title: RSS zdroj článkov
95
+ subscribe: Prihlásiť k odberu
96
+ posts:
97
+ other: Ďaľšie články
98
+ created_at: 'Publikovaný %{when}'
99
+ read_more: Celý článok
100
+ comments:
101
+ singular: komentár
102
+ none: Niesu tu žiadne komentáre
103
+ archives: Archív
104
+ categories:
105
+ show:
106
+ no_posts: Niesu tu žiadne články momentálne.
107
+ posts:
108
+ post:
109
+ filed_in: Podaný
110
+ comment: komentár
111
+ comments:
112
+ by: 'Odoslal %{who}'
113
+ time_ago: '%{time} späť'
114
+ thank_you: 'Vďaka za komentár.'
115
+ thank_you_moderated: 'Ďakujeme za Váš komentár. Vaša správa čaká na schválenie a objaví sa v najbližšej dobe.'
116
+ index:
117
+ no_blog_articles_yet: Práve niesu žiadne články na blogu. Zostante naladení.
118
+ show:
119
+ blog_home: Hlavná stránka blogu
120
+ comments:
121
+ title: Komentáre
122
+ add: Pridať komentár
123
+ other: Ďalšie články
124
+ filed_in: Podaný
125
+ submit: Odoslať komentár
126
+ archive:
127
+ blog_archive_for: 'Blog archív pre %{date}'
128
+ no_blog_articles_posted: 'Niesu žiadne články publikované %{date}.'
@@ -0,0 +1,128 @@
1
+ zh-CN:
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>(opens in a new window)</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
+ uncategorized:
44
+ no_items_yet: '没有未归类的博文。'
45
+ post:
46
+ view_live_html: '查看此博 <br/><em>(opens in a new window)</em>'
47
+ edit: 编辑此博
48
+ delete: 永久删除此博
49
+ settings:
50
+ notification_recipients:
51
+ value: 发送通知
52
+ explanation: '每次有人发表评论,发送邮件告知有新评论。'
53
+ hint: '增加新评论时,将会发送邮件告知您。'
54
+ example: "输入您的邮件地址,如: jack@work.com, jill@office.com"
55
+ updated: '通知收件人已被设为 "%{recipients}"'
56
+ submenu:
57
+ categories:
58
+ title: 分类
59
+ manage: 管理
60
+ new: 创建新的类别
61
+ comments:
62
+ title: 评论
63
+ title_with_count: '评论 (%{new_count} new)'
64
+ new: 新
65
+ unmoderated: 新
66
+ approved: 批准
67
+ rejected: 驳回
68
+ posts:
69
+ title: 博文
70
+ manage: 管理博文
71
+ new: 创建新博文
72
+ uncategorized: 未归类博文
73
+ settings:
74
+ title: 设置
75
+ moderation: 等待审核
76
+ update_notified: 更新获得通知的人
77
+ comments: 评论
78
+ blog:
79
+ comment_mailer:
80
+ notification:
81
+ greeting: 您好
82
+ you_recieved_new_comment: 您刚收到来自网站的一条新评论
83
+ comment_starts: --- 评论开始 ---
84
+ comment_ends: --- 评论结束 ---
85
+ from: 来自
86
+ email: 邮件
87
+ message: 信息
88
+ closing_line: 亲切问候
89
+ ps: 'P.S. All your comments are stored in the "Blog" section of Refinery under the "Comments" submenu should you ever want to view it later there.'
90
+ shared:
91
+ categories:
92
+ title: 分类
93
+ rss_feed:
94
+ title: RSS源
95
+ subscribe: 订阅
96
+ posts:
97
+ other: 其他博文
98
+ created_at: '发表于 %{when}'
99
+ read_more: 阅读更多
100
+ comments:
101
+ singular: 评论
102
+ none: 没有评论
103
+ archives: 档案
104
+ categories:
105
+ show:
106
+ no_posts: 此处没有文章。
107
+ posts:
108
+ post:
109
+ filed_in: 用户体验
110
+ comment: 评论
111
+ comments:
112
+ by: '发布由 %{who}'
113
+ time_ago: '%{time} 之前'
114
+ thank_you: '感谢您的评论。'
115
+ thank_you_moderated: '感谢您的评论。 您的信息已被列入等待审核队列,并会在短期内出现。'
116
+ index:
117
+ no_blog_articles_yet: 尚未发布文章。敬请关注。
118
+ show:
119
+ blog_home: 博客首页
120
+ comments:
121
+ title: 评论
122
+ add: 发表评论
123
+ other: 其他博文
124
+ filed_in: 用户体验
125
+ submit: 发送评论
126
+ archive:
127
+ blog_archive_for: '博客存档 %{date}'
128
+ no_blog_articles_posted: '没有发布文章 %{date}。敬请关注。'
@@ -1,4 +1,4 @@
1
- Refinery::Application.routes.draw do
1
+ ::Refinery::Application.routes.draw do
2
2
  scope(:path => 'blog', :module => 'blog') do
3
3
  root :to => 'posts#index', :as => 'blog_root'
4
4
  match 'feed.rss', :to => 'posts#index.rss', :as => 'blog_rss_feed'
@@ -6,6 +6,7 @@ Refinery::Application.routes.draw do
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
8
  get 'archive/:year(/:month)', :to => 'posts#archive', :as => 'archive_blog_posts'
9
+ get 'tagged/:tag_name' => 'posts#tagged', :as => 'tagged_posts'
9
10
  end
10
11
 
11
12
  scope(:path => 'refinery', :as => 'admin', :module => 'admin') do
@@ -0,0 +1,28 @@
1
+ class ActsAsTaggableOnMigration < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :tags do |t|
4
+ t.string :name
5
+ end
6
+
7
+ create_table :taggings do |t|
8
+ t.references :tag
9
+
10
+ # You should make sure that the column created is
11
+ # long enough to store the required class names.
12
+ t.references :taggable, :polymorphic => true
13
+ t.references :tagger, :polymorphic => true
14
+
15
+ t.string :context
16
+
17
+ t.datetime :created_at
18
+ end
19
+
20
+ add_index :taggings, :tag_id
21
+ add_index :taggings, [:taggable_id, :taggable_type, :context]
22
+ end
23
+
24
+ def self.down
25
+ drop_table :taggings
26
+ drop_table :tags
27
+ end
28
+ end
@@ -0,0 +1,25 @@
1
+ class CreateSeoMetaForBlog < ActiveRecord::Migration
2
+
3
+ def self.up
4
+ unless ::SeoMetum.table_exists?
5
+ create_table ::SeoMetum.table_name do |t|
6
+ t.integer :seo_meta_id
7
+ t.string :seo_meta_type
8
+
9
+ t.string :browser_title
10
+ t.string :meta_keywords
11
+ t.text :meta_description
12
+
13
+ t.timestamps
14
+ end
15
+
16
+ add_index ::SeoMetum.table_name, :id
17
+ add_index ::SeoMetum.table_name, [:seo_meta_id, :seo_meta_type]
18
+ end
19
+ end
20
+
21
+ def self.down
22
+ # can't drop the table because someone else might be using it.
23
+ end
24
+
25
+ end
@@ -1,16 +1,20 @@
1
- User.find(:all).each do |user|
2
- user.plugins.create(:name => "refinerycms_blog",
3
- :position => (user.plugins.maximum(:position) || -1) +1)
4
- end
1
+ ::User.find(:all).each do |user|
2
+ if user.plugins.where(:name => 'refinerycms_blog').blank?
3
+ user.plugins.create(:name => "refinerycms_blog",
4
+ :position => (user.plugins.maximum(:position) || -1) +1)
5
+ end
6
+ end if defined?(::User)
5
7
 
6
- page = Page.create(
7
- :title => "Blog",
8
- :link_url => "/blog",
9
- :deletable => false,
10
- :position => ((Page.maximum(:position, :conditions => {:parent_id => nil}) || -1)+1),
11
- :menu_match => "^/blogs?(\/|\/.+?|)$"
12
- )
8
+ if defined?(::Page)
9
+ page = ::Page.create(
10
+ :title => "Blog",
11
+ :link_url => "/blog",
12
+ :deletable => false,
13
+ :position => ((Page.maximum(:position, :conditions => {:parent_id => nil}) || -1)+1),
14
+ :menu_match => "^/blogs?(\/|\/.+?|)$"
15
+ )
13
16
 
14
- Page.default_parts.each do |default_page_part|
15
- page.parts.create(:title => default_page_part, :body => nil)
16
- end
17
+ ::Page.default_parts.each do |default_page_part|
18
+ page.parts.create(:title => default_page_part, :body => nil)
19
+ end
20
+ end
@@ -1,15 +1,15 @@
1
- @blog
1
+ @blog @blog_authors
2
2
  Feature: Blog Post Authors
3
3
  Blog posts can be assigned authors through the given user model
4
4
  current_user is assumed through admin screens
5
-
5
+
6
6
  Scenario: Saving a blog post in blog_posts#new associates the current_user as the author
7
7
  Given I am a logged in refinery user
8
-
8
+
9
9
  When I am on the new blog post form
10
10
  And I fill in "Title" with "This is my blog post"
11
11
  And I fill in "Body" with "And I love it"
12
12
  And I press "Save"
13
-
13
+
14
14
  Then there should be 1 blog post
15
15
  And the blog post should belong to me
@@ -1,4 +1,5 @@
1
+ require 'factory_girl'
2
+
1
3
  Factory.define(:blog_category) do |f|
2
4
  f.sequence(:title) { |n| "Shopping #{n}" }
3
- f.posts {|p| [p.association(:post)]}
4
5
  end
@@ -1,10 +1,8 @@
1
- Factory.sequence :email do |n|
2
- "person#{n}@example.com"
3
- end
1
+ require 'factory_girl'
4
2
 
5
3
  Factory.define(:blog_comment) do |f|
6
4
  f.name "Joe Commenter"
7
- f.email { Factory.next(:email) }
5
+ f.sequence(:email) { |n| "person#{n}@example.com" }
8
6
  f.body "Which one is the best for picking up new shoes?"
9
7
  f.association :post
10
8
  end
@@ -1,6 +1,9 @@
1
+ require 'factory_girl'
2
+
1
3
  Factory.define(:post, :class => BlogPost) do |f|
2
4
  f.sequence(:title) { |n| "Top #{n} Shopping Centers in Chicago" }
3
5
  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
6
  f.draft false
7
+ f.tag_list "chicago, shopping, fun times"
5
8
  f.published_at Time.now
6
9
  end
@@ -0,0 +1,11 @@
1
+ Given /^there is a blog post titled "([^"]*)" and tagged "([^"]*)"$/ do |title, tag_name|
2
+ @blog_post = Factory(:post, :title => title, :tag_list => tag_name)
3
+ end
4
+
5
+ When /^I visit the tagged posts page for "([^"]*)"$/ do |tag_name|
6
+ visit tagged_posts_path(tag_name.parameterize)
7
+ end
8
+
9
+ Then /^the blog post should have the tags "([^"]*)"$/ do |tag_list|
10
+ BlogPost.last.tag_list == tag_list.split(', ')
11
+ end
@@ -0,0 +1,26 @@
1
+ @blog @blog_tags
2
+ Feature: Blog Post Tags
3
+ Blog posts can be assigned tags
4
+
5
+ Background:
6
+ Given I am a logged in refinery user
7
+
8
+ Scenario: The blog post new/edit form has tag_list
9
+ When I am on the new blog post form
10
+ Then I should see "Tags"
11
+
12
+ Scenario: The blog post new/edit form saves tag_list
13
+ When I am on the new blog post form
14
+ And I fill in "Title" with "This is my blog post"
15
+ And I fill in "Body" with "And I love it"
16
+ And I fill in "Tags" with "chicago, bikes, beers, babes"
17
+ And I press "Save"
18
+
19
+ Then there should be 1 blog post
20
+ And the blog post should have the tags "chicago, bikes, beers, babes"
21
+
22
+ Scenario: The blog has a "tagged" route & view
23
+ Given there is a blog post titled "I love my city" and tagged "chicago"
24
+ When I visit the tagged posts page for "chicago"
25
+ Then I should see "Chicago"
26
+ And I should see "I love my city"