feat: #2906 add card ID badge

- adds vscode settings file to gitingore
- adds new badge for card ID
- adds card ID to board filter
- adds settings to disable card ID badge

Signed-off-by: Adrian Missy <adrian.missy@onewavestudios.com>
This commit is contained in:
Adrian Missy
2022-04-26 12:34:29 -05:00
committed by Julius Härtl
parent 1598896157
commit f7717aa02a
8 changed files with 98 additions and 3 deletions

1
.gitignore vendored
View File

@@ -9,3 +9,4 @@ tests/.phpunit.result.cache
vendor/ vendor/
.php_cs.cache .php_cs.cache
\.idea/ \.idea/
settings.json

View File

@@ -1066,6 +1066,7 @@ Deck stores user and app configuration values globally and per board. The GET en
| --- | --- | | --- | --- |
| calendar | Determines if the calendar/tasks integration through the CalDAV backend is enabled for the user (boolean) | | calendar | Determines if the calendar/tasks integration through the CalDAV backend is enabled for the user (boolean) |
| cardDetailsInModal | Determines if the bigger view is used (boolean) | | cardDetailsInModal | Determines if the bigger view is used (boolean) |
| cardIdBadge | Determines if the ID badges are displayed on cards (boolean) |
| groupLimit | Determines if creating new boards is limited to certain groups of the instance. The resulting output is an array of group objects with the id and the displayname (Admin only)| | groupLimit | Determines if creating new boards is limited to certain groups of the instance. The resulting output is an array of group objects with the id and the displayname (Admin only)|
``` ```
@@ -1079,6 +1080,7 @@ Deck stores user and app configuration values globally and per board. The GET en
"data": { "data": {
"calendar": true, "calendar": true,
"cardDetailsInModal": true, "cardDetailsInModal": true,
"cardIdBadge": true,
"groupLimit": [ "groupLimit": [
{ {
"id": "admin", "id": "admin",
@@ -1109,6 +1111,7 @@ Deck stores user and app configuration values globally and per board. The GET en
| notify-due | `off`, `assigned` or `all` | | notify-due | `off`, `assigned` or `all` |
| calendar | Boolean | | calendar | Boolean |
| cardDetailsInModal | Boolean | | cardDetailsInModal | Boolean |
| cardIdBadge | Boolean |
#### Example request #### Example request

View File

@@ -71,6 +71,7 @@ class ConfigService {
$data = [ $data = [
'calendar' => $this->isCalendarEnabled(), 'calendar' => $this->isCalendarEnabled(),
'cardDetailsInModal' => $this->isCardDetailsInModal(), 'cardDetailsInModal' => $this->isCardDetailsInModal(),
'cardIdBadge' => $this->isCardIdBadgeEnabled()
]; ];
if ($this->groupManager->isAdmin($this->getUserId())) { if ($this->groupManager->isAdmin($this->getUserId())) {
$data['groupLimit'] = $this->get('groupLimit'); $data['groupLimit'] = $this->get('groupLimit');
@@ -100,6 +101,11 @@ class ConfigService {
return false; return false;
} }
return (bool)$this->config->getUserValue($this->getUserId(), Application::APP_ID, 'cardDetailsInModal', true); return (bool)$this->config->getUserValue($this->getUserId(), Application::APP_ID, 'cardDetailsInModal', true);
case 'cardIdBadge':
if ($this->getUserId() === null) {
return false;
}
return (bool)$this->config->getUserValue($this->getUserId(), Application::APP_ID, 'cardIdBadge', false);
} }
return false; return false;
} }
@@ -131,6 +137,16 @@ class ConfigService {
return (bool)$this->config->getUserValue($this->getUserId(), Application::APP_ID, 'board:' . $boardId . ':cardDetailsInModal', $defaultState); return (bool)$this->config->getUserValue($this->getUserId(), Application::APP_ID, 'board:' . $boardId . ':cardDetailsInModal', $defaultState);
} }
public function isCardIdBadgeEnabled(): bool {
if ($this->getUserId() === null) {
return false;
}
$appConfigState = $this->config->getAppValue(Application::APP_ID, 'cardIdBadge', 'yes') === 'no';
$defaultState = (bool)$this->config->getUserValue($this->getUserId(), Application::APP_ID, 'cardIdBadge', $appConfigState);
return (bool)$this->config->getUserValue($this->getUserId(), Application::APP_ID, 'cardIdBadge', $defaultState);
}
public function set($key, $value) { public function set($key, $value) {
if ($this->getUserId() === null) { if ($this->getUserId() === null) {
throw new NoPermissionException('Must be logged in to set user config'); throw new NoPermissionException('Must be logged in to set user config');
@@ -153,6 +169,10 @@ class ConfigService {
$this->config->setUserValue($this->getUserId(), Application::APP_ID, 'cardDetailsInModal', (string)$value); $this->config->setUserValue($this->getUserId(), Application::APP_ID, 'cardDetailsInModal', (string)$value);
$result = $value; $result = $value;
break; break;
case 'cardIdBadge':
$this->config->setUserValue($this->getUserId(), Application::APP_ID, 'cardIdBadge', (string)$value);
$result = $value;
break;
case 'board': case 'board':
[$boardId, $boardConfigKey] = explode(':', $key); [$boardId, $boardConfigKey] = explode(':', $key);
if ($boardConfigKey === 'notify-due' && !in_array($value, [self::SETTING_BOARD_NOTIFICATION_DUE_ALL, self::SETTING_BOARD_NOTIFICATION_DUE_ASSIGNED, self::SETTING_BOARD_NOTIFICATION_DUE_OFF], true)) { if ($boardConfigKey === 'notify-due' && !in_array($value, [self::SETTING_BOARD_NOTIFICATION_DUE_ALL, self::SETTING_BOARD_NOTIFICATION_DUE_ASSIGNED, self::SETTING_BOARD_NOTIFICATION_DUE_OFF], true)) {

View File

@@ -22,6 +22,7 @@
<template> <template>
<div v-if="card" class="badges"> <div v-if="card" class="badges">
<CardId v-if="idBadge" class="icon-badge" :card="card" />
<div v-if="card.commentsCount > 0" <div v-if="card.commentsCount > 0"
v-tooltip="commentsHint" v-tooltip="commentsHint"
class="icon-badge" class="icon-badge"
@@ -50,6 +51,7 @@
</template> </template>
<script> <script>
import NcAvatarList from './AvatarList.vue' import NcAvatarList from './AvatarList.vue'
import CardId from './badges/CardId.vue'
import CardMenu from './CardMenu.vue' import CardMenu from './CardMenu.vue'
import TextIcon from 'vue-material-design-icons/Text.vue' import TextIcon from 'vue-material-design-icons/Text.vue'
import AttachmentIcon from 'vue-material-design-icons/Paperclip.vue' import AttachmentIcon from 'vue-material-design-icons/Paperclip.vue'
@@ -59,7 +61,7 @@ import CommentUnreadIcon from 'vue-material-design-icons/CommentAccount.vue'
export default { export default {
name: 'CardBadges', name: 'CardBadges',
components: { NcAvatarList, CardMenu, TextIcon, AttachmentIcon, CheckmarkIcon, CommentIcon, CommentUnreadIcon }, components: { NcAvatarList, CardMenu, TextIcon, AttachmentIcon, CheckmarkIcon, CommentIcon, CommentUnreadIcon, CardId },
props: { props: {
card: { card: {
type: Object, type: Object,
@@ -82,6 +84,9 @@ export default {
} }
return null return null
}, },
idBadge() {
return this.$store.getters.config('cardIdBadge')
},
}, },
methods: { methods: {
openComments() { openComments() {
@@ -103,7 +108,8 @@ export default {
display: flex; display: flex;
margin-right: 2px; margin-right: 2px;
span { span,
&::v-deep span {
padding: 10px 2px; padding: 10px 2px;
} }
} }

View File

@@ -74,6 +74,7 @@
<span @click.stop="applyLabelFilter(label)">{{ label.title }}</span> <span @click.stop="applyLabelFilter(label)">{{ label.title }}</span>
</li> </li>
</transition-group> </transition-group>
<div v-show="!compactMode" class="card-controls compact-item" @click="openCard"> <div v-show="!compactMode" class="card-controls compact-item" @click="openCard">
<CardBadges :card="card" /> <CardBadges :card="card" />
</div> </div>

View File

@@ -0,0 +1,46 @@
<!--
- @copyright Copyright (c) 2022 Adrian Missy <adrian.missy@onewavestudios.com>
-
- @author Adrian Missy <adrian.missy@onewavestudios.com>
-
- @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/>.
-
-->
<template>
<div v-if="card" class="cardid">
<span>#{{ card.id }}</span>
</div>
</template>
<script>
export default {
name: 'CardId',
props: {
card: {
type: Object,
default: null,
},
},
}
</script>
<style lang="scss" scoped>
.cardid {
font-size: .9em;
}
</style>

View File

@@ -72,6 +72,16 @@
</label> </label>
</div> </div>
<div>
<input id="toggle-idbadge"
v-model="cardIdBadge"
type="checkbox"
class="checkbox">
<label for="toggle-idbadge">
{{ t('deck', 'Show card ID badge') }}
</label>
</div>
<div> <div>
<input id="toggle-calendar" <input id="toggle-calendar"
v-model="configCalendar" v-model="configCalendar"
@@ -168,6 +178,14 @@ export default {
this.$store.dispatch('setConfig', { cardDetailsInModal: newValue }) this.$store.dispatch('setConfig', { cardDetailsInModal: newValue })
}, },
}, },
cardIdBadge: {
get() {
return this.$store.getters.config('cardIdBadge')
},
set(newValue) {
this.$store.dispatch('setConfig', { cardIdBadge: newValue })
},
},
configCalendar: { configCalendar: {
get() { get() {
return this.$store.getters.config('calendar') return this.$store.getters.config('calendar')

View File

@@ -183,7 +183,7 @@ export default {
}) !== -1 }) !== -1
} else { } else {
hasMatch = hasMatch && (card.title.toLowerCase().includes(filterOutQuotes(match).toLowerCase()) hasMatch = hasMatch && (card.title.toLowerCase().includes(filterOutQuotes(match).toLowerCase())
|| card.description.toLowerCase().includes(filterOutQuotes(match).toLowerCase())) || card.description.toLowerCase().includes(filterOutQuotes(match).toLowerCase()) || card.id === parseInt(filterOutQuotes(match)))
} }
if (!hasMatch) { if (!hasMatch) {
return false return false