From bd8cd1d48d3b265c7baa44a36d711ffff0275b6c Mon Sep 17 00:00:00 2001 From: bee0005 Date: Fri, 23 Sep 2016 13:45:20 +0000 Subject: [PATCH] add home delete --- app/controllers/home_controller.rb | 6 ++++-- app/helpers/home_helper.rb | 1 + app/views/home/index.html.erb | 26 ++++++++++++++++++++++---- app/views/node/index.html.erb | 6 ++---- 4 files changed, 29 insertions(+), 10 deletions(-) diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 72f9e47..3a5a781 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -27,14 +27,16 @@ class HomeController < ApplicationController `#{command}` redirect_to '/home/index' end - + + def delete_file file_name = params[:file_name] # delete file command = String.new command << "sudo rm -rf #{file_name}" puts command - `#{command}` + `#{command}` redirect_to '/home/index' end + end diff --git a/app/helpers/home_helper.rb b/app/helpers/home_helper.rb index 23de56a..475f4fc 100644 --- a/app/helpers/home_helper.rb +++ b/app/helpers/home_helper.rb @@ -1,2 +1,3 @@ module HomeHelper + end diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index c8907b8..bf418e4 100644 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -143,7 +143,10 @@ <% end %> <%=t["auth"]%> <%=t["size"]%> - <%=t["date"]%> + + <%=t["date"]%> + ')" href="#"> + <% end %> @@ -271,6 +274,19 @@ -