From 5a614bd3a486060bad7a160acecaa423b06e4cdf Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Tue, 17 Jun 2014 18:18:43 +0200 Subject: [PATCH] Another iteration over backlog. --- app/coffee/app.coffee | 1 - app/coffee/modules/backlog.coffee | 20 +++++- app/coffee/modules/base/bindonce.coffee | 38 +++++++++++ .../views/components/backlog-row.jade | 6 +- app/partials/views/modules/backlog-table.jade | 68 +++++++++---------- app/partials/views/modules/sprints.jade | 13 ++-- bower.json | 1 - gulpfile.coffee | 3 +- 8 files changed, 102 insertions(+), 48 deletions(-) create mode 100644 app/coffee/modules/base/bindonce.coffee diff --git a/app/coffee/app.coffee b/app/coffee/app.coffee index a096450e..29da6724 100644 --- a/app/coffee/app.coffee +++ b/app/coffee/app.coffee @@ -61,7 +61,6 @@ modules = [ # Vendor modules "ngRoute", "ngAnimate", - "pasvaz.bindonce", ] # Default Value for taiga local config module. diff --git a/app/coffee/modules/backlog.coffee b/app/coffee/modules/backlog.coffee index a9196e60..8a7fdda6 100644 --- a/app/coffee/modules/backlog.coffee +++ b/app/coffee/modules/backlog.coffee @@ -77,7 +77,7 @@ BacklogDirective = ($compile, $templateCache) -> $element.append(dom) link = ($scope, $element, $attrs, $ctrl) -> - backlogTableDom = $element.find("section.backlog-table") + backlogTableDom = $element.find("section.backlog-table-body") backlogLink($scope, backlogTableDom, $attrs, $ctrl) return { @@ -92,6 +92,24 @@ BacklogDirective = ($compile, $templateCache) -> link: link } +SprintDirective = ($compile, $templateCache) -> + link = (scope, element, attrs) -> + sprint = scope.$eval(attrs.tgSprint) + if scope.$first + element.addClass("sprint-current") + + if sprint.closed + element.addClass("sprint-closed") + + # Event Handlers + element.on "click", ".sprint-summary > a", (event) -> + element.find(".sprint-table").toggle() + + return { + link: link + } + module = angular.module("taigaBacklog", []) module.directive("tgBacklog", ["$compile", "$templateCache", BacklogDirective]) +module.directive("tgSprint", ["$compile", SprintDirective]) diff --git a/app/coffee/modules/base/bindonce.coffee b/app/coffee/modules/base/bindonce.coffee new file mode 100644 index 00000000..7351b062 --- /dev/null +++ b/app/coffee/modules/base/bindonce.coffee @@ -0,0 +1,38 @@ +### +# 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/base/bindonce.coffee +### + +# Html bind once directive +BindHtmlDirective = -> + link = (scope, element, attrs) -> + element.html(scope.$eval(attrs.tgBoHtml)) + + return {link:link} + +# Object reference bind once helper. +BindRefDirective = -> + link = (scope, element, attrs) -> + val = scope.$eval(attrs.tgBoRef) + element.html("##{val} ") + return {link:link} + +module = angular.module("taigaBase") +module.directive("tgBoHtml", BindHtmlDirective) +module.directive("tgBoRef", BindRefDirective) diff --git a/app/partials/views/components/backlog-row.jade b/app/partials/views/components/backlog-row.jade index ef48587a..56cd6bcc 100644 --- a/app/partials/views/components/backlog-row.jade +++ b/app/partials/views/components/backlog-row.jade @@ -1,5 +1,5 @@ div.row(ng-repeat="us in userstories") - div + div.user-stories div.user-story-name input(type="checkbox", name="") a(href="") {{ us.subject }} @@ -7,8 +7,8 @@ div.row(ng-repeat="us in userstories") a.icon.icon-edit(href="", title="Edit") a.icon.icon-delete(href="", title="Delete") div.user-story-tags - span.tag Tag name - span.tag Tag name + span.tag Tag name + span.tag Tag name div.status Status div.points 12 div.points 54 diff --git a/app/partials/views/modules/backlog-table.jade b/app/partials/views/modules/backlog-table.jade index e24c4ff8..00a1740e 100644 --- a/app/partials/views/modules/backlog-table.jade +++ b/app/partials/views/modules/backlog-table.jade @@ -10,40 +10,40 @@ section.backlog-table-header div.points.width-1 Front div.points.width-1 Total section.backlog-table-body - - for (var x = 0; x < 40; x++) - div.row - div.user-stories - div.user-story-name - input(type="checkbox", name="") - a(href="") Crear el perfil de usuario Senior en el admin - span.us-settings - a.icon.icon-edit(href="", title="Edit") - a.icon.icon-delete(href="", title="Delete") - div.user-story-tags - - for(var y = 0; y < 3; y++) - include ../components/tag - div.status.width-2 - a(href="", title="Status Name") Status Name - ul.popover.pop-status - li - a(href="", title="Status 1") Status 1 - li - a(href="", title="Status 2") Status 2 - li - a(href="", title="Status 3") Status 3 - div.points - a(href="", title="") 24 - div.points - a(href="", title="Total Points") 43 - ul.popover.pop-status - li - a(href="", title="Status 1") Status 1 - li - a(href="", title="Status 2") Status 2 - li - a(href="", title="Status 3") Status 3 - a.icon.icon-drag-v(href="", title="Drag") - hr.doom-line + // - for (var x = 0; x < 40; x++) + // div.row + // div.user-stories + // div.user-story-name + // input(type="checkbox", name="") + // a(href="") Crear el perfil de usuario Senior en el admin + // span.us-settings + // a.icon.icon-edit(href="", title="Edit") + // a.icon.icon-delete(href="", title="Delete") + // div.user-story-tags + // - for(var y = 0; y < 3; y++) + // include ../components/tag + // div.status.width-2 + // a(href="", title="Status Name") Status Name + // ul.popover.pop-status + // li + // a(href="", title="Status 1") Status 1 + // li + // a(href="", title="Status 2") Status 2 + // li + // a(href="", title="Status 3") Status 3 + // div.points + // a(href="", title="") 24 + // div.points + // a(href="", title="Total Points") 43 + // ul.popover.pop-status + // li + // a(href="", title="Status 1") Status 1 + // li + // a(href="", title="Status 2") Status 2 + // li + // a(href="", title="Status 3") Status 3 + // a.icon.icon-drag-v(href="", title="Drag") + // hr.doom-line script(type="text/ng-template" id="backlog-row.html") include ../components/backlog-row diff --git a/app/partials/views/modules/sprints.jade b/app/partials/views/modules/sprints.jade index cabe2396..616833de 100644 --- a/app/partials/views/modules/sprints.jade +++ b/app/partials/views/modules/sprints.jade @@ -10,7 +10,7 @@ section.sprints a.button-green(href="", title="Add New US") span.text + New sprint - section.sprint(ng-repeat="sprint in sprints track by sprint.id", tg-backlog-sprint) + section.sprint(ng-repeat="sprint in sprints track by sprint.id", tg-sprint="sprint") header div.sprint-summary a.icon.icon-arrow-up(href="", title="compact Sprint") @@ -26,11 +26,12 @@ section.sprints div.sprint-progress-bar div.current-progress div.sprint-table - - for (var x = 0; x < 10; x++) - div.row - div.column-us.width-8 - a.us-name(href="", title="") #125 Crear el perfil de usuario Senior en el admin - div.column-points.width-1 45 + div.row(ng-repeat="us in sprint.user_stories track by us.id") + div.column-us.width-8 + a.us-name(href="", title="") + span(tg-bo-ref="us.ref") + span(tg-bo-html="us.subject") + div.column-points.width-1(tg-bindonce-html="us.total_points") a.button.button-gray(href="", title="Current Sprint Taskboard") span Sprint Taskboard diff --git a/bower.json b/bower.json index 20cea1c5..bcb6b133 100644 --- a/bower.json +++ b/bower.json @@ -49,7 +49,6 @@ "i18next": "~1.7.1", "jquery": "~2.1.1", "select2": "~3.4.5", - "angular-bindonce": "~0.3.1", "angular-ui-select2": "~0.0.5", "google-diff-match-patch-js": "~1.0.0", "underscore.string": "~2.3.3", diff --git a/gulpfile.coffee b/gulpfile.coffee index 1de56485..f3957bde 100644 --- a/gulpfile.coffee +++ b/gulpfile.coffee @@ -51,8 +51,7 @@ vendorJsLibs = [ "app/vendor/angular/angular.js", "app/vendor/angular-route/angular-route.js", "app/vendor/angular-sanitize/angular-sanitize.js", - "app/vendor/angular-animate/angular-animate.js", - "app/vendor/angular-bindonce/bindonce.js" + "app/vendor/angular-animate/angular-animate.js" ]