From b5e3598b485fabb4c983d222d996d5583dfdd02a Mon Sep 17 00:00:00 2001 From: jendib Date: Sun, 4 Aug 2013 17:15:52 +0200 Subject: [PATCH] Tag stats design --- docs-parent/TODO | 3 ++- docs-web/src/main/webapp/js/controller/Tag.js | 9 +++++++++ docs-web/src/main/webapp/partial/tag.html | 4 ++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/docs-parent/TODO b/docs-parent/TODO index e80039bf..f752c062 100644 --- a/docs-parent/TODO +++ b/docs-parent/TODO @@ -1 +1,2 @@ -- Users administration (client) \ No newline at end of file +- Users administration (client) +- Tag color (client/server) \ No newline at end of file diff --git a/docs-web/src/main/webapp/js/controller/Tag.js b/docs-web/src/main/webapp/js/controller/Tag.js index 34e49b0a..052b0801 100644 --- a/docs-web/src/main/webapp/js/controller/Tag.js +++ b/docs-web/src/main/webapp/js/controller/Tag.js @@ -14,6 +14,15 @@ App.controller('Tag', function($scope, $dialog, $state, Tag, Restangular) { $scope.stats = data.stats; }) + /** + * Returns total number of document from tag stats. + */ + $scope.getStatCount = function() { + return _.reduce($scope.stats, function(memo, stat) { + return memo + stat.count + }, 0); + }; + /** * Add a tag. */ diff --git a/docs-web/src/main/webapp/partial/tag.html b/docs-web/src/main/webapp/partial/tag.html index f0c314d2..9c589946 100644 --- a/docs-web/src/main/webapp/partial/tag.html +++ b/docs-web/src/main/webapp/partial/tag.html @@ -27,8 +27,8 @@

{{ tags.length }} tag{{ tags.length > 1 ? 's' : '' }}

-
{{ stat.name }}
-
+
{{ stat.name }} {{ stat.count }}
+