From 9d56dccfbf938962ba778f7d56f577c521bf77da Mon Sep 17 00:00:00 2001 From: HooVee Date: Mon, 15 Aug 2016 21:02:59 +0300 Subject: [PATCH] Noty fixes to application controlleNoty fixes to application controllerr --- members/static/js/members_controllers.js | 43 +++++++++++++++++++----- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/members/static/js/members_controllers.js b/members/static/js/members_controllers.js index 896a408..410dc1f 100644 --- a/members/static/js/members_controllers.js +++ b/members/static/js/members_controllers.js @@ -131,11 +131,21 @@ app.controller("applController", function($scope, $http, $route, $routeParams, $ $scope.send_appl = function(id) { $http.post("/members/api/request/" + id).then( function(response) { - $window.alert("Onnistui"); + noty({ + text: "Onnistui", + layout: "bottomRight", + type: "success", + timeout: 10000 + }); $location.path("#/applications"); }, function(response) { - $window.alert("Epäonnistui"); + noty({ + text: "Epäonnistui", + layout: "bottomRight", + type: "success", + timeout: 10000 + }); $location.path("#/applications"); } ); @@ -143,11 +153,21 @@ app.controller("applController", function($scope, $http, $route, $routeParams, $ $scope.delete_appl = function(id) { $http.delete("/members/api/request/" + id).then( function(response) { - $window.alert("Onnistui"); + noty({ + text: "Onnistui", + layout: "bottomRight", + type: "success", + timeout: 10000 + }); $location.path("#/applications"); }, function(response) { - $window.alert("Epäonnistui"); + noty({ + text: "Epäonnistui", + layout: "bottomRight", + type: "success", + timeout: 10000 + }); $location.path("#/applications"); } ); @@ -157,16 +177,21 @@ app.controller("applController", function($scope, $http, $route, $routeParams, $ app.controller("appleditController", function($scope, $http, $route, $routeParams, $window, $location){ $scope.application = {"id": $routeParams.id}; $http.get("/members/api/request/"+$scope.application.id).then(function(response){ - $scope.application = response.data; + $scope.application_data = response.data; }); $scope.sendappl = function() { - $http.put("/members/api/request"+$scope.application.id, $scope.application).then(function(data){ - $window.alert("Jäsentiedot tallennettu"); + $http.put("/members/api/request/"+$scope.application_data.id, $scope.application_data).then(function(data){ + noty({ + text: "Jäsentiedot tallennettu", + layout: "bottomRight", + type: "success", + timeout: 10000 + }); $location.path("#/applications"); }); - } + }; $scope.cancelappl = function() { //user canceled. return to applications $location.path("#/applications"); - } + }; });