Store cardDetailsInModal in config instead of state
Signed-off-by: Dmitriy Ivanko <tmwsls12@gmail.com>
This commit is contained in:
committed by
Julius Härtl
parent
25dee609b5
commit
51bcbdb87d
@@ -1004,6 +1004,7 @@ Deck stores user and app configuration values globally and per board. The GET en
|
|||||||
| Config key | Description |
|
| Config key | Description |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| 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) |
|
||||||
| 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)|
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -1016,6 +1017,7 @@ Deck stores user and app configuration values globally and per board. The GET en
|
|||||||
},
|
},
|
||||||
"data": {
|
"data": {
|
||||||
"calendar": true,
|
"calendar": true,
|
||||||
|
"cardDetailsInModal": true,
|
||||||
"groupLimit": [
|
"groupLimit": [
|
||||||
{
|
{
|
||||||
"id": "admin",
|
"id": "admin",
|
||||||
@@ -1045,6 +1047,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 |
|
||||||
|
|
||||||
#### Example request
|
#### Example request
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,8 @@ class ConfigService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'calendar' => $this->isCalendarEnabled()
|
'calendar' => $this->isCalendarEnabled(),
|
||||||
|
'cardDetailsInModal' => $this->isCardDetailsInModal(),
|
||||||
];
|
];
|
||||||
if ($this->groupManager->isAdmin($this->getUserId())) {
|
if ($this->groupManager->isAdmin($this->getUserId())) {
|
||||||
$data['groupLimit'] = $this->get('groupLimit');
|
$data['groupLimit'] = $this->get('groupLimit');
|
||||||
@@ -88,6 +89,11 @@ class ConfigService {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return (bool)$this->config->getUserValue($this->getUserId(), Application::APP_ID, 'calendar', true);
|
return (bool)$this->config->getUserValue($this->getUserId(), Application::APP_ID, 'calendar', true);
|
||||||
|
case 'cardDetailsInModal':
|
||||||
|
if ($this->getUserId() === null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return (bool)$this->config->getUserValue($this->getUserId(), Application::APP_ID, 'cardDetailsInModal', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,6 +110,19 @@ class ConfigService {
|
|||||||
return (bool)$this->config->getUserValue($this->getUserId(), Application::APP_ID, 'board:' . $boardId . ':calendar', $defaultState);
|
return (bool)$this->config->getUserValue($this->getUserId(), Application::APP_ID, 'board:' . $boardId . ':calendar', $defaultState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isCardDetailsInModal(int $boardId = null): bool {
|
||||||
|
if ($this->getUserId() === null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$defaultState = (bool)$this->config->getUserValue($this->getUserId(), Application::APP_ID, 'cardDetailsInModal', true);
|
||||||
|
if ($boardId === null) {
|
||||||
|
return $defaultState;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (bool)$this->config->getUserValue($this->getUserId(), Application::APP_ID, 'board:' . $boardId . ':cardDetailsInModal', $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');
|
||||||
@@ -122,6 +141,10 @@ class ConfigService {
|
|||||||
$this->config->setUserValue($this->getUserId(), Application::APP_ID, 'calendar', (string)$value);
|
$this->config->setUserValue($this->getUserId(), Application::APP_ID, 'calendar', (string)$value);
|
||||||
$result = $value;
|
$result = $value;
|
||||||
break;
|
break;
|
||||||
|
case 'cardDetailsInModal':
|
||||||
|
$this->config->setUserValue($this->getUserId(), Application::APP_ID, 'cardDetailsInModal', (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)) {
|
||||||
|
|||||||
@@ -88,7 +88,6 @@ export default {
|
|||||||
navShown: state => state.navShown,
|
navShown: state => state.navShown,
|
||||||
sidebarShownState: state => state.sidebarShown,
|
sidebarShownState: state => state.sidebarShown,
|
||||||
currentBoard: state => state.currentBoard,
|
currentBoard: state => state.currentBoard,
|
||||||
cardDetailsInModal: state => state.cardDetailsInModal,
|
|
||||||
}),
|
}),
|
||||||
// TODO: properly handle sidebar showing for route subview and board sidebar
|
// TODO: properly handle sidebar showing for route subview and board sidebar
|
||||||
sidebarRouterView() {
|
sidebarRouterView() {
|
||||||
@@ -98,6 +97,14 @@ export default {
|
|||||||
sidebarShown() {
|
sidebarShown() {
|
||||||
return this.sidebarRouterView || this.sidebarShownState
|
return this.sidebarRouterView || this.sidebarShownState
|
||||||
},
|
},
|
||||||
|
cardDetailsInModal: {
|
||||||
|
get() {
|
||||||
|
return this.$store.getters.config('cardDetailsInModal')
|
||||||
|
},
|
||||||
|
set(newValue) {
|
||||||
|
this.$store.dispatch('setConfig', { cardDetailsInModal: newValue })
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.$store.dispatch('loadBoards')
|
this.$store.dispatch('loadBoards')
|
||||||
|
|||||||
@@ -162,7 +162,6 @@ export default {
|
|||||||
]),
|
]),
|
||||||
...mapState({
|
...mapState({
|
||||||
showArchived: state => state.showArchived,
|
showArchived: state => state.showArchived,
|
||||||
cardDetailsInModal: state => state.cardDetailsInModal,
|
|
||||||
}),
|
}),
|
||||||
cardsByStack() {
|
cardsByStack() {
|
||||||
return this.$store.getters.cardsByStack(this.stack.id).filter((card) => {
|
return this.$store.getters.cardsByStack(this.stack.id).filter((card) => {
|
||||||
@@ -175,6 +174,14 @@ export default {
|
|||||||
dragHandleSelector() {
|
dragHandleSelector() {
|
||||||
return this.canEdit ? null : '.no-drag'
|
return this.canEdit ? null : '.no-drag'
|
||||||
},
|
},
|
||||||
|
cardDetailsInModal: {
|
||||||
|
get() {
|
||||||
|
return this.$store.getters.config('cardDetailsInModal')
|
||||||
|
},
|
||||||
|
set(newValue) {
|
||||||
|
this.$store.dispatch('setConfig', { cardDetailsInModal: newValue })
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
@submit-title="handleSubmitTitle"
|
@submit-title="handleSubmitTitle"
|
||||||
@close="closeSidebar">
|
@close="closeSidebar">
|
||||||
<template #secondary-actions>
|
<template #secondary-actions>
|
||||||
<ActionButton v-if="cardDetailsInModal" icon="icon-menu-sidebar" @click.stop="showModal()">
|
<ActionButton v-if="cardDetailsInModal" icon="icon-menu-sidebar" @click.stop="closeModal()">
|
||||||
{{ t('deck', 'Open in sidebar view') }}
|
{{ t('deck', 'Open in sidebar view') }}
|
||||||
</ActionButton>
|
</ActionButton>
|
||||||
<ActionButton v-else icon="icon-external" @click.stop="showModal()">
|
<ActionButton v-else icon="icon-external" @click.stop="showModal()">
|
||||||
@@ -131,7 +131,6 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
...mapState({
|
...mapState({
|
||||||
currentBoard: state => state.currentBoard,
|
currentBoard: state => state.currentBoard,
|
||||||
cardDetailsInModal: state => state.cardDetailsInModal,
|
|
||||||
}),
|
}),
|
||||||
...mapGetters(['canEdit', 'assignables', 'cardActions', 'stackById']),
|
...mapGetters(['canEdit', 'assignables', 'cardActions', 'stackById']),
|
||||||
title() {
|
title() {
|
||||||
@@ -152,6 +151,14 @@ export default {
|
|||||||
link: window.location.protocol + '//' + window.location.host + generateUrl('/apps/deck/') + `#/board/${this.currentBoard.id}/card/${this.currentCard.id}`,
|
link: window.location.protocol + '//' + window.location.host + generateUrl('/apps/deck/') + `#/board/${this.currentBoard.id}/card/${this.currentCard.id}`,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
cardDetailsInModal: {
|
||||||
|
get() {
|
||||||
|
return this.$store.getters.config('cardDetailsInModal')
|
||||||
|
},
|
||||||
|
set(newValue) {
|
||||||
|
this.$store.dispatch('setConfig', { cardDetailsInModal: newValue })
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleUpdateTitleEditable(value) {
|
handleUpdateTitleEditable(value) {
|
||||||
@@ -177,7 +184,10 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
showModal() {
|
showModal() {
|
||||||
this.$store.dispatch('setCardDetailsInModal', true)
|
this.$store.dispatch('setConfig', { cardDetailsInModal: true })
|
||||||
|
},
|
||||||
|
closeModal() {
|
||||||
|
this.$store.dispatch('setConfig', { cardDetailsInModal: false })
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -224,7 +224,6 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
...mapState({
|
...mapState({
|
||||||
currentBoard: state => state.currentBoard,
|
currentBoard: state => state.currentBoard,
|
||||||
cardDetailsInModal: state => state.cardDetailsInModal,
|
|
||||||
}),
|
}),
|
||||||
...mapGetters(['canEdit', 'assignables']),
|
...mapGetters(['canEdit', 'assignables']),
|
||||||
formatedAssignables() {
|
formatedAssignables() {
|
||||||
@@ -250,6 +249,14 @@ export default {
|
|||||||
return assignable
|
return assignable
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
cardDetailsInModal: {
|
||||||
|
get() {
|
||||||
|
return this.$store.getters.config('cardDetailsInModal')
|
||||||
|
},
|
||||||
|
set(newValue) {
|
||||||
|
this.$store.dispatch('setConfig', { cardDetailsInModal: newValue })
|
||||||
|
},
|
||||||
|
},
|
||||||
duedate: {
|
duedate: {
|
||||||
get() {
|
get() {
|
||||||
return this.card.duedate ? new Date(this.card.duedate) : null
|
return this.card.duedate ? new Date(this.card.duedate) : null
|
||||||
|
|||||||
@@ -132,7 +132,6 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
...mapState({
|
...mapState({
|
||||||
currentBoard: state => state.currentBoard,
|
currentBoard: state => state.currentBoard,
|
||||||
cardDetailsInModal: state => state.cardDetailsInModal,
|
|
||||||
}),
|
}),
|
||||||
...mapGetters(['canEdit']),
|
...mapGetters(['canEdit']),
|
||||||
attachments() {
|
attachments() {
|
||||||
|
|||||||
@@ -144,10 +144,10 @@ export default {
|
|||||||
},
|
},
|
||||||
cardDetailsInModal: {
|
cardDetailsInModal: {
|
||||||
get() {
|
get() {
|
||||||
return this.$store.getters.cardDetailsInModal
|
return this.$store.getters.config('cardDetailsInModal')
|
||||||
},
|
},
|
||||||
set(newValue) {
|
set(newValue) {
|
||||||
this.$store.dispatch('setCardDetailsInModal', newValue)
|
this.$store.dispatch('setConfig', { cardDetailsInModal: newValue })
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
configCalendar: {
|
configCalendar: {
|
||||||
|
|||||||
@@ -62,7 +62,6 @@ export default new Vuex.Store({
|
|||||||
showArchived: false,
|
showArchived: false,
|
||||||
navShown: localStorage.getItem('deck.navShown') === 'true',
|
navShown: localStorage.getItem('deck.navShown') === 'true',
|
||||||
compactMode: localStorage.getItem('deck.compactMode') === 'true',
|
compactMode: localStorage.getItem('deck.compactMode') === 'true',
|
||||||
cardDetailsInModal: localStorage.getItem('deck.cardDetailsInModal') === 'true',
|
|
||||||
sidebarShown: false,
|
sidebarShown: false,
|
||||||
currentBoard: null,
|
currentBoard: null,
|
||||||
currentCard: null,
|
currentCard: null,
|
||||||
@@ -79,9 +78,6 @@ export default new Vuex.Store({
|
|||||||
config: state => (key) => {
|
config: state => (key) => {
|
||||||
return state.config[key]
|
return state.config[key]
|
||||||
},
|
},
|
||||||
cardDetailsInModal: state => {
|
|
||||||
return state.cardDetailsInModal
|
|
||||||
},
|
|
||||||
getSearchQuery: state => {
|
getSearchQuery: state => {
|
||||||
return state.searchQuery
|
return state.searchQuery
|
||||||
},
|
},
|
||||||
@@ -233,10 +229,6 @@ export default new Vuex.Store({
|
|||||||
state.compactMode = !state.compactMode
|
state.compactMode = !state.compactMode
|
||||||
localStorage.setItem('deck.compactMode', state.compactMode)
|
localStorage.setItem('deck.compactMode', state.compactMode)
|
||||||
},
|
},
|
||||||
setCardDetailsInModal(state) {
|
|
||||||
state.cardDetailsInModal = !state.cardDetailsInModal
|
|
||||||
localStorage.setItem('deck.cardDetailsInModal', state.cardDetailsInModal)
|
|
||||||
},
|
|
||||||
setBoards(state, boards) {
|
setBoards(state, boards) {
|
||||||
state.boards = boards
|
state.boards = boards
|
||||||
},
|
},
|
||||||
@@ -441,9 +433,6 @@ export default new Vuex.Store({
|
|||||||
toggleCompactMode({ commit }) {
|
toggleCompactMode({ commit }) {
|
||||||
commit('toggleCompactMode')
|
commit('toggleCompactMode')
|
||||||
},
|
},
|
||||||
setCardDetailsInModal({ commit }, show) {
|
|
||||||
commit('setCardDetailsInModal', show)
|
|
||||||
},
|
|
||||||
setCurrentBoard({ commit }, board) {
|
setCurrentBoard({ commit }, board) {
|
||||||
commit('setCurrentBoard', board)
|
commit('setCurrentBoard', board)
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user