- Worked th error layout

- Added some picto for the error views
- Bugfixes
This commit is contained in:
Dave Mc Nicoll committed 2021-08-27 18:06:15 +00:00
1 parent 421024f260
commit fd693fc8fc
15 files changed
+101 -18

No files matched your search

+10 -4
View File
@@ -10,7 +10,7 @@ use Picea,
use Psr\Http\Message\ServerRequestInterface;
use Storage\Session;
use Laminas\Diactoros\Response\{ HtmlResponse, TextResponse, RedirectResponse, JsonResponse };
use Laminas\Diactoros\Response\{ HtmlResponse, TextResponse, RedirectResponse, JsonResponse, EmptyResponse };
use Ulmus\EntityCollection;
@@ -21,12 +21,13 @@ use TheBugs\Email\MailerInterface;
use Notes\Route\Annotation\Object\Route as RouteParam,
Notes\Route\Annotation\Method\Route,
Notes\Security\Annotation\Security,
Notes\Security\Annotation\Taxus,
Notes\Tell\Annotation\Language;
use function file_get_contents;
/**
* @Security("locked" => false)
* @Security("locked" => true)
* @RouteParam("methods" => [ "GET", "POST", "DELETE" ])
*/
trait ControllerTrait {
@@ -68,9 +69,9 @@ trait ControllerTrait {
return new RedirectResponse($url, $code, $headers);
}
public function renderPdf($rawdata, int $status = 200, array $headers = []) : PdfResponse
public static function renderNothing(int $code = 204, array $headers = []) : ResponseInterface
{
return new PdfResponse($rawdata, $status, $headers);
return new EmptyResponse($code, $headers);
}
public static function renderText(string $text, int $code = 200, array $headers = []) : ResponseInterface
@@ -88,6 +89,11 @@ trait ControllerTrait {
return new JsonResponse($data, $code, $headers);
}
public function renderPdf($rawdata, int $status = 200, array $headers = []) : PdfResponse
{
return new PdfResponse($rawdata, $status, $headers);
}
public static function renderDownloadable(string $data, string $filename, int $code = 200, array $headers = []) : ResponseInterface
{
return new DownloadResponse($data, $filename, $code, $headers);