mirror of
https://github.com/Relintai/pandemonium_cms.git
synced 2024-11-20 10:07:17 +01:00
Implement rendering for page entries.
This commit is contained in:
parent
1527cdb480
commit
f6da7c1f12
@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=8 format=2]
|
||||
[gd_scene load_steps=7 format=2]
|
||||
|
||||
[ext_resource path="res://Main.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/web_pages/classes/WebPage.gd" type="Script" id=2]
|
||||
@ -9,11 +9,6 @@ script = ExtResource( 3 )
|
||||
text = "asdasdasd"
|
||||
hsize = 1
|
||||
|
||||
[sub_resource type="Resource" id=4]
|
||||
script = ExtResource( 3 )
|
||||
text = "rerer"
|
||||
hsize = 1
|
||||
|
||||
[sub_resource type="Resource" id=3]
|
||||
script = ExtResource( 3 )
|
||||
text = "rtrtrtrttrtA"
|
||||
@ -31,9 +26,9 @@ script = ExtResource( 1 )
|
||||
|
||||
[node name="index" type="StaticWebPage" parent="WebRoot"]
|
||||
uri_segment = "/"
|
||||
data = "<a href=\"/blog\">Blog</a>"
|
||||
data = "<a href=\"/page\">Page</a>"
|
||||
|
||||
[node name="Asdasd" type="WebNode" parent="WebRoot"]
|
||||
uri_segment = "asda"
|
||||
[node name="page" type="WebNode" parent="WebRoot"]
|
||||
uri_segment = "page"
|
||||
script = ExtResource( 2 )
|
||||
entries = [ SubResource( 1 ), SubResource( 4 ), SubResource( 3 ), SubResource( 2 ) ]
|
||||
entries = [ SubResource( 1 ), SubResource( 3 ), SubResource( 2 ) ]
|
||||
|
@ -2,10 +2,24 @@ tool
|
||||
extends WebNode
|
||||
class_name WebPage, "res://addons/web_pages/icons/icon_web_page.svg"
|
||||
|
||||
export(bool) var sohuld_render_menu : bool = true
|
||||
|
||||
export(Array, Resource) var entries : Array
|
||||
|
||||
signal entries_changed()
|
||||
|
||||
func _handle_request(request : WebServerRequest):
|
||||
if sohuld_render_menu:
|
||||
render_menu(request)
|
||||
|
||||
for i in range(entries.size()):
|
||||
var e : WebPageEntry = entries[i]
|
||||
|
||||
if e:
|
||||
e.render(request)
|
||||
|
||||
request.compile_and_send_body()
|
||||
|
||||
func add_entry(var entry : WebPageEntry, var after : WebPageEntry = null) -> void:
|
||||
if after != null:
|
||||
for i in range(entries.size()):
|
||||
|
@ -2,7 +2,11 @@ tool
|
||||
extends Resource
|
||||
class_name WebPageEntry, "res://addons/web_pages/icons/icon_web_page_entry.svg"
|
||||
|
||||
|
||||
func render(request : WebServerRequest):
|
||||
_render(request)
|
||||
|
||||
func _render(request : WebServerRequest):
|
||||
pass
|
||||
|
||||
func get_page_entry_class_name() -> String:
|
||||
return "WebPageEntry"
|
||||
|
@ -5,6 +5,8 @@ class_name WebPageEntryTitleText, "res://addons/web_pages/icons/icon_web_page_en
|
||||
export(String) var text : String
|
||||
export(int) var hsize : int = 1
|
||||
|
||||
func _render(request : WebServerRequest):
|
||||
request.body += "<h1>" + text + "</h1>"
|
||||
|
||||
func get_page_entry_class_name() -> String:
|
||||
return "WebPageEntryTitleText"
|
||||
|
@ -62,7 +62,7 @@ size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="MainVB" type="VBoxContainer" parent="MC/EntriesContainer"]
|
||||
margin_right = 1010.0
|
||||
margin_right = 37.0
|
||||
margin_bottom = 24.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user