2222 <div class =" col-md-2 col-lg-2 col-sm-2 col-xs-2 left-nav fill" id =" lfm-leftcol" >
2323 <div id =" tree1" >
2424 </div >
25+ <a href =" #!" id =" add-folder" class =" add-folder btn btn-default btn-xs" ><i class =" fa fa-plus" ></i > New Folder</a >
2526 </div >
2627 <div class =" col-md-10 col-lg-10 col-sm-10 col-xs-10 right-nav" id =" right-nav" >
2728 <nav class =" navbar navbar-default" >
4142 <a href =" #!" id =" upload" data-toggle =" modal" data-target =" #uploadModal" ><i
4243 class =" fa fa-upload" ></i > Upload</a >
4344 </li >
44- <li >
45- <a href =" #!" class =" add-folder" id =" add-folder" ><i
46- class =" fa fa-plus" ></i > New Folder</a >
47- </li >
4845 <li >
4946 <a href =" #!" class =" thumbnail-display" id =" thumbnail-display" ><i
5047 class =" fa fa-picture-o" ></i > Thumbnails</a >
@@ -153,6 +150,7 @@ class="fa fa-list"></i> List</a>
153150 $ (" #tree1" ).html (data);
154151 });
155152 loadImages ();
153+ refreshFolders ();
156154 });
157155
158156 $ (" #upload-btn" ).click (function () {
@@ -225,6 +223,7 @@ function loadImages() {
225223 $ (" #content" ).html (data);
226224 $ (" #nav-buttons" ).removeClass (" hidden" );
227225 $ (" .dropdown-toggle" ).dropdown ();
226+ refreshFolders ();
228227 });
229228 }
230229 @else
@@ -242,6 +241,7 @@ function loadImages() {
242241 $ (" #content" ).html (data);
243242 $ (" #nav-buttons" ).removeClass (" hidden" );
244243 $ (" .dropdown-toggle" ).dropdown ();
244+ refreshFolders ();
245245 });
246246 }
247247 @endif
@@ -270,7 +270,6 @@ function trash(x) {
270270 });
271271 }
272272
273-
274273 function loadFiles () {
275274 $ .ajax ({
276275 type: " GET" ,
@@ -286,6 +285,14 @@ function loadFiles() {
286285 });
287286 }
288287
288+ function refreshFolders (){
289+ var wd = $ (" #working_dir" ).val ();
290+ if (wd != " /" ) {
291+ $ (' #' + wd + ' -folder' ).removeClass (' fa-folder' );
292+ $ (' #' + wd + ' -folder' ).addClass (' fa-folder-open' );
293+ }
294+ }
295+
289296 function cropImage (x ) {
290297 $ .ajax ({
291298 type: " GET" ,
@@ -305,7 +312,7 @@ function notImp() {
305312 bootbox .alert (' Not yet implemented!' );;
306313 }
307314
308- $ (" . add-folder" ).click (function () {
315+ $ (" # add-folder" ).click (function () {
309316 bootbox .prompt (" Folder name:" , function (result ) {
310317 if (result === null ) {
311318 } else {
@@ -314,13 +321,15 @@ function notImp() {
314321 dataType: " text" ,
315322 url: " /laravel-filemanager/newfolder" ,
316323 data: {
317- name: result
324+ name: result,
325+ dir: $ (" #working_dir" ).val ()
318326 },
319327 cache: false
320328 }).done (function (data ) {
321329 if (data == " OK" ) {
322330 loadFiles ();
323331 loadImages ();
332+ refreshFolders ();
324333 } else {
325334 notify (data);
326335 }
0 commit comments