add home delete
This commit is contained in:
		
							parent
							
								
									1b7b26ee06
								
							
						
					
					
						commit
						bd8cd1d48d
					
				@ -28,6 +28,7 @@ class HomeController < ApplicationController
 | 
				
			|||||||
        redirect_to '/home/index'
 | 
					        redirect_to '/home/index'
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
    def delete_file
 | 
					    def delete_file
 | 
				
			||||||
        file_name = params[:file_name]
 | 
					        file_name = params[:file_name]
 | 
				
			||||||
        # delete file
 | 
					        # delete file
 | 
				
			||||||
@ -37,4 +38,5 @@ class HomeController < ApplicationController
 | 
				
			|||||||
         `#{command}`
 | 
					         `#{command}`
 | 
				
			||||||
        redirect_to '/home/index'
 | 
					        redirect_to '/home/index'
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
				
			|||||||
@ -1,2 +1,3 @@
 | 
				
			|||||||
module HomeHelper
 | 
					module HomeHelper
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
				
			|||||||
@ -143,7 +143,10 @@
 | 
				
			|||||||
									<% end %>
 | 
														<% end %>
 | 
				
			||||||
									<td><%=t["auth"]%></td>
 | 
														<td><%=t["auth"]%></td>
 | 
				
			||||||
									<td><%=t["size"]%></td>
 | 
														<td><%=t["size"]%></td>
 | 
				
			||||||
									<td><%=t["date"]%></td>
 | 
														<td>
 | 
				
			||||||
 | 
															<%=t["date"]%>
 | 
				
			||||||
 | 
															<a class='pull-right' onclick="delete_file('<%=@current_dir + "/" + t["name"]%>')" href="#"><i class="fa fa-trash"></i></a>
 | 
				
			||||||
 | 
														</td>
 | 
				
			||||||
								</tr>
 | 
													</tr>
 | 
				
			||||||
								<% end %>
 | 
													<% end %>
 | 
				
			||||||
							</tbody>
 | 
												</tbody>
 | 
				
			||||||
@ -271,6 +274,19 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
<!-- File manager functions -->
 | 
					<!-- File manager functions -->
 | 
				
			||||||
<script>
 | 
					<script>
 | 
				
			||||||
 | 
					function delete_file(directory){
 | 
				
			||||||
 | 
						if (confirm("Are you sure you want to delete '"+ directory+"' ?")) {
 | 
				
			||||||
 | 
							$.ajax({
 | 
				
			||||||
 | 
								method: "POST",
 | 
				
			||||||
 | 
								url: "/home/delete",
 | 
				
			||||||
 | 
								data: { file_name: directory },
 | 
				
			||||||
 | 
								success  : function(result){
 | 
				
			||||||
 | 
									location.reload(true);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							})
 | 
				
			||||||
 | 
						} 
 | 
				
			||||||
 | 
						//alert(directory);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
function change_upper(directory){
 | 
					function change_upper(directory){
 | 
				
			||||||
	if(directory == "/") return;
 | 
						if(directory == "/") return;
 | 
				
			||||||
	var lastindex = directory.lastIndexOf("/");
 | 
						var lastindex = directory.lastIndexOf("/");
 | 
				
			||||||
@ -317,9 +333,12 @@ function change_directory(directory){
 | 
				
			|||||||
					new_tr += "<a href='/file_download?file_name="+ (cur + "/" + result.file[i].name).replace(/\//, "+") + "'> " + result.file[i].name + "</a>"
 | 
										new_tr += "<a href='/file_download?file_name="+ (cur + "/" + result.file[i].name).replace(/\//, "+") + "'> " + result.file[i].name + "</a>"
 | 
				
			||||||
					new_tr += "</td>";
 | 
										new_tr += "</td>";
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
									
 | 
				
			||||||
				new_tr += "<td>"+result.file[i].auth+"</td>";
 | 
									new_tr += "<td>"+result.file[i].auth+"</td>";
 | 
				
			||||||
				new_tr += "<td>"+result.file[i].size+"</td>";
 | 
									new_tr += "<td>"+result.file[i].size+"</td>";
 | 
				
			||||||
				new_tr += "<td>"+result.file[i].date+"</td>";
 | 
									new_tr += "<td>"+result.file[i].date+" <a class='pull-right' onclick='delete_file(" +'"' + cur + "/" + result.file[i].name +'"'+ ")'  href='#'><i class='fa fa-trash'></i></a></td>";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
													
 | 
				
			||||||
				new_tr += "</tr>";
 | 
									new_tr += "</tr>";
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			new_table += new_tr;
 | 
								new_table += new_tr;
 | 
				
			||||||
@ -330,7 +349,6 @@ function change_directory(directory){
 | 
				
			|||||||
	})
 | 
						})
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
 | 
					 | 
				
			||||||
<!-- On document ready -->
 | 
					<!-- On document ready -->
 | 
				
			||||||
<script>
 | 
					<script>
 | 
				
			||||||
$(document).ready(function() {
 | 
					$(document).ready(function() {
 | 
				
			||||||
 | 
				
			|||||||
@ -9,7 +9,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    <div class="clearfix"></div>
 | 
					    <div class="clearfix"></div>
 | 
				
			||||||
        <div class="row">
 | 
					        <div class="row">
 | 
				
			||||||
            <div class="col-md-12 col-sm-12 col-xs-12">
 | 
					            <div class="col-md-6 col-sm-6 col-xs-6">
 | 
				
			||||||
              <div class="x_panel">
 | 
					              <div class="x_panel">
 | 
				
			||||||
                <div class="x_title">
 | 
					                <div class="x_title">
 | 
				
			||||||
                  <h2>Add Node</h2>
 | 
					                  <h2>Add Node</h2>
 | 
				
			||||||
@ -33,8 +33,6 @@
 | 
				
			|||||||
                <div class="x_content">
 | 
					                <div class="x_content">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                  <form class="form-horizontal form-label-left" action="/node/add" method="post" novalidate>
 | 
					                  <form class="form-horizontal form-label-left" action="/node/add" method="post" novalidate>
 | 
				
			||||||
                    <span class="section">Node Info</span>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    <div class="item form-group">
 | 
					                    <div class="item form-group">
 | 
				
			||||||
                      <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Host Name <span class="required">*</span>
 | 
					                      <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Host Name <span class="required">*</span>
 | 
				
			||||||
                      </label>
 | 
					                      </label>
 | 
				
			||||||
@ -64,7 +62,7 @@
 | 
				
			|||||||
                        <input id="password" type="password" name="user_password" data-validate-length="1,10" class="form-control col-md-7 col-xs-12" required="required">
 | 
					                        <input id="password" type="password" name="user_password" data-validate-length="1,10" class="form-control col-md-7 col-xs-12" required="required">
 | 
				
			||||||
                      </div>
 | 
					                      </div>
 | 
				
			||||||
                    </div>
 | 
					                    </div>
 | 
				
			||||||
                    <div class="ln_solid"></div>
 | 
					                    <!--<div class="ln_solid"></div>-->
 | 
				
			||||||
                    <div class="form-group">
 | 
					                    <div class="form-group">
 | 
				
			||||||
                      <div class="col-md-6 col-md-offset-3">
 | 
					                      <div class="col-md-6 col-md-offset-3">
 | 
				
			||||||
                        <button type="submit" class="btn btn-primary">Cancel</button>
 | 
					                        <button type="submit" class="btn btn-primary">Cancel</button>
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user