Now implemented create/edit userstory from kanban.

stable
Andrey Antukh 2014-07-22 12:34:00 +02:00
parent 2d3df5f55a
commit 2ef0a69679
7 changed files with 53 additions and 28 deletions

View File

@ -70,7 +70,7 @@ CreateEditUserstoryDirective = ($repo, $model, $rs, $rootScope) ->
$scope.us = {
project: $scope.projectId
is_archived: false
status: $scope.project.default_us_status
status: statusId or $scope.project.default_us_status
}
isNew = true
# Update texts for creation

View File

@ -59,8 +59,8 @@ class KanbanController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fi
# @scope.$on("sprintform:create:success", @.loadProjectStats)
# @scope.$on("sprintform:remove:success", @.loadSprints)
# @scope.$on("sprintform:remove:success", @.loadProjectStats)
# @scope.$on("usform:new:success", @.loadUserstories)
# @scope.$on("usform:edit:success", @.loadUserstories)
@scope.$on("usform:new:success", @.onNewUserstory)
@scope.$on("usform:edit:success", @.onUserstoryEdited)
@scope.$on("kanban:us:move", @.moveUs)
# @scope.$on("sprint:us:moved", @.loadSprints)
# @scope.$on("sprint:us:moved", @.loadProjectStats)
@ -157,25 +157,19 @@ class KanbanController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fi
return promise
## Template actions
# editUserStory: (us) ->
# @rootscope.$broadcast("usform:edit", us)
editUserStory: (us) ->
@rootscope.$broadcast("usform:edit", us)
# deleteUserStory: (us) ->
# #TODO: i18n
# title = "Delete User Story"
# subtitle = us.subject
addNewUs: (type, statusId) ->
switch type
when "standard" then @rootscope.$broadcast("usform:new", statusId)
when "bulk" then @rootscope.$broadcast("usform:bulk", statusId)
# @confirm.ask(title, subtitle).then =>
# # We modify the userstories in scope so the user doesn't see the removed US for a while
# @scope.userstories = _.without(@scope.userstories, us);
# @filterVisibleUserstories()
# @.repo.remove(us).then =>
# @.loadBacklog()
onNewUserstory: (ctx, us) ->
@scope.usByStatus[us.status].splice(0, 0, us)
# addNewUs: (type) ->
# switch type
# when "standard" then @rootscope.$broadcast("usform:new")
# when "bulk" then @rootscope.$broadcast("usform:bulk")
onUserstoryEdited: (ctx, us) ->
@.loadUserstories()
module.controller("KanbanController", KanbanController)
@ -191,11 +185,24 @@ KanbanDirective = ($repo, $rootscope) ->
module.directive("tgKanban", ["$tgRepo", "$rootScope", KanbanDirective])
#############################################################################
## Taskboard Task Directive
#############################################################################
KanbanUserstoryDirective = ->
link = ($scope, $el, $attrs) ->
$el.disableSelection()
return {link:link}
module.directive("tgKanbanUserstory", KanbanUserstoryDirective)
#############################################################################
## Kanban User Directive
#############################################################################
KanbanUserDirective = ($log) ->
template = _.template("""
<figure class="avatar">

View File

@ -41,6 +41,9 @@ KanbanSortableDirective = ($repo, $rs, $rootscope) ->
#########################
link = ($scope, $el, $attrs) ->
$el.css("height", "800px")
$el.closest(".kanban-table-body").css("height", "800px")
oldParentScope = null
newParentScope = null
itemEl = null

View File

@ -185,6 +185,12 @@ TaskboardDirective = ($rootscope) ->
return {link: link}
module.directive("tgTaskboard", ["$rootScope", TaskboardDirective])
#############################################################################
## Taskboard Task Directive
#############################################################################
TaskboardTaskDirective = ->
link = ($scope, $el, $attrs) ->
@ -198,7 +204,7 @@ module.directive("tgTaskboardTask", TaskboardTaskDirective)
#############################################################################
## Task Row Size Fixer Directive
## Taskboard Task Row Size Fixer Directive
#############################################################################
TaskboardRowSizeFixer = ->
@ -210,6 +216,12 @@ TaskboardRowSizeFixer = ->
return {link: link}
module.directive("tgTaskboardRowSizeFixer", TaskboardRowSizeFixer)
#############################################################################
## Taskboard us points Directive
#############################################################################
TaskboardUsPointsDirective = ($repo, $confirm) ->
# TODO: i18n
@ -305,6 +317,4 @@ TaskboardUsPointsDirective = ($repo, $confirm) ->
return {link: link}
module.directive("tgTaskboard", ["$rootScope", TaskboardDirective])
module.directive("tgTaskboardRowSizeFixer", TaskboardRowSizeFixer)
module.directive("tgTaskboardUsPoints", ["$tgRepo", "$tgConfirm", TaskboardUsPointsDirective])

View File

@ -21,3 +21,6 @@ block content
//-include views/modules/burndown
//-include views/modules/list-filters-kanban
include views/modules/kanban-table
div.lightbox.lightbox_add-new-us.hidden(tg-lb-create-edit-userstory)
include views/modules/lightbox_add-new-us

View File

@ -3,10 +3,10 @@ div.kanban-tagline
div.kanban-task-inner
p.task-text
span.task-num(tg-bo-ref="us.ref")
a.task-name(href="", title="", tg-bo-html="us.subject")
a.task-name(href="", title="", tg-bind-html="us.subject")
tg-kanban-user-avatar(model="us.assigned_to")
a.icon.icon-edit(href="", title="Edit", ng-click="ctrl.editTask(task)")
a.icon.icon-edit(href="", title="Edit", ng-click="ctrl.editUserStory(us)")
a.icon.icon-drag-h(href="", title="Drag&Drop")
a.task-points(href="", title="task points", tg-bo-html="us.total_points") --
a.task-points(href="", title="task points", tg-bind-html="us.total_points") --

View File

@ -3,11 +3,13 @@ div.kanban-table
div.kanban-table-inner
h2.task-colum_name(ng-repeat="s in usStatusList track by s.id")
span(tg-bo-html="s.name")
a.icon.icon-plus(href="", title="Add New task")
a.icon.icon-plus(href="", title="Add New task",
ng-click="ctrl.addNewUs('standard', s.id)")
div.kanban-table-body
div.kanban-table-inner
div.kanban-uses-box.task-column(ng-repeat="status in usStatusList track by status.id",
tg-kanban-sortable)
div.kanban-task(ng-repeat="us in usByStatus[status.id] track by us.id")
div.kanban-task(ng-repeat="us in usByStatus[status.id] track by us.id",
tg-kanban-userstory)
include ../components/kanban-task