From 4d922b6a0c81ee0620b7761acbf6e2e35f116790 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Mon, 3 Oct 2016 21:09:20 -0400 Subject: [PATCH] Clean up file adding and listing --- .../Controllers/Server/AjaxController.php | 9 +- resources/views/server/files/add.blade.php | 116 +++++++++++------- 2 files changed, 75 insertions(+), 50 deletions(-) diff --git a/app/Http/Controllers/Server/AjaxController.php b/app/Http/Controllers/Server/AjaxController.php index b109063bd..f2db322ec 100644 --- a/app/Http/Controllers/Server/AjaxController.php +++ b/app/Http/Controllers/Server/AjaxController.php @@ -115,11 +115,12 @@ class AjaxController extends Controller // Determine if we should show back links in the file browser. // This code is strange, and could probably be rewritten much better. - $goBack = explode('/', rtrim($this->directory, '/')); - if (isset($goBack[2]) && !empty($goBack[2])) { + $goBack = explode('/', trim($this->directory, '/')); + if (!empty(array_filter($goBack)) && count($goBack) >= 2) { $prevDir['show'] = true; - $prevDir['link'] = '/' . trim(str_replace(end($goBack), '', $this->directory), '/'); - $prevDir['link_show'] = trim($prevDir['link'], '/'); + array_pop($goBack); + $prevDir['link'] = '/' . implode('/', $goBack); + $prevDir['link_show'] = implode('/', $goBack) . '/'; } $controller = new Repositories\Daemon\FileRepository($uuid); diff --git a/resources/views/server/files/add.blade.php b/resources/views/server/files/add.blade.php index 1cd106be9..5719a66ef 100644 --- a/resources/views/server/files/add.blade.php +++ b/resources/views/server/files/add.blade.php @@ -25,7 +25,8 @@ @section('scripts') @parent - + {!! Theme::js('js/binaryjs.js') !!} + {!! Theme::js('js/vendor/lodash/lodash.js') !!} @endsection @section('content') @@ -36,56 +37,72 @@
- -
-

/home/container/{{ $directory }}

-
-
+
+
+
+ Save As: + +
+

All files are saved relative to /home/container. You can enter more of the path into the Save As field to save the file into a specific folder.

-
-
-
- - -
-
- -
+
+
+
+
+
- +
+
+
+ + +
+
+ +
+
@can('upload-files', $server)
-

/home/container/  

-
Please edit the path location above before you upload files. They will automatically be placed in the directory you specify above. Simply click next to /home/container/ and begin typing. You can change this each time you upload a new file without having to press anything else.
+
+
+
+ Upload Directory: + +
+

All files are saved relative to /home/container. You can enter more of the path into the Save As field to save the file into a specific folder.

+
+
+ +
Edit the path location above before you upload files. They will automatically be placed in the directory you specify above. You can change this each time you upload a new file without having to press anything else.
@@ -227,7 +244,14 @@ $(window).load(function () { }); function save() { - var fileName = $('input[name="file"]').val(); + if (_.isEmpty($('#file_name').val())) { + $.notify({ + message: 'No filename was passed.' + }, { + type: 'danger' + }); + return; + } $('#create_file').append(' ').addClass('disabled'); $.ajax({ type: 'POST',