Finishing basic visualization for user story
parent
18318d4e75
commit
6442f8b040
|
@ -58,7 +58,7 @@ CreateEditUserstoryDirective = ($repo, $model, $rs, $rootScope) ->
|
|||
$el.find("label.blocked").addClass("selected")
|
||||
if us.team_requirement
|
||||
$el.find("label.team-requirement").addClass("selected")
|
||||
if us.is_blocked
|
||||
if us.client_requirement
|
||||
$el.find("label.client-requirement").addClass("selected")
|
||||
|
||||
$scope.$on "$destroy", ->
|
||||
|
|
|
@ -25,9 +25,10 @@ taiga = @.taiga
|
|||
resourceProvider = ($repo, $http, $urls) ->
|
||||
service = {}
|
||||
|
||||
service.list = (projectId, sprintId=null) ->
|
||||
service.list = (projectId, sprintId=null, userStoryId=null) ->
|
||||
params = {project: projectId}
|
||||
params.milestone = sprintId if sprintId
|
||||
params.user_story = userStoryId if userStoryId
|
||||
return $repo.queryMany("tasks", params)
|
||||
|
||||
service.bulkCreate = (projectId, usId, data) ->
|
||||
|
|
|
@ -55,11 +55,10 @@ class UserStoryDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
|
|||
@scope.project = project
|
||||
@scope.statusList = project.issue_statuses
|
||||
@scope.statusById = groupBy(project.us_statuses, (x) -> x.id)
|
||||
@scope.severityList = project.severities
|
||||
@scope.severityById = groupBy(project.severities, (x) -> x.id)
|
||||
@scope.priorityList = project.priorities
|
||||
@scope.priorityById = groupBy(project.priorities, (x) -> x.id)
|
||||
@scope.taskStatusById = groupBy(project.task_statuses, (x) -> x.id)
|
||||
@scope.membersById = groupBy(project.memberships, (x) -> x.user)
|
||||
@scope.pointsList = _.sortBy(project.points, "order")
|
||||
@scope.pointsById = groupBy(@scope.pointsList, (e) -> e.id)
|
||||
return project
|
||||
|
||||
loadUs: ->
|
||||
|
@ -69,6 +68,15 @@ class UserStoryDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
|
|||
@scope.previousUrl = "/project/#{@scope.project.slug}/us/#{@scope.us.neighbors.previous.ref}" if @scope.us.neighbors.previous.id?
|
||||
@scope.nextUrl = "/project/#{@scope.project.slug}/us/#{@scope.us.neighbors.next.ref}" if @scope.us.neighbors.next.id?
|
||||
|
||||
loadTasks: ->
|
||||
# http://localhost:8000/api/v1/tasks?user_story=6
|
||||
return @rs.tasks.list(@scope.projectId, null, @scope.usId).then (tasks) =>
|
||||
@scope.tasks = tasks
|
||||
@scope.totalTasks = tasks.length
|
||||
closedTasks = _.filter(tasks, (task) => @scope.taskStatusById[task.status].is_closed)
|
||||
@scope.totalClosedTasks = closedTasks.length
|
||||
@scope.usProgress = 100 * @scope.totalClosedTasks / @scope.totalTasks
|
||||
|
||||
loadHistory: ->
|
||||
return @rs.userstories.history(@scope.usId).then (history) =>
|
||||
_.each history.results, (historyResult) ->
|
||||
|
@ -95,6 +103,7 @@ class UserStoryDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
|
|||
return promise.then(=> @.loadProject())
|
||||
.then(=> @.loadUsersAndRoles())
|
||||
.then(=> @.loadUs())
|
||||
.then(=> @.loadTasks())
|
||||
.then(=> @.loadHistory())
|
||||
|
||||
getUserFullName: (userId) ->
|
||||
|
@ -222,3 +231,63 @@ UsStatusDetailDirective = () ->
|
|||
return {link:link, require:"ngModel"}
|
||||
|
||||
module.directive("tgUsStatusDetail", UsStatusDetailDirective)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#############################################################################
|
||||
## User story points detail directive
|
||||
#############################################################################
|
||||
|
||||
USPointsDetailDirective = () ->
|
||||
#TODO: i18n
|
||||
template = _.template("""
|
||||
<ul class="points-per-role">
|
||||
<li class="total">
|
||||
<span class="points"><%- totalPoints %></span>
|
||||
<span class="role">total</span>
|
||||
</li>
|
||||
<% _.each(rolePoints, function(rolePoint) { %>
|
||||
<li class="total">
|
||||
<span class="points"><%- rolePoint.points %></span>
|
||||
<span class="role"><%- rolePoint.name %></span></li>
|
||||
<% }); %>
|
||||
</ul>
|
||||
""")
|
||||
|
||||
link = ($scope, $el, $attrs, $model) ->
|
||||
editable = $attrs.editable?
|
||||
|
||||
renderUsPointsDetail = (us) ->
|
||||
|
||||
rolePoints = _.clone(_.filter($scope.project.roles, "computable"), true)
|
||||
_.map rolePoints, (v, k) ->
|
||||
val = $scope.pointsById[us.points[v.id]].value
|
||||
val = "?" if not val?
|
||||
v.points = val
|
||||
|
||||
html = template({
|
||||
editable: editable
|
||||
totalPoints: us.total_points
|
||||
rolePoints: rolePoints
|
||||
})
|
||||
$el.html(html)
|
||||
|
||||
$scope.$watch $attrs.ngModel, (us) ->
|
||||
if us?
|
||||
renderUsPointsDetail(us)
|
||||
|
||||
if editable
|
||||
console.log "TODO"
|
||||
|
||||
return {link:link, require:"ngModel"}
|
||||
|
||||
module.directive("tgUsPointsDetail", USPointsDetailDirective)
|
||||
|
|
|
@ -50,10 +50,5 @@ block content
|
|||
section.us-assigned-to(tg-assigned-to, ng-model="issue")
|
||||
section.watchers(tg-watchers, ng-model="issue.watchers")
|
||||
|
||||
section.us-detail-settings
|
||||
//TODO: remove commented from issues-detail when copied to user-story-detail
|
||||
//span.button.button-gray Client requirement
|
||||
//span.button.button-gray Team requirement
|
||||
|
||||
div.lightbox.lightbox_block.hidden
|
||||
include views/modules/lightbox_block
|
||||
|
|
|
@ -48,24 +48,16 @@ block content
|
|||
section.us-status(tg-us-status-detail, ng-model="us")
|
||||
|
||||
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
|
||||
- for(var x=0; x<5; x++)
|
||||
li.total
|
||||
span.points 10
|
||||
span.role UX
|
||||
div.current-progress(style="width:{{ usProgress }}%")
|
||||
span.tasks-completed {{ totalClosedTasks }}/{{ totalTasks}} tasks completed
|
||||
ul.points-per-role(tg-us-points-detail, ng-model="us")
|
||||
|
||||
section.us-assigned-to(tg-assigned-to, ng-model="us")
|
||||
section.watchers(tg-watchers, ng-model="us.watchers")
|
||||
|
||||
section.us-detail-settings
|
||||
span.button.button-gray(href="", title="Client requirement") Client requirement
|
||||
span.button.button-gray(href="", title="Team requirement") Team requirement
|
||||
span.button.button-red(href="", title="Block") Block
|
||||
span.button.button-gray(href="", title="Client requirement", ng-class="us.client_requirement ? 'active' : ''") Client requirement
|
||||
span.button.button-gray(href="", title="Team requirement", ng-class="us.team_requirement ? 'active' : ''") Team requirement
|
||||
|
||||
div.lightbox.lightbox_block.hidden
|
||||
include views/modules/lightbox_block
|
||||
|
|
Loading…
Reference in New Issue