Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assign users to cards #314

Merged
merged 21 commits into from
Oct 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
bf1927d
WIP: assign users
juliusknorr Sep 15, 2017
bf3dad5
Fix card headings
juliusknorr Sep 29, 2017
c9ac13f
Backend: Get list of users to assign
juliusknorr Oct 1, 2017
a889a68
Frontend: Add UI for user assignment
juliusknorr Oct 1, 2017
b15bbbd
Backend: assign/remove user impelementation
juliusknorr Oct 1, 2017
fb3fd67
Frontend: Fix assigning/removing users
juliusknorr Oct 1, 2017
e20acd1
Frontend: cleanup dom structure and css
juliusknorr Oct 1, 2017
98414b0
Card: Show assigned users on board
juliusknorr Oct 1, 2017
7f75d17
Tests: Fix tests for user assignment
juliusknorr Oct 3, 2017
05b92c1
Frontend: Fix codacy errors
juliusknorr Oct 3, 2017
9d9e7fc
Fix issue with new findUser implementation
juliusknorr Oct 4, 2017
1714fa3
Fix tests that invoke findUsers
juliusknorr Oct 10, 2017
0edc451
Fix inspection issues
juliusknorr Oct 10, 2017
d2e1deb
Card: Only show users that are not already assigned
juliusknorr Oct 10, 2017
d4eaa2d
Tests: Add integration test for user assignment
juliusknorr Oct 10, 2017
9ee7150
Frontend: fix warnings in withoutAssignedUsers filter
juliusknorr Oct 11, 2017
82c4048
Use default (larger) avatar size, default (smaller) action bar height
Oct 13, 2017
a744eb5
Give 44*44px clickable area for the icon-more button
Oct 13, 2017
24b5263
Add some space between multiple assignees
Oct 13, 2017
915cde4
Card: Fix styling issue when only duedate is set
juliusknorr Oct 18, 2017
8f835f5
Frontend: Remove unrequired css and fix language strings
juliusknorr Oct 18, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions appinfo/database.xml
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,44 @@
</index>
</declaration>
</table>
<table>
<name>*dbprefix*deck_assigned_users</name>
<declaration>
<field>
<name>id</name>
<type>integer</type>
<default>0</default>
<notnull>true</notnull>
<autoincrement>1</autoincrement>
<length>4</length>
</field>
<field>
<name>participant</name>
<type>text</type>
<notnull>true</notnull>
<length>64</length>
</field>
<field>
<name>card_id</name>
<type>integer</type>
<default>0</default>
<notnull>true</notnull>
<length>4</length>
</field>
<index>
<name>deck_assigned_users_idx_p</name>
<field>
<name>participant</name>
</field>
</index>
<index>
<name>deck_assigned_users_idx_c</name>
<field>
<name>card_id</name>
</field>
</index>
</declaration>
</table>
<table>
<name>*dbprefix*deck_board_acl</name>
<declaration>
Expand Down
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
💥 This is still alpha software: it may not be stable enough for production!

</description>
<version>0.3.0-dev1</version>
<version>0.3.0-dev2</version>
<licence>agpl</licence>
<author>Julius Härtl</author>
<namespace>Deck</namespace>
Expand Down
2 changes: 2 additions & 0 deletions appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
['name' => 'card#unarchive', 'url' => '/cards/{cardId}/unarchive', 'verb' => 'PUT'],
['name' => 'card#assignLabel', 'url' => '/cards/{cardId}/label/{labelId}', 'verb' => 'POST'],
['name' => 'card#removeLabel', 'url' => '/cards/{cardId}/label/{labelId}', 'verb' => 'DELETE'],
['name' => 'card#assignUser', 'url' => '/cards/{cardId}/assign', 'verb' => 'POST'],
['name' => 'card#unassignUser', 'url' => '/cards/{cardId}/assign/{userId}', 'verb' => 'DELETE'],

// labels
['name' => 'label#create', 'url' => '/labels', 'verb' => 'POST'],
Expand Down
161 changes: 100 additions & 61 deletions css/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -350,30 +350,71 @@ input.input-inline {
padding: 5px;
}

.card-assigned-users {
display: flex;
justify-content: flex-end;
flex-grow: 1;
.assigned-user {
z-index: 4;
margin: 6px 0 6px 6px;
}
}

.card-controls {
padding: 10px;
background: $color-lightgrey;
display: flex;
position: relative;
padding-left: 10px;

.card-options {
opacity: 0.3;
position: absolute;
right: 10px;
top: 8px;
justify-content: flex-end;
}

&:hover .card-options {
opacity: 1;
}

.icon-filetype-text {
margin-right: 10px;
margin: 10px;
margin-left: 0px;
}

.due {
border-radius: 3px;
margin: 6px 4px 6px 0px;
padding: 0 4px;
font-size: 90%;
opacity: 0.5;
display: flex;
align-items: center;

.icon {
background-size: contain;
}

&.overdue {
background-color: $color-error;
color: $color-primary-text;

.icon-badge {
background-image: url('../img/calendar-white.svg');
}
}
&.now {
background-color: $color-warning;
}
&.next {
background-color: $color-warning-light;
}

span {
margin-left: 3px;
}
}

button {
padding: 0px;
margin-right: 0px;
padding: 22px;
margin: 0;
}
}

Expand Down Expand Up @@ -492,39 +533,6 @@ input.input-inline {
}
}

.due {
border-radius: 3px;
margin: -4px 4px -4px -4px;
padding: 0px 4px;
font-size: 90%;
opacity: 0.5;
display: flex;
align-items: center;

.icon {
background-size: contain;
}

&.overdue {
background-color: $color-error;
color: $color-primary-text;

.icon-badge {
background-image: url('../img/calendar-white.svg');
}
}
&.now {
background-color: $color-warning;
}
&.next {
background-color: $color-warning-light;
}

span {
margin-left: 3px;
}
}

/**
* App sidebar
*/
Expand Down Expand Up @@ -595,20 +603,15 @@ input.input-inline {
}
}

.select2-container {
margin: 0px;
}

h4 {
.section-header {
border-bottom: 1px solid $color-lightgrey;
padding: 15px 0px 5px 0px;
margin: 0 0 10px 0;
font-size: 15px;

> div {
display: inline-flex;
align-content: center;
justify-content: space-between;
display: flex;
margin-bottom: 5px;
margin-top: 20px;
h4 {
padding-top: 5px;
padding-bottom: 5px;
flex: 1;
}
}

Expand Down Expand Up @@ -642,9 +645,36 @@ input.input-inline {
text-align: right;
}

#card-tag-label {
padding-top: 0px !important;
margin-top: 0px;
.card-details-assign-users {

.select2 .ui-select-choices-row-inner {
display: flex;
padding: 5px !important;
}

.card-details-assign-users-list {
display: flex;
.assigned-user {
position: relative;

.avatardiv {
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;
}
}
}
}

#card-description {
Expand Down Expand Up @@ -985,10 +1015,19 @@ input.input-inline {
}
}

.select2-container-multi .select2-choices .select2-search-choice {
padding: 3px 0 !important;
border: 0 !important;
overflow: hidden;
.select2-container {
width: 100%;
margin: 0;

.select2-choices {
padding: 0 !important;

.select2-search-choice {
padding: 3px 0 !important;
border: 0 !important;
overflow: hidden;
}
}
}

.ui-select-container[disabled] .ui-select-match-item {
Expand Down
37 changes: 35 additions & 2 deletions js/controller/CardController.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
/* global app */
/* global moment */

app.controller('CardController', function ($scope, $rootScope, $routeParams, $location, $stateParams, $interval, BoardService, CardService, StackService, StatusService) {
app.controller('CardController', function ($scope, $rootScope, $routeParams, $location, $stateParams, $interval, $timeout, BoardService, CardService, StackService, StatusService) {
$scope.sidebar = $rootScope.sidebar;
$scope.status = {
lastEdit: 0,
Expand Down Expand Up @@ -139,4 +139,37 @@ app.controller('CardController', function ($scope, $rootScope, $routeParams, $lo
CardService.update(element);
StackService.updateCard(element);
};
});

/**
* Show ui-select field when clicking the add button
*/
$scope.showAssignUser = function() {
$scope.status.showAssignUser = true;
$timeout(function() {
$('#assignUserSelect').find('a').click();
});
};

/**
* Hide ui-select when select list is closed
*/
$scope.assingUserOpenClose = function(isOpen) {
if (!isOpen) {
$scope.status.showAssignUser = false;
}
};

$scope.addAssignedUser = function(item) {
CardService.assignUser(CardService.getCurrent(), item.uid).then(function (data) {
StackService.updateCard(CardService.getCurrent());
});
$scope.status.showAssignUser = false;
};

$scope.removeAssignedUser = function(item) {
CardService.unassignUser(CardService.getCurrent(), item.participant.uid).then(function (data) {
StackService.updateCard(CardService.getCurrent());
});
};

});
45 changes: 45 additions & 0 deletions js/filters/withoutAssignedUsers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* @copyright Copyright (c) 2017 Julius Härtl <jus@bitgrid.net>
*
* @author Julius Härtl <jus@bitgrid.net>
*
* @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 <http://www.gnu.org/licenses/>.
*
*/

/* global app */
/* global angular */

/*
* Remove all assignedUsers from users list
*/
app.filter('withoutAssignedUsers', function () {
return function (users, assignedUsers) {
var _result = [];
angular.forEach(users, function (user) {
var _found = false;
angular.forEach(assignedUsers, function (assignedUser) {
if (assignedUser.participant.uid === user.uid) {
_found = true;
}
});
if (_found === false) {
_result.push(user);
}
});
return _result;
};
});
Loading