rails_admin_comments 0.2.3.3 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9def7a1d3c49125431c8c0cb21860624da66c16b
4
- data.tar.gz: f7a9e8e91c2c7e80015b47208a937299c8c4efd3
3
+ metadata.gz: ba7a121ac7788f5ec9886d9421168858fbf8099a
4
+ data.tar.gz: ba44064cfc1379ada742b146c683dbadc71c9a40
5
5
  SHA512:
6
- metadata.gz: 12635a30d8fd2b73570326ef420b4c9378c690a118c15b525091bca522e58124d12805a23402babd8b66507d9bd3ff43e6a3637307b989aeb68f0a68e7c5b443
7
- data.tar.gz: 3b85956299714a26b7c9c9ce2efdb605af1264a3b69e088d4072cb9137e9e8d52bb152f03c078e9cab32b9bd1827b624199d1ce987aaeca2e5b662c190fe1321
6
+ metadata.gz: 51f68aca9bfc4430f4cc8d5658d5e7cd5d4b8b5554c09e291aaecdd7f4e56407123a6203b7989909dbe5186f8c39e533e62ca347219abb0b5cbbd287718bbb02
7
+ data.tar.gz: 39e13a90b30789a9fe723dea12f7080e20e77078e28937c7787bbe2ed141e333fc4b26c7692e57186a55e7b9663144cc48345f0f68ce0478300c242887ac5c19
@@ -1 +1 @@
1
- rails_admin_comments
1
+ rails_admin_comments_rails5
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # RailsAdminComments DEVELOPMENT VERSION
2
2
 
3
+ ### Rails 5 support
4
+
3
5
  Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/rails_admin_comments`. To experiment with that code, run `bin/console` for an interactive prompt.
4
6
 
5
7
  TODO: Delete this and the text above, and describe your gem
@@ -5,9 +5,6 @@ require 'mongoid_userstamp'
5
5
 
6
6
  require "rails_admin_comments/engine"
7
7
 
8
- require 'rails_admin/config/actions'
9
- require 'rails_admin/config/model'
10
-
11
8
  require 'rails_admin_comments/configuration'
12
9
 
13
10
  require 'rails_admin/config/actions'
@@ -34,9 +34,9 @@ module RailsAdmin
34
34
  begin
35
35
  if params['rails_admin_comments_comment'].present?
36
36
  if params['rails_admin_comments_comment']['id'].present?
37
- @comment = @object.rails_admin_comments.where(id: params['rails_admin_comments_comment']['id']).first
37
+ @comment = @object.rails_admin_comments.find(params['rails_admin_comments_comment']['id'])
38
38
  end
39
- @comment ||= @object.rails_admin_comments.new
39
+ @comment = @object.rails_admin_comments.new if @comment.nil?
40
40
 
41
41
  @comment.content = params['rails_admin_comments_comment']['content']
42
42
  @comment.visible_for_user_ids = params['rails_admin_comments_comment']['visible_for_user_ids']
@@ -61,24 +61,8 @@ module RailsAdmin
61
61
  @message = "<strong class='error'>#{I18n.t('admin.actions.comments.error')}</strong>: #{e}".freeze
62
62
  end
63
63
 
64
- @comments = @object.rails_admin_comments.by_date.enabled.for_user(current_user) || []
65
- render action: @action.template_name
66
-
67
- elsif request.delete?
68
- if params['rails_admin_comments_comment']['id'].present?
69
- @comment = @object.rails_admin_comments.where(id: params['rails_admin_comments_comment']['id']).first
70
- end
71
- if @comment and @comment.destroy
72
- @comment = nil
73
- @message = "<strong class='success'>Удалено</strong>".freeze
74
- else
75
- @message = "<strong class='error'>Удаление не удалось</strong>".freeze
76
- end
77
-
78
- @comments = @object.rails_admin_comments.by_date.enabled.for_user(current_user) || []
79
64
  render action: @action.template_name
80
65
  end
81
-
82
66
  end
83
67
  end
84
68
  end
@@ -127,7 +111,7 @@ module RailsAdmin
127
111
  begin
128
112
  if params['rails_admin_comments_model_comment'].present?
129
113
  if params['rails_admin_comments_model_comment']['id'].present?
130
- @comment = @model.rails_admin_model_comments.where(id: params['rails_admin_comments_model_comment']['id']).first
114
+ @comment = @model.rails_admin_model_comments.find(params['rails_admin_comments_model_comment']['id'])
131
115
  end
132
116
  @comment ||= @model.rails_admin_model_comments.new
133
117
 
@@ -154,21 +138,18 @@ module RailsAdmin
154
138
  @message = "<strong class='error'>#{I18n.t('admin.actions.comments.error')}</strong>: #{e}".freeze
155
139
  end
156
140
 
157
- @comments = @model.rails_admin_model_comments.by_date.enabled.for_user(current_user) || []
158
141
  render action: @action.template_name
159
142
 
160
143
  elsif request.delete?
161
144
  if params['rails_admin_comments_model_comment']['id'].present?
162
- @comment = @model.rails_admin_model_comments.where(id: params['rails_admin_comments_model_comment']['id']).first
145
+ @comment = @model.rails_admin_model_comments.find(params['rails_admin_comments_model_comment']['id'])
163
146
  end
164
147
  if @comment and @comment.destroy
165
148
  @comment = nil
166
- @message = "<strong class='success'>Удалено</strong>".freeze
149
+ @message = "Удалено".freeze
167
150
  else
168
- @message = "<strong class='error'>Удаление не удалось</strong>".freeze
151
+ @message = "Удаление не удалось".freeze
169
152
  end
170
-
171
- @comments = @model.rails_admin_model_comments.by_date.enabled.for_user(current_user) || []
172
153
  render action: @action.template_name
173
154
  end
174
155
  end
@@ -7,7 +7,7 @@ module RailsAdminComments
7
7
  include ::Mongoid::Timestamps::Short
8
8
  include ::Mongoid::Userstamp
9
9
 
10
- belongs_to :rails_admin_commentable, polymorphic: true
10
+ belongs_to :rails_admin_commentable, polymorphic: true, optional: true
11
11
 
12
12
  store_in collection: "rails_admin_comments".freeze
13
13
 
@@ -21,7 +21,7 @@ module RailsAdminComments
21
21
 
22
22
  has_and_belongs_to_many :visible_for_users, class_name: "User", inverse_of: nil
23
23
  scope :for_user, ->(user) {
24
- any_of({visible_for_user_ids: user}, {visible_for_user_ids: nil}, {visible_for_user_ids: []})
24
+ any_of({visible_for_user_ids: user}, {visible_for_user_ids: nil})
25
25
  }
26
26
  end
27
27
  end
@@ -9,7 +9,7 @@ module RailsAdminComments
9
9
 
10
10
  field :model_name, type: String
11
11
 
12
- store_in collection: "rails_admin_model_comments"
12
+ store_in collection: "rails_admin_model_comments".freeze
13
13
 
14
14
  field :enabled, type: ::Mongoid::VERSION.to_i < 4 ? Boolean : ::Mongoid::Boolean, default: true
15
15
  scope :enabled, -> { where(enabled: true) }
@@ -21,7 +21,7 @@ module RailsAdminComments
21
21
 
22
22
  has_and_belongs_to_many :visible_for_users, class_name: "User", inverse_of: nil
23
23
  scope :for_user, ->(user) {
24
- any_of({visible_for_user_ids: user}, {visible_for_user_ids: nil}, {visible_for_user_ids: []})
24
+ any_of({visible_for_user_ids: user}, {visible_for_user_ids: nil})
25
25
  }
26
26
  end
27
27
  end
@@ -1,3 +1,3 @@
1
1
  module RailsAdminComments
2
- VERSION = "0.2.3.3".freeze
2
+ VERSION = "0.3.0".freeze
3
3
  end
@@ -30,7 +30,9 @@ Gem::Specification.new do |spec|
30
30
  spec.add_development_dependency "bundler", "~> 1.10"
31
31
  spec.add_development_dependency "rake", "~> 10.0"
32
32
 
33
- spec.add_dependency "rails_admin", [">= 0.8.1", "< 1.1"]
34
- spec.add_dependency "mongoid", [">= 5.0", "< 6.1"]
35
- spec.add_dependency "glebtv_mongoid_userstamp", '~> 0.6'
33
+ spec.add_dependency "rails", '>= 5.0.0'
34
+
35
+ spec.add_dependency "rails_admin", '>= 1.0.0.rc'
36
+ spec.add_dependency "mongoid", [">= 5.0", "< 7.0"]
37
+ spec.add_dependency "glebtv_mongoid_userstamp", '~> 0.6.1'
36
38
  end
data/release.sh CHANGED
@@ -2,5 +2,5 @@
2
2
  bundle update
3
3
  git add --all .
4
4
  git commit -am "${*:1}"
5
- git push -u origin master
5
+ git push -u origin rails5
6
6
  rake release
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_admin_comments
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3.3
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Kiseliev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-31 00:00:00.000000000 Z
11
+ date: 2016-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -39,25 +39,33 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rails_admin
42
+ name: rails
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 0.8.1
48
- - - "<"
49
- - !ruby/object:Gem::Version
50
- version: '1.1'
47
+ version: 5.0.0
51
48
  type: :runtime
52
49
  prerelease: false
53
50
  version_requirements: !ruby/object:Gem::Requirement
54
51
  requirements:
55
52
  - - ">="
56
53
  - !ruby/object:Gem::Version
57
- version: 0.8.1
58
- - - "<"
54
+ version: 5.0.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: rails_admin
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 1.0.0.rc
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
59
67
  - !ruby/object:Gem::Version
60
- version: '1.1'
68
+ version: 1.0.0.rc
61
69
  - !ruby/object:Gem::Dependency
62
70
  name: mongoid
63
71
  requirement: !ruby/object:Gem::Requirement
@@ -67,7 +75,7 @@ dependencies:
67
75
  version: '5.0'
68
76
  - - "<"
69
77
  - !ruby/object:Gem::Version
70
- version: '6.1'
78
+ version: '7.0'
71
79
  type: :runtime
72
80
  prerelease: false
73
81
  version_requirements: !ruby/object:Gem::Requirement
@@ -77,21 +85,21 @@ dependencies:
77
85
  version: '5.0'
78
86
  - - "<"
79
87
  - !ruby/object:Gem::Version
80
- version: '6.1'
88
+ version: '7.0'
81
89
  - !ruby/object:Gem::Dependency
82
90
  name: glebtv_mongoid_userstamp
83
91
  requirement: !ruby/object:Gem::Requirement
84
92
  requirements:
85
93
  - - "~>"
86
94
  - !ruby/object:Gem::Version
87
- version: '0.6'
95
+ version: 0.6.1
88
96
  type: :runtime
89
97
  prerelease: false
90
98
  version_requirements: !ruby/object:Gem::Requirement
91
99
  requirements:
92
100
  - - "~>"
93
101
  - !ruby/object:Gem::Version
94
- version: '0.6'
102
+ version: 0.6.1
95
103
  description: Comments for rails_admin
96
104
  email:
97
105
  - i43ack@gmail.com