diff --git a/app/views/visitors/index.html.haml b/app/views/visitors/index.html.haml
index a437984c..909402c7 100644
--- a/app/views/visitors/index.html.haml
+++ b/app/views/visitors/index.html.haml
@@ -15,6 +15,30 @@
%p= link_to '+ New Doodad', new_doodad_path
= render @doodads
+:javascript
+ function destroyDoodad(doodad_id) {
+ return fetch("/doodads/" + doodad_id, {
+ method: 'DELETE',
+ headers: {
+ "Content-Type": "application/json",
+ "Accept": "application/json"
+ }
+ })
+ .then(response => response)
+ };
+ // var s2 = Swiped.init({ query: '.bar li', list: true, left: 200, right: 200 });
+ var index_doodad_swiped = Swiped.init({ query: '#doodads .doodad',
+ list: true,
+ left: 200,
+ right: 200,
+ onOpen: function() {
+ var doodad_id = this.elem.className.split("-")[1];
+ destroyDoodad(doodad_id)
+ .then(results => console.log(results));
+ this.destroy(true)
+ }
+ });
+
-# #canisters
= render @canisters
- if current_user.signed_in?