diff --git a/app/coffee/app.coffee b/app/coffee/app.coffee index 3d298fe5..71c5644e 100644 --- a/app/coffee/app.coffee +++ b/app/coffee/app.coffee @@ -52,8 +52,6 @@ configure = ($routeProvider, $locationProvider, $httpProvider, $provide, $tgEven # User stories $routeProvider.when("/project/:pslug/us/:usref", {templateUrl: "/partials/us-detail.html", resolve: {loader: tgLoaderProvider.add()}}) - $routeProvider.when("/project/:pslug/us/:usref/edit", - {templateUrl: "/partials/us-detail-edit.html"}) # Tasks $routeProvider.when("/project/:pslug/task/:taskref", diff --git a/app/coffee/modules/base.coffee b/app/coffee/modules/base.coffee index d3dffe7f..61917a05 100644 --- a/app/coffee/modules/base.coffee +++ b/app/coffee/modules/base.coffee @@ -67,7 +67,6 @@ urls = { "project-search": "/project/:project/search" "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-edit": "/project/:project/task/:ref/edit" diff --git a/app/coffee/modules/userstories/detail.coffee b/app/coffee/modules/userstories/detail.coffee index ce7e81e8..ef455461 100644 --- a/app/coffee/modules/userstories/detail.coffee +++ b/app/coffee/modules/userstories/detail.coffee @@ -140,230 +140,6 @@ class UserStoryDetailController extends mixOf(taiga.Controller, taiga.PageMixin) 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(""" -

- - <% if (is_closed) { %> - Closed - <% } else { %> - Open - <% } %> - <%= status.name %> -

- -
-
- - <%- totalClosedTasks %>/<%- totalTasks %> tasks completed - -
- -
-
- <%- owner.full_name_display %> -
- -
- Created by <%- owner.full_name_display %> - <%- date %> -
-
- - - -
-
- - <%= status.name %> - <% if (editable) { %> - - <% } %> - status -
-
- """) - selectionStatusTemplate = _.template(""" - - """) - selectionPointsTemplate = _.template(""" - - """) - - 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 ############################################################################# diff --git a/app/partials/us-detail-edit.jade b/app/partials/us-detail-edit.jade deleted file mode 100644 index 43fe65c2..00000000 --- a/app/partials/us-detail-edit.jade +++ /dev/null @@ -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) diff --git a/app/partials/us-detail.jade b/app/partials/us-detail.jade index d8e51b7a..83db67b7 100644 --- a/app/partials/us-detail.jade +++ b/app/partials/us-detail.jade @@ -4,7 +4,7 @@ block head title Taiga Your agile, free, and open source project management tool block content - div.wrapper(tg-us-detail, ng-controller="UserStoryDetailController as ctrl", + div.wrapper(ng-controller="UserStoryDetailController as ctrl", ng-init="section='backlog'") div.main.us-detail div.us-detail-header.header-with-actions @@ -15,10 +15,6 @@ block content href="", title="Go to taskboard", tg-nav="project-taskboard:project=project.slug,sprint=sprint.slug", 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 div.us-title(ng-class="{blocked: us.is_blocked}")