Same to paged articles.

This commit is contained in:
Relintai 2022-02-14 23:20:47 +01:00
parent 809de8a01c
commit 642c39552f
6 changed files with 38 additions and 8 deletions

View File

@ -29,8 +29,7 @@ void PagedArticle::handle_request_main(Request *request) {
if (rp == "") {
render_menu(request);
// summary page
request->body += index_page;
render(request);
request->compile_and_send_body();
return;
@ -49,6 +48,14 @@ void PagedArticle::handle_request_main(Request *request) {
request->compile_and_send_body();
}
void PagedArticle::render(Request *request) {
// summary page
request->body += index_page;
}
void PagedArticle::render_preview(Request *request) {
}
void PagedArticle::load() {
ERR_FAIL_COND_MSG(articles_folder == "", "Error: PagedArticle::load called, but a articles_folder is not set!");

View File

@ -1,9 +1,9 @@
#ifndef PAGED_ARTICLE_H
#define PAGED_ARTICLE_H
#include <map>
#include "core/containers/vector.h"
#include "core/string.h"
#include <map>
#include "web/file_cache.h"
#include "web/http/web_node.h"
@ -16,6 +16,9 @@ class PagedArticle : public WebNode {
public:
void handle_request_main(Request *request);
void render(Request *request);
void render_preview(Request *request);
void load();
void load_folder(const String &folder, const String &path);
String get_index_page();

View File

@ -3,20 +3,26 @@
#include "web/html/html_builder.h"
#include "core/os/directory.h"
#include "web/html/utils.h"
#include "paged_article.h"
#include "web/html/utils.h"
#include <iostream>
void PagedArticles::_handle_request_main(Request *request) {
render_menu(request);
// summary page
request->body += index_page;
render(request);
request->compile_and_send_body();
}
void PagedArticles::render(Request *request) {
// summary page
request->body += index_page;
}
void PagedArticles::render_preview(Request *request) {
}
void PagedArticles::load() {
ERR_FAIL_COND_MSG(folder == "", "Error: PagedArticles::load called, but a folder is not set!");

View File

@ -17,6 +17,9 @@ class PagedArticles : public WebNode {
public:
void _handle_request_main(Request *request);
void render(Request *request);
void render_preview(Request *request);
void load();
void generate_index_page();

View File

@ -1,8 +1,8 @@
#include "paged_articles_md_index.h"
#include "web/html/html_builder.h"
#include "web/http/request.h"
#include "web/http/web_permission.h"
#include "web/html/html_builder.h"
void PagedArticlesMDIndex::handle_request_main(Request *request) {
if (_web_permission.is_valid()) {
@ -21,6 +21,14 @@ void PagedArticlesMDIndex::handle_request_main(Request *request) {
articles->handle_request_main(request);
}
void PagedArticlesMDIndex::render(Request *request) {
main_page->render(request);
}
void PagedArticlesMDIndex::render_preview(Request *request) {
main_page->render_preview(request);
}
void PagedArticlesMDIndex::load() {
main_page->folder = folder;
main_page->load();

View File

@ -17,6 +17,9 @@ class PagedArticlesMDIndex : public WebNode {
public:
void handle_request_main(Request *request);
void render(Request *request);
void render_preview(Request *request);
void load();
PagedArticlesMDIndex();