Browse Source

add confirmation modal and reload of albums after merge

Rouven Hurling 9 years ago
parent
commit
2e71c71a28
2 changed files with 35 additions and 5 deletions
  1. 0 0
      dist/main.js
  2. 35 5
      src/scripts/album.js

File diff suppressed because it is too large
+ 0 - 0
dist/main.js


+ 35 - 5
src/scripts/album.js

@@ -570,11 +570,41 @@ album.getArchive = function(albumID) {
 }
 
 album.merge = function(albumIDs) {
-    var params = {
-        albumIDs: albumIDs.join()
+    var action = {}
+
+    action.fn = function() {
+
+        var params;
+
+        basicModal.close();
+
+        params = {
+            albumIDs: albumIDs.join()
+        }
+
+        api.post('Album::merge', params, function(data) {
+            if (data!==true) {
+                lychee.error(null, params, data);
+            } else {
+                albums.json = null
+                albums.load()
+            }
+        })
+
     }
 
-    api.post('Album::merge', params, function(data) {
-        if (data!==true) lychee.error(null, params, data);
-    })
+    basicModal.show({
+        body: '<p>Are you sure you want to merge all selected albums?</p>',
+        buttons: {
+            action: {
+                title: 'Merge Albums',
+                fn: action.fn,
+                class: 'red'
+            },
+            cancel: {
+                title: "Don't merge",
+                fn: basicModal.close
+            }
+        }
+    });
 }

Some files were not shown because too many files changed in this diff