fix color change bug

This commit is contained in:
Dennis Eichhorn 2020-09-19 21:22:34 +02:00
parent cbe3d16e4c
commit 1548e762ab
2 changed files with 4 additions and 2 deletions

View File

@ -98,7 +98,7 @@ final class ApiController extends Controller
/** @var Tag $tag */
$tag = TagMapper::get((int) $request->getData('id'));
$tag->setTitle((string) ($request->getData('title') ?? $tag->getTitle()));
$tag->setColor($request->getData('color') ?? $tag->getColor());
$tag->setColor(\str_pad($request->getData('color') ?? $tag->getColor(), 9, 'ff', \STR_PAD_RIGHT));
return $tag;
}

View File

@ -15,6 +15,7 @@ declare(strict_types=1);
use phpOMS\Localization\ISO639Enum;
use phpOMS\Uri\UriFactory;
/** @var \Modules\Tag\Models\Tag */
$tag = $this->getData('tag');
$l11n = $this->getData('l11n') ?? [];
@ -23,7 +24,7 @@ echo $this->getData('nav')->render(); ?>
<div class="row">
<div class="col-xs-12 col-md-6">
<div class="portlet">
<form id="fUnitCreate" method="put" action="<?= UriFactory::build('{/api}tag'); ?>">
<form id="fTagUpdate" method="post" action="<?= UriFactory::build('{/api}tag'); ?>">
<div class="portlet-head"><?= $this->getHtml('Tag'); ?></div>
<div class="portlet-body">
<table class="layout wf-100" style="table-layout: fixed">
@ -34,6 +35,7 @@ echo $this->getData('nav')->render(); ?>
</table>
</div>
<div class="portlet-foot">
<input type="hidden" name="id" value="<?= $tag->getId(); ?>">
<input id="iSubmit" name="submit" type="submit" value="<?= $this->getHtml('Save', '0', '0'); ?>">
</div>
</form>