From 071c876af7dd472dfdb9deef1322f104792dbca5 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Tue, 2 Apr 2024 21:40:47 +0000 Subject: [PATCH] template fixes + bug fixes + style fixes --- .../Components/AttributeTypeListView.php | 2 -- .../Backend/Components/AttributeValueView.php | 9 ++++++++ Theme/Backend/Components/type-view.tpl.php | 20 +++++++++++++----- Theme/Backend/Components/value-view.tpl.php | 21 ++++++++++++------- Theme/Backend/Lang/de.lang.php | 13 ++++++------ Theme/Backend/Lang/en.lang.php | 13 ++++++------ tests/Models/AttributeValueTest.php | 20 +++++++++--------- 7 files changed, 62 insertions(+), 36 deletions(-) diff --git a/Theme/Backend/Components/AttributeTypeListView.php b/Theme/Backend/Components/AttributeTypeListView.php index fc6941e..92b1395 100644 --- a/Theme/Backend/Components/AttributeTypeListView.php +++ b/Theme/Backend/Components/AttributeTypeListView.php @@ -14,12 +14,10 @@ declare(strict_types=1); namespace Modules\Attribute\Theme\Backend\Components; -use Modules\Attribute\Models\AttributeType; use phpOMS\Localization\L11nManager; use phpOMS\Message\RequestAbstract; use phpOMS\Message\ResponseAbstract; use phpOMS\Views\View; -use Web\Backend\Views\L11nView; /** * Component view. diff --git a/Theme/Backend/Components/AttributeValueView.php b/Theme/Backend/Components/AttributeValueView.php index 4787b32..dd81147 100644 --- a/Theme/Backend/Components/AttributeValueView.php +++ b/Theme/Backend/Components/AttributeValueView.php @@ -14,6 +14,7 @@ declare(strict_types=1); namespace Modules\Attribute\Theme\Backend\Components; +use Modules\Attribute\Models\AttributeType; use Modules\Attribute\Models\AttributeValue; use phpOMS\Localization\L11nManager; use phpOMS\Message\RequestAbstract; @@ -32,6 +33,14 @@ use Web\Backend\Views\L11nView; */ class AttributeValueView extends View { + /** + * Attributes + * + * @var \Modules\Attribute\Models\AttributeType + * @since 1.0.0 + */ + public AttributeType $type; + /** * Attributes * diff --git a/Theme/Backend/Components/type-view.tpl.php b/Theme/Backend/Components/type-view.tpl.php index c9dd1b4..b79e0dd 100644 --- a/Theme/Backend/Components/type-view.tpl.php +++ b/Theme/Backend/Components/type-view.tpl.php @@ -18,19 +18,21 @@ use phpOMS\Uri\UriFactory; $types = AttributeValueType::getConstants(); $isNew = $this->attribute->id === 0; -$path = $this->path; +$path = $this->path; echo $this->data['nav']->render(); ?>
+
+
- request->uri->fragment === 'c-tab-1' ? ' checked' : ''; ?>> + request->uri->fragment === 'c-tab-1' ? ' checked' : ''; ?>>
@@ -45,12 +47,12 @@ echo $this->data['nav']->render(); ?>
- + >
- > $type) : ?>
+
l11nView->render( $this->l11ns, @@ -98,14 +101,20 @@ echo $this->data['nav']->render(); ?> ); ?>
+
+ request->uri->fragment === 'c-tab-2' ? ' checked' : ''; ?>>
-
getHtml('Defaults'); ?>download
+
+ getHtml('Defaults'); ?> + download + getHtml('New', '0', '0'); ?> +
@@ -166,5 +175,6 @@ echo $this->data['nav']->render(); ?> + \ No newline at end of file diff --git a/Theme/Backend/Components/value-view.tpl.php b/Theme/Backend/Components/value-view.tpl.php index 2b75330..a7a4aa4 100644 --- a/Theme/Backend/Components/value-view.tpl.php +++ b/Theme/Backend/Components/value-view.tpl.php @@ -32,20 +32,25 @@ echo $this->data['nav']->render(); ?>
- - + + >
- attribute->valueInt !== null) : ?> + type->datatype === AttributeValueType::_INT || $this->type->datatype === AttributeValueType::_FLOAT_INT) : ?> - attribute->valueDec !== null) : ?> + type->datatype === AttributeValueType::_FLOAT) : ?> - attribute->valueStr !== null) : ?> + type->datatype === AttributeValueType::_STRING) : ?> - attribute->valueDat !== null) : ?> + type->datatype === AttributeValueType::_DATETIME) : ?> + type->datatype === AttributeValueType::_BOOL) : ?> +
@@ -61,6 +66,7 @@ echo $this->data['nav']->render(); ?> +
l11nView->render( $this->l11ns, @@ -68,4 +74,5 @@ echo $this->data['nav']->render(); ?> '{/api}' . $this->path . '/attribute/value/l11n?csrf={$CSRF}' ); ?> -
\ No newline at end of file + + \ No newline at end of file diff --git a/Theme/Backend/Lang/de.lang.php b/Theme/Backend/Lang/de.lang.php index 303f3e1..1a1b740 100644 --- a/Theme/Backend/Lang/de.lang.php +++ b/Theme/Backend/Lang/de.lang.php @@ -27,11 +27,12 @@ return ['Attribute' => [ 'Type' => 'Type', 'Unit' => 'Unit', 'Value' => 'Value', - '_INT' => 'INTEGER', - '_STRING' => 'STRING', - '_FLOAT' => 'FLOAT', - '_FLOAT_INT' => 'FLOAT_INT', - '_DATETIME' => 'DATETIME', + '_INT' => 'INTEGER', + '_STRING' => 'STRING', + '_FLOAT' => 'FLOAT', + '_FLOAT_INT' => 'FLOAT_INT', + '_DATETIME' => 'DATETIME', '_BOOL' => 'BOOL', - 'Defaults' => 'Standards', + 'Defaults' => 'Standards', + 'Localization' => 'Lokalisierung', ]]; diff --git a/Theme/Backend/Lang/en.lang.php b/Theme/Backend/Lang/en.lang.php index 44e6d3e..69278ff 100755 --- a/Theme/Backend/Lang/en.lang.php +++ b/Theme/Backend/Lang/en.lang.php @@ -27,11 +27,12 @@ return ['Attribute' => [ 'Type' => 'Type', 'Unit' => 'Unit', 'Value' => 'Value', - '_INT' => 'INTEGER', - '_FLOAT_INT' => 'FLOAT_INT', - '_STRING' => 'STRING', - '_FLOAT' => 'FLOAT', - '_DATETIME' => 'DATETIME', + '_INT' => 'INTEGER', + '_FLOAT_INT' => 'FLOAT_INT', + '_STRING' => 'STRING', + '_FLOAT' => 'FLOAT', + '_DATETIME' => 'DATETIME', '_BOOL' => 'BOOL', - 'Defaults' => 'Defaults', + 'Defaults' => 'Defaults', + 'Localization' => 'Localization', ]]; diff --git a/tests/Models/AttributeValueTest.php b/tests/Models/AttributeValueTest.php index 9d01dde..3c36ec8 100644 --- a/tests/Models/AttributeValueTest.php +++ b/tests/Models/AttributeValueTest.php @@ -76,11 +76,11 @@ final class AttributeValueTest extends \PHPUnit\Framework\TestCase $value = new AttributeValue(); self::assertEquals( [ - 'id' => 0, - 'valueInt' => null, - 'valueStr' => null, - 'valueDec' => null, - 'valueDat' => null, + 'id' => 0, + 'valueInt' => null, + 'valueStr' => null, + 'valueDec' => null, + 'valueDat' => null, 'isDefault' => false, ], $value->toArray() @@ -92,11 +92,11 @@ final class AttributeValueTest extends \PHPUnit\Framework\TestCase $value = new AttributeValue(); self::assertEquals( [ - 'id' => 0, - 'valueInt' => null, - 'valueStr' => null, - 'valueDec' => null, - 'valueDat' => null, + 'id' => 0, + 'valueInt' => null, + 'valueStr' => null, + 'valueDec' => null, + 'valueDat' => null, 'isDefault' => false, ], $value->jsonSerialize()