comfy_blog 1.12.3 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +5 -15
  3. data/Gemfile +7 -6
  4. data/LICENSE +1 -1
  5. data/README.md +14 -9
  6. data/Rakefile +1 -32
  7. data/app/controllers/comfy/admin/blog/posts_controller.rb +26 -22
  8. data/app/controllers/comfy/blog/posts_controller.rb +31 -38
  9. data/app/models/comfy/blog/post.rb +34 -36
  10. data/app/views/comfy/admin/blog/partials/_navigation.html.haml +4 -6
  11. data/app/views/comfy/admin/blog/posts/_form.html.haml +23 -11
  12. data/app/views/comfy/admin/blog/posts/edit.html.haml +2 -2
  13. data/app/views/comfy/admin/blog/posts/index.html.haml +29 -25
  14. data/app/views/comfy/admin/blog/posts/new.html.haml +2 -2
  15. data/app/views/comfy/blog/posts/index.html.haml +25 -10
  16. data/app/views/comfy/blog/posts/index.rss.builder +12 -12
  17. data/app/views/layouts/comfy/blog/application.html.erb +22 -0
  18. data/comfy_blog.gemspec +3 -1
  19. data/config/application.rb +13 -7
  20. data/config/blog_routes.rb +2 -2
  21. data/config/environments/development.rb +37 -4
  22. data/config/environments/test.rb +13 -4
  23. data/config/initializers/comfy_blog.rb +3 -7
  24. data/config/locales/cs.yml +38 -0
  25. data/config/locales/da.yml +38 -0
  26. data/config/locales/de.yml +38 -0
  27. data/config/locales/en.yml +38 -0
  28. data/config/locales/es.yml +38 -0
  29. data/config/locales/fr.yml +38 -0
  30. data/config/locales/it.yml +38 -0
  31. data/config/locales/ja.yml +38 -0
  32. data/config/locales/nb.yml +38 -0
  33. data/config/locales/nl.yml +38 -0
  34. data/config/locales/pl.yml +38 -0
  35. data/config/locales/pt-BR.yml +38 -0
  36. data/config/locales/ru.yml +38 -0
  37. data/config/locales/sv.yml +38 -0
  38. data/config/locales/tr.yml +38 -0
  39. data/config/locales/uk.yml +38 -0
  40. data/config/locales/zh-CN.yml +38 -0
  41. data/config/locales/zh-TW.yml +38 -0
  42. data/config/storage.yml +35 -0
  43. data/db/migrate/00_create_cms.rb +144 -116
  44. data/db/migrate/01_create_blog.rb +15 -43
  45. data/lib/comfy_blog/configuration.rb +9 -9
  46. data/lib/comfy_blog/engine.rb +7 -7
  47. data/lib/comfy_blog/routes/blog.rb +12 -13
  48. data/lib/comfy_blog/routes/blog_admin.rb +7 -12
  49. data/lib/comfy_blog/version.rb +1 -1
  50. data/lib/generators/comfy/blog/blog_generator.rb +16 -14
  51. data/test/controllers/comfy/admin/blog/posts_controller_test.rb +83 -59
  52. data/test/controllers/comfy/blog/posts_controller_test.rb +56 -42
  53. data/test/fixtures/comfy/blog/posts.yml +3 -4
  54. data/test/fixtures/comfy/cms/layouts.yml +10 -0
  55. data/test/fixtures/comfy/cms/sites.yml +1 -1
  56. data/test/fixtures/generators/blog/routes.rb +2 -3
  57. data/test/gemfiles/Gemfile.rails.5.2 +22 -0
  58. data/test/generators/blog_generator_test.rb +7 -7
  59. data/test/integration/i18n_test.rb +37 -0
  60. data/test/lib/configuration_test.rb +4 -5
  61. data/test/models/posts_test.rb +35 -30
  62. data/test/test_helper.rb +40 -29
  63. metadata +29 -35
  64. data/app/controllers/comfy/admin/blog/base_controller.rb +0 -12
  65. data/app/controllers/comfy/admin/blog/blogs_controller.rb +0 -51
  66. data/app/controllers/comfy/admin/blog/comments_controller.rb +0 -33
  67. data/app/controllers/comfy/blog/base_controller.rb +0 -33
  68. data/app/controllers/comfy/blog/comments_controller.rb +0 -33
  69. data/app/models/comfy/blog/blog.rb +0 -31
  70. data/app/models/comfy/blog/comment.rb +0 -29
  71. data/app/views/comfy/admin/blog/blogs/_form.html.haml +0 -11
  72. data/app/views/comfy/admin/blog/blogs/edit.html.haml +0 -5
  73. data/app/views/comfy/admin/blog/blogs/index.html.haml +0 -26
  74. data/app/views/comfy/admin/blog/blogs/new.html.haml +0 -5
  75. data/app/views/comfy/admin/blog/comments/_comment.html.haml +0 -17
  76. data/app/views/comfy/admin/blog/comments/index.html.haml +0 -17
  77. data/app/views/comfy/admin/blog/comments/toggle_publish.js.erb +0 -1
  78. data/app/views/comfy/blog/comments/_form.html.haml +0 -10
  79. data/app/views/comfy/blog/posts/show.html.haml +0 -18
  80. data/app/views/layouts/comfy/blog/application.html.haml +0 -7
  81. data/config/initializers/secret_token.rb +0 -15
  82. data/test/controllers/comfy/admin/blog/blogs_controller_test.rb +0 -94
  83. data/test/controllers/comfy/admin/blog/comments_controller_test.rb +0 -57
  84. data/test/controllers/comfy/blog/comments_controller_test.rb +0 -36
  85. data/test/fixtures/comfy/blog/blogs.yml +0 -7
  86. data/test/fixtures/comfy/blog/comments.yml +0 -6
  87. data/test/gemfiles/Gemfile.rails.4.0 +0 -10
  88. data/test/gemfiles/Gemfile.rails.4.1 +0 -10
  89. data/test/gemfiles/Gemfile.rails.4.2 +0 -10
  90. data/test/gemfiles/Gemfile.rails.master +0 -10
  91. data/test/models/blog_test.rb +0 -59
  92. data/test/models/comments_test.rb +0 -45
@@ -1,57 +0,0 @@
1
- require_relative '../../../../test_helper'
2
-
3
- class Comfy::Admin::Blog::CommentsControllerTest < ActionController::TestCase
4
-
5
- def setup
6
- @site = comfy_cms_sites(:default)
7
- @blog = comfy_blog_blogs(:default)
8
- @post = comfy_blog_posts(:default)
9
- @comment = comfy_blog_comments(:default)
10
- end
11
-
12
- def test_get_index
13
- get :index, :site_id => @site, :blog_id => @blog
14
- assert_response :success
15
- assert_template :index
16
- assert assigns(:comments)
17
- assert !assigns(:post)
18
- end
19
-
20
- def test_get_index_for_post
21
- get :index, :site_id => @site, :blog_id => @blog, :post_id => @post
22
- assert_response :success
23
- assert_template :index
24
- assert assigns(:post)
25
- assert assigns(:comments)
26
- end
27
-
28
- def test_publish
29
- assert @comment.is_published?
30
- xhr :patch, :toggle_publish, :site_id => @site, :blog_id => @blog, :id => @comment
31
- assert_response :success
32
- @comment.reload
33
- assert !@comment.is_published?
34
-
35
- xhr :patch, :toggle_publish, :site_id => @site, :blog_id => @blog, :id => @comment
36
- assert_response :success
37
- @comment.reload
38
- assert @comment.is_published?
39
- end
40
-
41
- def test_destroy
42
- assert_difference 'Comfy::Blog::Comment.count', -1 do
43
- delete :destroy, :site_id => @site, :blog_id => @blog, :id => @comment
44
- assert_response :redirect
45
- assert_redirected_to :action => :index
46
- assert_equal 'Comment deleted', flash[:success]
47
- end
48
- end
49
-
50
- def test_destroy_failure
51
- delete :destroy, :site_id => @site, :blog_id => @blog, :id => 'invalid'
52
- assert_response :redirect
53
- assert_redirected_to :action => :index
54
- assert_equal 'Comment not found', flash[:error]
55
- end
56
-
57
- end
@@ -1,36 +0,0 @@
1
- require_relative '../../../test_helper'
2
-
3
- class Comfy::Blog::CommentsControllerTest < ActionController::TestCase
4
-
5
- def setup
6
- @blog = comfy_blog_blogs(:default)
7
- @post = comfy_blog_posts(:default)
8
- end
9
-
10
- def test_creation
11
- assert_difference 'Comfy::Blog::Comment.count' do
12
- post :create, :slug => @post.slug, :comment => {
13
- :author => 'Test',
14
- :email => 'test@test.test',
15
- :content => 'Test Content'
16
- }
17
- assert_response :redirect
18
- assert_redirected_to comfy_blog_post_path
19
- assert_equal 'Comment created', flash[:success]
20
-
21
- comment = Comfy::Blog::Comment.last
22
- assert_equal 'Test', comment.author
23
- assert_equal @post, comment.post
24
- end
25
- end
26
-
27
- def test_creation_failure
28
- assert_no_difference 'Comfy::Blog::Comment.count' do
29
- post :create, :slug => @post.slug, :comment => { }
30
- assert_response :success
31
- assert_template :show
32
- assert_equal 'Failed to create Comment', flash[:error]
33
- end
34
- end
35
-
36
- end
@@ -1,7 +0,0 @@
1
- default:
2
- site: default
3
- label: Default Blog
4
- identifier: default-blog
5
- path:
6
- app_layout: comfy/blog/application
7
- description: Default Description
@@ -1,6 +0,0 @@
1
- default:
2
- post: default
3
- author: Default Name
4
- email: default@test.test
5
- content: Default Content
6
- is_published: true
@@ -1,10 +0,0 @@
1
- source 'http://rubygems.org'
2
-
3
- gem 'rails', '~> 4.0.0'
4
- gem 'comfortable_mexican_sofa'
5
- gem 'kaminari', '>= 0.16.1'
6
-
7
- group :test do
8
- gem 'sqlite3'
9
- gem 'coveralls', :require => false
10
- end
@@ -1,10 +0,0 @@
1
- source 'http://rubygems.org'
2
-
3
- gem 'rails', '~> 4.1.0'
4
- gem 'comfortable_mexican_sofa'
5
- gem 'kaminari', '>= 0.16.1'
6
-
7
- group :test do
8
- gem 'sqlite3'
9
- gem 'coveralls', :require => false
10
- end
@@ -1,10 +0,0 @@
1
- source 'http://rubygems.org'
2
-
3
- gem 'rails', '~> 4.2.0'
4
- gem 'comfortable_mexican_sofa'
5
- gem 'kaminari', '>= 0.16.1'
6
-
7
- group :test do
8
- gem 'sqlite3'
9
- gem 'coveralls', :require => false
10
- end
@@ -1,10 +0,0 @@
1
- source 'http://rubygems.org'
2
-
3
- gem 'rails', :github => 'rails/rails'
4
- gem 'comfortable_mexican_sofa'
5
- gem 'kaminari', '>= 0.16.1'
6
-
7
- group :test do
8
- gem 'sqlite3'
9
- gem 'coveralls', :require => false
10
- end
@@ -1,59 +0,0 @@
1
- require_relative '../test_helper'
2
-
3
- class BlogTest < ActiveSupport::TestCase
4
-
5
- def test_site_association
6
- assert_equal [comfy_blog_blogs(:default)], comfy_cms_sites(:default).blogs
7
- end
8
-
9
- def test_fixtures_validity
10
- Comfy::Blog::Blog.all.each do |blog|
11
- assert blog.valid?, blog.errors.inspect
12
- end
13
- end
14
-
15
- def test_validation
16
- blog = Comfy::Blog::Blog.new
17
- assert blog.invalid?
18
- assert_errors_on blog, :site_id, :label, :identifier, :path
19
- end
20
-
21
- def test_validation_path_presence
22
- blog_a = comfy_blog_blogs(:default)
23
- refute blog_a.path.present?
24
-
25
- blog_b = comfy_cms_sites(:default).blogs.new(
26
- :label => 'Test Blog A',
27
- :identifier => 'test-blog-a'
28
- )
29
- assert blog_b.invalid?
30
- assert_errors_on blog_b, :path
31
-
32
- blog_a.update_column(:path, 'blog-a')
33
- assert blog_b.invalid?
34
- assert_errors_on blog_b, :path
35
-
36
- blog_b.path = 'blog-a'
37
- assert blog_b.invalid?
38
- assert_errors_on blog_b, :path
39
-
40
- blog_b.path = 'blog-b'
41
- assert blog_b.valid?
42
- end
43
-
44
- def test_creation
45
- assert_difference 'Comfy::Blog::Blog.count' do
46
- comfy_cms_sites(:default).blogs.create(
47
- :label => 'Test Blog',
48
- :identifier => 'test-blog',
49
- :path => 'test-blog'
50
- )
51
- end
52
- end
53
-
54
- def test_destroy
55
- assert_difference ['Comfy::Blog::Blog.count', 'Comfy::Blog::Post.count'], -1 do
56
- comfy_blog_blogs(:default).destroy
57
- end
58
- end
59
- end
@@ -1,45 +0,0 @@
1
- require_relative '../test_helper'
2
-
3
- class BlogCommentsTest < ActiveSupport::TestCase
4
-
5
- def test_fixtures_validity
6
- Comfy::Blog::Comment.all.each do |comment|
7
- assert comment.valid?, comment.errors.full_messages.to_s
8
- end
9
- end
10
-
11
- def test_validations
12
- comment = Comfy::Blog::Comment.new
13
- assert comment.invalid?
14
- assert_errors_on comment, [:post_id, :content, :author, :email]
15
- end
16
-
17
- def test_creation
18
- assert_difference 'Comfy::Blog::Comment.count' do
19
- comment = comfy_blog_posts(:default).comments.create(
20
- :content => 'Test Content',
21
- :author => 'Tester',
22
- :email => 'test@test.test'
23
- )
24
- assert !comment.is_published?
25
- end
26
- end
27
-
28
- def test_creation_with_auto_publishing
29
- ComfyBlog.config.auto_publish_comments = true
30
-
31
- comment = comfy_blog_posts(:default).comments.create(
32
- :content => 'Test Content',
33
- :author => 'Tester',
34
- :email => 'test@test.test'
35
- )
36
- assert comment.is_published?
37
- end
38
-
39
- def test_scope_published
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
- end
44
-
45
- end