handlers: HandlerPageEdit: Use RevisionRenderer
This commit is contained in:
parent
ecd45a61c8
commit
d18c0669ce
@ -23,6 +23,7 @@ SOFTWARE.
|
|||||||
#include "../request.h"
|
#include "../request.h"
|
||||||
|
|
||||||
#include "../parser.h"
|
#include "../parser.h"
|
||||||
|
#include "../revisionrenderer.h"
|
||||||
bool HandlerPageEdit::canAccess([[maybe_unused]] std::string page)
|
bool HandlerPageEdit::canAccess([[maybe_unused]] std::string page)
|
||||||
{
|
{
|
||||||
return effectivePermissions(page).canEdit();
|
return effectivePermissions(page).canEdit();
|
||||||
@ -115,12 +116,16 @@ Response HandlerPageEdit::handleRequest(PageDao &pageDao, std::string pagename,
|
|||||||
{
|
{
|
||||||
std::string newContent = r.post("content");
|
std::string newContent = r.post("content");
|
||||||
Parser parser;
|
Parser parser;
|
||||||
|
std::string title = parser.extractCommand("pagetitle", newContent);
|
||||||
TemplatePage templatePage = this->templ->getPage("page_creation_preview");
|
TemplatePage templatePage = this->templ->getPage("page_creation_preview");
|
||||||
templatePage.setVar("actionurl", urlProvider->editPage(pagename));
|
templatePage.setVar("actionurl", urlProvider->editPage(pagename));
|
||||||
templatePage.setVar("preview_content", parser.parse(pageDao, *this->urlProvider, newContent));
|
|
||||||
|
RevisionRenderer revisionRenderer { *this->templ, *this->database, *this->urlProvider };
|
||||||
|
|
||||||
|
templatePage.setVar("preview_content", revisionRenderer.renderContent(newContent));
|
||||||
templatePage.setVar("content", newContent);
|
templatePage.setVar("content", newContent);
|
||||||
setPageVars(templatePage, pagename);
|
setPageVars(templatePage, pagename);
|
||||||
templatePage.setVar("title", createPageTitle("Preview: " + pagename));
|
templatePage.setVar("title", createPageTitle("Preview: " + title));
|
||||||
templatePage.setVar("comment", r.post("comment"));
|
templatePage.setVar("comment", r.post("comment"));
|
||||||
Response response;
|
Response response;
|
||||||
response.setBody(templatePage.render());
|
response.setBody(templatePage.render());
|
||||||
|
Caricamento…
Fai riferimento in un nuovo problema
Block a user