mirror of
https://github.com/Relintai/rcpp_framework.git
synced 2024-11-10 00:52:11 +01:00
Added more helper methods to WebNode. Also a render_menu() virtual.
This commit is contained in:
parent
bde46b20cd
commit
127219fe34
@ -4,8 +4,8 @@
|
||||
#include "http_enums.h"
|
||||
#include "request.h"
|
||||
|
||||
#include "core/settings/settings.h"
|
||||
#include "core/http/web_server.h"
|
||||
#include "core/settings/settings.h"
|
||||
|
||||
#ifdef DATABASES_ENABLED
|
||||
#include "core/database/database.h"
|
||||
@ -85,6 +85,16 @@ void WebNode::handle_error_send_request(Request *request, const int error_code)
|
||||
request->send();
|
||||
}
|
||||
|
||||
void WebNode::render_menu(Request *request) {
|
||||
WebNode *root = get_root();
|
||||
|
||||
if (root) {
|
||||
root->_render_menu(request);
|
||||
}
|
||||
}
|
||||
void WebNode::_render_menu(Request *request) {
|
||||
}
|
||||
|
||||
void WebNode::create_validators() {
|
||||
}
|
||||
|
||||
@ -105,6 +115,16 @@ WebServer *WebNode::get_server() {
|
||||
return Object::cast_to<WebServer>(get_tree());
|
||||
}
|
||||
|
||||
WebNode *WebNode::get_root() {
|
||||
WebServer *s = get_server();
|
||||
|
||||
if (!s) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return s->get_web_root();
|
||||
}
|
||||
|
||||
WebNode::WebNode() :
|
||||
Node() {
|
||||
// should look this up in parents when parented (and node parenting is implemented)
|
||||
|
@ -35,6 +35,8 @@ public:
|
||||
virtual void handle_request_main(Request *request);
|
||||
virtual void _handle_request_main(Request *request);
|
||||
virtual void handle_error_send_request(Request *request, const int error_code);
|
||||
virtual void render_menu(Request *request);
|
||||
virtual void _render_menu(Request *request);
|
||||
|
||||
virtual void create_validators();
|
||||
|
||||
@ -44,6 +46,7 @@ public:
|
||||
virtual void create_default_entries();
|
||||
|
||||
WebServer *get_server();
|
||||
WebNode *get_root();
|
||||
|
||||
WebNode();
|
||||
~WebNode();
|
||||
|
@ -32,6 +32,7 @@ void AdminPanel::handle_request_main(Request *request) {
|
||||
return;
|
||||
}
|
||||
|
||||
//render_menu(request);
|
||||
render_headers(request);
|
||||
render_segment_body_top(request);
|
||||
render_controller_panel(request, c);
|
||||
|
Loading…
Reference in New Issue
Block a user