Remove US edition page and some extra deprecated code
parent
d41b259fbd
commit
94a9e4b7bf
|
@ -52,8 +52,6 @@ configure = ($routeProvider, $locationProvider, $httpProvider, $provide, $tgEven
|
||||||
# User stories
|
# User stories
|
||||||
$routeProvider.when("/project/:pslug/us/:usref",
|
$routeProvider.when("/project/:pslug/us/:usref",
|
||||||
{templateUrl: "/partials/us-detail.html", resolve: {loader: tgLoaderProvider.add()}})
|
{templateUrl: "/partials/us-detail.html", resolve: {loader: tgLoaderProvider.add()}})
|
||||||
$routeProvider.when("/project/:pslug/us/:usref/edit",
|
|
||||||
{templateUrl: "/partials/us-detail-edit.html"})
|
|
||||||
|
|
||||||
# Tasks
|
# Tasks
|
||||||
$routeProvider.when("/project/:pslug/task/:taskref",
|
$routeProvider.when("/project/:pslug/task/:taskref",
|
||||||
|
|
|
@ -67,7 +67,6 @@ urls = {
|
||||||
"project-search": "/project/:project/search"
|
"project-search": "/project/:project/search"
|
||||||
|
|
||||||
"project-userstories-detail": "/project/:project/us/:ref"
|
"project-userstories-detail": "/project/:project/us/:ref"
|
||||||
"project-userstories-detail-edit": "/project/:project/us/:ref/edit"
|
|
||||||
|
|
||||||
"project-tasks-detail": "/project/:project/task/:ref"
|
"project-tasks-detail": "/project/:project/task/:ref"
|
||||||
"project-tasks-detail-edit": "/project/:project/task/:ref/edit"
|
"project-tasks-detail-edit": "/project/:project/task/:ref/edit"
|
||||||
|
|
|
@ -140,230 +140,6 @@ class UserStoryDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
|
||||||
module.controller("UserStoryDetailController", UserStoryDetailController)
|
module.controller("UserStoryDetailController", UserStoryDetailController)
|
||||||
|
|
||||||
|
|
||||||
#############################################################################
|
|
||||||
## User story Main Directive
|
|
||||||
#############################################################################
|
|
||||||
|
|
||||||
UsDirective = ($tgrepo, $log, $location, $confirm, $navUrls, $loading) ->
|
|
||||||
linkSidebar = ($scope, $el, $attrs, $ctrl) ->
|
|
||||||
|
|
||||||
link = ($scope, $el, $attrs) ->
|
|
||||||
$ctrl = $el.controller()
|
|
||||||
linkSidebar($scope, $el, $attrs, $ctrl)
|
|
||||||
|
|
||||||
if $el.is("form")
|
|
||||||
form = $el.checksley()
|
|
||||||
|
|
||||||
$el.on "click", ".save-us", (event) ->
|
|
||||||
if not form.validate()
|
|
||||||
return
|
|
||||||
|
|
||||||
onSuccess = ->
|
|
||||||
$loading.finish(target)
|
|
||||||
$confirm.notify("success")
|
|
||||||
ctx = {
|
|
||||||
project: $scope.project.slug
|
|
||||||
ref: $scope.us.ref
|
|
||||||
}
|
|
||||||
$location.path($navUrls.resolve("project-userstories-detail", ctx))
|
|
||||||
|
|
||||||
onError = ->
|
|
||||||
$loading.finish(target)
|
|
||||||
$confirm.notify("error")
|
|
||||||
|
|
||||||
target = angular.element(event.currentTarget)
|
|
||||||
$loading.start(target)
|
|
||||||
$tgrepo.save($scope.us).then(onSuccess, onError)
|
|
||||||
|
|
||||||
return {link:link}
|
|
||||||
|
|
||||||
module.directive("tgUsDetail", ["$tgRepo", "$log", "$tgLocation", "$tgConfirm",
|
|
||||||
"$tgNavUrls", "$tgLoading", UsDirective])
|
|
||||||
|
|
||||||
|
|
||||||
#############################################################################
|
|
||||||
## User story status directive
|
|
||||||
#############################################################################
|
|
||||||
|
|
||||||
UsStatusDetailDirective = () ->
|
|
||||||
#TODO: i18n
|
|
||||||
template = _.template("""
|
|
||||||
<h1>
|
|
||||||
<span>
|
|
||||||
<% if (is_closed) { %>
|
|
||||||
Closed
|
|
||||||
<% } else { %>
|
|
||||||
Open
|
|
||||||
<% } %>
|
|
||||||
<span class="us-detail-status" style="color:<%= status.color %>"><%= status.name %></span>
|
|
||||||
</h1>
|
|
||||||
|
|
||||||
<div class="us-detail-progress-bar">
|
|
||||||
<div class="current-progress" style="width:<%- usProgress %>%"/>
|
|
||||||
<span clasS="tasks-completed">
|
|
||||||
<%- totalClosedTasks %>/<%- totalTasks %> tasks completed
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="us-created-by">
|
|
||||||
<div class="user-avatar">
|
|
||||||
<img src="<%= owner.photo %>" alt="<%- owner.full_name_display %>" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="created-by">
|
|
||||||
<span class="created-title">Created by <%- owner.full_name_display %></span>
|
|
||||||
<span class="created-date"><%- date %></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<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 <% if (editable) { %>clickable<% } %>" data-role-id="<%- rolePoint.id %>">
|
|
||||||
<span class="points"><%- rolePoint.points %></span>
|
|
||||||
<span class="role"><%- rolePoint.name %></span></li>
|
|
||||||
<% }); %>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<div class="issue-data">
|
|
||||||
<div class="status-data <% if (editable) { %>clickable<% } %>">
|
|
||||||
<span class="level" style="background-color:<%= status.color %>"></span>
|
|
||||||
<span class="status-status"><%= status.name %></span>
|
|
||||||
<% if (editable) { %>
|
|
||||||
<span class="icon icon-arrow-bottom"></span>
|
|
||||||
<% } %>
|
|
||||||
<span class="level-name">status</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
""")
|
|
||||||
selectionStatusTemplate = _.template("""
|
|
||||||
<ul class="popover pop-status">
|
|
||||||
<% _.each(statuses, function(status) { %>
|
|
||||||
<li><a href="" class="status" title="<%- status.name %>"
|
|
||||||
data-status-id="<%- status.id %>"><%- status.name %></a></li>
|
|
||||||
<% }); %>
|
|
||||||
</ul>
|
|
||||||
""")
|
|
||||||
selectionPointsTemplate = _.template("""
|
|
||||||
<ul class="popover pop-points-open">
|
|
||||||
<% _.each(points, function(point) { %>
|
|
||||||
<li><a href="" class="point" title="<%- point.name %>"
|
|
||||||
data-point-id="<%- point.id %>"><%- point.name %></a>
|
|
||||||
</li>
|
|
||||||
<% }); %>
|
|
||||||
</ul>
|
|
||||||
""")
|
|
||||||
|
|
||||||
link = ($scope, $el, $attrs, $model) ->
|
|
||||||
editable = $attrs.editable?
|
|
||||||
updatingSelectedRoleId = null
|
|
||||||
$ctrl = $el.controller()
|
|
||||||
|
|
||||||
showSelectPoints = (target) ->
|
|
||||||
us = $model.$modelValue
|
|
||||||
$el.find(".pop-points-open").remove()
|
|
||||||
$el.find(target).append(selectionPointsTemplate({ "points": $scope.project.points }))
|
|
||||||
target.removeClass('active')
|
|
||||||
$el.find(".pop-points-open a[data-point-id='#{us.points[updatingSelectedRoleId]}']").addClass("active")
|
|
||||||
# If not showing role selection let's move to the left
|
|
||||||
$el.find(".pop-points-open").popover().open()
|
|
||||||
|
|
||||||
calculateTotalPoints = (us)->
|
|
||||||
values = _.map(us.points, (v, k) -> $scope.pointsById[v].value)
|
|
||||||
values = _.filter(values, (num) -> num?)
|
|
||||||
if values.length == 0
|
|
||||||
return "?"
|
|
||||||
|
|
||||||
return _.reduce(values, (acc, num) -> acc + num)
|
|
||||||
|
|
||||||
renderUsstatus = (us) ->
|
|
||||||
owner = $scope.usersById?[us.owner]
|
|
||||||
date = moment(us.created_date).format("DD MMM YYYY HH:mm")
|
|
||||||
status = $scope.statusById[us.status]
|
|
||||||
rolePoints = _.clone(_.filter($scope.project.roles, "computable"), true)
|
|
||||||
_.map rolePoints, (v, k) ->
|
|
||||||
name = $scope.pointsById[us.points[v.id]].name
|
|
||||||
name = "?" if not name?
|
|
||||||
v.points = name
|
|
||||||
|
|
||||||
totalTasks = $scope.tasks.length
|
|
||||||
totalClosedTasks = _.filter($scope.tasks, (task) => $scope.taskStatusById[task.status].is_closed).length
|
|
||||||
usProgress = 0
|
|
||||||
usProgress = 100 * totalClosedTasks / totalTasks if totalTasks > 0
|
|
||||||
html = template({
|
|
||||||
owner: owner
|
|
||||||
date: date
|
|
||||||
editable: editable
|
|
||||||
is_closed: us.is_closed
|
|
||||||
status: status
|
|
||||||
totalPoints: us.total_points
|
|
||||||
rolePoints: rolePoints
|
|
||||||
totalTasks: totalTasks
|
|
||||||
totalClosedTasks: totalClosedTasks
|
|
||||||
usProgress: usProgress
|
|
||||||
})
|
|
||||||
$el.html(html)
|
|
||||||
$el.find(".status-data").append(selectionStatusTemplate({statuses:$scope.statusList}))
|
|
||||||
|
|
||||||
bindOnce $scope, "tasks", (tasks) ->
|
|
||||||
$scope.$watch $attrs.ngModel, (us) ->
|
|
||||||
if us?
|
|
||||||
renderUsstatus(us)
|
|
||||||
|
|
||||||
$scope.$on "related-tasks:update", ->
|
|
||||||
us = $scope.$eval $attrs.ngModel
|
|
||||||
if us?
|
|
||||||
# Reload the us because the status could have changed
|
|
||||||
$ctrl.loadUs()
|
|
||||||
renderUsstatus(us)
|
|
||||||
|
|
||||||
if editable
|
|
||||||
$el.on "click", ".status-data", (event) ->
|
|
||||||
event.preventDefault()
|
|
||||||
event.stopPropagation()
|
|
||||||
$el.find(".pop-status").popover().open()
|
|
||||||
|
|
||||||
$el.on "click", ".status", (event) ->
|
|
||||||
event.preventDefault()
|
|
||||||
event.stopPropagation()
|
|
||||||
target = angular.element(event.currentTarget)
|
|
||||||
$model.$modelValue.status = target.data("status-id")
|
|
||||||
renderUsstatus($model.$modelValue)
|
|
||||||
$.fn.popover().closeAll()
|
|
||||||
|
|
||||||
$el.on "click", ".total.clickable", (event) ->
|
|
||||||
event.preventDefault()
|
|
||||||
event.stopPropagation()
|
|
||||||
target = angular.element(event.currentTarget)
|
|
||||||
updatingSelectedRoleId = target.data("role-id")
|
|
||||||
target.siblings().removeClass('active')
|
|
||||||
target.addClass('active')
|
|
||||||
showSelectPoints(target)
|
|
||||||
|
|
||||||
$el.on "click", ".point", (event) ->
|
|
||||||
event.preventDefault()
|
|
||||||
event.stopPropagation()
|
|
||||||
|
|
||||||
target = angular.element(event.currentTarget)
|
|
||||||
$.fn.popover().closeAll()
|
|
||||||
|
|
||||||
$scope.$apply () ->
|
|
||||||
us = $model.$modelValue
|
|
||||||
usPoints = _.clone(us.points, true)
|
|
||||||
usPoints[updatingSelectedRoleId] = target.data("point-id")
|
|
||||||
us.points = usPoints
|
|
||||||
us.total_points = calculateTotalPoints(us)
|
|
||||||
renderUsstatus(us)
|
|
||||||
|
|
||||||
return {link:link, require:"ngModel"}
|
|
||||||
|
|
||||||
module.directive("tgUsStatusDetail", UsStatusDetailDirective)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
## User story status display directive
|
## User story status display directive
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
|
@ -1,52 +0,0 @@
|
||||||
extends dummy-layout
|
|
||||||
|
|
||||||
block head
|
|
||||||
title Taiga Your agile, free, and open source project management tool
|
|
||||||
|
|
||||||
block content
|
|
||||||
form.wrapper(tg-us-detail, ng-controller="UserStoryDetailController as ctrl",
|
|
||||||
ng-init="section='backlog'")
|
|
||||||
div.main.us-detail
|
|
||||||
div.us-detail-header.header-with-actions
|
|
||||||
include views/components/mainTitle
|
|
||||||
.action-buttons
|
|
||||||
a.button.button-green.save-us(href="", title="Save") Save
|
|
||||||
a.button.button-red.cancel(tg-nav="project-userstories-detail:project=project.slug,ref=us.ref", href="", title="Cancel") Cancel
|
|
||||||
|
|
||||||
section.us-story-main-data
|
|
||||||
div.us-title(ng-class="{blocked: us.is_blocked}")
|
|
||||||
div.us-edit-name-inner
|
|
||||||
span.us-number(tg-bo-ref="us.ref")
|
|
||||||
input(type="text", ng-model="us.subject", data-required="true", data-maxlength="500")
|
|
||||||
p.block-desc-container(ng-show="us.is_blocked")
|
|
||||||
span.block-description-title Blocked
|
|
||||||
span.block-description(tg-bind-html="us.blocked_note || 'This US is blocked'")
|
|
||||||
a.unblock(ng-click="ctrl.unblock()", href="", title="Unblock US") Unblock
|
|
||||||
|
|
||||||
div(tg-tag-line, editable="true", ng-model="us.tags")
|
|
||||||
|
|
||||||
section.us-content
|
|
||||||
textarea(placeholder="Write a description of your user story", ng-model="us.description", tg-markitup)
|
|
||||||
|
|
||||||
tg-attachments(ng-model="us", type="us")
|
|
||||||
tg-history(ng-model="us", type="us", mode="edit")
|
|
||||||
|
|
||||||
sidebar.menu-secondary.sidebar
|
|
||||||
section.us-status(tg-us-status-detail, ng-model="us", editable="true")
|
|
||||||
section.us-assigned-to(tg-assigned-to, ng-model="us", editable="true")
|
|
||||||
section.watchers(tg-watchers, ng-model="us", editable="true")
|
|
||||||
|
|
||||||
section.us-detail-settings
|
|
||||||
fieldset
|
|
||||||
label.clickable.button.button-gray(for="client-requirement", ng-class="{'active': us.client_requirement}") Client requirement
|
|
||||||
input(ng-model="us.client_requirement", type="checkbox", id="client-requirement", name="client-requirement")
|
|
||||||
fieldset
|
|
||||||
label.clickable.button.button-gray(for="team-requirement", ng-class="{'active': us.team_requirement}") Team requirement
|
|
||||||
input(ng-model="us.team_requirement", type="checkbox", id="team-requirement", name="team-requirement")
|
|
||||||
|
|
||||||
a.button.button-gray.clickable(ng-show="!us.is_blocked", ng-click="ctrl.block()") Block
|
|
||||||
a.button.button-red(tg-check-permission="delete_us", ng-click="ctrl.delete()", href="") Delete
|
|
||||||
|
|
||||||
div.lightbox.lightbox-block.hidden(tg-lb-block, title="Blocking issue", ng-model="us")
|
|
||||||
div.lightbox.lightbox-select-user.hidden(tg-lb-assignedto)
|
|
||||||
div.lightbox.lightbox-select-user.hidden(tg-lb-watchers)
|
|
|
@ -4,7 +4,7 @@ block head
|
||||||
title Taiga Your agile, free, and open source project management tool
|
title Taiga Your agile, free, and open source project management tool
|
||||||
|
|
||||||
block content
|
block content
|
||||||
div.wrapper(tg-us-detail, ng-controller="UserStoryDetailController as ctrl",
|
div.wrapper(ng-controller="UserStoryDetailController as ctrl",
|
||||||
ng-init="section='backlog'")
|
ng-init="section='backlog'")
|
||||||
div.main.us-detail
|
div.main.us-detail
|
||||||
div.us-detail-header.header-with-actions
|
div.us-detail-header.header-with-actions
|
||||||
|
@ -15,10 +15,6 @@ block content
|
||||||
href="", title="Go to taskboard",
|
href="", title="Go to taskboard",
|
||||||
tg-nav="project-taskboard:project=project.slug,sprint=sprint.slug",
|
tg-nav="project-taskboard:project=project.slug,sprint=sprint.slug",
|
||||||
ng-if="sprint && project.is_backlog_activated") Taskboard
|
ng-if="sprint && project.is_backlog_activated") Taskboard
|
||||||
a.button.button-green(
|
|
||||||
tg-check-permission="modify_us", href="",
|
|
||||||
title="Edit",
|
|
||||||
tg-nav="project-userstories-detail-edit:project=project.slug,ref=us.ref") Edit
|
|
||||||
|
|
||||||
section.us-story-main-data
|
section.us-story-main-data
|
||||||
div.us-title(ng-class="{blocked: us.is_blocked}")
|
div.us-title(ng-class="{blocked: us.is_blocked}")
|
||||||
|
|
Loading…
Reference in New Issue