diff --git a/app/coffee/modules/backlog/main.coffee b/app/coffee/modules/backlog/main.coffee index 031020d5..c5cb1eec 100644 --- a/app/coffee/modules/backlog/main.coffee +++ b/app/coffee/modules/backlog/main.coffee @@ -32,15 +32,6 @@ class BacklogController extends mixOf(taiga.Controller, taiga.PageMixin) @rootscope.$on("usform:bulk:success", @.loadUserstories) - initializeProjectStats: -> - @scope.stats = { - total_points: "--" - defined_points: "--" - assigned_points: "--" - closed_points: "--" - completedPercentage: "--%" - } - loadProjectStats: -> return @rs.projects.stats(@scope.projectId).then (stats) => @scope.stats = stats @@ -76,9 +67,6 @@ class BacklogController extends mixOf(taiga.Controller, taiga.PageMixin) return project loadInitialData: -> - # Set stats initial values - @.initializeProjectStats() - # Resolve project slug promise = @repo.resolve({pslug: @params.pslug}).then (data) => @scope.projectId = data.project diff --git a/app/coffee/modules/common/filters.coffee b/app/coffee/modules/common/filters.coffee new file mode 100644 index 00000000..c78bbaa7 --- /dev/null +++ b/app/coffee/modules/common/filters.coffee @@ -0,0 +1,31 @@ +### +# Copyright (C) 2014 Andrey Antukh +# Copyright (C) 2014 Jesús Espino Garcia +# Copyright (C) 2014 David Barragán Merino +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +# File: modules/common/filters.coffee +### + + +defaultFilter = -> + return (value, defaultValue) -> + if not value + return defaultValue + return value + +module = angular.module("taigaCommon") +module.filter("default", defaultFilter) + diff --git a/app/partials/views/components/summary.jade b/app/partials/views/components/summary.jade index aa77ed0d..1d850f13 100644 --- a/app/partials/views/components/summary.jade +++ b/app/partials/views/components/summary.jade @@ -6,14 +6,14 @@ div.summary(tg-backlog-summary) span.description completed ul li - span.number(ng-bind="stats.total_points") + span.number(ng-bind="stats.total_points|default:'--'") span.description project
points li - span.number(ng-bind="stats.defined_points") + span.number(ng-bind="stats.defined_points|default:'--'") span.description defined
points li - span.number(ng-bind="stats.assigned_points") + span.number(ng-bind="stats.assigned_points|default:'--'") span.description assigned
points li - span.number(ng-bind="stats.closed_points") + span.number(ng-bind="stats.closed_points|default:'-- %'") span.description closed
points