Merge branch 'master' into stable
commit
dd7d5ca16e
|
@ -2,6 +2,12 @@
|
|||
|
||||
## Unreleased
|
||||
|
||||
## 3.4.4 (2018-09-19)
|
||||
|
||||
### Misc
|
||||
|
||||
- Minor bug fixes.
|
||||
|
||||
## 3.4.3 (2018-09-19)
|
||||
|
||||
### Misc
|
||||
|
|
|
@ -18,14 +18,15 @@
|
|||
###
|
||||
|
||||
AssignedToInlineDirective = ($rootscope, $confirm, $repo, $loading, $modelTransform, $template
|
||||
$translate, $compile, $currentUserService, avatarService) ->
|
||||
link = ($scope, $el, $attrs, $ctrl) ->
|
||||
$translate, $compile, $currentUserService, avatarService, $userListService) ->
|
||||
link = ($scope, $el, $attr, $model) ->
|
||||
isEditable = ->
|
||||
return $scope.project?.my_permissions?.indexOf($attrs.requiredPerm) != -1
|
||||
return $scope.project?.my_permissions?.indexOf($attr.requiredPerm) != -1
|
||||
|
||||
renderUserList = (text) ->
|
||||
activeUsers = _.reject($scope.activeUsers, {"id": $scope.selected.id}) if $scope.selected?
|
||||
users = $ctrl.getUserList(activeUsersactiveUsers, $scope.user.id, text)
|
||||
selectedId = $model.$modelValue.assigned_to
|
||||
users = $userListService.searchUsers(text)
|
||||
users = _.reject(users, {"id": selectedId}) if selectedId
|
||||
|
||||
visibleUsers = _.slice(users, 0, 5)
|
||||
visibleUsers = _.map visibleUsers, (user) -> user.avatar = avatarService.getAvatar(user)
|
||||
|
@ -58,16 +59,17 @@ $translate, $compile, $currentUserService, avatarService) ->
|
|||
$el.on "click", ".users-dropdown", (event) ->
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
$scope.usersSearch = ""
|
||||
renderUserList()
|
||||
$scope.$apply()
|
||||
$el.find(".pop-users").popover().open()
|
||||
|
||||
$scope.selfAssign = () ->
|
||||
$attr.ngModel.assigned_to = $currentUserService.getUser().get('id')
|
||||
renderUser($attr.ngModel)
|
||||
$model.$modelValue.assigned_to = $currentUserService.getUser().get('id')
|
||||
renderUser($model.$modelValue)
|
||||
|
||||
$scope.unassign = () ->
|
||||
$attr.ngModel.assigned_to = null
|
||||
$model.$modelValue.assigned_to = null
|
||||
renderUser()
|
||||
|
||||
$scope.$watch "usersSearch", (searchingText) ->
|
||||
|
@ -78,11 +80,11 @@ $translate, $compile, $currentUserService, avatarService) ->
|
|||
$el.on "click", ".user-list-single", (event) ->
|
||||
event.preventDefault()
|
||||
target = angular.element(event.currentTarget)
|
||||
$attr.ngModel.assigned_to = target.data("user-id")
|
||||
renderUser($attr.ngModel)
|
||||
$model.$modelValue.assigned_to = target.data("user-id")
|
||||
renderUser($model.$modelValue)
|
||||
$scope.$apply()
|
||||
|
||||
$scope.$watch $attrs.ngModel, (instance) ->
|
||||
$scope.$watch $attr.ngModel, (instance) ->
|
||||
renderUser(instance)
|
||||
|
||||
$scope.$on "isiocaine:changed", (ctx, instance) ->
|
||||
|
@ -94,8 +96,9 @@ $translate, $compile, $currentUserService, avatarService) ->
|
|||
return {
|
||||
link:link,
|
||||
templateUrl: "common/components/assigned-to-inline.html"
|
||||
require:"ngModel"
|
||||
}
|
||||
|
||||
angular.module('taigaComponents').directive("tgAssignedToInline", ["$rootScope", "$tgConfirm",
|
||||
"$tgRepo", "$tgLoading", "$tgQueueModelTransformation", "$tgTemplate", "$translate", "$compile",
|
||||
"tgCurrentUserService", "tgAvatarService", AssignedToInlineDirective])
|
||||
"tgCurrentUserService", "tgAvatarService", "tgUserListService", AssignedToInlineDirective])
|
||||
|
|
|
@ -73,28 +73,26 @@ $translate, $compile, $currentUserService, avatarService, $userListService) ->
|
|||
$el.on "click", ".users-dropdown", (event) ->
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
$scope.usersSearch = null
|
||||
renderUsersList()
|
||||
$scope.$apply()
|
||||
$el.find(".pop-users").popover().open()
|
||||
|
||||
$scope.assign = (user) ->
|
||||
currentAssignedIds.push(user.id)
|
||||
renderUsers()
|
||||
applyToModel()
|
||||
|
||||
$scope.selfAssign = () ->
|
||||
currentAssignedIds.push($currentUserService.getUser().get('id'))
|
||||
renderUsers()
|
||||
applyToModel()
|
||||
$scope.usersSearch = null
|
||||
|
||||
$scope.unassign = (user) ->
|
||||
assignedUserId = user.id
|
||||
|
||||
title = $translate.instant("COMMON.ASSIGNED_USERS.TITLE_LIGHTBOX_DELETE_ASSIGNED")
|
||||
message = $scope.usersById[assignedUserId].full_name_display
|
||||
|
||||
$confirm.askOnDelete(title, message).then (askResponse) ->
|
||||
users = $model.$modelValue.assigned_users
|
||||
users.splice(users.indexOf(assignedUserId), 1)
|
||||
index = currentAssignedIds.indexOf(user.id)
|
||||
currentAssignedIds.splice(index, 1)
|
||||
renderUsers()
|
||||
applyToModel()
|
||||
askResponse.finish()
|
||||
|
||||
$el.on "click", ".users-search", (event) ->
|
||||
event.stopPropagation()
|
||||
|
@ -104,21 +102,6 @@ $translate, $compile, $currentUserService, avatarService, $userListService) ->
|
|||
renderUsersList(searchingText)
|
||||
$el.find('input').focus()
|
||||
|
||||
$el.on "click", ".user-list-single", (event) ->
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
target = angular.element(event.currentTarget)
|
||||
index = currentAssignedIds.indexOf(target.data("user-id"))
|
||||
if index == -1
|
||||
currentAssignedIds.push(target.data("user-id"))
|
||||
else
|
||||
currentAssignedIds.splice(index, 1)
|
||||
applyToModel()
|
||||
renderUsers()
|
||||
$el.find(".pop-users").popover().close()
|
||||
$scope.usersSearch = null
|
||||
$scope.$apply()
|
||||
|
||||
$scope.$watch $attrs.ngModel, (item) ->
|
||||
return if not item?
|
||||
currentAssignedIds = []
|
||||
|
|
|
@ -95,6 +95,7 @@ div.pop-users.popover(ng-class="{'multiple': assignedUsers.length > 0}")
|
|||
data-user-id="{{ user.id }}"
|
||||
title="{{ user.full_name_display }}"
|
||||
ng-repeat="user in users"
|
||||
ng-click="assign(user)"
|
||||
)
|
||||
img.user-list-avatar(
|
||||
style="background: {{user.avatar.bg }}"
|
||||
|
|
Loading…
Reference in New Issue