From 693c26c2b32f65bc79b5e9c64efddae01ede3a8b Mon Sep 17 00:00:00 2001 From: Jonathan Rehm Date: Sat, 22 Jul 2017 11:24:47 -0700 Subject: [PATCH] Attach events to button toolbar Since this is closer to the elements, we can be more sure that we won't have events fire when we don't want them to. For example, if we're viewing the page in a modal, we don't want the event handler living longer than the content itself. --- cps/static/js/details.js | 2 +- cps/templates/detail.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cps/static/js/details.js b/cps/static/js/details.js index c3aaf4e4..74dbb08e 100644 --- a/cps/static/js/details.js +++ b/cps/static/js/details.js @@ -6,7 +6,7 @@ $("#have_read_cb").on("change", function() { $(this).closest("form").submit(); }); -$(document).on("click", "[data-shelf-action]", function (e) { +$("#shelf-actions").on("click", "[data-shelf-action]", function (e) { e.preventDefault(); $.get(this.href) diff --git a/cps/templates/detail.html b/cps/templates/detail.html index 37cdd01f..08f84ca6 100644 --- a/cps/templates/detail.html +++ b/cps/templates/detail.html @@ -183,7 +183,7 @@ {% if g.user.is_authenticated %} {% if g.user.shelf.all() or g.public_shelfes %} -