From 61b9bbdea11902fba4b161674b0e504a5964874e Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Tue, 1 Jul 2014 13:17:32 +0200 Subject: [PATCH] Initial work on issues detail. --- app/coffee/app.coffee | 6 +- app/coffee/modules/base.coffee | 3 +- app/coffee/modules/base/navurls.coffee | 1 + app/coffee/modules/issues/detail.coffee | 118 +++++++++++++++++++ app/coffee/modules/issues/list.coffee | 2 +- app/coffee/modules/resources/issues.coffee | 3 + app/partials/issues-detail.jade | 84 +++++++++++++ app/partials/issues.jade | 16 +-- app/partials/views/modules/issues-table.jade | 3 +- 9 files changed, 222 insertions(+), 14 deletions(-) create mode 100644 app/coffee/modules/issues/detail.coffee create mode 100644 app/partials/issues-detail.jade diff --git a/app/coffee/app.coffee b/app/coffee/app.coffee index 22f12efe..f27ed304 100644 --- a/app/coffee/app.coffee +++ b/app/coffee/app.coffee @@ -21,11 +21,15 @@ @taiga = taiga = {} -configure = ($routeProvider, $locationProvider, $httpProvider, $provide, $compileProvider, $gmUrlsProvider) -> +configure = ($routeProvider, $locationProvider, $httpProvider, $provide, + $compileProvider, $gmUrlsProvider) -> + $routeProvider.when("/project/:pslug/backlog", {templateUrl: "/partials/backlog.html"}) $routeProvider.when("/project/:pslug/taskboard/:id", {templateUrl: "/partials/taskboard.html"}) $routeProvider.when("/project/:pslug/issues", {templateUrl: "/partials/issues.html"}) $routeProvider.when("/project/:pslug/search", {templateUrl: "/partials/search.html"}) + $routeProvider.when("/project/:pslug/issues/:issueref", + {templateUrl: "/partials/issues-detail.html"}) $routeProvider.when("/login", {templateUrl: "/partials/login.html"}) $routeProvider.when("/register", {templateUrl: "/partials/register.html"}) diff --git a/app/coffee/modules/base.coffee b/app/coffee/modules/base.coffee index eebfed1a..1945988a 100644 --- a/app/coffee/modules/base.coffee +++ b/app/coffee/modules/base.coffee @@ -164,7 +164,8 @@ urls = { "project-backlog": "/project/:project/backlog", "project-taskboard": "/project/:project/taskboard/:sprint", "project-issues": "/project/:project/issues", - "project-search": "/project/:project/search" + "project-search": "/project/:project/search", + "project-issues-detail": "/project/:project/issues/:ref" } init = ($log, $navurls) -> diff --git a/app/coffee/modules/base/navurls.coffee b/app/coffee/modules/base/navurls.coffee index 71675ebd..136c385a 100644 --- a/app/coffee/modules/base/navurls.coffee +++ b/app/coffee/modules/base/navurls.coffee @@ -76,6 +76,7 @@ NavigationUrlsDirective = ($navurls, $auth, $q, $location) -> options.user = user.username if user url = $navurls.resolve(name) + fullUrl = formatUrl(url, options) $location.url(fullUrl) diff --git a/app/coffee/modules/issues/detail.coffee b/app/coffee/modules/issues/detail.coffee new file mode 100644 index 00000000..4c761f3e --- /dev/null +++ b/app/coffee/modules/issues/detail.coffee @@ -0,0 +1,118 @@ +### +# 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/issues/detail.coffee +### + +taiga = @.taiga + +mixOf = @.taiga.mixOf +trim = @.taiga.trim +toString = @.taiga.toString +joinStr = @.taiga.joinStr +groupBy = @.taiga.groupBy +bindOnce = @.taiga.bindOnce + +module = angular.module("taigaIssues") + +############################################################################# +## Issue Detail Controller +############################################################################# + +class IssueDetailController extends mixOf(taiga.Controller, taiga.PageMixin) + @.$inject = [ + "$scope", + "$rootScope", + "$tgRepo", + "$tgConfirm", + "$tgResources", + "$routeParams", + "$q", + "$location" + ] + + constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location) -> + @scope.issueRef = @params.issueref + @scope.sectionName = "Issues" + + promise = @.loadInitialData() + promise.then null, -> + console.log "FAIL" #TODO + + loadProject: -> + return @rs.projects.get(@scope.projectId).then (project) => + @scope.project = project + @scope.issueStatusById = groupBy(project.issue_statuses, (x) -> x.id) + @scope.severityById = groupBy(project.severities, (x) -> x.id) + @scope.priorityById = groupBy(project.priorities, (x) -> x.id) + @scope.membersById = groupBy(project.memberships, (x) -> x.user) + return project + + loadIssue: -> + return @rs.issues.get(@scope.projectId, @scope.issueId).then (issue) => + @scope.issue = issue + return issue + + loadInitialData: -> + params = { + pslug: @params.pslug + issueref: @params.issueref + } + + promise = @repo.resolve(params).then (data) => + @scope.projectId = data.project + @scope.issueId = data.issue + return data + + return promise.then(=> @.loadProject()) + .then(=> @.loadUsersAndRoles()) + .then(=> @.loadIssue()) + +module.controller("IssueDetailController", IssueDetailController) + + +############################################################################# +## Issue Main Directive +############################################################################# + +IssueDirective = ($log, $location) -> + linkSidebar = ($scope, $el, $attrs, $ctrl) -> + + + + + link = ($scope, $el, $attrs) -> + $ctrl = $el.controller() + linkSidebar($scope, $el, $attrs, $ctrl) + + return {link:link} + + +module.directive("tgIssueDetail", ["$log", "$tgLocation", IssueDirective]) + + +############################################################################# +## TagLine (possible should be moved as generic directive) +############################################################################# + +TagLineDirective = ($log) -> + link = ($scope, $el, $attrs) -> + + return {link:link} + +module.directive("tgTagLine", ["$log", TagLineDirective]) diff --git a/app/coffee/modules/issues/list.coffee b/app/coffee/modules/issues/list.coffee index 8674721d..9db21da3 100644 --- a/app/coffee/modules/issues/list.coffee +++ b/app/coffee/modules/issues/list.coffee @@ -16,7 +16,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . # -# File: modules/issues.coffee +# File: modules/issues/list.coffee ### taiga = @.taiga diff --git a/app/coffee/modules/resources/issues.coffee b/app/coffee/modules/resources/issues.coffee index d15d2980..cf0966e5 100644 --- a/app/coffee/modules/resources/issues.coffee +++ b/app/coffee/modules/resources/issues.coffee @@ -25,6 +25,9 @@ taiga = @.taiga resourceProvider = ($repo) -> service = {} + service.get = (projectId, issueId) -> + return $repo.queryOne("issues", issueId) + service.list = (projectId, filters) -> params = {project: projectId} params = _.extend({}, params, filters or {}) diff --git a/app/partials/issues-detail.jade b/app/partials/issues-detail.jade new file mode 100644 index 00000000..71a63723 --- /dev/null +++ b/app/partials/issues-detail.jade @@ -0,0 +1,84 @@ +extends dummy-layout + +block head + title Taiga Project management web application with scrum in mind! + +block content + div.wrapper(tg-issue-detail, ng-controller="IssueDetailController as ctrl", + ng-init="section='issues'") + div.main.us-detail + div.us-detail-header + include views/components/mainTitle + a.button.button-green(href="", title="Edit") Edit + section.us-story-main-data + h2.us-title + span.us-number(tg-bo-html="issue.ref") + span.us-name(ng-bind="issue.subject") + + // div.blocked-warning + // span.icon.icon-warning + // p.blocked Blocked! + // p We need Pilar to make a prototype out of this or we are not sure + // a.button.button-red.button-block(href="", title="Unblock US") Unblock + + div.user-story-tags(tg-tag-line, ng-model="issue.tags") + span + - for(var y = 0; y < 6; y++) + include views/components/tag + input(type="text", placeholder="Write tag...") + section.us-content(tg-bind-html="issue.description_html") + + // include views/modules/attachments + section.us-activity + ul.us-activity-tabs + li + a.active(href="#") + span.icon.icon-bulk + span.tab-title Comments + + li + a(href="#") + span.icon.icon-issues + span.tab-title Activity + include views/modules/comments + // include views/modules/activity + sidebar.menu-secondary.sidebar + h1 + span Open + span.us-detail-status In progress + div.us-detail-progress-bar + div.current-progress + span.tasks-completed 6/7 tasks completed + ul.points-per-role + li.total + span.points 10 + span.role total + + li(ng-repeat="role in roles track by role.id") + span.points 10 + span.role UX + + section.us-detail-assigned-to + div.user-avatar + a.avatar(href="", title="Assigned to") + img(src="http://thecodeplayer.com/u/uifaces/18.jpg", alt="username") + div.assigned-to + span.assigned-title Assigned to + span.user-assigned Anler Hernández + + section.watchers + div.watchers-header + span.title watchers + a.icon.icon-plus(href="", title="Add watcher") + div.watchers-content + - for(var y=0; y<5; y++) + div.watcher-single + div.watcher-avatar + a.avatar(href="", title="Assigned to") + img(src="http://thecodeplayer.com/u/uifaces/32.jpg", alt="username") + a.watcher-name(href="", title="Jesús Espino") Jesús Espino + + section.us-detail-settings + a.button.button-gray(href="", title="Client requirement") Client requirement + a.button.button-gray(href="", title="Team requirement") Team requirement + a.button.button-red(href="", title="Block") Block diff --git a/app/partials/issues.jade b/app/partials/issues.jade index e10f20af..6eae55ad 100644 --- a/app/partials/issues.jade +++ b/app/partials/issues.jade @@ -7,22 +7,18 @@ block content div.wrapper.issues(tg-issues, ng-controller="IssuesController as ctrl", ng-init="section='issues'") sidebar.menu-secondary.extrabar.filters-bar include views/modules/filters - //- TODO: Please delete this once filters are working correctly - sidebar.menu-secondary.sidebar.filters-container - // TODO: maybe everything related to this section - // should be done in one unique include? - header - h1 Filters - include views/modules/search-in - include views/modules/filter-tags + section.main.issues-page header include views/components/mainTitle + include views/modules/list-filters include views/modules/issues-table + + // Paginator is rended using js. div.paginator.issues-paginator - //-Included paginator via JS - div.lightbox.lightbox_add-issue.hidden + + div.hidden.lightbox.lightbox_add-issue include views/modules/lightbox_add-issue div.lightbox.lightbox_add-bulk include views/modules/lightbox_add-bulk diff --git a/app/partials/views/modules/issues-table.jade b/app/partials/views/modules/issues-table.jade index 36094734..83b86600 100644 --- a/app/partials/views/modules/issues-table.jade +++ b/app/partials/views/modules/issues-table.jade @@ -9,6 +9,7 @@ section.issues-table.basic-table div.level-field(tg-issue-severity="issue") div.level-field(tg-issue-priority="issue") div.subject - a(href="", tg-bo-html="issue.subject") + a(href="", tg-nav="project-issues-detail:project=project.slug,ref=issue.ref", + tg-bo-html="issue.subject") div.issue-field(tg-issue-status="issue") div.assigned-field(tg-issue-assignedto="issue")