mirror of
https://github.com/Relintai/pandemonium_cms.git
synced 2024-11-14 09:37:19 +01:00
Added web editor for WebPageEntryText.
This commit is contained in:
parent
14d4514be0
commit
92bc494059
@ -16,6 +16,38 @@ func set_text(t : String) -> void:
|
|||||||
func _render(request : WebServerRequest):
|
func _render(request : WebServerRequest):
|
||||||
request.body += compiled_text
|
request.body += compiled_text
|
||||||
|
|
||||||
|
func _handle_edit(request : WebServerRequest) -> void:
|
||||||
|
if !request.can_edit():
|
||||||
|
#should be ERR_FAIL_COND
|
||||||
|
return
|
||||||
|
|
||||||
|
var b : HTMLBuilder = HTMLBuilder.new()
|
||||||
|
|
||||||
|
if request.get_method() == HTTPServerEnums.HTTP_METHOD_POST:
|
||||||
|
set_text(request.get_parameter("text"))
|
||||||
|
|
||||||
|
#b.div().f().w("Save successful!").cdiv()
|
||||||
|
request.send_redirect(request.get_url_root_parent(2))
|
||||||
|
|
||||||
|
b.div().f().a(request.get_url_root_parent(2)).f().w("<-- back").ca().cdiv()
|
||||||
|
b.br()
|
||||||
|
|
||||||
|
b.h1().f().w("Editing: Text").ch1()
|
||||||
|
b.br()
|
||||||
|
|
||||||
|
b.form_post(request.get_url_root())
|
||||||
|
b.csrf_tokenr(request)
|
||||||
|
b.label().fora("text").f().w("Text: ").clabel().br()
|
||||||
|
b.textarea("text", "", "text").rows("50").cols("80").f().w(text).ctextarea()
|
||||||
|
b.br()
|
||||||
|
b.input_submit("Save")
|
||||||
|
b.cform()
|
||||||
|
b.br()
|
||||||
|
b.br()
|
||||||
|
|
||||||
|
request.body += b.result
|
||||||
|
request.compile_and_send_body()
|
||||||
|
|
||||||
func _get_editor() -> Control:
|
func _get_editor() -> Control:
|
||||||
var WebPageEntryTextEditor : PackedScene = ResourceLoader.load("res://addons/web_pages/editor/post_entries/WebPageEntryTextEditor.tscn", "PackedScene")
|
var WebPageEntryTextEditor : PackedScene = ResourceLoader.load("res://addons/web_pages/editor/post_entries/WebPageEntryTextEditor.tscn", "PackedScene")
|
||||||
return WebPageEntryTextEditor.instance() as Control
|
return WebPageEntryTextEditor.instance() as Control
|
||||||
|
Loading…
Reference in New Issue
Block a user