foreman_datacenter 0.1.36 → 0.1.37

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: db1cc96b60f64e415c59d84afe0d3156992b2338
4
- data.tar.gz: fa207733005d350e4a2d23f3f5941d324645a7a9
3
+ metadata.gz: 6b851bab3120b7c4df74cb7ce12aeeed27688047
4
+ data.tar.gz: 72c137e7e300c640f898e21beaa690a1b556c345
5
5
  SHA512:
6
- metadata.gz: 84ade058da8490f5a9acb57faf7cae8f963475f87b38e0f0a7eb3c837470f4e29842a52aa6541ab2751b5f093b74dbf50016451d1be618c6ed48848c69929a84
7
- data.tar.gz: 2e7645d8ceaed125d5ae05e46e43101cc01c506322d419bba6586a40e8c906ae97c4a1dcf8015e15c2b61899c8210a72439f66647a456a633219cefb0c6ab487
6
+ metadata.gz: 990fa58e3d5fcd8f37b02f3600636f48ba13154ebc296d958cab91d973a665c88817716f814a9bd427ac524d2d174a219cd7ec338bbb2351efd253809054f01b
7
+ data.tar.gz: 6260c29af8dfd26be3d004f5cfa010d793db5f8860dad31e8ed108da387282f9d078957c1179b1c9070ff7362060819064d63b9db8977db5abefe4a95264b7fa
@@ -4,3 +4,8 @@ ul.none-list {
4
4
  margin-top: 5px !important;
5
5
  }
6
6
 
7
+ ul.none-list-child {
8
+ list-style-type: none !important;
9
+ padding-left: 15px !important;
10
+ margin-top: 5px !important;
11
+ }
@@ -26,7 +26,7 @@ module ForemanDatacenter
26
26
  @comment = Comment.find(params[:id])
27
27
  @device = find_commentable(@comment)
28
28
  @submodule = parse_submodule(@comment)
29
- if @comment.user == @current_user
29
+ if @comment.user == @current_user or @comment.user.nil?
30
30
  if @comment.update(comment_params)
31
31
  process_success :success_redirect => "/datacenter/#{@submodule}/#{@comment.commentable_id}#comment-#{@comment.id}"
32
32
  else
@@ -39,7 +39,7 @@ module ForemanDatacenter
39
39
 
40
40
  def destroy
41
41
  @comment = Comment.find(params[:id])
42
- if @comment.user == @current_user
42
+ if @comment.user == @current_user or @comment.user.nil?
43
43
  if @comment.destroy
44
44
  process_success :success_redirect => "/datacenter/#{@resource}/#{@id}#comment-#{@comment.id}"
45
45
  else
@@ -60,7 +60,7 @@ module ForemanDatacenter
60
60
  comment = Comment.find(params[:id])
61
61
  commentable = comment.commentable_type.constantize.find(comment.commentable_id)
62
62
  resource = parse_submodule(comment)
63
- if comment.user != @current_user
63
+ unless comment.user == @current_user or comment.user.nil?
64
64
  process_error :redirect => (request.referrer || "/datacenter/#{resource}/#{commentable.id}" || root_path), :error_msg => _("You can edit only your own comments")
65
65
  return
66
66
  end
@@ -97,3 +97,4 @@ module ForemanDatacenter
97
97
  end
98
98
  end
99
99
 
100
+
@@ -1,4 +1,4 @@
1
- <ul class="none-list">
1
+ <ul class="none-list-child">
2
2
  <li>
3
3
  <% c.each do |comment, children |%>
4
4
  <%= render 'foreman_datacenter/comments/item', comment: comment, commentable_data: commentable_data %>
@@ -18,7 +18,7 @@
18
18
  <small>
19
19
  <%= link_to "Reply", new_comment_path(parent_id: comment.id, resource: commentable_data[:resource], resource_id: commentable_data[:id]) %>
20
20
  &nbsp;
21
- <% if @current_user == comment.user %>
21
+ <% if @current_user == comment.user or comment.user.nil? %>
22
22
  <%= link_to "Edit", "/datacenter/comments/#{comment.id}/edit" %>
23
23
  &nbsp;
24
24
  <%= link_to "Delete", "/datacenter/#{commentable_data[:resource]}/#{commentable_data[:id]}/comments/#{comment.id}", method: :delete, data: {confirm: "Are you sure?"} %>
@@ -1,3 +1,3 @@
1
1
  module ForemanDatacenter
2
- VERSION = '0.1.36'.freeze
2
+ VERSION = '0.1.37'.freeze
3
3
  end
@@ -18,7 +18,19 @@ namespace :foreman_datacenter do
18
18
  end
19
19
  end
20
20
  end
21
+
22
+ task comments: :environment do
23
+ # creating new comments from old_comments column and flushing it
24
+ ForemanDatacenter::Device.all.each do |device|
25
+ if device.old_comments != ""
26
+ begin
27
+ device.comments.create!(content: device.old_comments)
28
+ device.update_attribute(:old_comments, "")
29
+ rescue => e
30
+ puts "#{e}"
31
+ end
32
+ end
33
+ end
34
+ end
21
35
  end
22
36
 
23
- # TODO
24
- # comments
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_datacenter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.36
4
+ version: 0.1.37
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Ivanov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-21 00:00:00.000000000 Z
11
+ date: 2017-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deface