From d9d4ffbecfb900e4ae967b059137bee0295130d9 Mon Sep 17 00:00:00 2001 From: Ramon Gutierrez Date: Sat, 27 Apr 2024 01:44:39 +0800 Subject: [PATCH 01/27] Add static content endpoint for customer app #799 --- config/routes/apiv2.yaml | 8 ++++- .../StaticContentController.php | 34 +++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 src/Controller/CustomerAppAPI/StaticContentController.php diff --git a/config/routes/apiv2.yaml b/config/routes/apiv2.yaml index dc603c9f..4041b372 100644 --- a/config/routes/apiv2.yaml +++ b/config/routes/apiv2.yaml @@ -312,4 +312,10 @@ apiv2_insurance_premiums_banner: apiv2_insurance_body_types: path: /apiv2/insurance/body_types controller: App\Controller\CustomerAppAPI\InsuranceController::getBodyTypes - methods: [GET] \ No newline at end of file + methods: [GET] + +# static content +apiv2_static_content: + path: /apiv2/static_content/{id} + controller: App\Controller\CustomerAppAPI\StaticContentController::getContent + methods: [GET] diff --git a/src/Controller/CustomerAppAPI/StaticContentController.php b/src/Controller/CustomerAppAPI/StaticContentController.php new file mode 100644 index 00000000..868eea40 --- /dev/null +++ b/src/Controller/CustomerAppAPI/StaticContentController.php @@ -0,0 +1,34 @@ +validateRequest($req); + + if (!$validity['is_valid']) { + return new ApiResponse(false, $validity['error']); + } + + // get content + $content = $this->em->getRepository(Staticcontent::class)->find($id); + + // check if it exists + if ($content == null) { + return new ApiResponse(false, 'Requested content does not exist.'); + } + + // response + return new ApiResponse(true, '', [ + 'content' => $content->content, + ]); + } +} From c9cb6e8b53ecb7e9147481aa512f4bff4eee1cda Mon Sep 17 00:00:00 2001 From: Ramon Gutierrez Date: Sat, 27 Apr 2024 01:45:25 +0800 Subject: [PATCH 02/27] Add markdown support to static content form view #799 --- templates/static-content/form.html.twig | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/templates/static-content/form.html.twig b/templates/static-content/form.html.twig index dece1005..3f078773 100644 --- a/templates/static-content/form.html.twig +++ b/templates/static-content/form.html.twig @@ -48,7 +48,7 @@ - + @@ -70,8 +70,19 @@ {% endblock %} +{% block stylesheets %} + +{% endblock %} + {% block scripts %} +