Update to make history delete and pin function call to new APIs
This commit is contained in:
parent
7a46c9fc5c
commit
68457ed3a2
1 changed files with 58 additions and 28 deletions
|
@ -166,19 +166,32 @@ function parseHistoryCallback(list, notehistory) {
|
||||||
pinned = false;
|
pinned = false;
|
||||||
item._values.pinned = false;
|
item._values.pinned = false;
|
||||||
}
|
}
|
||||||
getHistory(function (notehistory) {
|
checkIfAuth(function () {
|
||||||
for(var i = 0; i < notehistory.length; i++) {
|
postHistoryToServer(id, {
|
||||||
if (notehistory[i].id == id) {
|
pinned: pinned
|
||||||
notehistory[i].pinned = pinned;
|
}, function (err, result) {
|
||||||
break;
|
if (!err) {
|
||||||
}
|
if (pinned)
|
||||||
}
|
$this.addClass('active');
|
||||||
saveHistory(notehistory);
|
else
|
||||||
if (pinned)
|
$this.removeClass('active');
|
||||||
$this.addClass('active');
|
}
|
||||||
else
|
});
|
||||||
$this.removeClass('active');
|
}, function () {
|
||||||
});
|
getHistory(function (notehistory) {
|
||||||
|
for(var i = 0; i < notehistory.length; i++) {
|
||||||
|
if (notehistory[i].id == id) {
|
||||||
|
notehistory[i].pinned = pinned;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
saveHistory(notehistory);
|
||||||
|
if (pinned)
|
||||||
|
$this.addClass('active');
|
||||||
|
else
|
||||||
|
$this.removeClass('active');
|
||||||
|
});
|
||||||
|
})
|
||||||
});
|
});
|
||||||
buildTagsFilter(filtertags);
|
buildTagsFilter(filtertags);
|
||||||
}
|
}
|
||||||
|
@ -199,23 +212,40 @@ var clearHistory = false;
|
||||||
var deleteId = null;
|
var deleteId = null;
|
||||||
|
|
||||||
function deleteHistory() {
|
function deleteHistory() {
|
||||||
if (clearHistory) {
|
checkIfAuth(function () {
|
||||||
saveHistory([]);
|
deleteServerHistory(deleteId, function (err, result) {
|
||||||
historyList.clear();
|
if (!err) {
|
||||||
checkHistoryList();
|
if (clearHistory) {
|
||||||
deleteId = null;
|
historyList.clear();
|
||||||
} else {
|
checkHistoryList();
|
||||||
if (!deleteId) return;
|
} else {
|
||||||
getHistory(function (notehistory) {
|
historyList.remove('id', deleteId);
|
||||||
var newnotehistory = removeHistory(deleteId, notehistory);
|
checkHistoryList();
|
||||||
saveHistory(newnotehistory);
|
}
|
||||||
historyList.remove('id', deleteId);
|
}
|
||||||
|
$('.delete-modal').modal('hide');
|
||||||
|
deleteId = null;
|
||||||
|
clearHistory = false;
|
||||||
|
});
|
||||||
|
}, function () {
|
||||||
|
if (clearHistory) {
|
||||||
|
saveHistory([]);
|
||||||
|
historyList.clear();
|
||||||
checkHistoryList();
|
checkHistoryList();
|
||||||
deleteId = null;
|
deleteId = null;
|
||||||
});
|
} else {
|
||||||
}
|
if (!deleteId) return;
|
||||||
$('.delete-modal').modal('hide');
|
getHistory(function (notehistory) {
|
||||||
clearHistory = false;
|
var newnotehistory = removeHistory(deleteId, notehistory);
|
||||||
|
saveHistory(newnotehistory);
|
||||||
|
historyList.remove('id', deleteId);
|
||||||
|
checkHistoryList();
|
||||||
|
deleteId = null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
$('.delete-modal').modal('hide');
|
||||||
|
clearHistory = false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$(".ui-delete-modal-confirm").click(function () {
|
$(".ui-delete-modal-confirm").click(function () {
|
||||||
|
|
Loading…
Reference in a new issue