Commit 8ac13faf2b99263eefc2edc84f86fd8bca807188

Authored by totoro
1 parent 8645a410

[+] add jq_button_confirm. jQuery button with image and confirmation dialog

[+] add some icons url as string constant
[~] change_list doesn't show icon if the icon class is empty
web/jQuery/CXM_jquery_button.anubis
@@ -9,6 +9,7 @@ @@ -9,6 +9,7 @@
9 transmit calexium_lib/web/CXM_making_a_web_site.anubis 9 transmit calexium_lib/web/CXM_making_a_web_site.anubis
10 transmit calexium_lib/web/CXM_jquery.anubis 10 transmit calexium_lib/web/CXM_jquery.anubis
11 transmit calexium_lib/web/jQuery/CXM_jquery_icons.anubis 11 transmit calexium_lib/web/jQuery/CXM_jquery_icons.anubis
  12 +transmit calexium_lib/web/widgets/button.anubis
12 transmit calexium_lib/web/js_tools.anubis 13 transmit calexium_lib/web/js_tools.anubis
13 transmit tools/basis.anubis 14 transmit tools/basis.anubis
14 transmit system/string.anubis 15 transmit system/string.anubis
@@ -339,7 +340,33 @@ public define HTML_Partial_Content @@ -339,7 +340,33 @@ public define HTML_Partial_Content
339 partial(jquery_button(jQuery_button(button, uid, button_name, button_label, actioner, jq_icon_none, jq_icon_none))) 340 partial(jquery_button(jQuery_button(button, uid, button_name, button_label, actioner, jq_icon_none, jq_icon_none)))
340 ])). 341 ])).
341 342
342 - 343 +public define HTML_Partial_Content
  344 + jq_button_confirm
  345 + (
  346 + JQuery_img_button button,
  347 + String dlg_title,
  348 + String dlg_text,
  349 + String dlg_ok,
  350 + String dlg_cancel,
  351 + String url,
  352 + List((String, String)) extra_ops
  353 + )=
  354 + since button is jquery_img_button(img_url, button_label, button_name, actioner, orientation),
  355 + with uid = generate_random_string(20),
  356 +
  357 + js_confirm_dialog_data_obj = "CalexiumToolBox.data.confirm_dialog[" + to_js_string(uid) + "]",
  358 + js_data = js_confirm_dialog_data_obj + " = {
  359 + title: " + to_js_string(dlg_title) + ",
  360 + text: " + to_js_string(dlg_text) + ",
  361 + ok : " + to_js_string(dlg_ok) + ",
  362 + cancel: " + to_js_string(dlg_cancel) + "};",
  363 +
  364 + button_name = uid,
  365 + actioner = jQuery_actioner(same, jqscript, "CalexiumToolBox.make_confirm_dialog(this, " + to_js_string("/?a=" + url + format_extra_operands(extra_ops))+");"),
  366 +
  367 + partial_content([js(js_file("js/cxm/cxm.js")), js_inline(jquery_ready(js_data))],sequence([
  368 + partial(jquery_button(jquery_img_button(img_url, button_label, button_name, actioner, orientation)))
  369 + ])).
343 370
344 public define HTML_Partial_Content 371 public define HTML_Partial_Content
345 jq_button_confirm 372 jq_button_confirm
@@ -352,6 +379,18 @@ public define HTML_Partial_Content @@ -352,6 +379,18 @@ public define HTML_Partial_Content
352 String url 379 String url
353 )= 380 )=
354 jq_button_confirm(button_label, dlg_title, dlg_text, dlg_ok, dlg_cancel, url, []). 381 jq_button_confirm(button_label, dlg_title, dlg_text, dlg_ok, dlg_cancel, url, []).
  382 +
  383 +public define HTML_Partial_Content
  384 + jq_button_confirm
  385 + (
  386 + JQuery_img_button button,
  387 + String dlg_title,
  388 + String dlg_text,
  389 + String dlg_ok,
  390 + String dlg_cancel,
  391 + String url
  392 + )=
  393 + jq_button_confirm(button, dlg_title, dlg_text, dlg_ok, dlg_cancel, url, []).
355 394
356 public define HTML_Partial_Content 395 public define HTML_Partial_Content
357 img_submit_button 396 img_submit_button
@@ -359,4 +398,4 @@ public define HTML_Partial_Content @@ -359,4 +398,4 @@ public define HTML_Partial_Content
359 String label, //translated label of the button 398 String label, //translated label of the button
360 String form_id // 399 String form_id //
361 )= 400 )=
362 - jquery_button(jquery_img_button("icons/16x16/check.png", label, "", jQuery_actioner(same, jqform, form_id), left)). 401 + jquery_button(jquery_img_button(icn16_check, label, "", jQuery_actioner(same, jqform, form_id), left)).
web/widgets/button.anubis
@@ -16,6 +16,9 @@ public define String icn16_edit = "icons/16x16/edit.png". @@ -16,6 +16,9 @@ public define String icn16_edit = "icons/16x16/edit.png".
16 public define String icn16_check = "icons/16x16/check.png". 16 public define String icn16_check = "icons/16x16/check.png".
17 public define String icn16_phone = "icons/16x16/phone.png". 17 public define String icn16_phone = "icons/16x16/phone.png".
18 public define String icn16_locked = "icons/16x16/locked.png". 18 public define String icn16_locked = "icons/16x16/locked.png".
  19 +public define String icn16_clock = "icons/16x16/clock.png".
  20 +public define String icn16_html = "icons/16x16/mimetypes/html.png".
  21 +public define String icn16_txt = "icons/16x16/mimetypes/txt.png".
19 22
20 public define HTML_Partial_Content 23 public define HTML_Partial_Content
21 img_button_flink 24 img_button_flink
web/widgets/css_helper.anubis
@@ -118,6 +118,14 @@ public type ChangeListItem: @@ -118,6 +118,14 @@ public type ChangeListItem:
118 String label, 118 String label,
119 String value). 119 String value).
120 120
  121 +public define ChangeListItem
  122 + change_list_item
  123 + (
  124 + String label,
  125 + String value
  126 + )=
  127 + change_list_item("", label, value).
  128 +
121 define HTML_Row(HTML_Off_Form) 129 define HTML_Row(HTML_Off_Form)
122 make_row 130 make_row
123 ( 131 (
@@ -127,8 +135,12 @@ define HTML_Row(HTML_Off_Form) @@ -127,8 +135,12 @@ define HTML_Row(HTML_Off_Form)
127 if item is change_list_item(icon, label, value) then 135 if item is change_list_item(icon, label, value) then
128 //with bg = (Cell_Option) else core_attrs([class()]), 136 //with bg = (Cell_Option) else core_attrs([class()]),
129 row([], 137 row([],
130 - [  
131 - cell([core_attrs([class("icon "+icon)])],text("")), 138 + if icon = "" then
  139 + [ cell([core_attrs([class("label")])],text(label)),
  140 + cell(text(value))
  141 + ]
  142 + else
  143 + [ cell([core_attrs([class("icon "+icon)])],text("")),
132 cell([core_attrs([class("label")])],text(label)), 144 cell([core_attrs([class("label")])],text(label)),
133 cell(text(value)) 145 cell(text(value))
134 ] 146 ]
@@ -149,13 +161,14 @@ define List(HTML_Row(HTML_Off_Form)) @@ -149,13 +161,14 @@ define List(HTML_Row(HTML_Off_Form))
149 make_changelist_rows(t, [ make_row(h, odd) . so_far], 1 - odd) 161 make_changelist_rows(t, [ make_row(h, odd) . so_far], 1 - odd)
150 }. 162 }.
151 163
152 -public define HTML_Off_Form  
153 - process_changelist 164 +public define HTML_Partial_Content
  165 + changelist_table
154 ( 166 (
155 List(ChangeListItem) items 167 List(ChangeListItem) items
156 )= 168 )=
  169 + partial_content([css(css_file("css/changelists.css"))],
157 div([class("changelist")], 170 div([class("changelist")],
158 - table([class("module"), attr("cellspacing","0")], make_changelist_rows(items, [], 1))) 171 + table([class("module"), attr("cellspacing","0")], make_changelist_rows(items, [], 1))))
159 . 172 .
160 173
161 public define HTML_Off_Form 174 public define HTML_Off_Form
web/widgets/dashboard.anubis
@@ -28,14 +28,14 @@ public define HTML_Off_Form @@ -28,14 +28,14 @@ public define HTML_Off_Form
28 if left is 28 if left is
29 { 29 {
30 none then literal(""), 30 none then literal(""),
31 - content(list, title) then html_wave_box_wide(title, sequence([process_changelist(list)])) 31 + content(list, title) then partial(html_wave_box_wide(title, changelist_table(list)))
32 } 32 }
33 ), 33 ),
34 cell([class("module_col right_col")], 34 cell([class("module_col right_col")],
35 if right is 35 if right is
36 { 36 {
37 none then literal(""), 37 none then literal(""),
38 - content(list, title) then html_wave_box_wide(title, sequence([process_changelist(list)])) 38 + content(list, title) then partial(html_wave_box_wide(title, changelist_table(list)))
39 } 39 }
40 ) 40 )
41 ]) 41 ])