Commit e04d167ece685446a2360e38398d3839a517ae28

Authored by David RENÉ
1 parent 50e33f38

add jqload as new alternative of the JQuery_Actioner_type. jqload let manage act…

…ion with load_content
web/CXM_jquery.anubis
@@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
7 */ 7 */
8 8
9 transmit calexium_lib/web/CXM_making_a_web_site.anubis 9 transmit calexium_lib/web/CXM_making_a_web_site.anubis
  10 +read calexium_lib/web/load_content.anubis
10 read tools/printable_tree.anubis 11 read tools/printable_tree.anubis
11 read tools/basis.anubis 12 read tools/basis.anubis
12 13
@@ -15,7 +16,8 @@ public type JQuery_Actioner_type: @@ -15,7 +16,8 @@ public type JQuery_Actioner_type:
15 jqform ( String form, WEB_Action_Name name, List((String,String)) extra_ops), 16 jqform ( String form, WEB_Action_Name name, List((String,String)) extra_ops),
16 jqlink ( WEB_Action_Name name, List((String,String)) extra_ops), 17 jqlink ( WEB_Action_Name name, List((String,String)) extra_ops),
17 jqflink ( String link), 18 jqflink ( String link),
18 - jqscript( String script) 19 + jqscript( String script),
  20 + jqload ( String target, WEB_Action_Name name, List((String,String)) extra_ops)
19 . 21 .
20 22
21 public define JQuery_Actioner_type jqlink(WEB_Action_Name name) = jqlink(name, []). 23 public define JQuery_Actioner_type jqlink(WEB_Action_Name name) = jqlink(name, []).
@@ -96,8 +98,9 @@ public define String @@ -96,8 +98,9 @@ public define String
96 action_name(action) then "document.location='/?aws_action="+action+"';", 98 action_name(action) then "document.location='/?aws_action="+action+"';",
97 url(url) then "document.location='"+url+"';", 99 url(url) then "document.location='"+url+"';",
98 } 100 }
99 - jqflink(link) then "document.location='"+link+"';",  
100 - jqscript(script) then script 101 + jqflink(link) then "document.location='"+link+"';",
  102 + jqscript(script) then script
  103 + jqload(target_id, web_action, extra_args) then load_content(target_id, web_action, extra_args, false)
101 }, 104 },
102 same(label) then 105 same(label) then
103 if act_type is 106 if act_type is
@@ -107,7 +110,7 @@ public define String @@ -107,7 +110,7 @@ public define String
107 { 110 {
108 no_action then "", //will use the default action defined in form 111 no_action then "", //will use the default action defined in form
109 controller_action(ctrl, action) then 112 controller_action(ctrl, action) then
110 - "$('#"+form+"').get(0).setAttribute('action','/?aws_controller="+ctrl+"&aws_action="+action+format_extra_operands(extra_ops)+"');\n" 113 + "$('#"+form+"').get(0).setAttribute('action','/?aws_c="+ctrl+"&aws_a="+action+format_extra_operands(extra_ops)+"');\n"
111 action_name(action) then 114 action_name(action) then
112 "$('#"+form+"').get(0).setAttribute('action','/?aws_action="+action+"');", 115 "$('#"+form+"').get(0).setAttribute('action','/?aws_action="+action+"');",
113 url(url) then 116 url(url) then
@@ -124,6 +127,7 @@ public define String @@ -124,6 +127,7 @@ public define String
124 } 127 }
125 jqflink(link) then "document.location='"+link+"';", 128 jqflink(link) then "document.location='"+link+"';",
126 jqscript(script) then script 129 jqscript(script) then script
  130 + jqload(target_id, web_action, extra_args) then load_content(target_id, web_action, extra_args, false)
127 }, 131 },
128 other(window_name, window_options) then 132 other(window_name, window_options) then
129 if act_type is 133 if act_type is
@@ -153,7 +157,7 @@ public define String @@ -153,7 +157,7 @@ public define String
153 } 157 }
154 jqflink(link) then "document.location='"+link+"';", 158 jqflink(link) then "document.location='"+link+"';",
155 jqscript(script) then script 159 jqscript(script) then script
156 - 160 + jqload(target_id, web_action, extra_args) then load_content(target_id, web_action, extra_args, false)
157 } 161 }
158 }. 162 }.
159 163
web/jQuery/CXM_jquery_button.anubis
@@ -392,6 +392,19 @@ public define HTML_Partial_Content @@ -392,6 +392,19 @@ public define HTML_Partial_Content
392 jquery_button(jquery_img_button(icon, label, "", jQuery_actioner(same, jqlink(action, extra_ops)), left)) 392 jquery_button(jquery_img_button(icon, label, "", jQuery_actioner(same, jqlink(action, extra_ops)), left))
393 . 393 .
394 394
  395 +
  396 +public define HTML_Partial_Content
  397 + img_button
  398 + (
  399 + String icon, //URL of
  400 + String label, //translated label of the button
  401 + WEB_Action_Name action,
  402 + List((String,String)) extra_ops,
  403 + String target
  404 + )=
  405 + jquery_button(jquery_img_button(icon, label, "", jQuery_actioner(same, jqload(target, action, extra_ops)), left))
  406 +.
  407 +
395 public define HTML_Partial_Content 408 public define HTML_Partial_Content
396 img_button 409 img_button
397 ( 410 (
web/load_content.anubis
@@ -9,7 +9,8 @@ @@ -9,7 +9,8 @@
9 read system/convert.anubis 9 read system/convert.anubis
10 read calexium_lib/web/types/making_a_web_site.anubis 10 read calexium_lib/web/types/making_a_web_site.anubis
11 read calexium_lib/web/CXM_web_action.anubis 11 read calexium_lib/web/CXM_web_action.anubis
12 -read calexium_lib/web/CXM_jquery.anubis 12 +//read calexium_lib/web/CXM_jquery.anubis
  13 +read calexium_lib/web/js_tools.anubis
13 14
14 public define String 15 public define String
15 load_content 16 load_content
@@ -24,6 +25,17 @@ public define String @@ -24,6 +25,17 @@ public define String
24 . 25 .
25 26
26 public define String 27 public define String
  28 + load_content_JS_String
  29 + (
  30 + String target,
  31 + WEB_Action_Name web_action,
  32 + List((String,String)) extra_args,
  33 + Bool replace
  34 + )=
  35 + to_JS_String("CalexiumToolBox.ajax_load_content('"+target+"', "+format_web_action_name_to_js(web_action, extra_args)+", "+to_String(replace)+")")
  36 +.
  37 +
  38 +public define String
27 load_content 39 load_content
28 ( 40 (
29 String target, 41 String target,
@@ -73,7 +85,7 @@ public define HTML_Partial_Content @@ -73,7 +85,7 @@ public define HTML_Partial_Content
73 )= 85 )=
74 partial_content([ 86 partial_content([
75 js(js_file("js/cxm/cxm.js")), 87 js(js_file("js/cxm/cxm.js")),
76 - js_inline(jquery_ready(load_content(target, web_action, extra_args, replace))) 88 + js_inline(script("text/javascript","$(document).ready(function(){"+load_content(target, web_action, extra_args, replace)+"});"))
77 ], 89 ],
78 empty) 90 empty)
79 . 91 .