File tree Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -26,13 +26,17 @@ Cookbook.prototype = {
2626 } ) ;
2727 return deferred . promise ( ) ;
2828 } ,
29- update : function ( id , recipeDate ) {
29+ update : function ( id , recipeData ) {
30+ if ( recipeData && id ) {
31+ recipeData += '&id=' + id ;
32+ }
33+
3034 var deferred = $ . Deferred ( ) ;
3135 var self = this ;
3236 $ . ajax ( {
3337 url : this . _baseUrl + '/recipes' ,
3438 method : 'PUT' ,
35- data : recipeDate
39+ data : recipeData
3640 } ) . done ( function ( response ) {
3741 deferred . resolve ( response ) ;
3842 } ) . fail ( function ( ) {
Original file line number Diff line number Diff line change @@ -431,7 +431,18 @@ public function addRecipe($json) {
431431 $ recipe_file = null ;
432432
433433 try {
434- $ recipe_folder = $ user_folder ->get ($ json ['name ' ]);
434+ if (isset ($ json ['id ' ]) && $ json ['id ' ]) {
435+ $ recipe_folder = $ user_folder ->getById ($ json ['id ' ])[0 ];
436+
437+ $ path = $ recipe_folder ->getPath ();
438+ $ path = dirname ($ path ) . '/ ' . $ json ['name ' ];
439+
440+ $ recipe_folder ->move ($ path );
441+
442+ } else {
443+ $ recipe_folder = $ user_folder ->get ($ json ['name ' ]);
444+ }
445+
435446 } catch (\OCP \Files \NotFoundException $ e ) {
436447 $ recipe_folder = $ user_folder ->newFolder ($ json ['name ' ]);
437448 }
You can’t perform that action at this time.
0 commit comments