diff --git a/app/modules/components/assigned-to/assigned-item/assigned-item.directive.coffee b/app/modules/components/assigned-to/assigned-item/assigned-item.directive.coffee new file mode 100644 index 00000000..42bcf36d --- /dev/null +++ b/app/modules/components/assigned-to/assigned-item/assigned-item.directive.coffee @@ -0,0 +1,37 @@ +### +# Copyright (C) 2014-2016 Taiga Agile LLC +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +# File: assigned-to-selector.directive.coffee +### + +AssignedItemDirective = () -> + + link = (scope, el, attrs) -> + + return { + # controller: "AssignedToSelectorCtrl", + # controllerAs: "vm", + # bindToController: true, + templateUrl: "components/assigned-to/assigned-item/assigned-item.html", + scope: { + member: "=", + }, + link: link + } + +AssignedItemDirective.$inject = [] + +angular.module("taigaComponents").directive("tgAssignedItem", AssignedItemDirective) diff --git a/app/modules/components/assigned-to/assigned-item/assigned-item.jade b/app/modules/components/assigned-to/assigned-item/assigned-item.jade new file mode 100644 index 00000000..d3c97e4f --- /dev/null +++ b/app/modules/components/assigned-to/assigned-item/assigned-item.jade @@ -0,0 +1 @@ +.member {{member}} diff --git a/app/modules/components/assigned-to/assigned-to-selector/assigned-to-selector.controller.coffee b/app/modules/components/assigned-to/assigned-to-selector/assigned-to-selector.controller.coffee new file mode 100644 index 00000000..6d05b878 --- /dev/null +++ b/app/modules/components/assigned-to/assigned-to-selector/assigned-to-selector.controller.coffee @@ -0,0 +1,25 @@ +### +# Copyright (C) 2014-2015 Taiga Agile LLC +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +# File: assigned-to-selector.controller.coffee +### + +class AssignedToSelectorController + @.$inject = [] + + constructor: () -> + +angular.module('taigaComponents').controller('AssignedToSelectorCtrl', AssignedToSelectorController) diff --git a/app/modules/components/assigned-to/assigned-to-selector/assigned-to-selector.directive.coffee b/app/modules/components/assigned-to/assigned-to-selector/assigned-to-selector.directive.coffee index b13be4d0..33b828d0 100644 --- a/app/modules/components/assigned-to/assigned-to-selector/assigned-to-selector.directive.coffee +++ b/app/modules/components/assigned-to/assigned-to-selector/assigned-to-selector.directive.coffee @@ -19,20 +19,15 @@ AssignedToSelectorDirective = () -> - link = (scope, el, attrs) -> - console.log scope.assigned.toJS() - console.log scope.project.toJS() - return { - # controller: "AssignedToSelectorCtrl", - # controllerAs: "vm", - # bindToController: true, + controller: "AssignedToSelectorCtrl", + controllerAs: "vm", + bindToController: true, templateUrl: "components/assigned-to/assigned-to-selector/assigned-to-selector.html", scope: { assigned: "=", project: "=" - }, - link: link + } } AssignedToSelectorDirective.$inject = [] diff --git a/app/modules/components/assigned-to/assigned-to-selector/assigned-to-selector.jade b/app/modules/components/assigned-to/assigned-to-selector/assigned-to-selector.jade index 29de6158..e14d5c8c 100644 --- a/app/modules/components/assigned-to/assigned-to-selector/assigned-to-selector.jade +++ b/app/modules/components/assigned-to/assigned-to-selector/assigned-to-selector.jade @@ -1,4 +1,17 @@ tg-lightbox-close .assigned-to-container - h2.title(translate="COMMON.ASSIGNED_TO.TITLE_ACTION_EDIT_ASSIGNMENT") + h2.title(translate="LIGHTBOX.ASSIGNED_TO.SELECT") + input.assign-input( + type="text" + placeholder="{{'LIGHTBOX.ASSIGNED_TO.SEARCH' | translate}}" + autofocus + ng-model="vm.assignToMember.name" + ng-model-options="{debounce: 200}" + ) + ul.tags-dropdown + li(ng-repeat="member in vm.project.members | filter: vm.assignToMember.name") + tg-assigned-item.assigned-members-option( + member="member" + ng-click="vm.onAddTag(tag[0], tag[1], vm.project)" + ) diff --git a/app/modules/components/assigned-to/assigned-to.controller.coffee b/app/modules/components/assigned-to/assigned-to.controller.coffee index d7b76bc4..9a04e103 100644 --- a/app/modules/components/assigned-to/assigned-to.controller.coffee +++ b/app/modules/components/assigned-to/assigned-to.controller.coffee @@ -23,15 +23,16 @@ class AssignedToController ] constructor: (@lightboxFactory) -> + @.has_permissions = _.includes(@.project.my_permissions, 'modify_epic') onSelectAssignedTo: (assigned, project) -> @lightboxFactory.create('tg-assigned-to-selector', { "class": "lightbox lightbox-assigned-to-selector open" - "assigned": "assigned" + "assignedTo": "assignedTo" "project": "project" }, { - "assigned": assigned - "project": project + "assignedTo": @.assignedTo + "project": @.project }) angular.module('taigaComponents').controller('AssignedToCtrl', AssignedToController) diff --git a/app/modules/components/assigned-to/assigned-to.directive.coffee b/app/modules/components/assigned-to/assigned-to.directive.coffee index bc596b3c..ae0683ce 100644 --- a/app/modules/components/assigned-to/assigned-to.directive.coffee +++ b/app/modules/components/assigned-to/assigned-to.directive.coffee @@ -25,7 +25,7 @@ AssignedToDirective = () -> bindToController: true, templateUrl: "components/assigned-to/assigned-to.html", scope: { - assignedTo: "=" + assignedTo: "=", project: "=" } } diff --git a/app/modules/components/assigned-to/assigned-to.jade b/app/modules/components/assigned-to/assigned-to.jade index e1570c69..3eb7fe76 100644 --- a/app/modules/components/assigned-to/assigned-to.jade +++ b/app/modules/components/assigned-to/assigned-to.jade @@ -1,13 +1,24 @@ img.assigned-to( - ng-if="vm.assignedTo" + ng-if="vm.assignedTo && vm.has_permissions" tg-avatar="vm.assignedTo" alt="{{vm.assignedTo.get('full_name_display')}}" title="{{vm.assignedTo.get('full_name_display')}}" ng-click="vm.onSelectAssignedTo(vm.assignedTo, vm.project)" ) img.assigned-to( - ng-if="!vm.assignedTo" + ng-if="vm.assignedTo && !vm.has_permissions" + tg-avatar="vm.assignedTo" + alt="{{vm.assignedTo.get('full_name_display')}}" + title="{{vm.assignedTo.get('full_name_display')}}" +) +img.assigned-to( + ng-if="!vm.assignedTo && vm.has_permissions" src="/#{v}/images/unnamed.png" alt="{{EPICS.DASHBOARD.UNASSIGNED | translate}}" ng-click="vm.onSelectAssignedTo(vm.assignedTo, vm.project)" ) +img.assigned-to( + ng-if="!vm.assignedTo && !vm.has_permissions" + src="/#{v}/images/unnamed.png" + alt="{{EPICS.DASHBOARD.UNASSIGNED | translate}}" +) diff --git a/app/modules/epics/dashboard/story-row/story-row.jade b/app/modules/epics/dashboard/story-row/story-row.jade index 0783c479..ba9580ef 100644 --- a/app/modules/epics/dashboard/story-row/story-row.jade +++ b/app/modules/epics/dashboard/story-row/story-row.jade @@ -26,19 +26,12 @@ alt="{{::vm.story.getIn(['project_extra_info', 'name'])}}" ) .sprint(ng-if="vm.column.sprint") {{::vm.story.get('milestone_name')}} - .assigned( - ng-if="vm.column.assigned && vm.story.get('assigned_to')" - ng-click="vm.onSelectAssignedTo()" - ) + .assigned(ng-if="vm.column.assigned && vm.story.get('assigned_to')") img( tg-avatar="vm.story.get('assigned_to_extra_info')" alt="{{::vm.story.getIn(['assigned_to_extra_info', 'full_name_display'])}}" ) - .assigned( - ng-if="vm.column.assigned && !vm.story.get('assigned_to')" - ng-class="{'is-unassigned': !vm.story.get('assigned_to')}" - ng-click="vm.onSelectAssignedTo()" - ) + .assigned(ng-if="vm.column.assigned && !vm.story.get('assigned_to')") img( src="/#{v}/images/unnamed.png" alt="{{EPICS.DASHBOARD.UNASSIGNED | translate}}" diff --git a/app/modules/epics/dashboard/story-row/story-row.scss b/app/modules/epics/dashboard/story-row/story-row.scss index 4eaf597e..ad742a2a 100644 --- a/app/modules/epics/dashboard/story-row/story-row.scss +++ b/app/modules/epics/dashboard/story-row/story-row.scss @@ -86,7 +86,4 @@ margin-right: .25rem; vertical-align: middle; } - .is-unassigned { - color: $gray-light; - } }