Card: Show assigned users on board
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
committed by
Julius Härtl
parent
02ec4ae9d1
commit
99c31d3c00
@@ -350,6 +350,20 @@ input.input-inline {
|
|||||||
padding: 5px;
|
padding: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.card-assigned-users {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
flex-grow: 1;
|
||||||
|
.assigned-user {
|
||||||
|
margin-right: 5px;
|
||||||
|
z-index: 4;
|
||||||
|
}
|
||||||
|
.avatardiv, .avatardiv img {
|
||||||
|
width: 26px !important;
|
||||||
|
height: 26px !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.card-controls {
|
.card-controls {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
background: $color-lightgrey;
|
background: $color-lightgrey;
|
||||||
@@ -357,10 +371,7 @@ input.input-inline {
|
|||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
.card-options {
|
.card-options {
|
||||||
opacity: 0.3;
|
justify-content: flex-end;
|
||||||
position: absolute;
|
|
||||||
right: 10px;
|
|
||||||
top: 8px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover .card-options {
|
&:hover .card-options {
|
||||||
@@ -374,6 +385,8 @@ input.input-inline {
|
|||||||
button {
|
button {
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
margin-right: 0px;
|
margin-right: 0px;
|
||||||
|
margin-top: 5px;
|
||||||
|
margin-left: 5px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -160,12 +160,16 @@ app.controller('CardController', function ($scope, $rootScope, $routeParams, $lo
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.addAssignedUser = function(item) {
|
$scope.addAssignedUser = function(item) {
|
||||||
CardService.assignUser(CardService.getCurrent(), item.uid);
|
CardService.assignUser(CardService.getCurrent(), item.uid).then(function (data) {
|
||||||
|
StackService.updateCard(CardService.getCurrent());
|
||||||
|
});
|
||||||
$scope.status.showAssignUser = false;
|
$scope.status.showAssignUser = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.removeAssignedUser = function(item) {
|
$scope.removeAssignedUser = function(item) {
|
||||||
CardService.unassignUser(CardService.getCurrent(), item.participant.uid);
|
CardService.unassignUser(CardService.getCurrent(), item.participant.uid).then(function (data) {
|
||||||
|
StackService.updateCard(CardService.getCurrent());
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -98,6 +98,8 @@ app.factory('CardService', function(ApiService, $http, $q){
|
|||||||
CardService.prototype.assignUser = function (card, user) {
|
CardService.prototype.assignUser = function (card, user) {
|
||||||
var deferred = $q.defer();
|
var deferred = $q.defer();
|
||||||
var self = this;
|
var self = this;
|
||||||
|
if (self.getCurrent().assignedUsers === null)
|
||||||
|
self.getCurrent().assignedUsers = [];
|
||||||
$http.post(this.baseUrl + '/' + card.id + '/assign', {'userId': user}).then(function (response) {
|
$http.post(this.baseUrl + '/' + card.id + '/assign', {'userId': user}).then(function (response) {
|
||||||
self.getCurrent().assignedUsers.push(response.data);
|
self.getCurrent().assignedUsers.push(response.data);
|
||||||
deferred.resolve(response.data);
|
deferred.resolve(response.data);
|
||||||
|
|||||||
@@ -33,10 +33,10 @@ use OCP\AppFramework\Controller;
|
|||||||
class StackController extends Controller {
|
class StackController extends Controller {
|
||||||
private $userId;
|
private $userId;
|
||||||
private $stackService;
|
private $stackService;
|
||||||
public function __construct($appName, IRequest $request, StackService $cardService, $userId) {
|
public function __construct($appName, IRequest $request, StackService $stackService, $userId) {
|
||||||
parent::__construct($appName, $request);
|
parent::__construct($appName, $request);
|
||||||
$this->userId = $userId;
|
$this->userId = $userId;
|
||||||
$this->stackService = $cardService;
|
$this->stackService = $stackService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace OCA\Deck\Service;
|
|||||||
use OCA\Deck\Db\Acl;
|
use OCA\Deck\Db\Acl;
|
||||||
use OCA\Deck\Db\CardMapper;
|
use OCA\Deck\Db\CardMapper;
|
||||||
use OCA\Deck\Db\LabelMapper;
|
use OCA\Deck\Db\LabelMapper;
|
||||||
|
use OCA\Deck\Db\AssignedUsersMapper;
|
||||||
|
|
||||||
use OCA\Deck\Db\Stack;
|
use OCA\Deck\Db\Stack;
|
||||||
|
|
||||||
@@ -42,12 +42,13 @@ class StackService {
|
|||||||
private $permissionService;
|
private $permissionService;
|
||||||
private $boardService;
|
private $boardService;
|
||||||
|
|
||||||
public function __construct(StackMapper $stackMapper, CardMapper $cardMapper, LabelMapper $labelMapper, PermissionService $permissionService, BoardService $boardService) {
|
public function __construct(StackMapper $stackMapper, CardMapper $cardMapper, LabelMapper $labelMapper, PermissionService $permissionService, BoardService $boardService, AssignedUsersMapper $assignedUsersMapper) {
|
||||||
$this->stackMapper = $stackMapper;
|
$this->stackMapper = $stackMapper;
|
||||||
$this->cardMapper = $cardMapper;
|
$this->cardMapper = $cardMapper;
|
||||||
$this->labelMapper = $labelMapper;
|
$this->labelMapper = $labelMapper;
|
||||||
$this->permissionService = $permissionService;
|
$this->permissionService = $permissionService;
|
||||||
$this->boardService = $boardService;
|
$this->boardService = $boardService;
|
||||||
|
$this->assignedUsersMapper = $assignedUsersMapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function findAll($boardId) {
|
public function findAll($boardId) {
|
||||||
@@ -57,6 +58,8 @@ class StackService {
|
|||||||
foreach ($stacks as $stackIndex => $stack) {
|
foreach ($stacks as $stackIndex => $stack) {
|
||||||
$cards = $this->cardMapper->findAll($stack->id);
|
$cards = $this->cardMapper->findAll($stack->id);
|
||||||
foreach ($cards as $cardIndex => $card) {
|
foreach ($cards as $cardIndex => $card) {
|
||||||
|
$assignedUsers = $this->assignedUsersMapper->find($card->getId());
|
||||||
|
$card->setAssignedUsers($assignedUsers);
|
||||||
if (array_key_exists($card->id, $labels)) {
|
if (array_key_exists($card->id, $labels)) {
|
||||||
$cards[$cardIndex]->setLabels($labels[$card->id]);
|
$cards[$cardIndex]->setLabels($labels[$card->id]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,6 +70,11 @@
|
|||||||
<i class="icon icon-badge"></i>
|
<i class="icon icon-badge"></i>
|
||||||
<span data-timestamp="{{ c.duedate | dateToTimestamp }}" class="live-relative-timestamp">{{ c.duedate | relativeDateFilterString }}</span>
|
<span data-timestamp="{{ c.duedate | dateToTimestamp }}" class="live-relative-timestamp">{{ c.duedate | relativeDateFilterString }}</span>
|
||||||
</span>
|
</span>
|
||||||
|
<div class="card-assigned-users">
|
||||||
|
<div class="assigned-user" ng-repeat="user in c.assignedUsers | limitTo: 3">
|
||||||
|
<div class="avatardiv" avatar ng-attr-displayname="{{ user.participant.uid }}"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="app-popover-menu-utils" ng-if="!boardservice.isArchived()">
|
<div class="app-popover-menu-utils" ng-if="!boardservice.isArchived()">
|
||||||
<button class="button-inline card-options icon-more" ng-model="card"></button>
|
<button class="button-inline card-options icon-more" ng-model="card"></button>
|
||||||
<div class="popovermenu hidden">
|
<div class="popovermenu hidden">
|
||||||
|
|||||||
Reference in New Issue
Block a user