This commit is contained in:
Dennis Eichhorn 2023-10-09 22:06:37 +00:00
parent 1fa7d96774
commit 46239c3ada
4 changed files with 24 additions and 16 deletions

View File

@ -18,10 +18,10 @@ use phpOMS\Uri\UriFactory;
<div class="row"> <div class="row">
<div class="col-xs-12"> <div class="col-xs-12">
<section class="portlet"> <section class="portlet">
<form id="commentCreate" method="PUT" action="<?= UriFactory::build('{/api}comment/list?id={!#commentCreate [name=comment]}&csrf={$CSRF}'); ?>"> <form id="commentCreate" class="Comments_create" method="PUT" action="<?= UriFactory::build('{/api}comment/list?id={!#commentCreate [name=comment]}&csrf={$CSRF}'); ?>">
<div class="portlet-head">Create Comment</div> <div class="portlet-head">Create Comment</div>
<div class="portlet-body"> <div class="portlet-body">
<textarea name="comment">For writing a new comment... of course this is just a placeholder</textarea> <textarea name="comment"></textarea>
</div> </div>
<div class="portlet-foot"><input type="submit" name="createButton" id="iCreateButton" value="<?= $this->getHtml('Create', '0', '0'); ?>"></div> <div class="portlet-foot"><input type="submit" name="createButton" id="iCreateButton" value="<?= $this->getHtml('Create', '0', '0'); ?>"></div>
</form> </form>

View File

@ -75,7 +75,12 @@ foreach ($comments as $comment) : ?>
<?php endforeach; ?> <?php endforeach; ?>
</div> </div>
<div class="portlet-foot"> <div class="portlet-foot">
<?= $this->printHtml($this->renderUserName('%3$s %2$s %1$s', [$comment->createdBy->name1, $comment->createdBy->name2, $comment->createdBy->name3, $comment->createdBy->login ?? ''])); ?> <a class="content" href="<?= UriFactory::build('profile/single?{?}&id=' . $comment->createdBy->id); ?>">
<?= $this->printHtml($this->renderUserName(
'%3$s %2$s %1$s',
[$comment->createdBy->name1, $comment->createdBy->name2, $comment->createdBy->name3, $comment->createdBy->login ?? '']
)); ?>
</a>
<span class="floatRight"><?= $comment->createdAt->format('Y-m-d H:i:s'); ?></span> <span class="floatRight"><?= $comment->createdAt->format('Y-m-d H:i:s'); ?></span>
</div> </div>
</section> </section>

View File

@ -0,0 +1,3 @@
.Comments_create textarea {
height: 150px;
}

View File

@ -105,7 +105,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
$request->header->account = 1; $request->header->account = 1;
$this->module->apiCommentListCreate($request, $response); $this->module->apiCommentListCreate($request, $response);
self::assertGreaterThan(0, $lId = $response->get('')['response']->id); self::assertGreaterThan(0, $lId = $response->getDataArray('')['response']->id);
$response = new HttpResponse(); $response = new HttpResponse();
$request = new HttpRequest(new HttpUri('')); $request = new HttpRequest(new HttpUri(''));
@ -118,10 +118,10 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
$request->setData('commentlist_status', '2'); $request->setData('commentlist_status', '2');
$this->module->apiCommentListUpdate($request, $response); $this->module->apiCommentListUpdate($request, $response);
self::assertTrue($response->get('')['response']->allowEdit); self::assertTrue($response->getDataArray('')['response']->allowEdit);
self::assertFalse($response->get('')['response']->allowVoting); self::assertFalse($response->getDataArray('')['response']->allowVoting);
self::assertTrue($response->get('')['response']->allowFiles); self::assertTrue($response->getDataArray('')['response']->allowFiles);
self::assertEquals(2, $response->get('')['response']->status); self::assertEquals(2, $response->getDataArray('')['response']->status);
} }
/** /**
@ -137,7 +137,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
$request->header->account = 1; $request->header->account = 1;
$this->module->apiCommentListCreate($request, $response); $this->module->apiCommentListCreate($request, $response);
self::assertGreaterThan(0, $lId = $response->get('')['response']->id); self::assertGreaterThan(0, $lId = $response->getDataArray('')['response']->id);
$response = new HttpResponse(); $response = new HttpResponse();
$request = new HttpRequest(new HttpUri('')); $request = new HttpRequest(new HttpUri(''));
@ -163,7 +163,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
$request->setData('media', \json_encode([1])); $request->setData('media', \json_encode([1]));
$this->module->apiCommentCreate($request, $response); $this->module->apiCommentCreate($request, $response);
self::assertGreaterThan(0, $cId = $response->get('')['response']->id); self::assertGreaterThan(0, $cId = $response->getDataArray('')['response']->id);
//read //read
$response = new HttpResponse(); $response = new HttpResponse();
@ -173,8 +173,8 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
$request->setData('id', $cId); $request->setData('id', $cId);
$this->module->apiCommentGet($request, $response); $this->module->apiCommentGet($request, $response);
self::assertEquals('', $response->get('')['response']->title); self::assertEquals('', $response->getDataArray('')['response']->title);
self::assertEquals('Some **text**.', $response->get('')['response']->contentRaw); self::assertEquals('Some **text**.', $response->getDataArray('')['response']->contentRaw);
// update // update
$response = new HttpResponse(); $response = new HttpResponse();
@ -186,8 +186,8 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
$request->setData('plain', 'New plain'); $request->setData('plain', 'New plain');
$this->module->apiCommentUpdate($request, $response); $this->module->apiCommentUpdate($request, $response);
self::assertEquals('New title', $response->get('')['response']->title); self::assertEquals('New title', $response->getDataArray('')['response']->title);
self::assertEquals('New plain', $response->get('')['response']->contentRaw); self::assertEquals('New plain', $response->getDataArray('')['response']->contentRaw);
} }
/** /**
@ -236,7 +236,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
$request->setData('type', '1'); $request->setData('type', '1');
$this->module->apiChangeCommentVote($request, $response); $this->module->apiChangeCommentVote($request, $response);
self::assertGreaterThan(0, $vId = $response->get('')['response']->id); self::assertGreaterThan(0, $vId = $response->getDataArray('')['response']->id);
$response = new HttpResponse(); $response = new HttpResponse();
$request = new HttpRequest(new HttpUri('')); $request = new HttpRequest(new HttpUri(''));
@ -246,6 +246,6 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
$request->setData('type', '-1'); $request->setData('type', '-1');
$this->module->apiChangeCommentVote($request, $response); $this->module->apiChangeCommentVote($request, $response);
self::assertEquals($vId, $response->get('')['response']->id); self::assertEquals($vId, $response->getDataArray('')['response']->id);
} }
} }