From 206f3ba28d878591ddf7b27e80983f5307577186 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Thu, 29 Jan 2015 23:00:46 +0100 Subject: [PATCH] New modal for setDropboxKey --- src/scripts/settings.js | 55 ++++++++++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 17 deletions(-) diff --git a/src/scripts/settings.js b/src/scripts/settings.js index 978d56b..db742ea 100644 --- a/src/scripts/settings.js +++ b/src/scripts/settings.js @@ -304,29 +304,50 @@ settings.setSorting = function() { settings.setDropboxKey = function(callback) { - var buttons, - params, - key; + var action, + msg = ""; - buttons = [ - ['Set Key', function() { + action = function(data) { - key = $('.message input.text#key').val(); + var params, + key = data.key; - params = 'setDropboxKey&key=' + key; - lychee.api(params, function(data) { + if (data.key.length<1) { + basicModal.error('key'); + return false; + } - if (data===true) { - lychee.dropboxKey = key; - if (callback) lychee.loadDropbox(callback); - } else lychee.error(null, params, data); + basicModal.close(); - }); + params = 'setDropboxKey&key=' + key; + lychee.api(params, function(data) { - }], - ['Cancel', function() {}] - ]; + if (data===true) { + lychee.dropboxKey = key; + if (callback) lychee.loadDropbox(callback); + } else lychee.error(null, params, data); + + }); - modal.show('Set Dropbox Key', "In order to import photos from your Dropbox, you need a valid drop-ins app key from their website. Generate yourself a personal key and enter it below: ", buttons); + } + + msg += "

"; + msg += "In order to import photos from your Dropbox, you need a valid drop-ins app key from their website. Generate yourself a personal key and enter it below:"; + msg += ""; + msg += "

"; + + basicModal.show({ + body: msg, + buttons: { + action: { + title: 'Set Dropbox Key', + fn: action + }, + cancel: { + title: 'Cancel', + fn: basicModal.close + } + } + }); } \ No newline at end of file