diff --git a/EMS/admin-ui-bundle/src/Resources/views/bootstrap5/ajax/extract-data-file.json.twig b/EMS/admin-ui-bundle/src/Resources/views/bootstrap5/ajax/extract-data-file.json.twig deleted file mode 100644 index 75ce8b258..000000000 --- a/EMS/admin-ui-bundle/src/Resources/views/bootstrap5/ajax/extract-data-file.json.twig +++ /dev/null @@ -1,9 +0,0 @@ -{% extends '@EMSAdminUI/bootstrap5/ajax/notification.json.twig' %} - -{% block body %} - "content": {{ (data.content)|json_encode|raw }}, - "author": {{ data.author|json_encode|raw }}, - "date": {{ data.date|json_encode|raw }}, - "language": {{ data.locale|json_encode|raw }}, - "title": {{ data.title|json_encode|raw }}, -{% endblock %} \ No newline at end of file diff --git a/EMS/core-bundle/src/Controller/ContentManagement/FileController.php b/EMS/core-bundle/src/Controller/ContentManagement/FileController.php index c28079e36..129f933df 100644 --- a/EMS/core-bundle/src/Controller/ContentManagement/FileController.php +++ b/EMS/core-bundle/src/Controller/ContentManagement/FileController.php @@ -70,9 +70,13 @@ public function extractFileContent(Request $request, string $sha1, bool $forced throw new NotFoundHttpException(\sprintf('Asset %s not found', $sha1)); } - $response = $this->render("@$this->templateNamespace/ajax/extract-data-file.json.twig", [ + $response = $this->flashMessageLogger->buildJsonResponse([ 'success' => !$data->isEmpty(), - 'data' => $data, + 'content' => $data->getContent(), + 'author' => $data->getAuthor(), + 'date' => $data->getDate(), + 'language' => $data->getLocale(), + 'title' => $data->getTitle(), ]); $response->headers->set('Content-Type', 'application/json'); diff --git a/EMS/core-bundle/src/Resources/views/ajax/extract-data-file.json.twig b/EMS/core-bundle/src/Resources/views/ajax/extract-data-file.json.twig deleted file mode 100644 index 107ae203f..000000000 --- a/EMS/core-bundle/src/Resources/views/ajax/extract-data-file.json.twig +++ /dev/null @@ -1,9 +0,0 @@ -{% extends '@EMSCore/ajax/notification.json.twig' %} - -{% block body %} - "content": {{ (data.content)|json_encode|raw }}, - "author": {{ data.author|json_encode|raw }}, - "date": {{ data.date|json_encode|raw }}, - "language": {{ data.locale|json_encode|raw }}, - "title": {{ data.title|json_encode|raw }}, -{% endblock %} \ No newline at end of file