l11n, unit/app and simplification fixes

This commit is contained in:
Dennis Eichhorn 2023-01-07 19:00:32 +01:00
parent ce530f6d9b
commit 67424ec6cf
7 changed files with 23 additions and 13 deletions

View File

@ -19,9 +19,7 @@
"name": "organization_unit_image", "name": "organization_unit_image",
"type": "INT", "type": "INT",
"default": null, "default": null,
"null": true, "null": true
"foreignTable": "media",
"foreignKey": "media_id"
}, },
"organization_unit_description": { "organization_unit_description": {
"name": "organization_unit_description", "name": "organization_unit_description",

View File

@ -56,7 +56,10 @@ final class BackendController extends Controller
$view->setTemplate('/Modules/Organization/Theme/Backend/unit-list'); $view->setTemplate('/Modules/Organization/Theme/Backend/unit-list');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1004703001, $request, $response)); $view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1004703001, $request, $response));
$mapper = UnitMapper::getAll()->with('parent')->with('image')->limit(25); $mapper = UnitMapper::getAll()
->with('parent')
->with('image')
->limit(25);
if ($request->getData('ptype') === 'p') { if ($request->getData('ptype') === 'p') {
$view->setData('units', $mapper->where('id', (int) ($request->getData('id') ?? 0), '<')->execute()); $view->setData('units', $mapper->where('id', (int) ($request->getData('id') ?? 0), '<')->execute());
@ -90,7 +93,14 @@ final class BackendController extends Controller
$selectorView = new \Modules\Organization\Theme\Backend\Components\UnitTagSelector\UnitTagSelectorView($this->app->l11nManager, $request, $response); $selectorView = new \Modules\Organization\Theme\Backend\Components\UnitTagSelector\UnitTagSelectorView($this->app->l11nManager, $request, $response);
$view->addData('unit-selector', $selectorView); $view->addData('unit-selector', $selectorView);
$view->addData('unit', UnitMapper::get()->with('parent')->with('image')->where('id', (int) $request->getData('id'))->execute());
$unit = UnitMapper::get()
->with('parent')
->with('image')
->where('id', (int) $request->getData('id'))
->execute();
$view->addData('unit', $unit);
$editor = new \Modules\Editor\Theme\Backend\Components\Editor\BaseView($this->app->l11nManager, $request, $response); $editor = new \Modules\Editor\Theme\Backend\Components\Editor\BaseView($this->app->l11nManager, $request, $response);
$view->addData('editor', $editor); $view->addData('editor', $editor);

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

View File

@ -28,7 +28,8 @@ echo $this->getData('nav')->render(); ?>
<tr><td><label for="iName"><?= $this->getHtml('Name'); ?></label> <tr><td><label for="iName"><?= $this->getHtml('Name'); ?></label>
<tr><td><input type="text" name="name" id="iName" placeholder="&#xf040; Karaka" required> <tr><td><input type="text" name="name" id="iName" placeholder="&#xf040; Karaka" required>
<tr><td><label for="iParent"><?= $this->getHtml('UnitLogo'); ?></label> <tr><td><label for="iParent"><?= $this->getHtml('UnitLogo'); ?></label>
<tr><td><img id="preview-logo" class="preview" src="#" accept="image/*" alt="<?= $this->getHtml('UnitLogo'); ?>"> <tr><td><img id="preview-logo" alt="<?= $this->getHtml('Logo'); ?>"
itemprop="logo" loading="lazy" width="40x" class="preview" src="<?= UriFactory::build('Modules/Organization/Theme/Backend/img/org_default.png'); ?>" accept="image/*">
<tr><td><?= $this->getData('media-preview-upload')->render('fUnitCreate', 'logo', '/Modules/Organization'); ?> <tr><td><?= $this->getData('media-preview-upload')->render('fUnitCreate', 'logo', '/Modules/Organization'); ?>
<tr><td><label for="iParent"><?= $this->getHtml('Parent'); ?></label> <tr><td><label for="iParent"><?= $this->getHtml('Parent'); ?></label>
<tr><td><?= $this->getData('unit-selector')->render('iParent', 'parent', false); ?> <tr><td><?= $this->getData('unit-selector')->render('iParent', 'parent', false); ?>

View File

@ -88,8 +88,8 @@ echo $this->getData('nav')->render(); ?>
<tr tabindex="0" data-href="<?= $url; ?>"> <tr tabindex="0" data-href="<?= $url; ?>">
<td data-label="<?= $this->getHtml('ID', '0', '0'); ?>"><a href="<?= $url; ?>"><?= $value->getId(); ?></a> <td data-label="<?= $this->getHtml('ID', '0', '0'); ?>"><a href="<?= $url; ?>"><?= $value->getId(); ?></a>
<td><a href="<?= $url; ?>"><img alt="<?= $this->getHtml('IMG_alt_profile'); ?>" class="profile-image" src="<?= $value->image instanceof NullMedia ? <td><a href="<?= $url; ?>"><img alt="<?= $this->getHtml('IMG_alt_profile'); ?>" class="profile-image" src="<?= $value->image instanceof NullMedia ?
UriFactory::build('Web/Backend/img/user_default_' . \mt_rand(1, 6) .'.png') : UriFactory::build('Modules/Organization/Theme/Backend/img/org_default.png') :
UriFactory::build('{/lang}/{/app}/' . $value->image->getPath()); ?>"></a> UriFactory::build($value->image->getPath()); ?>"></a>
<td data-label="<?= $this->getHtml('Name'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->name); ?></a> <td data-label="<?= $this->getHtml('Name'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->name); ?></a>
<td data-label="<?= $this->getHtml('Parent'); ?>"><a class="content" href="<?= UriFactory::build('{/lang}/{/app}/organization/unit/profile?{?}&id=' . $value->parent->getId()); ?>"><?= $this->printHtml($value->parent->name); ?></a> <td data-label="<?= $this->getHtml('Parent'); ?>"><a class="content" href="<?= UriFactory::build('{/lang}/{/app}/organization/unit/profile?{?}&id=' . $value->parent->getId()); ?>"><?= $this->printHtml($value->parent->name); ?></a>
<?php endforeach; ?> <?php endforeach; ?>

View File

@ -38,8 +38,8 @@ echo $this->getData('nav')->render(); ?>
itemprop="logo" loading="lazy" itemprop="logo" loading="lazy"
src="<?= src="<?=
$unit->image instanceof NullMedia ? $unit->image instanceof NullMedia ?
UriFactory::build('Web/Backend/img/user_default_' . \mt_rand(1, 6) .'.png') : UriFactory::build('Modules/Organization/Theme/Backend/img/org_default.png') :
UriFactory::build('{/lang}/{/app}/' . $unit->image->getPath()); ?>" UriFactory::build($unit->image->getPath()); ?>"
width="40x"> width="40x">
</a> </a>
</div> </div>

View File

@ -16,10 +16,11 @@
}, },
"description": "The business module.", "description": "The business module.",
"directory": "Organization", "directory": "Organization",
"asset-dependencies": {
"Modules/Editor": "*"
},
"dependencies": { "dependencies": {
"Admin": "1.0.0", "Admin": "1.0.0"
"Editor": "1.0.0",
"Media": "1.0.0"
}, },
"providing": { "providing": {
"Navigation": "*", "Navigation": "*",