Modifying assigned to from taskboard
parent
0eb7b5f68d
commit
a81ffef253
|
@ -351,15 +351,19 @@ AssignedToDirective = ($rootscope, $confirm) ->
|
|||
link = ($scope, $el, $attrs, $model) ->
|
||||
editable = $attrs.editable?
|
||||
|
||||
$scope.$watch $attrs.ngModel, (assignedToId) ->
|
||||
renderAssignedTo = (issue) ->
|
||||
assignedToId = issue?.assigned_to
|
||||
assignedTo = null
|
||||
assignedTo = $scope.usersById[assignedToId] if assignedToId?
|
||||
html = template({assignedTo: assignedTo, editable:editable})
|
||||
$el.html(html)
|
||||
|
||||
$scope.$watch $attrs.ngModel, (issue) ->
|
||||
renderAssignedTo(issue)
|
||||
|
||||
$el.on "click", ".user-assigned", (event) ->
|
||||
event.preventDefault()
|
||||
$rootscope.$broadcast("assigned-to:add")
|
||||
$rootscope.$broadcast("assigned-to:add", $model.$modelValue)
|
||||
|
||||
$el.on "click", ".icon-delete", (event) ->
|
||||
event.preventDefault()
|
||||
|
@ -368,10 +372,8 @@ AssignedToDirective = ($rootscope, $confirm) ->
|
|||
$confirm.ask(title, subtitle).then =>
|
||||
$model.$setViewValue(null)
|
||||
|
||||
$scope.$on "assigned-to:added", (ctx, user) ->
|
||||
$scope.$apply ->
|
||||
$model.$setViewValue(user.id)
|
||||
|
||||
$scope.$on "assigned-to:added", (ctx, issue) ->
|
||||
renderAssignedTo(issue)
|
||||
|
||||
return {link:link, require:"ngModel"}
|
||||
|
||||
|
|
|
@ -48,11 +48,11 @@ module.directive("tgLbCreateIssue", [
|
|||
|
||||
AddWatcherDirective = () ->
|
||||
link = ($scope, $el, $attrs) ->
|
||||
$scope.watcherSearch = {}
|
||||
$scope.usersSearch = {}
|
||||
$scope.$on "watcher:add", ->
|
||||
$el.removeClass("hidden")
|
||||
$scope.$apply ->
|
||||
$scope.watcherSearch = {}
|
||||
$scope.usersSearch = {}
|
||||
|
||||
$scope.$on "$destroy", ->
|
||||
$el.off()
|
||||
|
@ -73,14 +73,16 @@ AddWatcherDirective = () ->
|
|||
module.directive("tgLbAddWatcher", AddWatcherDirective)
|
||||
|
||||
|
||||
AddAssignedToDirective = () ->
|
||||
EditAssignedToDirective = () ->
|
||||
link = ($scope, $el, $attrs) ->
|
||||
$scope.watcherSearch = {}
|
||||
$scope.$on "assigned-to:add", ->
|
||||
$scope.usersSearch = {}
|
||||
editingElement = null
|
||||
|
||||
$scope.$on "assigned-to:add", (ctx, element) ->
|
||||
editingElement = element
|
||||
$el.removeClass("hidden")
|
||||
$el.find("input").focus()
|
||||
$scope.$apply ->
|
||||
$scope.watcherSearch = {}
|
||||
$scope.usersSearch = {}
|
||||
|
||||
$scope.$on "$destroy", ->
|
||||
$el.off()
|
||||
|
@ -92,10 +94,12 @@ AddAssignedToDirective = () ->
|
|||
$el.on "click", ".watcher-single", (event) ->
|
||||
event.preventDefault()
|
||||
target = angular.element(event.currentTarget)
|
||||
watcher = target.scope().user
|
||||
if editingElement?
|
||||
editingElement.assigned_to = target.scope().user.id
|
||||
|
||||
$el.addClass("hidden")
|
||||
$scope.$broadcast("assigned-to:added", watcher)
|
||||
$scope.$broadcast("assigned-to:added", editingElement)
|
||||
|
||||
return {link:link}
|
||||
|
||||
module.directive("tgLbAddAssignedTo", AddAssignedToDirective)
|
||||
module.directive("tgLbEditAssignedTo", EditAssignedToDirective)
|
||||
|
|
|
@ -58,6 +58,10 @@ class TaskboardController extends mixOf(taiga.Controller, taiga.PageMixin)
|
|||
@.loadTaskboard()
|
||||
@scope.$on "taskform:edit:success", =>
|
||||
@.loadTaskboard()
|
||||
@scope.$on "assigned-to:added", (ctx, task) =>
|
||||
@scope.$apply(
|
||||
@repo.save(task)
|
||||
)
|
||||
|
||||
loadSprintStats: ->
|
||||
return @rs.sprints.stats(@scope.projectId, @scope.sprintId).then (stats) =>
|
||||
|
@ -145,6 +149,9 @@ class TaskboardController extends mixOf(taiga.Controller, taiga.PageMixin)
|
|||
editTask: (task) ->
|
||||
@rootscope.$broadcast("taskform:edit", task)
|
||||
|
||||
editTaskAssignedTo: (task) ->
|
||||
@rootscope.$broadcast("assigned-to:add", task)
|
||||
|
||||
module.controller("TaskboardController", TaskboardController)
|
||||
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ block content
|
|||
|
||||
sidebar.menu-secondary.sidebar
|
||||
section.us-status(tg-issue-status, ng-model="issue", editable="true")
|
||||
section.us-assigned-to(tg-assigned-to, ng-model="issue.assigned_to", editable="true")
|
||||
section.us-assigned-to(tg-assigned-to, ng-model="issue", editable="true")
|
||||
section.watchers(tg-watchers, ng-model="issue.watchers", editable="true")
|
||||
|
||||
section.us-detail-settings
|
||||
|
@ -50,7 +50,7 @@ block content
|
|||
div.lightbox.lightbox_block.hidden(tg-lb-block, title="Blocking issue", ng-model="issue")
|
||||
include views/modules/lightbox_block
|
||||
|
||||
div.lightbox.lightbox_select_user.hidden(tg-lb-add-assigned-to)
|
||||
div.lightbox.lightbox_select_user.hidden(tg-lb-edit-assigned-to)
|
||||
include views/modules/lightbox-assigned-to
|
||||
|
||||
div.lightbox.lightbox_select_user.hidden(tg-lb-add-watcher)
|
||||
|
|
|
@ -47,7 +47,7 @@ block content
|
|||
|
||||
sidebar.menu-secondary.sidebar
|
||||
section.us-status(tg-issue-status, ng-model="issue")
|
||||
section.us-assigned-to(tg-assigned-to, ng-model="issue.assigned_to")
|
||||
section.us-assigned-to(tg-assigned-to, ng-model="issue")
|
||||
section.watchers(tg-watchers, ng-model="issue.watchers")
|
||||
|
||||
section.us-detail-settings
|
||||
|
|
|
@ -23,3 +23,5 @@ block content
|
|||
include views/modules/lightbox_add-edit-task
|
||||
div.lightbox.lightbox_add-bulk.hidden(tg-lb-create-bulk-tasks)
|
||||
include views/modules/lightbox_add-task-bulk
|
||||
div.lightbox.lightbox_select_user.hidden(tg-lb-edit-assigned-to)
|
||||
include views/modules/lightbox-assigned-to
|
||||
|
|
|
@ -2,7 +2,7 @@ div.taskboard-tagline
|
|||
a.taskboard-tag(ng-repeat="tag in task.tags" href="" title="{{ tag }}")
|
||||
div.taskboard-task-inner
|
||||
figure.avatar
|
||||
a(href="", title="See {{ usersById[task.assigned_to].username }}'s profile")
|
||||
a(ng-click="ctrl.editTaskAssignedTo(task)", href="", title="See {{ usersById[task.assigned_to].username }}'s profile")
|
||||
img.avatar(src="{{ usersById[task.assigned_to].photo }}",
|
||||
alt="{{ usersById[task.assigned_to].username }}'s avatar")
|
||||
figcaption {{ usersById[task.assigned_to].full_name_display }}
|
||||
|
|
|
@ -3,10 +3,10 @@ a.close(href="", title="close")
|
|||
form
|
||||
h2.title Select assigned to
|
||||
fieldset
|
||||
input(type="text", data-maxlength="500", placeholder="Search for users", ng-model="watcherSearch.$")
|
||||
input(type="text", data-maxlength="500", placeholder="Search for users", ng-model="usersSearch.$")
|
||||
|
||||
div.watchers
|
||||
div.watcher-single(ng-repeat="user in users|filter:watcherSearch:strict|limitTo:5 track by user.id")
|
||||
div.watcher-single(ng-repeat="user in users|filter:usersSearch:strict|limitTo:5 track by user.id")
|
||||
div.watcher-avatar
|
||||
a.avatar(href="", title="Assigned to")
|
||||
img(tg-bo-src="user.photo", tg-bo-alt="user.photo")
|
||||
|
|
|
@ -3,10 +3,10 @@ a.close(href="", title="close")
|
|||
form
|
||||
h2.title Add watchers
|
||||
fieldset
|
||||
input(type="text", data-maxlength="500", placeholder="Search for users", ng-model="watcherSearch.$")
|
||||
input(type="text", data-maxlength="500", placeholder="Search for users", ng-model="usersSearch.$")
|
||||
|
||||
div.watchers
|
||||
div.watcher-single(ng-repeat="user in users|filter:watcherSearch:strict|limitTo:5 track by user.id")
|
||||
div.watcher-single(ng-repeat="user in users|filter:usersSearch:strict|limitTo:5 track by user.id")
|
||||
div.watcher-avatar
|
||||
a.avatar(href="", title="Assigned to")
|
||||
img(tg-bo-src="user.photo", tg-bo-alt="user.photo")
|
||||
|
|
|
@ -201,7 +201,6 @@
|
|||
@include clearfix();
|
||||
@include transition(background .2s ease-in);
|
||||
background: darken($whitish, 5%);
|
||||
cursor: pointer;
|
||||
margin-bottom: .5rem;
|
||||
padding: .5rem;
|
||||
&:last-child {
|
||||
|
|
Loading…
Reference in New Issue