Commit a34dedddf129158f9d1024636581c64cc403944c
1 parent
5312282e
change translation folder for DataTables from "DataTables-1.10.7" to "DataTables"
move "datetimepicker" plugin initialization js into another function so it can be used elsewhere replace "lang" option for datetimepicker to "setLocale" (this option was removed in the latest version of the plug-in, breaking translations) optimize further a "img_button_confirm" function replace the usage of "image" in a "img_button_confirm" function by literal, because there was no "cursor: pointer" being applied
Showing
3 changed files
with
44 additions
and
37 deletions
Show diff stats
web/jQuery/CXM_jquery_datatable_translation.anubis
| ... | ... | @@ -14,7 +14,7 @@ public define String |
| 14 | 14 | String language, |
| 15 | 15 | String web_dir |
| 16 | 16 | )= |
| 17 | - with lang_file = web_dir+"/public/js/jquery/plug-in/DataTables-1.10.7/translation/"+language+".txt", | |
| 17 | + with lang_file = web_dir+"/public/js/jquery/plug-in/DataTables/translation/"+language+".txt", | |
| 18 | 18 | with file = if file_exists(lang_file) then |
| 19 | 19 | language |
| 20 | 20 | else |
| ... | ... | @@ -22,7 +22,7 @@ public define String |
| 22 | 22 | "en", |
| 23 | 23 | |
| 24 | 24 | "\"oLanguage\": { |
| 25 | - \"sUrl\": \"/js/jquery/plug-in/DataTables-1.10.7/translation/"+file+".txt\" | |
| 25 | + \"sUrl\": \"/js/jquery/plug-in/DataTables/translation/"+file+".txt\" | |
| 26 | 26 | }". |
| 27 | 27 | |
| 28 | 28 | ... | ... |
web/jQuery/ui-addon/datetimepicker.anubis
| ... | ... | @@ -23,42 +23,49 @@ read calexium_lib/web/CXM_jquery.anubis |
| 23 | 23 | ] |
| 24 | 24 | . |
| 25 | 25 | |
| 26 | +public define String | |
| 27 | + datetimepicker_init_js | |
| 28 | + ( | |
| 29 | + String lang, | |
| 30 | + Bool add_icon | |
| 31 | + ) = "// Datetimepicker\n | |
| 32 | + $.datetimepicker.setLocale('"+lang+"'); | |
| 33 | + $('.datepicker').datetimepicker({timepicker:false,format:'d/m/Y'}); | |
| 34 | + $('.datetimepicker').datetimepicker({format:'Y-m-d H:i'}); | |
| 35 | + $('.timepicker').datetimepicker({datepicker:false,format:'H:i',step:5}); | |
| 36 | + " + if add_icon then " | |
| 37 | + var items_add_func = function (index) { | |
| 38 | + var icon_file = 'icon_calendar.gif'; | |
| 39 | + var dt_picker = $(this); | |
| 40 | + | |
| 41 | + if (dt_picker.hasClass('timepicker')) { | |
| 42 | + icon_file = 'icon_clock.gif'; | |
| 43 | + } | |
| 44 | + | |
| 45 | + var icon = $('<img src=\"icons/16x16/'+icon_file+'\"/>'); | |
| 46 | + | |
| 47 | + icon.click(function () { dt_picker.datetimepicker('show'); }); | |
| 48 | + icon.hover(function() { $(this).css('cursor','pointer'); }); | |
| 49 | + dt_picker.after(icon); | |
| 50 | + }; | |
| 51 | + | |
| 52 | + $('.datepicker').each(items_add_func); | |
| 53 | + $('.datetimepicker').each(items_add_func); | |
| 54 | + $('.timepicker').each(items_add_func); | |
| 55 | + " else "". | |
| 26 | 56 | |
| 27 | 57 | /* Initialize jQuery datetimepicker */ |
| 28 | 58 | public define List(HTML_Head_Tag) |
| 29 | 59 | jq_datetimepicker_init |
| 30 | 60 | ( |
| 31 | - String lang, | |
| 61 | + String lang, | |
| 32 | 62 | Bool add_icon |
| 33 | 63 | ) |
| 34 | 64 | = |
| 35 | 65 | [ |
| 36 | 66 | css(css_file("js/jquery/plug-in/datetimepicker/datetimepicker.css")), |
| 37 | 67 | js(js_file("js/jquery/plug-in/datetimepicker/datetimepicker.min.js")), |
| 38 | - js_inline(jquery_ready("// Datetimepicker\n | |
| 39 | - $('.datepicker').datetimepicker({lang:'"+lang+"',timepicker:false,format:'d/m/Y'}); | |
| 40 | - $('.datetimepicker').datetimepicker({lang:'"+lang+"',format:'Y-m-d H:i'}); | |
| 41 | - $('.timepicker').datetimepicker({lang:'"+lang+"',datepicker:false,format:'H:i',step:5}); | |
| 42 | - " + if add_icon then " | |
| 43 | - var items_add_func = function (index) { | |
| 44 | - var icon_file = 'icon_calendar.gif'; | |
| 45 | - var dt_picker = $(this); | |
| 46 | - | |
| 47 | - if (dt_picker.hasClass('timepicker')) { | |
| 48 | - icon_file = 'icon_clock.gif'; | |
| 49 | - } | |
| 50 | - | |
| 51 | - var icon = $('<img src=\"icons/16x16/'+icon_file+'\"/>'); | |
| 52 | - | |
| 53 | - icon.click(function () { dt_picker.datetimepicker('show'); }); | |
| 54 | - icon.hover(function() { $(this).css('cursor','pointer'); }); | |
| 55 | - dt_picker.after(icon); | |
| 56 | - }; | |
| 57 | - | |
| 58 | - $('.datepicker').each(items_add_func); | |
| 59 | - $('.datetimepicker').each(items_add_func); | |
| 60 | - $('.timepicker').each(items_add_func); | |
| 61 | - " else "")) | |
| 68 | + js_inline(jquery_ready(datetimepicker_init_js(lang, add_icon))) | |
| 62 | 69 | ] |
| 63 | 70 | . |
| 64 | 71 | ... | ... |
web/widgets/button.anubis
| ... | ... | @@ -120,7 +120,7 @@ public define HTML_Partial_Content |
| 120 | 120 | with uid = generate_random_string(20), |
| 121 | 121 | |
| 122 | 122 | partial_content([js(js_file("js/cxm/cxm.js")), js_inline(jquery_ready(img_button_confirm_js(uid, dlg_title, dlg_text, dlg_ok, dlg_cancel)))], |
| 123 | - image(img_button_confirm_image_attrs(core_attrs, uid, actioner), img_path, "")). | |
| 123 | + literal("<img " + format_attrs(img_button_confirm_image_attrs(core_attrs, uid, actioner)) + " src=\"" + img_path + "\"></img>")). | |
| 124 | 124 | |
| 125 | 125 | public define HTML_Partial_Content |
| 126 | 126 | img_button_confirm |
| ... | ... | @@ -149,21 +149,21 @@ public define String |
| 149 | 149 | |
| 150 | 150 | "<script type=\"text/javascript\">" + jquery_ready(img_button_confirm_js(uid, dlg_title, dlg_text, dlg_ok, dlg_cancel)) + "</script>" + |
| 151 | 151 | "<img " + format_attrs(img_button_confirm_image_attrs(core_attrs, uid, actioner)) + " src=\"" + img_path + "\"></img>". |
| 152 | - | |
| 152 | + | |
| 153 | 153 | public define String |
| 154 | 154 | img_button_confirm |
| 155 | 155 | ( |
| 156 | - String img_path, | |
| 157 | - List(CoreAttrs) core_attrs, | |
| 158 | - String dlg_title_js_escaped, | |
| 159 | - String dlg_text_js_escaped, | |
| 160 | - String dlg_ok_js_escaped, | |
| 161 | - String dlg_cancel_js_escaped, | |
| 162 | - String dlg_ok_js_script | |
| 156 | + String img_path, | |
| 157 | + String inline_img_attrb, | |
| 158 | + String dlg_title_js_escaped, | |
| 159 | + String dlg_text_js_escaped, | |
| 160 | + String dlg_ok_js_escaped, | |
| 161 | + String dlg_cancel_js_escaped, | |
| 162 | + String dlg_ok_js_script | |
| 163 | 163 | ) = |
| 164 | 164 | with uid = generate_random_string(10), |
| 165 | 165 | "<script type=\"text/javascript\">$(document).ready(function(){CalexiumToolBox.data.confirm_dialog['" + uid + "'] = {title:" + dlg_title_js_escaped + ",text:" + dlg_text_js_escaped + ",ok:" + dlg_ok_js_escaped + ",cancel:" + dlg_cancel_js_escaped + |
| 166 | - "};});</script><img " + format_attrs(core_attrs) + " id=\"" + uid + "\" style=\"cursor:pointer\" onclick=\"CalexiumToolBox.make_confirm_dialog(this," + dlg_ok_js_script + ");\" src=\"" + img_path + "\"></img>". | |
| 166 | + "};});</script><img " + inline_img_attrb + " id=\"" + uid + "\" style=\"cursor:pointer\" onclick=\"CalexiumToolBox.make_confirm_dialog(this," + dlg_ok_js_script + ");\" src=\"" + img_path + "\"></img>". | |
| 167 | 167 | |
| 168 | 168 | public define String |
| 169 | 169 | img_button_confirm | ... | ... |