aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r/static/js
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2015-03-28 09:55:16 +0100
committerCédric Bonhomme <cedric@cedricbonhomme.org>2015-03-28 09:55:16 +0100
commitd1cbb124997166292eed2f7cfb25c82d82792226 (patch)
tree655a29c97f058076425558f8ce9c48651639112e /pyaggr3g470r/static/js
parentMerge branch 'master' of bitbucket.org:cedricbonhomme/pyaggr3g470r (diff)
downloadnewspipe-d1cbb124997166292eed2f7cfb25c82d82792226.tar.gz
newspipe-d1cbb124997166292eed2f7cfb25c82d82792226.tar.bz2
newspipe-d1cbb124997166292eed2f7cfb25c82d82792226.zip
It is now possible to delete all duplicate articles with one request.
Diffstat (limited to 'pyaggr3g470r/static/js')
-rw-r--r--pyaggr3g470r/static/js/articles.js33
1 files changed, 32 insertions, 1 deletions
diff --git a/pyaggr3g470r/static/js/articles.js b/pyaggr3g470r/static/js/articles.js
index e30c6979..a5ac82d0 100644
--- a/pyaggr3g470r/static/js/articles.js
+++ b/pyaggr3g470r/static/js/articles.js
@@ -131,7 +131,7 @@ if (typeof jQuery === 'undefined') { throw new Error('Requires jQuery') }
var article_id = $(this).parent().parent().parent().attr("data-article");
$(this).parent().parent().parent().remove();
- // sends the updates to the server
+ // sends the updates to the server
$.ajax({
type: 'DELETE',
url: API_ROOT + "article/" + article_id,
@@ -144,4 +144,35 @@ if (typeof jQuery === 'undefined') { throw new Error('Requires jQuery') }
});
});
+
+ // Delete all duplicate articles (used in the page /duplicates)
+ $('.delete-all').click(function(){
+ var data = [];
+
+ var columnNo = $(this).parent().index();
+ $(this).closest("table")
+ .find("tr td:nth-child(" + (columnNo+1) + ")")
+ .each(function(line, column) {
+ data.push(parseInt(column.id));
+ }).remove();
+
+ data = JSON.stringify(data);
+
+ // sends the updates to the server
+ $.ajax({
+ type: 'DELETE',
+ // Provide correct Content-Type, so that Flask will know how to process it.
+ contentType: 'application/json',
+ data: data,
+ url: API_ROOT + "articles",
+ success: function (result) {
+ //console.log(result);
+ },
+ error: function(XMLHttpRequest, textStatus, errorThrown){
+ console.log(XMLHttpRequest.responseText);
+ }
+ });
+
+ });
+
}(jQuery);
bgstack15