handlers: HandlerPageEdit: Use RevisionRenderer
Šī revīzija ir iekļauta:
vecāks
ecd45a61c8
revīzija
d18c0669ce
@ -23,6 +23,7 @@ SOFTWARE.
|
||||
#include "../request.h"
|
||||
|
||||
#include "../parser.h"
|
||||
#include "../revisionrenderer.h"
|
||||
bool HandlerPageEdit::canAccess([[maybe_unused]] std::string page)
|
||||
{
|
||||
return effectivePermissions(page).canEdit();
|
||||
@ -115,12 +116,16 @@ Response HandlerPageEdit::handleRequest(PageDao &pageDao, std::string pagename,
|
||||
{
|
||||
std::string newContent = r.post("content");
|
||||
Parser parser;
|
||||
std::string title = parser.extractCommand("pagetitle", newContent);
|
||||
TemplatePage templatePage = this->templ->getPage("page_creation_preview");
|
||||
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);
|
||||
setPageVars(templatePage, pagename);
|
||||
templatePage.setVar("title", createPageTitle("Preview: " + pagename));
|
||||
templatePage.setVar("title", createPageTitle("Preview: " + title));
|
||||
templatePage.setVar("comment", r.post("comment"));
|
||||
Response response;
|
||||
response.setBody(templatePage.render());
|
||||
|
Notiek ielāde…
Atsaukties uz šo jaunā problēmā
Block a user