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 == "") { if (rp == "") {
render_menu(request); render_menu(request);
// summary page render(request);
request->body += index_page;
request->compile_and_send_body(); request->compile_and_send_body();
return; return;
@ -49,6 +48,14 @@ void PagedArticle::handle_request_main(Request *request) {
request->compile_and_send_body(); 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() { void PagedArticle::load() {
ERR_FAIL_COND_MSG(articles_folder == "", "Error: PagedArticle::load called, but a articles_folder is not set!"); 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 #ifndef PAGED_ARTICLE_H
#define PAGED_ARTICLE_H #define PAGED_ARTICLE_H
#include <map>
#include "core/containers/vector.h" #include "core/containers/vector.h"
#include "core/string.h" #include "core/string.h"
#include <map>
#include "web/file_cache.h" #include "web/file_cache.h"
#include "web/http/web_node.h" #include "web/http/web_node.h"
@ -16,6 +16,9 @@ class PagedArticle : public WebNode {
public: public:
void handle_request_main(Request *request); void handle_request_main(Request *request);
void render(Request *request);
void render_preview(Request *request);
void load(); void load();
void load_folder(const String &folder, const String &path); void load_folder(const String &folder, const String &path);
String get_index_page(); String get_index_page();

View File

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

View File

@ -9,7 +9,7 @@
#include "web/http/request.h" #include "web/http/request.h"
//todo pagination // todo pagination
class PagedArticles : public WebNode { class PagedArticles : public WebNode {
RCPP_OBJECT(PagedArticles, WebNode); RCPP_OBJECT(PagedArticles, WebNode);
@ -17,6 +17,9 @@ class PagedArticles : public WebNode {
public: public:
void _handle_request_main(Request *request); void _handle_request_main(Request *request);
void render(Request *request);
void render_preview(Request *request);
void load(); void load();
void generate_index_page(); void generate_index_page();

View File

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

View File

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