diff --git a/members/static/html/jasenhakemukset.html b/members/static/html/jasenhakemukset.html index e6eda34..95e1a3f 100644 --- a/members/static/html/jasenhakemukset.html +++ b/members/static/html/jasenhakemukset.html @@ -21,11 +21,11 @@
- Muokkaa + Muokkaa
- \ No newline at end of file + diff --git a/members/static/js/members_controllers.js b/members/static/js/members_controllers.js index 13f4c86..fc0f8d2 100644 --- a/members/static/js/members_controllers.js +++ b/members/static/js/members_controllers.js @@ -19,15 +19,6 @@ app.controller("getController", function($scope, $http, $window, $location){ layout: "bottomRight", type: "success", timeout: 10000 - // , - // buttons: [ - // { - // addClass: 'btn btn-primary', text: 'Undo', onClick: function() { - - // } - // } - // ] - // http://ned.im/noty/#/about }); $scope.getFunction(); }, @@ -73,15 +64,6 @@ function() ] }); }); - - // var msg = attr.ngConfirmClick || "Are you sure?"; - // var clickAction = attr.confirmedClick; - // element.bind('click',function (event) - // { - // if ( window.confirm(msg) ) { - // scope.$eval(clickAction) - // } - // }); } }}]); @@ -104,27 +86,30 @@ app.controller("postController", function($scope, $http, $location) { }); } }); -app.controller("editController", function($scope, $http, $route, $routeParams, $window, $location) { - $scope.member = {"id": $routeParams.id}; - $http.get("/members/api/member/"+$scope.member.id).then(function(response){ - $scope.member = response.data; - }); - - $scope.send = function() { - $http.put("/members/api/member/"+$scope.member.id, $scope.member).then(function(data){ - noty({ - text: "Jäsentiedot tallennettu", - layout: "bottomRight", - type: "success", - timeout: 10000 - }); - $location.path("/list"); +function editor(returnpath){ + return function($scope, $http, $route, $routeParams, $window, $location) { + $scope.member = {"id": $routeParams.id}; + $http.get("/members/api/member/"+$scope.member.id).then(function(response){ + $scope.member = response.data; }); - } - $scope.cancel = function() { //user canceled. return to list - $location.path("/list"); - } -}); + + $scope.send = function() { + $http.put("/members/api/member/"+$scope.member.id, $scope.member).then(function(data){ + noty({ + text: "Jäsentiedot tallennettu", + layout: "bottomRight", + type: "success", + timeout: 10000 + }); + $location.path(returnpath); + }); + } + $scope.cancel = function() { //user canceled. return to list + $location.path(returnpath); + } + } +} +app.controller("editController",editor("/list")); app.controller("applController", function($scope, $http, $route, $routeParams, $window, $location){ $scope.applGetFunction = function() { @@ -179,24 +164,4 @@ 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.sendappl = function() { - $http.put("/members/api/request/"+$scope.application.id, $scope.application).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"); - }; -}); +app.controller("appleditController", editor("/applications")); diff --git a/members/static/js/members_routers.js b/members/static/js/members_routers.js index 7c274a7..a2c1ce8 100644 --- a/members/static/js/members_routers.js +++ b/members/static/js/members_routers.js @@ -21,7 +21,7 @@ app.config(['$routeProvider', function($routeProvider){ controller:'applController', }) .when('/applications/edit/:id',{ - templateUrl:"/static/html/muokkaa_hakemusta.html", + templateUrl:"/static/html/muokkaa_jasenta.html", controller:'appleditController', }) .otherwise({