Permalink
Browse files

When a route checkbox is toggled, actually toggle the route in the da…

…tabase (#113)

* Fixes #112 where routes could not be enabled or disabled
  • Loading branch information...
jlyon1 authored and kochman committed Nov 28, 2017
1 parent f9b9262 commit 5dd9136a7e573bccb0ae5fda6566d9d05935e575
Showing with 13 additions and 1 deletion.
  1. +13 −1 static/js/routes.js
View
@@ -39,7 +39,7 @@ Vue.component('route-card', {
<b>id</b>: {{info.id}}<br>
<b>name</b>: {{info.name}}<br>
<b>Description</b>: {{info.description}}<br>
<b>enabled</b>: <input type="checkbox" v-model="info.enabled"></input>{{info.enabled}}<br>
<b>enabled</b>: <input type="checkbox" v-model="info.enabled" @click="toggleRoute(info.id)"></input>{{info.enabled}}<br>
<b>Color</b>: {{info.color}}<br>
<b>Created</b>: {{info.created}} <br>
<br>
@@ -61,6 +61,18 @@ Vue.component('route-card', {
this.deleteCount++;
}
},
toggleRoute: function(id){
data = {id: id, enabled: !this.info.enabled};
$.ajax({
url: "/routes/edit",
type: "POST",
data: JSON.stringify(data),
contentType: "application/json",
complete: function(data){
}
});
},
deleteRoute: function(id){
$.ajax({
url: '/routes/' + id,

0 comments on commit 5dd9136

Please sign in to comment.