diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 989797b..73c0a64 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -44,6 +44,9 @@ class ApplicationController < ActionController::Base puts @files return @files end - - + + def checkDir + files = file_directory(params[:path]) + render :json => {:file => files , :current => @current_dir} + end end diff --git a/app/controllers/volume_controller.rb b/app/controllers/volume_controller.rb index 9a87794..ca94f9e 100644 --- a/app/controllers/volume_controller.rb +++ b/app/controllers/volume_controller.rb @@ -38,13 +38,6 @@ class VolumeController < ApplicationController redirect_to '/volume/info' end - - - def checkDir - files = file_directory(params[:path]) - render :json => {:file => files , :current => @current_dir} - end - def volume_mount @config = get_conf volume_name = params[:volume_name] diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index f943ab5..2c55dc3 100644 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -207,7 +207,7 @@ function change_directory(directory){ $.ajax({ method: "POST", - url: "/volume/changeDir", + url: "/application/changeDir", data: { path: directory }, success : function(result){ $("#table_div").empty(); diff --git a/config/routes.rb b/config/routes.rb index f4143c8..470bc2c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -6,6 +6,8 @@ Rails.application.routes.draw do # You can have the root of your site routed with "root" root 'home#index' + post 'application/changeDir' => 'application#checkDir' + get 'index' => 'plainpage#index' #Home @@ -15,7 +17,6 @@ Rails.application.routes.draw do #Volume get 'volume/index' => 'volume#index' post 'file_upload' => 'volume#file_upload' - post 'volume/changeDir' => 'volume#checkDir' post 'volume/mount' => "volume#volume_mount" get 'volume/start/:volume_name' => "volume#volume_start" get 'volume/stop/:volume_name' => "volume#volume_stop"