comfy_blog 1.1.1 → 1.12.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 (61) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -0
  3. data/README.md +3 -3
  4. data/app/controllers/{admin → comfy/admin}/blog/base_controller.rb +2 -2
  5. data/app/controllers/{admin → comfy/admin}/blog/blogs_controller.rb +1 -1
  6. data/app/controllers/{admin → comfy/admin}/blog/comments_controller.rb +1 -1
  7. data/app/controllers/{admin → comfy/admin}/blog/posts_controller.rb +2 -1
  8. data/app/controllers/{blog → comfy/blog}/base_controller.rb +1 -1
  9. data/app/controllers/{blog → comfy/blog}/comments_controller.rb +4 -4
  10. data/app/controllers/{blog → comfy/blog}/posts_controller.rb +1 -1
  11. data/app/models/{blog → comfy/blog}/blog.rb +4 -2
  12. data/app/models/{blog → comfy/blog}/comment.rb +2 -2
  13. data/app/models/{blog → comfy/blog}/post.rb +2 -2
  14. data/app/views/{admin → comfy/admin}/blog/blogs/_form.html.haml +2 -2
  15. data/app/views/{admin → comfy/admin}/blog/blogs/edit.html.haml +0 -0
  16. data/app/views/comfy/admin/blog/blogs/index.html.haml +26 -0
  17. data/app/views/{admin → comfy/admin}/blog/blogs/new.html.haml +0 -0
  18. data/app/views/comfy/admin/blog/comments/_comment.html.haml +17 -0
  19. data/app/views/{admin → comfy/admin}/blog/comments/index.html.haml +1 -1
  20. data/app/views/{admin → comfy/admin}/blog/comments/toggle_publish.js.erb +0 -0
  21. data/app/views/comfy/admin/blog/partials/_navigation.html.haml +6 -0
  22. data/app/views/{admin → comfy/admin}/blog/posts/_form.html.haml +4 -3
  23. data/app/views/{admin → comfy/admin}/blog/posts/edit.html.haml +0 -0
  24. data/app/views/comfy/admin/blog/posts/index.html.haml +32 -0
  25. data/app/views/{admin → comfy/admin}/blog/posts/new.html.haml +0 -0
  26. data/app/views/{blog → comfy/blog}/comments/_form.html.haml +1 -1
  27. data/app/views/{blog → comfy/blog}/posts/index.html.haml +1 -1
  28. data/app/views/{blog → comfy/blog}/posts/index.rss.builder +2 -2
  29. data/app/views/{blog → comfy/blog}/posts/show.html.haml +1 -1
  30. data/app/views/layouts/{blog → comfy/blog}/application.html.haml +0 -0
  31. data/comfy_blog.gemspec +2 -2
  32. data/config/application.rb +2 -0
  33. data/config/initializers/comfy_blog.rb +6 -3
  34. data/db/migrate/00_create_cms.rb +41 -39
  35. data/db/migrate/01_create_blog.rb +13 -13
  36. data/lib/comfy_blog/configuration.rb +7 -3
  37. data/lib/comfy_blog/engine.rb +2 -2
  38. data/lib/comfy_blog/routes/blog.rb +10 -8
  39. data/lib/comfy_blog/routes/blog_admin.rb +8 -6
  40. data/lib/comfy_blog/version.rb +1 -1
  41. data/lib/generators/comfy/blog/blog_generator.rb +1 -1
  42. data/test/controllers/{admin → comfy/admin}/blog/blogs_controller_test.rb +8 -8
  43. data/test/controllers/{admin → comfy/admin}/blog/comments_controller_test.rb +7 -7
  44. data/test/controllers/{admin → comfy/admin}/blog/posts_controller_test.rb +16 -8
  45. data/test/controllers/{blog → comfy/blog}/comments_controller_test.rb +8 -8
  46. data/test/controllers/{blog → comfy/blog}/posts_controller_test.rb +5 -5
  47. data/test/fixtures/{blog → comfy/blog}/blogs.yml +1 -1
  48. data/test/fixtures/{blog → comfy/blog}/comments.yml +0 -0
  49. data/test/fixtures/{blog → comfy/blog}/posts.yml +0 -0
  50. data/test/fixtures/{cms → comfy/cms}/sites.yml +0 -0
  51. data/test/generators/blog_generator_test.rb +1 -1
  52. data/test/lib/configuration_test.rb +4 -3
  53. data/test/models/{blog/blog_test.rb → blog_test.rb} +10 -10
  54. data/test/models/{blog/comments_test.rb → comments_test.rb} +9 -9
  55. data/test/models/{blog/posts_test.rb → posts_test.rb} +19 -19
  56. data/test/test_helper.rb +3 -2
  57. metadata +45 -46
  58. data/app/views/admin/blog/blogs/index.html.haml +0 -26
  59. data/app/views/admin/blog/comments/_comment.html.haml +0 -17
  60. data/app/views/admin/blog/partials/_navigation.html.haml +0 -6
  61. data/app/views/admin/blog/posts/index.html.haml +0 -32
@@ -1,22 +1,22 @@
1
- require_relative '../../test_helper'
1
+ require_relative '../test_helper'
2
2
 
3
3
  class BlogCommentsTest < ActiveSupport::TestCase
4
4
 
5
5
  def test_fixtures_validity
6
- Blog::Comment.all.each do |comment|
6
+ Comfy::Blog::Comment.all.each do |comment|
7
7
  assert comment.valid?, comment.errors.full_messages.to_s
8
8
  end
9
9
  end
10
10
 
11
11
  def test_validations
12
- comment = Blog::Comment.new
12
+ comment = Comfy::Blog::Comment.new
13
13
  assert comment.invalid?
14
14
  assert_errors_on comment, [:post_id, :content, :author, :email]
15
15
  end
16
16
 
17
17
  def test_creation
18
- assert_difference 'Blog::Comment.count' do
19
- comment = blog_posts(:default).comments.create(
18
+ assert_difference 'Comfy::Blog::Comment.count' do
19
+ comment = comfy_blog_posts(:default).comments.create(
20
20
  :content => 'Test Content',
21
21
  :author => 'Tester',
22
22
  :email => 'test@test.test'
@@ -28,7 +28,7 @@ class BlogCommentsTest < ActiveSupport::TestCase
28
28
  def test_creation_with_auto_publishing
29
29
  ComfyBlog.config.auto_publish_comments = true
30
30
 
31
- comment = blog_posts(:default).comments.create(
31
+ comment = comfy_blog_posts(:default).comments.create(
32
32
  :content => 'Test Content',
33
33
  :author => 'Tester',
34
34
  :email => 'test@test.test'
@@ -37,9 +37,9 @@ class BlogCommentsTest < ActiveSupport::TestCase
37
37
  end
38
38
 
39
39
  def test_scope_published
40
- assert_equal 1, Blog::Comment.published.count
41
- blog_comments(:default).update_attribute(:is_published, false)
42
- assert_equal 0, Blog::Comment.published.count
40
+ assert_equal 1, Comfy::Blog::Comment.published.count
41
+ comfy_blog_comments(:default).update_attribute(:is_published, false)
42
+ assert_equal 0, Comfy::Blog::Comment.published.count
43
43
  end
44
44
 
45
45
  end
@@ -1,23 +1,23 @@
1
- require_relative '../../test_helper'
1
+ require_relative '../test_helper'
2
2
 
3
3
  class BlogPostsTest < ActiveSupport::TestCase
4
4
 
5
5
  def test_fixtures_validity
6
- Blog::Post.all.each do |post|
6
+ Comfy::Blog::Post.all.each do |post|
7
7
  assert post.valid?, post.errors.full_messages.to_s
8
8
  end
9
9
  end
10
10
 
11
11
  def test_validations
12
- post = Blog::Post.new
12
+ post = Comfy::Blog::Post.new
13
13
  assert post.invalid?
14
14
  assert_errors_on post, :blog_id, :title, :slug, :content
15
15
  end
16
16
 
17
17
  def test_validation_of_slug_uniqueness
18
- old_post = blog_posts(:default)
18
+ old_post = comfy_blog_posts(:default)
19
19
  old_post.update_attributes!(:published_at => Time.now)
20
- post = blog_blogs(:default).posts.new(
20
+ post = comfy_blog_blogs(:default).posts.new(
21
21
  :title => old_post.title,
22
22
  :content => 'Test Content'
23
23
  )
@@ -29,8 +29,8 @@ class BlogPostsTest < ActiveSupport::TestCase
29
29
  end
30
30
 
31
31
  def test_creation
32
- assert_difference 'Blog::Post.count' do
33
- post = blog_blogs(:default).posts.create!(
32
+ assert_difference 'Comfy::Blog::Post.count' do
33
+ post = comfy_blog_blogs(:default).posts.create!(
34
34
  :title => 'Test Post',
35
35
  :content => 'Test Content'
36
36
  )
@@ -41,13 +41,13 @@ class BlogPostsTest < ActiveSupport::TestCase
41
41
  end
42
42
 
43
43
  def test_set_slug
44
- post = Blog::Post.new(:title => 'Test Title')
44
+ post = Comfy::Blog::Post.new(:title => 'Test Title')
45
45
  post.send(:set_slug)
46
46
  assert_equal 'test-title', post.slug
47
47
  end
48
48
 
49
49
  def test_set_date
50
- post = Blog::Post.new
50
+ post = Comfy::Blog::Post.new
51
51
  post.send(:set_published_at)
52
52
  post.send(:set_date)
53
53
  assert_equal post.published_at.year, post.year
@@ -55,34 +55,34 @@ class BlogPostsTest < ActiveSupport::TestCase
55
55
  end
56
56
 
57
57
  def test_set_published_at
58
- post = Blog::Post.new
58
+ post = Comfy::Blog::Post.new
59
59
  post.send(:set_published_at)
60
60
  assert post.published_at.present?
61
61
  end
62
62
 
63
63
  def test_destroy
64
- assert_difference ['Blog::Post.count', 'Blog::Comment.count'], -1 do
65
- blog_posts(:default).destroy
64
+ assert_difference ['Comfy::Blog::Post.count', 'Comfy::Blog::Comment.count'], -1 do
65
+ comfy_blog_posts(:default).destroy
66
66
  end
67
67
  end
68
68
 
69
69
  def test_scope_published
70
- post = blog_posts(:default)
70
+ post = comfy_blog_posts(:default)
71
71
  assert post.is_published?
72
- assert_equal 1, Blog::Post.published.count
72
+ assert_equal 1, Comfy::Blog::Post.published.count
73
73
 
74
74
  post.update_attribute(:is_published, false)
75
- assert_equal 0, Blog::Post.published.count
75
+ assert_equal 0, Comfy::Blog::Post.published.count
76
76
  end
77
77
 
78
78
  def test_scope_for_year
79
- assert_equal 1, Blog::Post.for_year(2012).count
80
- assert_equal 0, Blog::Post.for_year(2013).count
79
+ assert_equal 1, Comfy::Blog::Post.for_year(2012).count
80
+ assert_equal 0, Comfy::Blog::Post.for_year(2013).count
81
81
  end
82
82
 
83
83
  def test_scope_for_month
84
- assert_equal 1, Blog::Post.for_month(1).count
85
- assert_equal 0, Blog::Post.for_month(2).count
84
+ assert_equal 1, Comfy::Blog::Post.for_month(1).count
85
+ assert_equal 0, Comfy::Blog::Post.for_month(2).count
86
86
  end
87
87
 
88
88
  end
@@ -20,8 +20,9 @@ class ActiveSupport::TestCase
20
20
 
21
21
  def reset_config
22
22
  ComfyBlog.configure do |config|
23
- config.posts_per_page = 10
24
- config.auto_publish_comments = false
23
+ config.posts_per_page = 10
24
+ config.auto_publish_comments = false
25
+ config.default_author = nil
25
26
  end
26
27
  end
27
28
 
metadata CHANGED
@@ -1,30 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: comfy_blog
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleg Khabarov
8
- - The Working Group Inc
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-11-05 00:00:00.000000000 Z
11
+ date: 2014-05-04 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: comfortable_mexican_sofa
16
15
  requirement: !ruby/object:Gem::Requirement
17
16
  requirements:
18
- - - '>='
17
+ - - ~>
19
18
  - !ruby/object:Gem::Version
20
- version: 1.11.0
19
+ version: 1.12.0
21
20
  type: :runtime
22
21
  prerelease: false
23
22
  version_requirements: !ruby/object:Gem::Requirement
24
23
  requirements:
25
- - - '>='
24
+ - - ~>
26
25
  - !ruby/object:Gem::Version
27
- version: 1.11.0
26
+ version: 1.12.0
28
27
  description: Simple Blog Engine for ComfortableMexicanSofa
29
28
  email:
30
29
  - oleg@khabarov.ca
@@ -38,33 +37,33 @@ files:
38
37
  - LICENSE
39
38
  - README.md
40
39
  - Rakefile
41
- - app/controllers/admin/blog/base_controller.rb
42
- - app/controllers/admin/blog/blogs_controller.rb
43
- - app/controllers/admin/blog/comments_controller.rb
44
- - app/controllers/admin/blog/posts_controller.rb
45
- - app/controllers/blog/base_controller.rb
46
- - app/controllers/blog/comments_controller.rb
47
- - app/controllers/blog/posts_controller.rb
48
- - app/models/blog/blog.rb
49
- - app/models/blog/comment.rb
50
- - app/models/blog/post.rb
51
- - app/views/admin/blog/blogs/_form.html.haml
52
- - app/views/admin/blog/blogs/edit.html.haml
53
- - app/views/admin/blog/blogs/index.html.haml
54
- - app/views/admin/blog/blogs/new.html.haml
55
- - app/views/admin/blog/comments/_comment.html.haml
56
- - app/views/admin/blog/comments/index.html.haml
57
- - app/views/admin/blog/comments/toggle_publish.js.erb
58
- - app/views/admin/blog/partials/_navigation.html.haml
59
- - app/views/admin/blog/posts/_form.html.haml
60
- - app/views/admin/blog/posts/edit.html.haml
61
- - app/views/admin/blog/posts/index.html.haml
62
- - app/views/admin/blog/posts/new.html.haml
63
- - app/views/blog/comments/_form.html.haml
64
- - app/views/blog/posts/index.html.haml
65
- - app/views/blog/posts/index.rss.builder
66
- - app/views/blog/posts/show.html.haml
67
- - app/views/layouts/blog/application.html.haml
40
+ - app/controllers/comfy/admin/blog/base_controller.rb
41
+ - app/controllers/comfy/admin/blog/blogs_controller.rb
42
+ - app/controllers/comfy/admin/blog/comments_controller.rb
43
+ - app/controllers/comfy/admin/blog/posts_controller.rb
44
+ - app/controllers/comfy/blog/base_controller.rb
45
+ - app/controllers/comfy/blog/comments_controller.rb
46
+ - app/controllers/comfy/blog/posts_controller.rb
47
+ - app/models/comfy/blog/blog.rb
48
+ - app/models/comfy/blog/comment.rb
49
+ - app/models/comfy/blog/post.rb
50
+ - app/views/comfy/admin/blog/blogs/_form.html.haml
51
+ - app/views/comfy/admin/blog/blogs/edit.html.haml
52
+ - app/views/comfy/admin/blog/blogs/index.html.haml
53
+ - app/views/comfy/admin/blog/blogs/new.html.haml
54
+ - app/views/comfy/admin/blog/comments/_comment.html.haml
55
+ - app/views/comfy/admin/blog/comments/index.html.haml
56
+ - app/views/comfy/admin/blog/comments/toggle_publish.js.erb
57
+ - app/views/comfy/admin/blog/partials/_navigation.html.haml
58
+ - app/views/comfy/admin/blog/posts/_form.html.haml
59
+ - app/views/comfy/admin/blog/posts/edit.html.haml
60
+ - app/views/comfy/admin/blog/posts/index.html.haml
61
+ - app/views/comfy/admin/blog/posts/new.html.haml
62
+ - app/views/comfy/blog/comments/_form.html.haml
63
+ - app/views/comfy/blog/posts/index.html.haml
64
+ - app/views/comfy/blog/posts/index.rss.builder
65
+ - app/views/comfy/blog/posts/show.html.haml
66
+ - app/views/layouts/comfy/blog/application.html.haml
68
67
  - comfy_blog.gemspec
69
68
  - config.ru
70
69
  - config/application.rb
@@ -88,21 +87,21 @@ files:
88
87
  - lib/generators/comfy/blog/README
89
88
  - lib/generators/comfy/blog/blog_generator.rb
90
89
  - script/rails
91
- - test/controllers/admin/blog/blogs_controller_test.rb
92
- - test/controllers/admin/blog/comments_controller_test.rb
93
- - test/controllers/admin/blog/posts_controller_test.rb
94
- - test/controllers/blog/comments_controller_test.rb
95
- - test/controllers/blog/posts_controller_test.rb
96
- - test/fixtures/blog/blogs.yml
97
- - test/fixtures/blog/comments.yml
98
- - test/fixtures/blog/posts.yml
99
- - test/fixtures/cms/sites.yml
90
+ - test/controllers/comfy/admin/blog/blogs_controller_test.rb
91
+ - test/controllers/comfy/admin/blog/comments_controller_test.rb
92
+ - test/controllers/comfy/admin/blog/posts_controller_test.rb
93
+ - test/controllers/comfy/blog/comments_controller_test.rb
94
+ - test/controllers/comfy/blog/posts_controller_test.rb
95
+ - test/fixtures/comfy/blog/blogs.yml
96
+ - test/fixtures/comfy/blog/comments.yml
97
+ - test/fixtures/comfy/blog/posts.yml
98
+ - test/fixtures/comfy/cms/sites.yml
100
99
  - test/fixtures/generators/blog/routes.rb
101
100
  - test/generators/blog_generator_test.rb
102
101
  - test/lib/configuration_test.rb
103
- - test/models/blog/blog_test.rb
104
- - test/models/blog/comments_test.rb
105
- - test/models/blog/posts_test.rb
102
+ - test/models/blog_test.rb
103
+ - test/models/comments_test.rb
104
+ - test/models/posts_test.rb
106
105
  - test/test_helper.rb
107
106
  homepage: http://github.com/comfy/comfy-blog
108
107
  licenses:
@@ -1,26 +0,0 @@
1
- .page-header
2
- = link_to 'New Blog', new_admin_blog_path(@site), :class => 'btn pull-right'
3
- %h2 Blogs
4
-
5
- = paginate @blogs
6
-
7
- %table.table.table-hover.table-bordered
8
- - @blogs.each do |blog|
9
- %tr
10
- %td.main
11
- = link_to blog.label, edit_admin_blog_path(@site, blog)
12
- .item-meta
13
- = blog.identifier
14
- %br
15
- - blog_path = blog_posts_url(@site.path, blog.path)
16
- = link_to blog_path, blog_path, :target => '_blank'
17
- %td
18
- .btn-group
19
- = link_to pluralize(blog.posts.count, 'Post'), admin_blog_posts_path(@site, blog), :class => 'btn btn-small btn-inverse'
20
- = link_to pluralize(blog.comments.count, 'Comment'), admin_blog_comments_path(@site, blog), :class => 'btn btn-small btn-inverse'
21
- %td
22
- .btn-group
23
- = link_to 'Edit', edit_admin_blog_path(@site, blog), :class => 'btn btn-small'
24
- = link_to 'Delete', admin_blog_path(@site, blog), :method => :delete, :data => {:confirm => 'Are you sure?'}, :class => 'btn btn-small btn-danger'
25
-
26
- = paginate @blogs
@@ -1,17 +0,0 @@
1
- %tr{:id => dom_id(comment)}
2
- %td
3
- = link_to comment.post.title.truncate(25), admin_blog_comments_path(@site, @blog, :post_id => comment.post)
4
- %td.main
5
- = comment.author
6
- .item-meta
7
- = mail_to comment.email
8
- %br
9
- = comment.content
10
- %td
11
- = comment.created_at.to_s(:db)
12
- %td
13
- - label, css_class = comment.is_published?? ['Unpublish', 'btn-danger'] : ['Publish', 'btn-info']
14
- = link_to label, toggle_publish_admin_blog_comment_path(@site, @blog, comment), :method => :patch, :remote => true, :class => "btn btn-small #{css_class}"
15
- %td
16
- .btn-group
17
- = link_to 'Delete', admin_blog_comment_path(@site, @blog, comment), :method => :delete, :data => {:confirm => 'Are you sure?'}, :class => 'btn btn-small btn-danger'
@@ -1,6 +0,0 @@
1
- - if @site.present? && @site.persisted?
2
- %li= active_link_to 'Blogs', admin_blogs_path(@site)
3
- - if @blog.present? && @blog.persisted?
4
- %ul
5
- %li= active_link_to 'Posts', admin_blog_posts_path(@site, @blog)
6
- %li= active_link_to 'Comments', admin_blog_comments_path(@site, @blog)
@@ -1,32 +0,0 @@
1
- .page-header
2
- = link_to 'New Blog Post', new_admin_blog_post_path(@site, @blog), :class => 'btn pull-right'
3
- %h2 Blog Posts
4
-
5
- = paginate @posts
6
-
7
- %table.table.table-hover.table-bordered
8
- %tr
9
- %th.main Title
10
- %th Author
11
- %th Published
12
- %th Comments
13
- %th
14
-
15
- - @posts.each do |post|
16
- %tr
17
- %td.main
18
- = link_to post.title, edit_admin_blog_post_path(@site, @blog, post)
19
- .item-meta
20
- = post.excerpt
21
- %td
22
- = post.author
23
- %td
24
- = post.published_at.try(:to_s, :db)
25
- %td
26
- = link_to pluralize(post.comments.count, 'Comment'), admin_blog_comments_path(@site, @blog, :post_id => post.id), :class => 'btn btn-small btn-inverse'
27
- %td
28
- .btn-group
29
- = link_to 'Edit', edit_admin_blog_post_path(@site, @blog, post), :class => 'btn btn-small'
30
- = link_to 'Delete', admin_blog_post_path(@site, @blog, post), :method => :delete, :data => {:confirm => 'Are you sure?'}, :class => 'btn btn-small btn-danger'
31
-
32
- = paginate @posts