This commit is contained in:
Dennis Eichhorn 2023-10-09 22:06:39 +00:00
parent 491140ca36
commit 91673a9717
5 changed files with 28 additions and 12 deletions

View File

@ -351,7 +351,7 @@ final class ApiController extends Controller
$internalResponse = new HttpResponse();
$this->app->moduleManager->get('Tag')->apiTagCreate($request, $internalResponse);
if (!\is_array($data = $internalResponse->get($request->uri->__toString()))) {
if (!\is_array($data = $internalResponse->getDataArray($request->uri->__toString()))) {
continue;
}

View File

@ -21,6 +21,7 @@ use Modules\News\Models\NewsSeenMapper;
use Modules\News\Models\NewsStatus;
use Modules\News\Models\PermissionCategory;
use phpOMS\Account\PermissionType;
use phpOMS\Asset\AssetType;
use phpOMS\Contract\RenderableInterface;
use phpOMS\Message\Http\RequestStatusCode;
use phpOMS\Message\RequestAbstract;
@ -204,6 +205,9 @@ final class BackendController extends Controller implements DashboardElementInte
if (!$article->comments !== null
&& $this->app->moduleManager->get('Comments')::ID > 0
) {
$head = $response->data['Content']->head;
$head->addAsset(AssetType::CSS, 'Modules/Comments/Theme/Backend/css/styles.css');
$commentCreateView = new \Modules\Comments\Theme\Backend\Components\Comment\CreateView($this->app->l11nManager, $request, $response);
$commentListView = new \Modules\Comments\Theme\Backend\Components\Comment\ListView($this->app->l11nManager, $request, $response);

View File

@ -89,7 +89,9 @@ echo $this->data['nav']->render(); ?>
<tr tabindex="0" data-href="<?= $url; ?>">
<td><span class="tag"><?= $this->getHtml('TYPE' . $news->getType()); ?></span></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($news->title); ?></a>
<td><a class="content" href="<?= UriFactory::build('{/base}/profile/single?{?}&for=' . $news->createdBy->id); ?>"><?= $this->printHtml($news->createdBy->name2 . ', ' . $news->createdBy->name1); ?></a>
<td><a class="content" href="<?= UriFactory::build('{/base}/profile/single?{?}&for=' . $news->createdBy->id); ?>">
<?= $this->printHtml($news->createdBy->name2 . ', ' . $news->createdBy->name1); ?>
</a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($news->publish->format('Y-m-d')); ?></a>
<?php endforeach; ?>
<?php if ($count === 0) : ?>

View File

@ -33,7 +33,17 @@ echo $this->data['nav']->render(); ?>
<section class="portlet">
<div class="portlet-body">
<article>
<h1><?= $this->printHtml($news->title); ?><span class="floatRight"><a href="<?= $profile; ?>"><?= $this->printHtml($this->renderUserName('%3$s %2$s %1$s', [$news->createdBy->name1, $news->createdBy->name2, $news->createdBy->name3, $news->createdBy->login ?? ''])); ?></a> - <?= $news->publish->format('Y-m-d'); ?></span></h1>
<h1>
<span class="floatRight">
<a href="<?= $profile; ?>">
<?= $this->printHtml($this->renderUserName(
'%3$s %2$s %1$s',
[$news->createdBy->name1, $news->createdBy->name2, $news->createdBy->name3, $news->createdBy->login ?? '']
)); ?>
</a> - <?= $news->publish->format('Y-m-d'); ?>
</span><?= $this->printHtml($news->title); ?>
</h1>
<?= $news->content; ?>
</article>
<div>
@ -62,4 +72,4 @@ if (!empty($commentList) && $commentList->status !== CommentListStatus::INACTIVE
/* @todo: check if user has permission to create a comment here, maybe he is only allowed to read comments */
echo $this->getData('commentCreate')->render(1);
echo $this->getData('commentList')->render($commentList);
endif; ?>
endif;

View File

@ -64,8 +64,8 @@ trait ApiControllerNewsArticleTrait
$this->module->apiNewsCreate($request, $response);
self::assertEquals('Controller Test Title', $response->get('')['response']->title);
self::assertGreaterThan(0, $response->get('')['response']->id);
self::assertEquals('Controller Test Title', $response->getDataArray('')['response']->title);
self::assertGreaterThan(0, $response->getDataArray('')['response']->id);
}
/**
@ -99,7 +99,7 @@ trait ApiControllerNewsArticleTrait
$this->module->apiNewsGet($request, $response);
self::assertGreaterThan(0, $response->get('')['response']->id);
self::assertGreaterThan(0, $response->getDataArray('')['response']->id);
}
/**
@ -120,7 +120,7 @@ trait ApiControllerNewsArticleTrait
$this->module->apiNewsUpdate($request, $response);
$this->module->apiNewsGet($request, $response);
self::assertEquals('New Title', $response->get('')['response']->title);
self::assertEquals('New Title', $response->getDataArray('')['response']->title);
}
/**
@ -137,7 +137,7 @@ trait ApiControllerNewsArticleTrait
$request->setData('id', 1);
$this->module->apiNewsDelete($request, $response);
self::assertEquals(1, $response->get('')['response']->id);
self::assertEquals(1, $response->getDataArray('')['response']->id);
self::assertInstanceOf(NullNewsArticle::class, NewsArticleMapper::get()->where('id', 1)->execute());
}
}