From af318414e2dc495698e244edfe53310649b7528f Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sun, 23 Sep 2018 15:52:19 -0700 Subject: [PATCH] Integrate photos with api.js. --- frontends/etiquette_flask/static/js/api.js | 25 +++++++++++++++++ .../etiquette_flask/templates/photo.html | 28 ++++--------------- 2 files changed, 31 insertions(+), 22 deletions(-) diff --git a/frontends/etiquette_flask/static/js/api.js b/frontends/etiquette_flask/static/js/api.js index fda62ec..506ff7c 100644 --- a/frontends/etiquette_flask/static/js/api.js +++ b/frontends/etiquette_flask/static/js/api.js @@ -149,6 +149,31 @@ function edit(bookmark_id, title, url, callback) /**************************************************************************************************/ api.photos = {}; +api.photos.add_tag = +function add_tag(photo_id, tagname, callback) +{ + var url = `/photo/${photo_id}/add_tag`; + var data = new FormData(); + data.append("tagname", tagname); + common.post(url, data, callback); +} + +api.photos.refresh_metadata = +function refresh_metadata(photo_id, callback) +{ + var url = `/photo/${photo_id}/refresh_metadata`; + common.post(url, null, callback); +} + +api.photos.remove_tag = +function remove_tag(photo_id, tagname, callback) +{ + var url = `/photo/${photo_id}/remove_tag`; + var data = new FormData(); + data.append("tagname", tagname); + common.post(url, data, callback); +} + /**************************************************************************************************/ api.tags = {}; diff --git a/frontends/etiquette_flask/templates/photo.html b/frontends/etiquette_flask/templates/photo.html index 66d46d2..1808002 100644 --- a/frontends/etiquette_flask/templates/photo.html +++ b/frontends/etiquette_flask/templates/photo.html @@ -8,6 +8,7 @@ + @@ -187,7 +188,7 @@ body

File info - +