diff --git a/app/templates/js/automation.js b/app/templates/js/automation.js index 660f9d9..0ff1874 100644 --- a/app/templates/js/automation.js +++ b/app/templates/js/automation.js @@ -1,5 +1,6 @@ function restartAutomation(automationId){ console.log("restartingAutomation" + automationId); + event.preventDefault(); $.ajax({ url: 'ajax', type: 'POST', @@ -16,8 +17,9 @@ function restartAutomation(automationId){ }); } -function toggleAutomation(automationId){ +function toggleAutomation(thisElement, automationId){ console.log("togglingAutomation" + automationId); + event.preventDefault(); $.ajax({ url: 'ajax', type: 'POST', @@ -26,7 +28,9 @@ function toggleAutomation(automationId){ "action": 'deactive' }, success: function(data){ - console.log(data); + console.log($('automation-'+automationId)); + $('#automation-'+automationId).toggleClass("is-inactive"); + console.log('active'); }, error: function (request, status, error) { console.log("ERROR ", request, error); diff --git a/app/templates/part/automationButton.phtml b/app/templates/part/automationButton.phtml index b064ddb..bdb31ac 100644 --- a/app/templates/part/automationButton.phtml +++ b/app/templates/part/automationButton.phtml @@ -1,6 +1,6 @@
-