rails_admin_comments 0.2.1 → 0.2.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/views/rails_admin/main/model_comments.html.slim +2 -2
- data/lib/rails_admin_comments/action.rb +25 -6
- data/lib/rails_admin_comments/models/mongoid/comments.rb +1 -1
- data/lib/rails_admin_comments/models/mongoid/model_comments.rb +1 -1
- data/lib/rails_admin_comments/version.rb +1 -1
- data/lib/rails_admin_comments.rb +3 -0
- data/rails_admin_comments.gemspec +3 -3
- metadata +16 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dbb52f3399323450849acd32f11e7a2562f461f9
|
4
|
+
data.tar.gz: 09ee120d4f78bf3aae941b80a9249b75c03459bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e42990d510caaaa63a2878d00c48766483b9548c5819c47b3fd2953d102f87046f630b8ad54d824a515074c650dae9e3ef89707dbb6b0ff674f34602806a9a16
|
7
|
+
data.tar.gz: 696cb6d81aeab696556c68df1c2f92420ae0d7661c33b00cd7c64ac8a1040a6e90e96c45a24931f37bfce9abb19b28ee751f25c84978cd8bd17b1029acfd844d
|
@@ -20,9 +20,9 @@
|
|
20
20
|
span.created_at= Russian::strftime c.c_at, "%d.%m.%Y в %H:%M:%S".freeze
|
21
21
|
span.updated_at= " (изм. #{Russian::strftime c.u_at, "%d.%m.%Y в %H:%M:%S"})".freeze if Russian::strftime c.u_at
|
22
22
|
- if creator == current_user or (current_user.respond_to?(:admin?) and current_user.admin?)
|
23
|
-
= link_to 'изменить', "##{edit_form_id}".freeze, class: 'comment_edit_form_link'.freeze
|
23
|
+
= link_to 'изменить'.freeze, "##{edit_form_id}".freeze, class: 'comment_edit_form_link'.freeze
|
24
24
|
= " | "
|
25
|
-
= link_to 'удалить', "##{edit_form_id}".freeze, class: 'comment_delete_form_link'.freeze
|
25
|
+
= link_to 'удалить'.freeze, "##{edit_form_id}".freeze, class: 'comment_delete_form_link'.freeze
|
26
26
|
p.content_block= c.content
|
27
27
|
p
|
28
28
|
.comment_edit_form.hidden{id=edit_form_id}
|
@@ -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.
|
37
|
+
@comment = @object.rails_admin_comments.where(id: params['rails_admin_comments_comment']['id']).first
|
38
38
|
end
|
39
|
-
@comment
|
39
|
+
@comment ||= @object.rails_admin_comments.new
|
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,8 +61,24 @@ 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) || []
|
64
79
|
render action: @action.template_name
|
65
80
|
end
|
81
|
+
|
66
82
|
end
|
67
83
|
end
|
68
84
|
end
|
@@ -111,7 +127,7 @@ module RailsAdmin
|
|
111
127
|
begin
|
112
128
|
if params['rails_admin_comments_model_comment'].present?
|
113
129
|
if params['rails_admin_comments_model_comment']['id'].present?
|
114
|
-
@comment = @model.rails_admin_model_comments.
|
130
|
+
@comment = @model.rails_admin_model_comments.where(id: params['rails_admin_comments_model_comment']['id']).first
|
115
131
|
end
|
116
132
|
@comment ||= @model.rails_admin_model_comments.new
|
117
133
|
|
@@ -138,18 +154,21 @@ module RailsAdmin
|
|
138
154
|
@message = "<strong class='error'>#{I18n.t('admin.actions.comments.error')}</strong>: #{e}".freeze
|
139
155
|
end
|
140
156
|
|
157
|
+
@comments = @model.rails_admin_model_comments.by_date.enabled.for_user(current_user) || []
|
141
158
|
render action: @action.template_name
|
142
159
|
|
143
160
|
elsif request.delete?
|
144
161
|
if params['rails_admin_comments_model_comment']['id'].present?
|
145
|
-
@comment = @model.rails_admin_model_comments.
|
162
|
+
@comment = @model.rails_admin_model_comments.where(id: params['rails_admin_comments_model_comment']['id']).first
|
146
163
|
end
|
147
164
|
if @comment and @comment.destroy
|
148
165
|
@comment = nil
|
149
|
-
@message = "
|
166
|
+
@message = "<strong class='success'>Удалено</strong>".freeze
|
150
167
|
else
|
151
|
-
@message = "
|
168
|
+
@message = "<strong class='error'>Удаление не удалось</strong>".freeze
|
152
169
|
end
|
170
|
+
|
171
|
+
@comments = @model.rails_admin_model_comments.by_date.enabled.for_user(current_user) || []
|
153
172
|
render action: @action.template_name
|
154
173
|
end
|
155
174
|
end
|
@@ -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})
|
24
|
+
any_of({visible_for_user_ids: user}, {visible_for_user_ids: nil}, {visible_for_user_ids: []})
|
25
25
|
}
|
26
26
|
end
|
27
27
|
end
|
@@ -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})
|
24
|
+
any_of({visible_for_user_ids: user}, {visible_for_user_ids: nil}, {visible_for_user_ids: []})
|
25
25
|
}
|
26
26
|
end
|
27
27
|
end
|
data/lib/rails_admin_comments.rb
CHANGED
@@ -30,7 +30,7 @@ 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",
|
34
|
-
spec.add_dependency "mongoid", [">= 5.0", "< 6.
|
35
|
-
spec.add_dependency "glebtv_mongoid_userstamp", '
|
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'
|
36
36
|
end
|
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.
|
4
|
+
version: 0.2.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Kiseliev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -42,16 +42,22 @@ dependencies:
|
|
42
42
|
name: rails_admin
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 0.8.1
|
48
|
+
- - "<"
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '1.1'
|
48
51
|
type: :runtime
|
49
52
|
prerelease: false
|
50
53
|
version_requirements: !ruby/object:Gem::Requirement
|
51
54
|
requirements:
|
52
|
-
- - "
|
55
|
+
- - ">="
|
53
56
|
- !ruby/object:Gem::Version
|
54
57
|
version: 0.8.1
|
58
|
+
- - "<"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '1.1'
|
55
61
|
- !ruby/object:Gem::Dependency
|
56
62
|
name: mongoid
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -61,7 +67,7 @@ dependencies:
|
|
61
67
|
version: '5.0'
|
62
68
|
- - "<"
|
63
69
|
- !ruby/object:Gem::Version
|
64
|
-
version: '6.
|
70
|
+
version: '6.1'
|
65
71
|
type: :runtime
|
66
72
|
prerelease: false
|
67
73
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -71,21 +77,21 @@ dependencies:
|
|
71
77
|
version: '5.0'
|
72
78
|
- - "<"
|
73
79
|
- !ruby/object:Gem::Version
|
74
|
-
version: '6.
|
80
|
+
version: '6.1'
|
75
81
|
- !ruby/object:Gem::Dependency
|
76
82
|
name: glebtv_mongoid_userstamp
|
77
83
|
requirement: !ruby/object:Gem::Requirement
|
78
84
|
requirements:
|
79
|
-
- - "
|
85
|
+
- - ">="
|
80
86
|
- !ruby/object:Gem::Version
|
81
|
-
version: 0.6
|
87
|
+
version: '0.6'
|
82
88
|
type: :runtime
|
83
89
|
prerelease: false
|
84
90
|
version_requirements: !ruby/object:Gem::Requirement
|
85
91
|
requirements:
|
86
|
-
- - "
|
92
|
+
- - ">="
|
87
93
|
- !ruby/object:Gem::Version
|
88
|
-
version: 0.6
|
94
|
+
version: '0.6'
|
89
95
|
description: Comments for rails_admin
|
90
96
|
email:
|
91
97
|
- i43ack@gmail.com
|