@@ -73,10 +73,11 @@ class BoardController extends ApiController {
|
|||||||
* @param $title
|
* @param $title
|
||||||
* @param $color
|
* @param $color
|
||||||
* @param $archived
|
* @param $archived
|
||||||
|
* @param $coverImages
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
* @return \OCP\AppFramework\Db\Entity
|
||||||
*/
|
*/
|
||||||
public function update($id, $title, $color, $archived) {
|
public function update($id, $title, $color, $archived, $coverImages) {
|
||||||
return $this->boardService->update($id, $title, $color, $archived);
|
return $this->boardService->update($id, $title, $color, $archived, $coverImages);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ class Board extends RelationalEntity {
|
|||||||
protected $stacks = [];
|
protected $stacks = [];
|
||||||
protected $deletedAt = 0;
|
protected $deletedAt = 0;
|
||||||
protected $lastModified = 0;
|
protected $lastModified = 0;
|
||||||
|
protected $coverImages = true;
|
||||||
|
|
||||||
protected $settings = [];
|
protected $settings = [];
|
||||||
|
|
||||||
@@ -47,6 +48,7 @@ class Board extends RelationalEntity {
|
|||||||
$this->addType('archived', 'boolean');
|
$this->addType('archived', 'boolean');
|
||||||
$this->addType('deletedAt', 'integer');
|
$this->addType('deletedAt', 'integer');
|
||||||
$this->addType('lastModified', 'integer');
|
$this->addType('lastModified', 'integer');
|
||||||
|
$this->addType('coverImages', 'boolean');
|
||||||
$this->addRelation('labels');
|
$this->addRelation('labels');
|
||||||
$this->addRelation('acl');
|
$this->addRelation('acl');
|
||||||
$this->addRelation('shared');
|
$this->addRelation('shared');
|
||||||
|
|||||||
27
lib/Migration/Version10400Date20210305.php
Normal file
27
lib/Migration/Version10400Date20210305.php
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace OCA\Deck\Migration;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
use OCP\DB\ISchemaWrapper;
|
||||||
|
use OCP\Migration\IOutput;
|
||||||
|
use OCP\Migration\SimpleMigrationStep;
|
||||||
|
|
||||||
|
class Version10400Date20210305 extends SimpleMigrationStep {
|
||||||
|
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
|
||||||
|
/** @var ISchemaWrapper $schema */
|
||||||
|
$schema = $schemaClosure();
|
||||||
|
|
||||||
|
// Add cover image database field
|
||||||
|
$table = $schema->getTable('deck_boards');
|
||||||
|
if (!$table->hasColumn('coverImages')) {
|
||||||
|
$table->addColumn('coverImages', 'boolean', [
|
||||||
|
'notnull' => false,
|
||||||
|
'default' => true,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
return $schema;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -408,13 +408,14 @@ class BoardService {
|
|||||||
* @param $title
|
* @param $title
|
||||||
* @param $color
|
* @param $color
|
||||||
* @param $archived
|
* @param $archived
|
||||||
|
* @param $coverImages
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
* @return \OCP\AppFramework\Db\Entity
|
||||||
* @throws DoesNotExistException
|
* @throws DoesNotExistException
|
||||||
* @throws \OCA\Deck\NoPermissionException
|
* @throws \OCA\Deck\NoPermissionException
|
||||||
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
||||||
* @throws BadRequestException
|
* @throws BadRequestException
|
||||||
*/
|
*/
|
||||||
public function update($id, $title, $color, $archived) {
|
public function update($id, $title, $color, $archived, $coverImages) {
|
||||||
if (is_numeric($id) === false) {
|
if (is_numeric($id) === false) {
|
||||||
throw new BadRequestException('board id must be a number');
|
throw new BadRequestException('board id must be a number');
|
||||||
}
|
}
|
||||||
@@ -431,12 +432,17 @@ class BoardService {
|
|||||||
throw new BadRequestException('archived must be a boolean');
|
throw new BadRequestException('archived must be a boolean');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_bool($coverImages) === false) {
|
||||||
|
throw new BadRequestException('coverImages must be a boolean');
|
||||||
|
}
|
||||||
|
|
||||||
$this->permissionService->checkPermission($this->boardMapper, $id, Acl::PERMISSION_MANAGE);
|
$this->permissionService->checkPermission($this->boardMapper, $id, Acl::PERMISSION_MANAGE);
|
||||||
$board = $this->find($id);
|
$board = $this->find($id);
|
||||||
$changes = new ChangeSet($board);
|
$changes = new ChangeSet($board);
|
||||||
$board->setTitle($title);
|
$board->setTitle($title);
|
||||||
$board->setColor($color);
|
$board->setColor($color);
|
||||||
$board->setArchived($archived);
|
$board->setArchived($archived);
|
||||||
|
$board->setCoverImages($coverImages);
|
||||||
$changes->setAfter($board);
|
$changes->setAfter($board);
|
||||||
$this->boardMapper->update($board); // operate on clone so we can check for updated fields
|
$this->boardMapper->update($board); // operate on clone so we can check for updated fields
|
||||||
$this->boardMapper->mapOwner($board);
|
$this->boardMapper->mapOwner($board);
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="card-upper">
|
<div class="card-upper">
|
||||||
<h3 v-if="compactMode || isArchived || showArchived || !canEdit || standalone">
|
<h3 v-if="compactMode || isArchived || showArchived || !canEdit || standalone">
|
||||||
|
{{ attachments }}
|
||||||
{{ card.title }}
|
{{ card.title }}
|
||||||
</h3>
|
</h3>
|
||||||
<h3 v-else-if="!editing">
|
<h3 v-else-if="!editing">
|
||||||
@@ -121,6 +122,7 @@ export default {
|
|||||||
}),
|
}),
|
||||||
...mapGetters([
|
...mapGetters([
|
||||||
'isArchived',
|
'isArchived',
|
||||||
|
|
||||||
]),
|
]),
|
||||||
board() {
|
board() {
|
||||||
return this.$store.getters.boardById(this?.stack?.boardId)
|
return this.$store.getters.boardById(this?.stack?.boardId)
|
||||||
@@ -128,6 +130,9 @@ export default {
|
|||||||
stack() {
|
stack() {
|
||||||
return this.$store.getters.stackById(this?.card?.stackId)
|
return this.$store.getters.stackById(this?.card?.stackId)
|
||||||
},
|
},
|
||||||
|
attachments() {
|
||||||
|
return [...this.$store.getters.attachmentsByCard(this.currentCard.id)].filter(attachment => attachment.deletedAt >= 0)
|
||||||
|
},
|
||||||
canEdit() {
|
canEdit() {
|
||||||
if (this.currentBoard) {
|
if (this.currentBoard) {
|
||||||
return !this.currentBoard.archived && this.$store.getters.canEdit
|
return !this.currentBoard.archived && this.$store.getters.canEdit
|
||||||
|
|||||||
@@ -111,7 +111,11 @@
|
|||||||
@click="isDueSubmenuActive=true">
|
@click="isDueSubmenuActive=true">
|
||||||
{{ dueDateReminderText }}
|
{{ dueDateReminderText }}
|
||||||
</ActionButton>
|
</ActionButton>
|
||||||
|
<ActionCheckbox v-if="canManage"
|
||||||
|
:checked="board.coverImages"
|
||||||
|
@change="actionToggleCoverImages">
|
||||||
|
{{ t('deck', 'Show cover images') }}
|
||||||
|
</ActionCheckbox>
|
||||||
<ActionButton v-if="canManage && !isDueSubmenuActive"
|
<ActionButton v-if="canManage && !isDueSubmenuActive"
|
||||||
icon="icon-delete"
|
icon="icon-delete"
|
||||||
:close-after-click="true"
|
:close-after-click="true"
|
||||||
@@ -136,7 +140,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { AppNavigationIconBullet, AppNavigationCounter, AppNavigationItem, ColorPicker, Actions, ActionButton } from '@nextcloud/vue'
|
import { AppNavigationIconBullet, AppNavigationCounter, AppNavigationItem, ColorPicker, Actions, ActionButton, ActionCheckbox } from '@nextcloud/vue'
|
||||||
import ClickOutside from 'vue-click-outside'
|
import ClickOutside from 'vue-click-outside'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -148,6 +152,7 @@ export default {
|
|||||||
ColorPicker,
|
ColorPicker,
|
||||||
Actions,
|
Actions,
|
||||||
ActionButton,
|
ActionButton,
|
||||||
|
ActionCheckbox,
|
||||||
},
|
},
|
||||||
directives: {
|
directives: {
|
||||||
ClickOutside,
|
ClickOutside,
|
||||||
@@ -308,6 +313,9 @@ export default {
|
|||||||
this.isDueSubmenuActive = false
|
this.isDueSubmenuActive = false
|
||||||
this.updateDueSetting = null
|
this.updateDueSetting = null
|
||||||
},
|
},
|
||||||
|
actionToggleCoverImages() {
|
||||||
|
this.$store.dispatch('toggleCoverImages', this.board)
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -311,6 +311,9 @@ export default new Vuex.Store({
|
|||||||
Vue.delete(state.currentBoard.acl, removeIndex)
|
Vue.delete(state.currentBoard.acl, removeIndex)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
toggleCoverImages(state) {
|
||||||
|
state.coverImages = !state.coverImages
|
||||||
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
@@ -497,5 +500,13 @@ export default new Vuex.Store({
|
|||||||
dispatch('loadBoardById', acl.boardId)
|
dispatch('loadBoardById', acl.boardId)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
toggleCoverImages({ commit }, board) {
|
||||||
|
const boardCopy = JSON.parse(JSON.stringify(board))
|
||||||
|
boardCopy.coverImages = !boardCopy.coverImages
|
||||||
|
apiClient.updateBoard(boardCopy)
|
||||||
|
.then((board) => {
|
||||||
|
commit('toggleCoverImages', board)
|
||||||
|
})
|
||||||
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user