Initial iteration on taskboard.

stable
Andrey Antukh 2014-06-24 16:10:21 +02:00
parent 82f0fc004b
commit 692f3564f7
8 changed files with 191 additions and 38 deletions

View File

@ -23,6 +23,8 @@
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/backlog", {templateUrl: "/partials/backlog.html"})
$routeProvider.when("/project/:pslug/taskboard/:id", {templateUrl: "/partials/taskboard.html"})
$routeProvider.when("/login", {templateUrl: "/partials/login.html"}) $routeProvider.when("/login", {templateUrl: "/partials/login.html"})
$routeProvider.otherwise({redirectTo: '/login'}) $routeProvider.otherwise({redirectTo: '/login'})
@ -71,6 +73,7 @@ modules = [
# Specific Modules # Specific Modules
"taigaBacklog", "taigaBacklog",
"taigaTaskboard",
# Vendor modules # Vendor modules
"ngRoute", "ngRoute",

View File

@ -107,5 +107,6 @@ module.run([
"$tgSprintsResourcesProvider", "$tgSprintsResourcesProvider",
"$tgUserstoriesResourcesProvider", "$tgUserstoriesResourcesProvider",
"$tgMdRenderResourcesProvider", "$tgMdRenderResourcesProvider",
"$tgTasksResourcesProvider",
initResources initResources
]) ])

View File

@ -0,0 +1,38 @@
###
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino Garcia <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán Merino <bameda@dbarragan.com>
#
# 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 <http://www.gnu.org/licenses/>.
#
# File: modules/resources/tasks.coffee
###
taiga = @.taiga
resourceProvider = ($repo) ->
service = {}
service.list = (projectId, sprintId=null) ->
params = {project: projectId}
params.milestone = sprintId if sprintId
return $repo.queryMany("tasks", params)
return (instance) ->
instance.tasks = service
module = angular.module("taigaResources")
module.factory("$tgTasksResourcesProvider", ["$tgRepo", resourceProvider])

View File

@ -0,0 +1,113 @@
###
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino Garcia <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán Merino <bameda@dbarragan.com>
#
# 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 <http://www.gnu.org/licenses/>.
#
# File: modules/taskboard.coffee
###
taiga = @.taiga
mixOf = @.taiga.mixOf
class TaskboardController extends mixOf(taiga.Controller, taiga.PageMixin)
@.$inject = [
"$scope",
"$rootScope",
"$tgRepo",
"$tgConfirm",
"$tgResources",
"$routeParams",
"$q"
]
constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q) ->
@scope.sprintId = @params.id
promise = @.loadInitialData()
promise.then null, ->
console.log "FAIL"
loadSprintStats: ->
return @rs.sprints.stats(@scope.projectId, @scope.sprintId).then (stats) =>
console.log "loadSprintStats",
@scope.stats = stats
return stats
loadSprint: ->
return @rs.sprints.get(@scope.projectId, @scope.sprintId).then (sprint) =>
console.log "loadSprint", sprint
@scope.sprint = sprint
@scope.userstories = sprint.user_stories
return sprint
loadTasks: ->
return @rs.tasks.list(@scope.projectId, @scope.sprintId).then (tasks) =>
@scope.tasks = tasks
@scope.tasksByStatus = _.groupBy(tasks, "status")
console.log "loadTasks", @scope.tasksByStatus
return tasks
loadProject: ->
return @rs.projects.get(@scope.projectId).then (project) =>
@scope.project = project
@scope.points = _.sortBy(project.points, "order")
@scope.statusList = _.sortBy(project.task_statuses, "id")
console.log "loadProject", @scope.statusList
return project
loadTaskboard: ->
return @q.all([
@.loadSprintStats(),
@.loadSprint()
# @.loadTasks(),
]).then(=> @.loadTasks())
loadInitialData: ->
console.log @params
promise = @repo.resolve({pslug: @params.pslug}).then (data) =>
@scope.projectId = data.project
return data
return promise.then(=> @.loadProject())
.then(=> @.loadUsersAndRoles())
.then(=> @.loadTaskboard())
#############################################################################
## TaskboardDirective
#############################################################################
TaskboardDirective = ->
#########################
## Drag & Drop Link
#########################
linkSortable = ($scope, $el, $attrs, $ctrl) ->
console.log "TaskboardDirective:linkSortable"
link = ($scope, $el, $attrs) ->
$ctrl = $el.controller()
linkSortable($scope, $el, $attrs, $ctrl)
# linkCommon($scope, $el, $attrs, $ctrl)
$scope.$on "$destroy", ->
$el.off()
return {link: link}
module = angular.module("taigaTaskboard", [])
module.controller("TaskboardController", TaskboardController)
module.directive("tgTaskboard", TaskboardDirective)

View File

@ -1,15 +1,15 @@
extends layout extends dummy-layout
block head block head
title Taiga Project management web application with scrum in mind! title Taiga Project management web application with scrum in mind!
block content block content
div.wrapper div.wrapper(tg-taskboard, ng-controller="TaskboardController as ctrl")
section.main.taskboard section.main.taskboard
h1 h1
span ProjectName span(tg-bo-html="project.name")
span.green Sprint Name span.green(tg-bo-html="sprint-name")
span.date 02/10/2014-15/10/2014 span.date(tg-date-range="sprint.estimated_start,sprint.estimated_finish")
include views/components/large-summary include views/components/sprint-summary
include views/modules/burndown include views/modules/burndown
include views/modules/taskboard-table include views/modules/taskboard-table

View File

@ -1,4 +1,5 @@
div.summary.large-summary div.summary.large-summary
div(tg-sprint-progressbar="sprint")
div.summary-progress-bar div.summary-progress-bar
div.current-progress div.current-progress
div.data div.data

View File

@ -1,4 +1,4 @@
div.taskboard-task div.taskboard-task(ng-repeat="t in tasksByStatus[s.id] track by t.id")
div.taskboard-tagline div.taskboard-tagline
- for(var y = 0; y < 3; y++) - for(var y = 0; y < 3; y++)
a.taskboard-tag(href="", title="tasboard-tag") a.taskboard-tag(href="", title="tasboard-tag")

View File

@ -1,13 +1,12 @@
div.taskboard-table div.taskboard-table
div.taskboard-table-header div.taskboard-table-header
div.taskboard-table-inner div.taskboard-table-inner
- for(var z = 0; z < 11; z++) h2.task-colum_name "User story"
h2.task-colum_name user stories h2.task-colum_name(ng-repeat="s in statusList track by s.id", tg-bo-html="s.name")
div.taskboard-table-body div.taskboard-table-body
div.taskboard-table-inner div.taskboard-table-inner
div.taskboard_task-list.task-column div.taskboard_task-list.task-column
- for(var x = 0; x < 3; x++) div.task-row(ng-repeat="us in userstories track by us.id")
div.task-row
div.tag-list div.tag-list
- for(var y = 0; y < 5; y++) - for(var y = 0; y < 5; y++)
include ../components/tag include ../components/tag
@ -25,8 +24,6 @@ div.taskboard-table
li Back li Back
span 4.5 span 4.5
include ../components/addnewus include ../components/addnewus
- for(var z = 0; z < 10; z++) div.taskboard_task-playground.task-column(ng-repeat="s in statusList track by s.id")
div.taskboard_task-playground.task-column div.task-row(ng-repeat="us in userstories track by us.id")
- for(var x = 0; x < 3; x++)
div.task-row
include ../components/taskboard-task include ../components/taskboard-task