foreman_datacenter 0.1.29 → 0.1.30
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49cdb573f462e46ab86a64cd7b8915f0c09ff72e
|
4
|
+
data.tar.gz: 8944573b46fa5dfa2932be16d7c8586ae9907687
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c69e5748012abb678d68b200eca283cfd60825992cca16e7632cad172d20d228a5970e71787630752b4991b8d5480961e55410c05beabea829df7ec30c84b96a
|
7
|
+
data.tar.gz: a8193287b95f9c995546bb339c5e0f2f23f8dd7397c5f1ae170319ad5f1ab88e7a35580c25b3b81705275806a01f42eb96274cf262d702fe07b8deb95535a690
|
@@ -13,7 +13,7 @@ module ForemanDatacenter
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def create
|
16
|
-
@comment = @commentable.comments.new(comment_params)
|
16
|
+
@comment = @commentable.comments.new(comment_params.merge(user_id: User.current.id))
|
17
17
|
if @comment.save
|
18
18
|
process_success :success_redirect => "/datacenter/#{@resource}/#{@id}#comment-#{@comment.id}"
|
19
19
|
else
|
@@ -25,7 +25,7 @@ module ForemanDatacenter
|
|
25
25
|
@comment = Comment.find(params[:id])
|
26
26
|
@device = find_commentable(@comment)
|
27
27
|
@submodule = parse_submodule(@comment)
|
28
|
-
if @comment.update(comment_params)
|
28
|
+
if @comment.update(comment_params.merge(user_id: User.current.id))
|
29
29
|
process_success :success_redirect => "/datacenter/#{@submodule}/#{@comment.commentable_id}#comment-#{@comment.id}"
|
30
30
|
else
|
31
31
|
process_error :redirect => "/datacenter/#{@submodule}/#{@comment.commentable_id}#comment-#{@comment.id}", :error_msg => _("Failed: %s") % (e)
|
@@ -60,7 +60,7 @@ module ForemanDatacenter
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def comment_params
|
63
|
-
params[:foreman_datacenter_comment].permit(:content, :commntable_type, :commentable_id, :parent_id)
|
63
|
+
params[:foreman_datacenter_comment].permit(:content, :commntable_type, :commentable_id, :parent_id, :user_id)
|
64
64
|
end
|
65
65
|
|
66
66
|
def find_commentable(comment)
|
@@ -2,6 +2,7 @@ module ForemanDatacenter
|
|
2
2
|
class Comment < ActiveRecord::Base
|
3
3
|
self.table_name = "datacenter_comments"
|
4
4
|
belongs_to :commentable, polymorphic: true
|
5
|
+
belongs_to :user
|
5
6
|
has_ancestry
|
6
7
|
# belongs_to :parent, class_name: "ForemanDatacenter::Comment"
|
7
8
|
# has_many :children, class_name: "ForemanDatacenter::Comment", foreign_key: "parent_id"
|
@@ -1,6 +1,10 @@
|
|
1
1
|
<strong id="comment-<%= comment.id %>">
|
2
2
|
<small class="text-left pull-left">
|
3
|
-
|
3
|
+
<% if comment.user %>
|
4
|
+
Posted by <%= "#{comment.try(:user).try(:firstname)} #{comment.try(:user).try(:lastname)}" %> at <%= comment.updated_at %>
|
5
|
+
<% else %>
|
6
|
+
Posted at <%= comment.updated_at %>
|
7
|
+
<% end %>
|
4
8
|
</small>
|
5
9
|
|
6
10
|
<small class="text-right pull-right">
|