Commit 4152ce3abcd199ad4a839b93ba7ddd483b01a4fe
1 parent
48495d18
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
Showing
2 changed files
with
14 additions
and
1 deletions
Show diff stats
web/types/controllers_web_site.anubis
| @@ -7,6 +7,7 @@ | @@ -7,6 +7,7 @@ | ||
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | read tools/printable_tree.anubis | 9 | read tools/printable_tree.anubis |
| 10 | +read web_action_name.anubis | ||
| 10 | transmit web_session.anubis | 11 | transmit web_session.anubis |
| 11 | transmit xlib/web/making_a_web_site.anubis | 12 | transmit xlib/web/making_a_web_site.anubis |
| 12 | 13 | ||
| @@ -64,6 +65,18 @@ public type WEB_Controller_Result: | @@ -64,6 +65,18 @@ public type WEB_Controller_Result: | ||
| 64 | // ) | 65 | // ) |
| 65 | . | 66 | . |
| 66 | 67 | ||
| 68 | +public define WEB_Controller_Result | ||
| 69 | + redirect | ||
| 70 | + ( | ||
| 71 | + WEB_Session _session, | ||
| 72 | + WEB_Action_Name wan | ||
| 73 | + )= | ||
| 74 | + if wan is controller_action(controller, action) then | ||
| 75 | + redirect(_session, controller, action) | ||
| 76 | + else | ||
| 77 | + redirect(_session, "", "") | ||
| 78 | +. | ||
| 79 | + | ||
| 67 | public type WEB_Action: | 80 | public type WEB_Action: |
| 68 | web_action( | 81 | web_action( |
| 69 | WEB_Action_Name name, // name of action | 82 | WEB_Action_Name name, // name of action |
web/widgets/button.anubis
| @@ -210,7 +210,7 @@ define List(CoreAttrs) | @@ -210,7 +210,7 @@ define List(CoreAttrs) | ||
| 210 | to_JS_String("Xlib.jq_query("+format_web_action_name_to_js(web_action, extra_ops)+")") | 210 | to_JS_String("Xlib.jq_query("+format_web_action_name_to_js(web_action, extra_ops)+")") |
| 211 | else | 211 | else |
| 212 | load_content_JS_String(load_content_target, web_action, extra_ops, true), | 212 | load_content_JS_String(load_content_target, web_action, extra_ops, true), |
| 213 | - //to_JS_String("Xlib.ajax_load_content('"++"', "+format_web_action_name_to_js(web_action, extra_ops)+", true)"), | 213 | + //to_JS_String("Xlib.load_content('"++"', "+format_web_action_name_to_js(web_action, extra_ops)+", true)"), |
| 214 | 214 | ||
| 215 | core_attrs + [id(uid), style("cursor: pointer"), event(onclick, "Xlib.make_confirm_dialog(this, "+ ok_action +");")]. | 215 | core_attrs + [id(uid), style("cursor: pointer"), event(onclick, "Xlib.make_confirm_dialog(this, "+ ok_action +");")]. |
| 216 | 216 |