From b0985b8ea21051475757168041130824122103d5 Mon Sep 17 00:00:00 2001 From: JonatanRek Date: Fri, 11 Oct 2019 17:41:58 +0200 Subject: [PATCH] Automation Toggle #2 --- app/templates/js/automation.js | 10 +++------- app/templates/part/automationButton.phtml | 4 ++-- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/app/templates/js/automation.js b/app/templates/js/automation.js index 0ff1874..4d307e1 100644 --- a/app/templates/js/automation.js +++ b/app/templates/js/automation.js @@ -1,12 +1,11 @@ function restartAutomation(automationId){ console.log("restartingAutomation" + automationId); - event.preventDefault(); $.ajax({ url: 'ajax', type: 'POST', data: { "automation_id" : automationId, - "action": 'restart' + "action": "restart" }, success: function(data){ console.log(data); @@ -17,20 +16,17 @@ function restartAutomation(automationId){ }); } -function toggleAutomation(thisElement, automationId){ +function toggleAutomation(automationId){ console.log("togglingAutomation" + automationId); - event.preventDefault(); $.ajax({ url: 'ajax', type: 'POST', data: { "automation_id" : automationId, - "action": 'deactive' + "action": "deactive" }, success: function(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 bdb31ac..2947597 100644 --- a/app/templates/part/automationButton.phtml +++ b/app/templates/part/automationButton.phtml @@ -53,10 +53,10 @@