foreman_datacenter 0.1.36 → 0.1.37
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.
- checksums.yaml +4 -4
 - data/app/assets/stylesheets/foreman_datacenter/comments.css +5 -0
 - data/app/controllers/foreman_datacenter/comments_controller.rb +4 -3
 - data/app/views/foreman_datacenter/comments/_children.html.erb +1 -1
 - data/app/views/foreman_datacenter/comments/_item.html.erb +1 -1
 - data/lib/foreman_datacenter/version.rb +1 -1
 - data/lib/tasks/devices_tasks.rake +14 -2
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 6b851bab3120b7c4df74cb7ce12aeeed27688047
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 72c137e7e300c640f898e21beaa690a1b556c345
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 990fa58e3d5fcd8f37b02f3600636f48ba13154ebc296d958cab91d973a665c88817716f814a9bd427ac524d2d174a219cd7ec338bbb2351efd253809054f01b
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 6260c29af8dfd26be3d004f5cfa010d793db5f8860dad31e8ed108da387282f9d078957c1179b1c9070ff7362060819064d63b9db8977db5abefe4a95264b7fa
         
     | 
| 
         @@ -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 
     | 
    
         
            -
                   
     | 
| 
      
 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 
     | 
    
         
            +
             
     | 
| 
         @@ -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 
     | 
    
         
             
                 
         
     | 
| 
       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 
     | 
    
         
             
                   
         
     | 
| 
       24 
24 
     | 
    
         
             
                  <%= link_to "Delete", "/datacenter/#{commentable_data[:resource]}/#{commentable_data[:id]}/comments/#{comment.id}", method: :delete, data: {confirm: "Are you sure?"} %>
         
     | 
| 
         @@ -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. 
     | 
| 
      
 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- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2017-10-24 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: deface
         
     |