2022-08-25 01:51:27 +02:00
|
|
|
tool
|
|
|
|
extends "res://addons/web_pages/classes/WebPageEntry.gd"
|
|
|
|
class_name WebPageEntryTitleText, "res://addons/web_pages/icons/icon_web_page_entry_title_text.svg"
|
|
|
|
|
2022-08-25 15:09:54 +02:00
|
|
|
export(String) var text : String
|
2022-08-25 01:51:27 +02:00
|
|
|
export(int) var hsize : int = 1
|
2022-08-25 15:20:18 +02:00
|
|
|
|
2022-08-25 15:35:23 +02:00
|
|
|
func _render(request : WebServerRequest):
|
|
|
|
request.body += "<h1>" + text + "</h1>"
|
2022-08-25 15:20:18 +02:00
|
|
|
|
|
|
|
func get_page_entry_class_name() -> String:
|
|
|
|
return "WebPageEntryTitleText"
|
2022-08-25 16:05:45 +02:00
|
|
|
|
2022-08-25 20:56:13 +02:00
|
|
|
func _handle_edit(request : WebServerRequest) -> void:
|
|
|
|
if !request.can_edit():
|
|
|
|
#should be ERR_FAIL_COND
|
|
|
|
return
|
|
|
|
|
2022-08-25 21:06:37 +02:00
|
|
|
var b : HTMLBuilder = HTMLBuilder.new()
|
|
|
|
|
2022-08-25 20:56:13 +02:00
|
|
|
if request.get_method() == HTTPServerEnums.HTTP_METHOD_POST:
|
2022-08-25 21:06:37 +02:00
|
|
|
text = request.get_parameter("text")
|
|
|
|
|
|
|
|
#b.div().f().w("Save successful!").cdiv()
|
2022-08-25 21:18:07 +02:00
|
|
|
request.send_redirect(request.get_url_root_parent(2))
|
2022-08-25 20:56:13 +02:00
|
|
|
|
2022-08-25 21:06:37 +02:00
|
|
|
b.div().f().a(request.get_url_root_parent(2)).f().w("<-- back").ca().cdiv()
|
|
|
|
b.br()
|
|
|
|
|
|
|
|
b.h1().f().w("Editing: Title Text").ch1()
|
|
|
|
b.br()
|
|
|
|
|
|
|
|
b.form_post(request.get_url_root())
|
|
|
|
b.csrf_tokenr(request)
|
|
|
|
b.label().fora("text").f().w("Text: ").clabel()
|
|
|
|
b.input_text("text", text, "", "", "text")
|
|
|
|
b.input_submit("Save")
|
|
|
|
b.cform()
|
2022-08-25 20:56:13 +02:00
|
|
|
|
2022-08-25 21:06:37 +02:00
|
|
|
request.body += b.result
|
|
|
|
request.compile_and_send_body()
|
2022-08-26 11:17:35 +02:00
|
|
|
|
|
|
|
func _get_editor() -> Control:
|
|
|
|
var WebPageEntryTitleTextEditor : PackedScene = ResourceLoader.load("res://addons/web_pages/editor/post_entries/WebPageEntryTitleTextEditor.tscn", "PackedScene")
|
|
|
|
return WebPageEntryTitleTextEditor.instance() as Control
|