the_comments 2.2.2 → 2.3.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.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +104 -20
  3. data/app/assets/javascripts/the_comments.js.coffee +7 -6
  4. data/app/assets/stylesheets/the_comments.css.scss +11 -8
  5. data/app/controllers/concerns/{controller.rb → the_comments/controller.rb} +29 -48
  6. data/app/controllers/concerns/the_comments/view_token.rb +20 -0
  7. data/app/models/concerns/{comment.rb → the_comments/comment.rb} +22 -9
  8. data/app/models/concerns/{comment_states.rb → the_comments/comment_states.rb} +2 -8
  9. data/app/models/concerns/{commentable.rb → the_comments/commentable.rb} +0 -0
  10. data/app/models/concerns/{user.rb → the_comments/user.rb} +6 -2
  11. data/app/views/the_comments/haml/_additional_info.html.haml +1 -1
  12. data/app/views/the_comments/haml/_comment_body.html.haml +7 -2
  13. data/app/views/the_comments/haml/_comment_edit.html.haml +1 -1
  14. data/app/views/the_comments/haml/_form.html.haml +4 -23
  15. data/app/views/the_comments/haml/_guest_form.html.haml +22 -0
  16. data/app/views/the_comments/haml/_logined_form.html.haml +18 -0
  17. data/app/views/the_comments/haml/_manage_controls.html.haml +20 -17
  18. data/app/views/the_comments/haml/_sidebar.html.haml +6 -25
  19. data/app/views/the_comments/haml/_sidebar_admin.html.haml +12 -0
  20. data/app/views/the_comments/haml/_sidebar_backlink.html.haml +3 -0
  21. data/app/views/the_comments/haml/_sidebar_user.html.haml +29 -0
  22. data/app/views/the_comments/haml/_tree.html.haml +13 -1
  23. data/app/views/the_comments/haml/manage.html.haml +8 -7
  24. data/app/views/the_comments/slim/_comment_body.html.slim +5 -1
  25. data/app/views/the_comments/slim/_form.html.slim +4 -23
  26. data/app/views/the_comments/slim/_guest_form.html.slim +22 -0
  27. data/app/views/the_comments/slim/_logined_form.html.slim +18 -0
  28. data/app/views/the_comments/slim/_manage_controls.html.slim +19 -16
  29. data/app/views/the_comments/slim/_sidebar.html.slim +6 -25
  30. data/app/views/the_comments/slim/_sidebar_admin.html.slim +12 -0
  31. data/app/views/the_comments/slim/_sidebar_backlink.html.slim +3 -0
  32. data/app/views/the_comments/slim/_sidebar_user.html.slim +29 -0
  33. data/app/views/the_comments/slim/_tree.html.slim +13 -1
  34. data/app/views/the_comments/slim/index.html.slim +2 -2
  35. data/app/views/the_comments/slim/manage.html.slim +7 -6
  36. data/config/initializers/the_comments.rb +0 -1
  37. data/config/locales/ru.yml +14 -10
  38. data/config/routes.rb +4 -2
  39. data/docs/whats_wrong_with_other_gems.md +13 -13
  40. data/docs/where_is_example_application.md +3 -3
  41. data/gem_version.rb +2 -2
  42. data/lib/the_comments.rb +26 -7
  43. data/lib/the_comments/config.rb +1 -4
  44. data/spec/dummy_app/Gemfile +2 -2
  45. data/spec/dummy_app/config/routes.rb +1 -0
  46. data/spec/dummy_app/spec/models/user_counters_spec.rb +5 -5
  47. data/the_comments.gemspec +3 -2
  48. data/views_converter.rb +2 -2
  49. metadata +49 -26
  50. data/app/views/the_comments/haml/index.html.haml +0 -18
  51. data/app/views/the_comments/haml/my_comments.html.haml +0 -28
@@ -10,6 +10,7 @@ App::Application.routes.draw do
10
10
  post "sessions" => "sessions#create", as: :sessions
11
11
 
12
12
  resources :posts
13
+ resources :users
13
14
 
14
15
  # TheComments routes
15
16
  concern :user_comments, TheComments::UserRoutes.new
@@ -142,7 +142,7 @@ describe User do
142
142
  context "Written by me counters" do
143
143
  after(:all) { destroy_all }
144
144
  before(:all){ create_users_and_post }
145
- it 'should has correct My counters values' do
145
+ it 'should has correct My counters values' do
146
146
  @comment = Comment.create!(
147
147
  user: @user,
148
148
  commentable: @post,
@@ -280,7 +280,7 @@ describe User do
280
280
 
281
281
  my_comments_count_assert @post_holder, 0
282
282
  comments_count_assert @post_holder, [0,0,0]
283
-
283
+
284
284
  comcoms_count_assert @post_holder, [0,9,0]
285
285
  comcoms_counters_assert @post_holder, [0,9,0]
286
286
 
@@ -304,7 +304,7 @@ describe User do
304
304
 
305
305
  my_comments_count_assert @post_holder, 0
306
306
  comments_count_assert @post_holder, [0,0,0]
307
-
307
+
308
308
  comcoms_count_assert @post_holder, [0,5,4]
309
309
  comcoms_counters_assert @post_holder, [0,5,4]
310
310
 
@@ -332,8 +332,8 @@ describe User do
332
332
  # end
333
333
  # end
334
334
 
335
- # it 'has correct counters after comment destroy' do
335
+ # it 'has correct counters after comment destroy' do
336
336
  # pending("has correct counters after comment destroy")
337
337
  # end
338
338
  end
339
- end
339
+ end
@@ -17,8 +17,9 @@ Gem::Specification.new do |gem|
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ["lib"]
19
19
 
20
- gem.add_dependency 'state_machine'
21
- gem.add_dependency 'the_sortable_tree'
20
+ gem.add_dependency 'state_machine', '~> 1.2.0'
21
+ gem.add_dependency 'the_sortable_tree', '~> 2.5.0'
22
+ gem.add_dependency 'the_simple_sort', '~> 0.0.2'
22
23
 
23
24
  # gem.add_dependency 'rails', '>= 4.0'
24
25
  end
@@ -1,4 +1,4 @@
1
- # gem install haml2slim --nori --nordoc
1
+ # gem install haml2slim --no-ri --no-rdoc
2
2
  # ruby views_converter.rb
3
3
 
4
4
  from = "./app/views/the_comments/haml"
@@ -13,4 +13,4 @@ Dir.glob("#{to}/*.slim") do |slim_file|
13
13
  file = File.open slim_file, "w"
14
14
  file.write content
15
15
  file.close
16
- end
16
+ end
metadata CHANGED
@@ -1,55 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: the_comments
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2
4
+ version: 2.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ilya N. Zykin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-04 00:00:00.000000000 Z
11
+ date: 2016-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: state_machine
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 1.2.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 1.2.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: the_sortable_tree
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: 2.5.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
41
- description: ' Comments with threading for Rails 4 '
40
+ version: 2.5.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: the_simple_sort
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.0.2
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.0.2
55
+ description: " Comments with threading for Rails 4 "
42
56
  email:
43
57
  - zykin-ilya@ya.ru
44
58
  executables: []
45
59
  extensions: []
46
60
  extra_rdoc_files: []
47
61
  files:
48
- - .gitignore
49
- - .ruby-gemset.example
50
- - .ruby-version.example
51
- - .rvmrc.example
52
- - .travis.yml
62
+ - ".gitignore"
63
+ - ".ruby-gemset.example"
64
+ - ".ruby-version.example"
65
+ - ".rvmrc.example"
66
+ - ".travis.yml"
53
67
  - Gemfile
54
68
  - LICENSE.txt
55
69
  - README.md
@@ -58,32 +72,41 @@ files:
58
72
  - app/assets/javascripts/the_comments_manage.js.coffee
59
73
  - app/assets/stylesheets/the_comments.css.scss
60
74
  - app/controllers/_templates_/comments_controller.rb
61
- - app/controllers/concerns/controller.rb
75
+ - app/controllers/concerns/the_comments/controller.rb
76
+ - app/controllers/concerns/the_comments/view_token.rb
62
77
  - app/helpers/render_comments_tree_helper.rb
63
78
  - app/models/_templates_/comment.rb
64
- - app/models/concerns/comment.rb
65
- - app/models/concerns/comment_states.rb
66
- - app/models/concerns/commentable.rb
67
- - app/models/concerns/user.rb
79
+ - app/models/concerns/the_comments/comment.rb
80
+ - app/models/concerns/the_comments/comment_states.rb
81
+ - app/models/concerns/the_comments/commentable.rb
82
+ - app/models/concerns/the_comments/user.rb
68
83
  - app/views/the_comments/_tree.html.erb
69
84
  - app/views/the_comments/haml/_additional_info.html.haml
70
85
  - app/views/the_comments/haml/_comment.html.haml
71
86
  - app/views/the_comments/haml/_comment_body.html.haml
72
87
  - app/views/the_comments/haml/_comment_edit.html.haml
73
88
  - app/views/the_comments/haml/_form.html.haml
89
+ - app/views/the_comments/haml/_guest_form.html.haml
90
+ - app/views/the_comments/haml/_logined_form.html.haml
74
91
  - app/views/the_comments/haml/_manage_controls.html.haml
75
92
  - app/views/the_comments/haml/_sidebar.html.haml
93
+ - app/views/the_comments/haml/_sidebar_admin.html.haml
94
+ - app/views/the_comments/haml/_sidebar_backlink.html.haml
95
+ - app/views/the_comments/haml/_sidebar_user.html.haml
76
96
  - app/views/the_comments/haml/_tree.html.haml
77
- - app/views/the_comments/haml/index.html.haml
78
97
  - app/views/the_comments/haml/manage.html.haml
79
- - app/views/the_comments/haml/my_comments.html.haml
80
98
  - app/views/the_comments/slim/_additional_info.html.slim
81
99
  - app/views/the_comments/slim/_comment.html.slim
82
100
  - app/views/the_comments/slim/_comment_body.html.slim
83
101
  - app/views/the_comments/slim/_comment_edit.html.slim
84
102
  - app/views/the_comments/slim/_form.html.slim
103
+ - app/views/the_comments/slim/_guest_form.html.slim
104
+ - app/views/the_comments/slim/_logined_form.html.slim
85
105
  - app/views/the_comments/slim/_manage_controls.html.slim
86
106
  - app/views/the_comments/slim/_sidebar.html.slim
107
+ - app/views/the_comments/slim/_sidebar_admin.html.slim
108
+ - app/views/the_comments/slim/_sidebar_backlink.html.slim
109
+ - app/views/the_comments/slim/_sidebar_user.html.slim
87
110
  - app/views/the_comments/slim/_tree.html.slim
88
111
  - app/views/the_comments/slim/index.html.slim
89
112
  - app/views/the_comments/slim/manage.html.slim
@@ -215,17 +238,17 @@ require_paths:
215
238
  - lib
216
239
  required_ruby_version: !ruby/object:Gem::Requirement
217
240
  requirements:
218
- - - '>='
241
+ - - ">="
219
242
  - !ruby/object:Gem::Version
220
243
  version: '0'
221
244
  required_rubygems_version: !ruby/object:Gem::Requirement
222
245
  requirements:
223
- - - '>='
246
+ - - ">="
224
247
  - !ruby/object:Gem::Version
225
248
  version: '0'
226
249
  requirements: []
227
250
  rubyforge_project:
228
- rubygems_version: 2.1.11
251
+ rubygems_version: 2.5.0
229
252
  signing_key:
230
253
  specification_version: 4
231
254
  summary: the_comments by the-teacher
@@ -1,18 +0,0 @@
1
- - content_for :title do
2
- = t "the_comments.management"
3
-
4
- - content_for :comments_sidebar do
5
- = render partial: 'the_comments/haml/sidebar'
6
-
7
- - content_for :comments_main do
8
- = paginate @comments
9
-
10
- .comments
11
- - @comments.each do |comment|
12
- - klass = { published: :primary, draft: :warning, deleted: :danger }[comment.state.to_sym]
13
- .panel{ class: "panel-#{klass}" }
14
- .panel-heading= comment.title
15
- .panel-body
16
- = render partial: 'the_comments/haml/comment_body', locals: { comment: comment }
17
-
18
- = paginate @comments
@@ -1,28 +0,0 @@
1
- - cuser = current_user
2
-
3
- - content_for :title do
4
- = t "the_comments.management"
5
-
6
- - content_for :comments_sidebar do
7
- = render partial: 'the_comments/haml/sidebar'
8
-
9
- - content_for :comments_main do
10
- = paginate @comments
11
-
12
- - if @comments.blank?
13
- .alert.alert-info= t 'the_comments.no_comments_here'
14
-
15
- .comments
16
- - @comments.each do |comment|
17
- - klass = { published: :primary, draft: :warning, deleted: :danger }[comment.state.to_sym]
18
- .panel{ class: "panel-#{klass}" }
19
- .panel-heading= comment.title
20
- .panel-body
21
- = render partial: 'the_comments/haml/comment_body', locals: { comment: comment }
22
-
23
- - if cuser.comments_admin?
24
- = render partial: 'the_comments/haml/comment_edit', locals: { comment: comment }
25
- = render partial: 'the_comments/haml/manage_controls', locals: { comment: comment }
26
- = render partial: 'the_comments/haml/additional_info', locals: { comment: comment }
27
-
28
- = paginate @comments