From 0330c01600fd4368fca4b022836a36f76fd11c88 Mon Sep 17 00:00:00 2001 From: Julius Haertl Date: Tue, 5 Jul 2016 02:28:15 +0200 Subject: [PATCH] More fixes --- appinfo/routes.php | 23 ++++++----- controller/sharecontroller.php | 45 +++++++++++++++++++++ css/style.css | 17 +++++--- js/directive/elastic.js | 18 +++++++++ js/public/app.js | 18 +++++++++ templates/part.boardlist.php | 2 +- templates/part.card.php | 74 ++++++++++++++++++++++++---------- 7 files changed, 158 insertions(+), 39 deletions(-) create mode 100644 controller/sharecontroller.php create mode 100644 js/directive/elastic.js diff --git a/appinfo/routes.php b/appinfo/routes.php index 9251fda33..bbddc7186 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -9,30 +9,26 @@ * @copyright Julius Härtl 2016 */ -/** - * Create your routes in here. The name is the lowercase name of the controller - * without the controller part, the stuff after the hash is the method. - * e.g. page#index -> OCA\Board\Controller\PageController->index() - * - * The controller class has to be registered in the application.php file since - * it's instantiated in there - */ return [ 'routes' => [ ['name' => 'page#index', 'url' => '/', 'verb' => 'GET'], - // api - ['name' => 'api#index', 'url' => '/api/', 'verb' => 'GET'], + + // share + ['name' => 'share#searchUser', 'url' => '/share/search/{search}', 'verb' => 'GET'], + // boards ['name' => 'board#index', 'url' => '/boards/', 'verb' => 'GET'], ['name' => 'board#create', 'url' => '/boards/', 'verb' => 'POST'], ['name' => 'board#read', 'url' => '/boards/{boardId}/', 'verb' => 'GET'], ['name' => 'board#update', 'url' => '/boards/', 'verb' => 'PUT'], ['name' => 'board#delete', 'url' => '/boards/{boardId}/', 'verb' => 'DELETE'], + // stacks ['name' => 'stack#index', 'url' => '/stacks/{boardId}/', 'verb' => 'GET'], ['name' => 'stack#create', 'url' => '/stacks/', 'verb' => 'POST'], ['name' => 'stack#update', 'url' => '/stacks/', 'verb' => 'PUT'], ['name' => 'stack#delete', 'url' => '/stacks/{stackId}/', 'verb' => 'DELETE'], + // cards ['name' => 'card#read', 'url' => '/cards/{cardId}/', 'verb' => 'GET'], ['name' => 'card#create', 'url' => '/cards/', 'verb' => 'POST'], @@ -40,10 +36,15 @@ return [ ['name' => 'card#rename', 'url' => '/cards/rename/', 'verb' => 'PUT'], ['name' => 'card#reorder', 'url' => '/cards/reorder/', 'verb' => 'PUT'], ['name' => 'card#delete', 'url' => '/cards/{cardId}/', 'verb' => 'DELETE'], + // card - assign labels ['name' => 'card#assignLabel', 'url' => '/cards/{cardId}/label/{labelId}', 'verb' => 'POST'], ['name' => 'card#removeLabel', 'url' => '/cards/{cardId}/label/{labelId}', 'verb' => 'DELETE'], + // TODO: card - assign user + ['name' => 'card#assignUser', 'url' => '/cards/{cardId}/user/{labelId}', 'verb' => 'POST'], + ['name' => 'card#removeUser', 'url' => '/cards/{cardId}/user/{labelId}', 'verb' => 'DELETE'], + // labels ['name' => 'label#create', 'url' => '/labels/', 'verb' => 'POST'], ['name' => 'label#update', 'url' => '/labels/', 'verb' => 'PUT'], @@ -53,8 +54,8 @@ return [ ['name' => 'public#index', 'url' => '/public/board/:hash', 'verb' => 'GET'], ['name' => 'public#board', 'url' => '/public/board/ajax/:hash', 'verb' => 'GET'], - // TODO: API for external access + //['name' => 'api#index', 'url' => '/api/', 'verb' => 'GET'], // ['name' => 'note_api#preflighted_cors', 'url' => '/api/v1/{path}/', 'verb' => 'OPTIONS', 'requirements' => ['path' => '.+']] ] diff --git a/controller/sharecontroller.php b/controller/sharecontroller.php new file mode 100644 index 000000000..bb5c86cde --- /dev/null +++ b/controller/sharecontroller.php @@ -0,0 +1,45 @@ +userManager = $userManager; + $this->groupManager = $groupManager; + + } + /** + * FIXME: REMOVE, just for testing + * @NoCSRFRequired + * @NoAdminRequired + */ + public function searchUser($search) { + $limit = null; + $offset = null; + $groups = []; + foreach ($this->groupManager->search($search, $limit, $offset) as $group) { + $groups[] = $group->getGID(); + } + $users = []; + foreach ($this->userManager->searchDisplayName($search, $limit, $offset) as $user) { + $users[] = $user->getDisplayName(); + } + return array( + 'users' => $users, + 'groups' => $groups + ); + } +} diff --git a/css/style.css b/css/style.css index ce9f04c02..0e5d5a656 100644 --- a/css/style.css +++ b/css/style.css @@ -352,15 +352,21 @@ } -#card-attachments, #sidebar-header, .card-block { - padding:10px; + padding:15px; +} +#card-attachments ul { + margin:5px; } #card-attachments .details { font-size:8pt; padding-left:15px; } +#attachment-add button { + background-color:#eeeeee; + font-size:9pt; +} #app-sidebar { right: -500px; @@ -401,8 +407,8 @@ } #assigned-users { - padding:10px; - padding-top:0; + margin-top:15px; + } .avatardiv { float:left; @@ -532,6 +538,7 @@ button:hover { .tabHeaders { clear: both; overflow:hidden; + margin-bottom:0; } #shareWithList .avatar { @@ -570,7 +577,7 @@ button:hover { padding-right:23px; } .ui-select-container { - background-color:#eeeeee !important; + background-color:#fafafa !important; } .ui-select-container.open { border: 1px solid #aaaaaa; diff --git a/js/directive/elastic.js b/js/directive/elastic.js new file mode 100644 index 000000000..b00d100c1 --- /dev/null +++ b/js/directive/elastic.js @@ -0,0 +1,18 @@ +// original idea from blockloop: http://stackoverflow.com/a/24090733 +app.directive('elastic', [ + '$timeout', + function($timeout) { + return { + restrict: 'A', + link: function($scope, element) { + $scope.initialHeight = $scope.initialHeight || element[0].style.height; + var resize = function() { + element[0].style.height = $scope.initialHeight; + element[0].style.height = "" + element[0].scrollHeight + "px"; + }; + element.on("input change", resize); + $timeout(resize, 0); + } + }; + } +]); \ No newline at end of file diff --git a/js/public/app.js b/js/public/app.js index 50addcfd2..7a6b6fea7 100644 --- a/js/public/app.js +++ b/js/public/app.js @@ -470,6 +470,24 @@ app.directive('cardActionUtils', function () { }); +// original idea from blockloop: http://stackoverflow.com/a/24090733 +app.directive('elastic', [ + '$timeout', + function($timeout) { + return { + restrict: 'A', + link: function($scope, element) { + $scope.initialHeight = $scope.initialHeight || element[0].style.height; + var resize = function() { + element[0].style.height = $scope.initialHeight; + element[0].style.height = "" + element[0].scrollHeight + "px"; + }; + element.on("input change", resize); + $timeout(resize, 0); + } + }; + } +]); app.factory('ApiService', ["$http", "$q", function($http, $q){ var ApiService = function(http, endpoint) { this.endpoint = endpoint; diff --git a/templates/part.boardlist.php b/templates/part.boardlist.php index 1da869620..9993c3e53 100644 --- a/templates/part.boardlist.php +++ b/templates/part.boardlist.php @@ -1,5 +1,5 @@
- +
diff --git a/templates/part.card.php b/templates/part.card.php index 42a103579..40d5da0af 100644 --- a/templates/part.card.php +++ b/templates/part.card.php @@ -9,6 +9,7 @@  

+
{{ cardservice.getCurrent().title }}
@@ -30,44 +31,73 @@ -
-
-
- - {{$item.title}} + + {{$item.title}} -
D
+ {{label.title}}

Description

- +
Add a card description ...
- + + + +
+
+ +
+ +
+ + + + + +
+ +
+ + + +
+
+ + + +
+
+ +
+
+