From 305993e0f97ea84213177daaa7dde55a13a4cf46 Mon Sep 17 00:00:00 2001 From: jendib Date: Mon, 12 Aug 2013 21:32:16 +0200 Subject: [PATCH] Tag stats reflect changes in the tag list --- docs-web/src/main/webapp/js/controller/Tag.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs-web/src/main/webapp/js/controller/Tag.js b/docs-web/src/main/webapp/js/controller/Tag.js index 7d9d88f4..9ab54e1e 100644 --- a/docs-web/src/main/webapp/js/controller/Tag.js +++ b/docs-web/src/main/webapp/js/controller/Tag.js @@ -61,6 +61,13 @@ App.controller('Tag', function($scope, $dialog, $state, Tag, Restangular) { * Update a tag. */ $scope.updateTag = function(tag) { - Restangular.one('tag', tag.id).post('', tag); + // Update the server + Restangular.one('tag', tag.id).post('', tag).then(function () { + // Update the stat object + var stat = _.find($scope.stats, function (t) { + return tag.id == t.id; + }); + _.extend(stat, tag); + }); }; }); \ No newline at end of file