From 403629c91ad4abd2be459f8e903fed707671c104 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Mon, 8 Jan 2018 12:44:15 +0100 Subject: [PATCH 1/3] Move unassign button to avatar menu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- css/style.scss | 16 +++--------- js/controller/CardController.js | 4 +-- js/directive/avatar.js | 3 ++- js/directive/contactsmenudelete.js | 39 ++++++++++++++++++++++++++++++ templates/main.php | 2 +- templates/part.card.php | 7 +++--- 6 files changed, 50 insertions(+), 21 deletions(-) create mode 100644 js/directive/contactsmenudelete.js diff --git a/css/style.scss b/css/style.scss index e228b4136..b0b45be4e 100644 --- a/css/style.scss +++ b/css/style.scss @@ -720,19 +720,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; } } } diff --git a/js/controller/CardController.js b/js/controller/CardController.js index f4815f517..190790cc0 100644 --- a/js/controller/CardController.js +++ b/js/controller/CardController.js @@ -169,8 +169,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..95f4a2489 100644 --- a/js/directive/avatar.js +++ b/js/directive/avatar.js @@ -32,6 +32,7 @@ app.directive('avatar', function() { $(element).contactsMenu(value, 0, $(element).parent()); } $(element).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..e9c638545 --- /dev/null +++ b/js/directive/contactsmenudelete.js @@ -0,0 +1,39 @@ +/* + * @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, + scope: true, + 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.card.php b/templates/part.card.php index 9931c1248..19c085281 100644 --- a/templates/part.card.php +++ b/templates/part.card.php @@ -66,10 +66,9 @@
    -
    -
    -
    +
    +
    From e1e01c0e0dca1f2e99e151d991ed980f9723e2c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Mon, 8 Jan 2018 13:35:49 +0100 Subject: [PATCH 2/3] Unify avatar directive MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- css/style.scss | 4 ++++ js/directive/avatar.js | 24 ++++++++++++++++++------ js/directive/contactsmenudelete.js | 7 +++---- templates/part.board.mainView.php | 2 +- templates/part.boardlist.php | 4 ++-- templates/part.card.php | 3 +-- 6 files changed, 29 insertions(+), 15 deletions(-) diff --git a/css/style.scss b/css/style.scss index b0b45be4e..4d663dae3 100644 --- a/css/style.scss +++ b/css/style.scss @@ -996,6 +996,10 @@ input.input-inline { padding: 16px; opacity: 0.5; } + + &.has-contactsmenu img { + cursor: pointer; + } } .avatardiv-container { diff --git a/js/directive/avatar.js b/js/directive/avatar.js index 95f4a2489..c93165985 100644 --- a/js/directive/avatar.js +++ b/js/directive/avatar.js @@ -23,15 +23,27 @@ 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 () {} }; diff --git a/js/directive/contactsmenudelete.js b/js/directive/contactsmenudelete.js index e9c638545..8fdbac5ef 100644 --- a/js/directive/contactsmenudelete.js +++ b/js/directive/contactsmenudelete.js @@ -25,15 +25,14 @@ app.directive('contactsmenudelete', function() { return { restrict: 'A', priority: 1, - scope: true, 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 () { + var menuEntry = $('
  • ' + t('deck', 'Remove user from card') + '
  • '); + menuEntry.on('click', function () { scope.removeAssignedUser(user); }); - $(menu).append(menuentry); + $(menu).append(menuEntry); } }; }); \ No newline at end of file diff --git a/templates/part.board.mainView.php b/templates/part.board.mainView.php index 823527d11..7fa82c0f4 100644 --- a/templates/part.board.mainView.php +++ b/templates/part.board.mainView.php @@ -82,7 +82,7 @@
    -
    +
    diff --git a/templates/part.boardlist.php b/templates/part.boardlist.php index 3047d0c36..a8a80a6b0 100644 --- a/templates/part.boardlist.php +++ b/templates/part.boardlist.php @@ -41,8 +41,8 @@
    -
    -
    + +
    diff --git a/templates/part.card.php b/templates/part.card.php index 19c085281..7e1633175 100644 --- a/templates/part.card.php +++ b/templates/part.card.php @@ -67,8 +67,7 @@
    -
    +
    From 14d5af683e7362042f402ab7d0b15c1d7d7dc73b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Mon, 8 Jan 2018 13:42:37 +0100 Subject: [PATCH 3/3] Show contacts menu for board owner MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- templates/part.boardlist.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/part.boardlist.php b/templates/part.boardlist.php index a8a80a6b0..bd3846b4e 100644 --- a/templates/part.boardlist.php +++ b/templates/part.boardlist.php @@ -41,7 +41,7 @@
    - +