diff --git a/css/style.scss b/css/style.scss
index 93a97ca81..092f61edb 100644
--- a/css/style.scss
+++ b/css/style.scss
@@ -724,19 +724,9 @@ input.input-inline {
.avatardiv-container {
margin-right: 5px;
}
- .icon-delete {
- display: none;
- position: absolute;
- top: 8px;
- left: 8px;
- }
- &:hover .icon-delete {
- display: inline-block;
- cursor: pointer;
- }
- &:hover .avatardiv {
- opacity: .7;
- }
+ }
+ .tooltip {
+ z-index: 998;
}
}
}
@@ -1010,6 +1000,10 @@ input.input-inline {
padding: 16px;
opacity: 0.5;
}
+
+ &.has-contactsmenu img {
+ cursor: pointer;
+ }
}
.avatardiv-container {
diff --git a/js/controller/CardController.js b/js/controller/CardController.js
index 567a045cd..565c85226 100644
--- a/js/controller/CardController.js
+++ b/js/controller/CardController.js
@@ -170,8 +170,8 @@ app.controller('CardController', function ($scope, $rootScope, $routeParams, $lo
$scope.status.showAssignUser = false;
};
- $scope.removeAssignedUser = function(item) {
- CardService.unassignUser(CardService.getCurrent(), item.participant.uid).then(function (data) {
+ $scope.removeAssignedUser = function(uid) {
+ CardService.unassignUser(CardService.getCurrent(), uid).then(function (data) {
StackService.updateCard(CardService.getCurrent());
});
};
diff --git a/js/directive/avatar.js b/js/directive/avatar.js
index fde199ce1..c93165985 100644
--- a/js/directive/avatar.js
+++ b/js/directive/avatar.js
@@ -23,15 +23,28 @@
app.directive('avatar', function() {
'use strict';
return {
- restrict: 'A',
- scope: true,
+ restrict: 'AEC',
+ transclude: true,
+ replace: true,
+ template: '
',
+ scope: { attr: '=' },
link: function(scope, element, attr){
+ scope.uid = attr.displayname;
+ scope.displayname = attr.displayname;
var value = attr.user;
- $(element).wrap('');
- if(attr.contactsmenu && oc_current_user !== value) {
- $(element).contactsMenu(value, 0, $(element).parent());
+ var avatardiv = $(element).find('.avatardiv');
+ if(typeof attr.contactsmenu !== 'undefined' && attr.contactsmenu !== 'false' && oc_current_user !== value) {
+ avatardiv.contactsMenu(value, 0, $(element));
+ avatardiv.addClass('has-contactsmenu');
}
- $(element).avatar(value, 32, false, false, false, attr.displayname);
- }
+ if(typeof attr.tooltip !== 'undefined' && attr.tooltip !== 'false') {
+ $(element).tooltip({
+ title: scope.displayname,
+ placement: 'top'
+ });
+ }
+ avatardiv.avatar(value, 32, false, false, false, attr.displayname);
+ },
+ controller: function () {}
};
});
\ No newline at end of file
diff --git a/js/directive/contactsmenudelete.js b/js/directive/contactsmenudelete.js
new file mode 100644
index 000000000..8fdbac5ef
--- /dev/null
+++ b/js/directive/contactsmenudelete.js
@@ -0,0 +1,38 @@
+/*
+ * @copyright Copyright (c) 2018 Julius Härtl
+ *
+ * @author Julius Härtl
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * 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 .
+ *
+ */
+
+app.directive('contactsmenudelete', function() {
+ 'use strict';
+ return {
+ restrict: 'A',
+ priority: 1,
+ link: function(scope, element, attr){
+ var user = attr.user;
+ var menu = $(element).parent().find('.contactsmenu-popover');
+ var menuEntry = $('' + t('deck', 'Remove user from card') + '');
+ menuEntry.on('click', function () {
+ scope.removeAssignedUser(user);
+ });
+ $(menu).append(menuEntry);
+ }
+ };
+});
\ No newline at end of file
diff --git a/templates/main.php b/templates/main.php
index 620e31c4c..36f7e0a4b 100644
--- a/templates/main.php
+++ b/templates/main.php
@@ -46,7 +46,7 @@ if(!\OC::$server->getConfig()->getSystemValue('debug', false)) {
$js = [
'app' => ['App', 'Config', 'Run'],
'controller' => ['AppController', 'BoardController', 'CardController', 'ListController'],
- 'directive' => ['appnavigationentryutils', 'appPopoverMenuUtils', 'autofocusoninsert', 'avatar', 'elastic', 'search', 'datepicker', 'timepicker'],
+ 'directive' => ['appnavigationentryutils', 'appPopoverMenuUtils', 'autofocusoninsert', 'avatar', 'contactsmenudelete', 'elastic', 'search', 'datepicker', 'timepicker'],
'filters' => ['boardFilterAcl', 'cardFilter', 'cardSearchFilter', 'iconWhiteFilter', 'lightenColorFilter', 'orderObjectBy', 'dateFilters', 'textColorFilter', 'withoutAssignedUsers'],
'service' => ['ApiService', 'BoardService', 'CardService', 'LabelService', 'StackService', 'StatusService'],
];
diff --git a/templates/part.board.mainView.php b/templates/part.board.mainView.php
index 34b3b134e..004fd2a9e 100644
--- a/templates/part.board.mainView.php
+++ b/templates/part.board.mainView.php
@@ -82,7 +82,7 @@