CC-2457:Confimation before deleting or changing

- done
This commit is contained in:
james 2011-06-29 14:42:56 -04:00
parent c300b8f36d
commit ae35ef12c2
1 changed files with 24 additions and 20 deletions

View File

@ -42,18 +42,20 @@ function setWatchedDirEvents() {
$('#storageFolder-ok').click(function(){ $('#storageFolder-ok').click(function(){
var url, chosen; 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"; $.post(url,
chosen = $('#storageFolder').val(); {format: "json", dir: chosen, element: "storageFolder"},
$.post(url, function(json) {
{format: "json", dir: chosen, element: "storageFolder"}, $("#watched-folder-section").empty();
$("#watched-folder-section").append(json.subform);
function(json) { setWatchedDirEvents();
$("#watched-folder-section").empty(); });
$("#watched-folder-section").append(json.subform); }
setWatchedDirEvents();
});
}); });
$('#watchedFolder-ok').click(function(){ $('#watchedFolder-ok').click(function(){
@ -73,19 +75,21 @@ function setWatchedDirEvents() {
}); });
$('.selected-item').find('.ui-icon-close').click(function(){ $('.selected-item').find('.ui-icon-close').click(function(){
var row = $(this).parent(); if(confirm("Are you sure you want to remove the watched folder?")){
var folder = $(this).prev().text(); var row = $(this).parent();
var folder = $(this).prev().text();
url = "/Preference/remove-watch-directory"; url = "/Preference/remove-watch-directory";
$.post(url, $.post(url,
{format: "json", dir: folder}, {format: "json", dir: folder},
function(json) { function(json) {
$("#watched-folder-section").empty(); $("#watched-folder-section").empty();
$("#watched-folder-section").append(json.subform); $("#watched-folder-section").append(json.subform);
setWatchedDirEvents(); setWatchedDirEvents();
}); });
}
}); });
} }