From ae35ef12c26d04a202f9414a967f6536da3f80ec Mon Sep 17 00:00:00 2001 From: james Date: Wed, 29 Jun 2011 14:42:56 -0400 Subject: [PATCH] CC-2457:Confimation before deleting or changing - done --- .../js/airtime/preferences/musicdirs.js | 44 ++++++++++--------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/airtime_mvc/public/js/airtime/preferences/musicdirs.js b/airtime_mvc/public/js/airtime/preferences/musicdirs.js index 47df6d58a..962613c05 100644 --- a/airtime_mvc/public/js/airtime/preferences/musicdirs.js +++ b/airtime_mvc/public/js/airtime/preferences/musicdirs.js @@ -42,18 +42,20 @@ function setWatchedDirEvents() { $('#storageFolder-ok').click(function(){ var url, chosen; + + if(confirm("Are you sure you want to change the storage folder?")){ + url = "/Preference/change-stor-directory"; + chosen = $('#storageFolder').val(); - url = "/Preference/change-stor-directory"; - chosen = $('#storageFolder').val(); + $.post(url, + {format: "json", dir: chosen, element: "storageFolder"}, - $.post(url, - {format: "json", dir: chosen, element: "storageFolder"}, - - function(json) { - $("#watched-folder-section").empty(); - $("#watched-folder-section").append(json.subform); - setWatchedDirEvents(); - }); + function(json) { + $("#watched-folder-section").empty(); + $("#watched-folder-section").append(json.subform); + setWatchedDirEvents(); + }); + } }); $('#watchedFolder-ok').click(function(){ @@ -73,19 +75,21 @@ function setWatchedDirEvents() { }); $('.selected-item').find('.ui-icon-close').click(function(){ - var row = $(this).parent(); - var folder = $(this).prev().text(); + if(confirm("Are you sure you want to remove the watched folder?")){ + var row = $(this).parent(); + var folder = $(this).prev().text(); - url = "/Preference/remove-watch-directory"; + url = "/Preference/remove-watch-directory"; - $.post(url, - {format: "json", dir: folder}, + $.post(url, + {format: "json", dir: folder}, - function(json) { - $("#watched-folder-section").empty(); - $("#watched-folder-section").append(json.subform); - setWatchedDirEvents(); - }); + function(json) { + $("#watched-folder-section").empty(); + $("#watched-folder-section").append(json.subform); + setWatchedDirEvents(); + }); + } }); }