Handle the "new" segment. Started work on admin_render_building.

This commit is contained in:
Relintai 2021-11-16 17:00:58 +01:00
parent da02282ef0
commit fc4f384170
3 changed files with 18 additions and 2 deletions

2
HEADS
View File

@ -1 +1 @@
{"engine": {"master": "9b78fb066e5c22c8b173609aaa0f06e50ab3fb3f"}}
{"engine": {"master": "b8b2d5a3a6ce3556ee465290260ce0a902e1a40a"}}

View File

@ -7,7 +7,6 @@
#include "core/http/request.h"
#include "core/http/session_manager.h"
#include "building_model.h"
#include "building_model.h"
void BuildingController::handle_request_default(Request *request) {
@ -19,6 +18,9 @@ void BuildingController::admin_handle_request_main(Request *request) {
if (seg == "") {
admin_render_building_list(request);
return;
} else if (seg == "new") {
admin_render_building(request, Ref<Building>());
return;
}
request->send_error(404);
@ -74,6 +76,19 @@ void BuildingController::admin_render_building_list(Request *request) {
request->body += b.result;
}
void BuildingController::admin_render_building(Request *request, Ref<Building> building) {
Vector<Ref<Building> > buildings = BuildingModel::get_singleton()->get_all();
HTMLBuilder b;
b.div("back")->f()->fa(request->get_url_root_parent(), "<--- Back")->cdiv();
b.br();
b.fdiv("top_menu", "Building Editor");
b.br();
b.div("top_menu")->f()->fa(request->get_url_root("new"), "Create New")->cdiv();
b.br();
}
void BuildingController::migrate() {
BuildingModel::get_singleton()->migrate();
}

View File

@ -23,6 +23,7 @@ public:
bool admin_full_render();
void admin_render_building_list(Request *request);
void admin_render_building(Request *request, Ref<Building> building);
void migrate();
virtual void add_default_data();