general fixes and tpl additions

This commit is contained in:
Dennis Eichhorn 2021-05-28 20:28:40 +02:00
parent fd37e86469
commit 527e540fe5
30 changed files with 92 additions and 3 deletions

View File

@ -36,6 +36,12 @@
"type": "INT",
"null": false
},
"kanban_board_style": {
"name": "kanban_board_style",
"type": "TEXT",
"null": true,
"default": null
},
"kanban_board_created_at": {
"name": "kanban_board_created_at",
"type": "DATETIME",
@ -142,6 +148,11 @@
"type": "TINYINT",
"null": false
},
"kanban_card_color": {
"name": "kanban_card_color",
"type": "VARCHAR(10)",
"null": false
},
"kanban_card_order": {
"name": "kanban_card_order",
"type": "INT",

View File

@ -87,6 +87,7 @@ final class ApiController extends Controller
$card->name = (string) ($request->getData('title'));
$card->descriptionRaw = (string) ($request->getData('plain') ?? '');
$card->description = Markdown::parse((string) ($request->getData('plain') ?? ''));
$card->style = (string) ($request->getData('style') ?? '');
$card->setColumn((int) $request->getData('column'));
$card->setOrder((int) ($request->getData('order') ?? 1));
$card->setRef((int) ($request->getData('ref') ?? 0));
@ -301,6 +302,50 @@ final class ApiController extends Controller
return [];
}
/**
* Routing end-point for application behaviour.
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param mixed $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiKanbanBoardUpdate(RequestAbstract $request, ResponseAbstract $response, $data = null) : void
{
$old = clone KanbanBoardMapper::get((int) $request->getData('id'));
$new = $this->updateBoardFromRequest($request);
$this->updateModel($request->header->account, $old, $new, KanbanBoardMapper::class, 'board', $request->getOrigin());
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Board', 'Board successfully updated', $new);
}
/**
* Method to update board from request.
*
* @param RequestAbstract $request Request
*
* @return KanbanBoard
*
* @since 1.0.0
*/
private function updateBoardFromRequest(RequestAbstract $request) : KanbanBoard
{
/** @var KanbanBoard $board */
$board = KanbanBoardMapper::get((int) $request->getData('id'));
$board->name = $request->getData('title') ?? $board->name;
$board->description = Markdown::parse((string) ($request->getData('plain') ?? $board->descriptionRaw));
$board->descriptionRaw = (string) ($request->getData('plain') ?? $board->descriptionRaw);
$board->setOrder((int) ($request->getData('order') ?? $board->order));
$board->setStatus((int) ($request->getData('status') ?? $board->getStatus()));
$board->style = (string) ($request->getData('style') ?? $board->style);
return $board;
}
/**
* Routing end-point for application behaviour.
*

View File

@ -46,7 +46,7 @@ class KanbanBoard implements \JsonSerializable
private int $status = BoardStatus::ACTIVE;
private int $order = 0;
public int $order = 0;
/**
* Description.
@ -64,6 +64,8 @@ class KanbanBoard implements \JsonSerializable
*/
public string $descriptionRaw = '';
public string $style = '';
/**
* Tags.
*

View File

@ -41,6 +41,7 @@ final class KanbanBoardMapper extends DataMapperAbstract
'kanban_board_descraw' => ['name' => 'kanban_board_descraw', 'type' => 'string', 'internal' => 'descriptionRaw'],
'kanban_board_status' => ['name' => 'kanban_board_status', 'type' => 'int', 'internal' => 'status'],
'kanban_board_order' => ['name' => 'kanban_board_order', 'type' => 'int', 'internal' => 'order'],
'kanban_board_style' => ['name' => 'kanban_board_style', 'type' => 'string', 'internal' => 'style'],
'kanban_board_created_by' => ['name' => 'kanban_board_created_by', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true],
'kanban_board_created_at' => ['name' => 'kanban_board_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true],
];

View File

@ -50,6 +50,8 @@ class KanbanCard implements \JsonSerializable
private int $type = CardType::TEXT;
public string $color = '';
/**
* Description.
*

View File

@ -43,6 +43,7 @@ final class KanbanCardMapper extends DataMapperAbstract
'kanban_card_type' => ['name' => 'kanban_card_type', 'type' => 'int', 'internal' => 'type'],
'kanban_card_status' => ['name' => 'kanban_card_status', 'type' => 'int', 'internal' => 'status'],
'kanban_card_order' => ['name' => 'kanban_card_order', 'type' => 'int', 'internal' => 'order'],
'kanban_card_color' => ['name' => 'kanban_card_color', 'type' => 'string', 'internal' => 'color'],
'kanban_card_ref' => ['name' => 'kanban_card_ref', 'type' => 'int', 'internal' => 'ref'],
'kanban_card_column' => ['name' => 'kanban_card_column', 'type' => 'int', 'internal' => 'column'],
'kanban_card_created_at' => ['name' => 'kanban_card_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true],

11
Models/styles.tpl.json Normal file
View File

@ -0,0 +1,11 @@
{
"version": "",
"board": {
"dashboard_background": "",
"board_background": "",
},
"cards": [
],
}

0
Theme/Backend/Lang/ar.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/cs.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/da.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/de.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/el.lang.php Normal file → Executable file
View File

3
Theme/Backend/Lang/en.lang.php Normal file → Executable file
View File

@ -14,4 +14,7 @@ declare(strict_types=1);
return ['Kanban' => [
'Dashboard' => 'Dashboard',
':bStatus1' => 'Active',
':bStatus2' => 'Inactive',
':bStatus3' => 'Archived',
]];

0
Theme/Backend/Lang/es.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/fi.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/fr.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/hu.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/it.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/ja.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/ko.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/no.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/pl.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/pt.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/ru.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/sv.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/th.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/tr.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/uk.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/zh.lang.php Normal file → Executable file
View File

View File

@ -30,6 +30,18 @@ echo $this->getData('nav')->render(); ?>
<table id="kanbanArchiveList" class="default sticky">
<thead>
<tr>
<td class="wf-100"><?= $this->getHtml('Status'); ?>
<label for="kanbanArchiveList-sort-1">
<input type="radio" name="kanbanArchiveList-sort" id="kanbanArchiveList-sort-1">
<i class="sort-asc fa fa-chevron-up"></i>
</label>
<label for="kanbanArchiveList-sort-2">
<input type="radio" name="kanbanArchiveList-sort" id="kanbanArchiveList-sort-2">
<i class="sort-desc fa fa-chevron-down"></i>
</label>
<label>
<i class="filter fa fa-filter"></i>
</label>
<td class="wf-100"><?= $this->getHtml('Title'); ?>
<label for="kanbanArchiveList-sort-3">
<input type="radio" name="kanbanArchiveList-sort" id="kanbanArchiveList-sort-3">
@ -62,8 +74,9 @@ echo $this->getData('nav')->render(); ?>
$url = UriFactory::build('{/prefix}kanban/board?{?}&id=' . $board->getId());
?>
<tr tabindex="0" data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $this->printHtml($board->title); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($board->getPublish()->format('Y-m-d')); ?></a>
<td><a href="<?= $url; ?>"><?= $this->getHtml(':bStatus' . $board->getStatus()); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($board->name); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($board->createdAt->format('Y-m-d')); ?></a>
<?php endforeach; ?>
<?php if ($count === 0) : ?>
<tr><td colspan="2" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>