From 4152ce3abcd199ad4a839b93ba7ddd483b01a4fe Mon Sep 17 00:00:00 2001 From: totoro Date: Sun, 21 Feb 2021 01:53:05 +0900 Subject: [PATCH] add helper for redirect in WEB_Controller_Result. This helper allows to use the WEB_Action_Name in redirect instead of the Controller_Name and Controller_Action --- web/types/controllers_web_site.anubis | 13 +++++++++++++ web/widgets/button.anubis | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/web/types/controllers_web_site.anubis b/web/types/controllers_web_site.anubis index 7ec52a9..c09983b 100644 --- a/web/types/controllers_web_site.anubis +++ b/web/types/controllers_web_site.anubis @@ -7,6 +7,7 @@ */ read tools/printable_tree.anubis +read web_action_name.anubis transmit web_session.anubis transmit xlib/web/making_a_web_site.anubis @@ -64,6 +65,18 @@ public type WEB_Controller_Result: // ) . +public define WEB_Controller_Result + redirect + ( + WEB_Session _session, + WEB_Action_Name wan + )= + if wan is controller_action(controller, action) then + redirect(_session, controller, action) + else + redirect(_session, "", "") +. + public type WEB_Action: web_action( WEB_Action_Name name, // name of action diff --git a/web/widgets/button.anubis b/web/widgets/button.anubis index ec89be6..6c8275a 100644 --- a/web/widgets/button.anubis +++ b/web/widgets/button.anubis @@ -210,7 +210,7 @@ define List(CoreAttrs) to_JS_String("Xlib.jq_query("+format_web_action_name_to_js(web_action, extra_ops)+")") else load_content_JS_String(load_content_target, web_action, extra_ops, true), - //to_JS_String("Xlib.ajax_load_content('"++"', "+format_web_action_name_to_js(web_action, extra_ops)+", true)"), + //to_JS_String("Xlib.load_content('"++"', "+format_web_action_name_to_js(web_action, extra_ops)+", true)"), core_attrs + [id(uid), style("cursor: pointer"), event(onclick, "Xlib.make_confirm_dialog(this, "+ ok_action +");")]. -- libgit2 0.21.4