Remove Task edition page and some extra deprecated code

stable
David Barragán Merino 2014-10-15 00:14:11 +02:00
parent 060fe067ba
commit 85fac7fd72
5 changed files with 4 additions and 186 deletions

View File

@ -56,8 +56,6 @@ configure = ($routeProvider, $locationProvider, $httpProvider, $provide, $tgEven
# Tasks
$routeProvider.when("/project/:pslug/task/:taskref",
{templateUrl: "/partials/task-detail.html", resolve: {loader: tgLoaderProvider.add()}})
$routeProvider.when("/project/:pslug/task/:taskref/edit",
{templateUrl: "/partials/task-detail-edit.html"})
# Wiki
$routeProvider.when("/project/:pslug/wiki",

View File

@ -69,7 +69,6 @@ urls = {
"project-userstories-detail": "/project/:project/us/:ref"
"project-tasks-detail": "/project/:project/task/:ref"
"project-tasks-detail-edit": "/project/:project/task/:ref/edit"
"project-issues-detail": "/project/:project/issue/:ref"
"project-issues-detail-edit": "/project/:project/issue/:ref/edit"

View File

@ -124,132 +124,6 @@ class TaskDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
module.controller("TaskDetailController", TaskDetailController)
#############################################################################
## Task Main Directive
#############################################################################
TaskDirective = ($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-task", (event) ->
if not form.validate()
return
onSuccess = ->
$loading.finish(target)
$confirm.notify("success")
ctx = {
project: $scope.project.slug
ref: $scope.task.ref
}
$location.path($navUrls.resolve("project-tasks-detail", ctx))
onError = ->
$loading.finish(target)
$confirm.notify("error")
target = angular.element(event.currentTarget)
$loading.start(target)
$tgrepo.save($scope.task).then(onSuccess, onError)
return {link:link}
module.directive("tgTaskDetail", ["$tgRepo", "$log", "$tgLocation", "$tgConfirm", "$tgNavUrls",
"$tgLoading", TaskDirective])
#############################################################################
## Task status directive
#############################################################################
TaskStatusDirective = () ->
#TODO: i18n
template = _.template("""
<h1>
<span>
<% if (status.is_closed) { %>
Closed
<% } else { %>
Open
<% } %>
<span class="us-detail-status" style="color:<%= status.color %>"><%= status.name %></span>
</h1>
<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>
<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>
""")
link = ($scope, $el, $attrs, $model) ->
editable = $attrs.editable?
renderTaskstatus = (task) ->
owner = $scope.usersById?[task.owner]
date = moment(task.created_date).format("DD MMM YYYY HH:mm")
status = $scope.statusById[task.status]
html = template({
owner: owner
date: date
editable: editable
status: status
})
$el.html(html)
$el.find(".status-data").append(selectionStatusTemplate({statuses:$scope.statusList}))
$scope.$watch $attrs.ngModel, (task) ->
if task?
renderTaskstatus(task)
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")
renderTaskstatus($model.$modelValue)
$el.find(".popover").popover().close()
return {link:link, require:"ngModel"}
module.directive("tgTaskStatus", TaskStatusDirective)
#############################################################################
## Task status display directive
#############################################################################
@ -352,10 +226,10 @@ TaskStatusButtonDirective = ($rootScope, $repo) ->
$.fn.popover().closeAll()
us = $model.$modelValue.clone()
us.status = target.data("status-id")
task = $model.$modelValue.clone()
task.status = target.data("status-id")
$model.$setViewValue(us)
$model.$setViewValue(task)
$repo.save($model.$modelValue).then ->
$rootScope.$broadcast("history:reload")

View File

@ -1,49 +0,0 @@
extends dummy-layout
block head
title Taiga Your agile, free, and open source project management tool
block content
form.wrapper(tg-task-detail, ng-controller="TaskDetailController 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-task(href="", title="Save") Save
a.button.button-red.cancel(tg-nav="project-tasks-detail:project=project.slug,ref=task.ref", href="", title="Cancel") Cancel
section.us-story-main-data
div.us-title(ng-class="{blocked: task.is_blocked}")
div.us-edit-name-inner
span.us-number(tg-bo-ref="task.ref")
input(type="text", ng-model="task.subject", data-required="true", data-maxlength="500")
p.block-desc-container(ng-show="task.is_blocked")
span.block-description-title Blocked
span.block-description(tg-bind-html="task.blocked_note || 'This task is blocked'")
a.unblock(ng-click="ctrl.unblock()", href="", title="Unblock task") Unblock
div(tg-tag-line, editable="true", ng-model="task.tags")
section.us-content
textarea(placeholder="Write a description of your task", ng-model="task.description", tg-markitup)
tg-attachments(ng-model="task", type="task")
tg-history(ng-model="task", type="task", mode="edit")
sidebar.menu-secondary.sidebar
section.us-status(tg-task-status, ng-model="task", editable="true")
section.us-assigned-to(tg-assigned-to, ng-model="task", editable="true")
section.watchers(tg-watchers, ng-model="task", editable="true")
section.us-detail-settings
fieldset(title="Feeling a bit overwhelmed by a task? Make sure others know about it by clicking on Iocaine when editing a task. It's possible to become immune to this (fictional) deadly poison by consuming small amounts over time just as it's possible to get better at what you do by occasionally taking on extra challenges!")
label.clickable.button.button-gray(for="is-iocaine", ng-class="{'active': task.is_iocaine}") Iocaine
input(ng-model="task.is_iocaine", type="checkbox", id="is-iocaine", name="is-iocaine")
a.button.button-gray.clickable(ng-show="!task.is_blocked", ng-click="ctrl.block()") Block
a.button.button-red(tg-check-permission="delete_task", ng-click="ctrl.delete()", href="") Delete
div.lightbox.lightbox-block.hidden(tg-lb-block, title="Blocking task", ng-model="task")
div.lightbox.lightbox-select-user.hidden(tg-lb-assignedto)
div.lightbox.lightbox-select-user.hidden(tg-lb-watchers)

View File

@ -4,7 +4,7 @@ block head
title Taiga Your agile, free, and open source project management tool
block content
div.wrapper(tg-task-detail, ng-controller="TaskDetailController as ctrl",
div.wrapper(ng-controller="TaskDetailController 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_task", href="",
title="Edit",
tg-nav="project-tasks-detail-edit:project=project.slug,ref=task.ref") Edit
section.us-story-main-data
div.us-title(ng-class="{blocked: task.is_blocked}")