Commit 3253fb48a874a1a5f88543601878511b9fe2167d
1 parent
095da71b
add "add_icon" parameter option to jq_datetimepicker_init to have calendar or cl…
…ock icon depending on the picker type next to the date input
Showing
2 changed files
with
40 additions
and
11 deletions
Show diff stats
database/vtm/view_table_renderer.anubis
| ... | ... | @@ -25,7 +25,8 @@ read calexium_lib/web/CXM_making_a_web_site.anubis |
| 25 | 25 | read calexium_lib/web/CXM_multihost_http_server.anubis |
| 26 | 26 | read calexium_lib/web/jQuery/CXM_jquery_datatable.anubis |
| 27 | 27 | read calexium_lib/web/jQuery/CXM_jquery_datatable_types.anubis |
| 28 | -read calexium_lib/web/jQuery/CXM_jquery_dialog.anubis | |
| 28 | +read calexium_lib/web/jQuery/CXM_jquery_dialog.anubis | |
| 29 | +read calexium_lib/web/jQuery/CXM_jquery_button.anubis | |
| 29 | 30 | read calexium_lib/web/jQuery/ui-addon/datetimepicker.anubis |
| 30 | 31 | read calexium_lib/web/CXM_form.anubis |
| 31 | 32 | read calexium_lib/web/widgets/css_helper.anubis |
| ... | ... | @@ -204,9 +205,10 @@ public define HTML_Partial_Content |
| 204 | 205 | partial_content( |
| 205 | 206 | div( [/*class("tableau")*/], |
| 206 | 207 | sequence( |
| 207 | - [ actioner(same,same, link([class("my_button")],_T("NEW")),"edit_table",[("table_name", rows.table_name)]), | |
| 208 | + [ | |
| 209 | + partial(jquery_button(jQuery_button(button, "edit_table_"+rows.table_name, "", _T("NEW"), jQuery_actioner(same, jqlink, "edit_table&table_name="+rows.table_name)))), | |
| 208 | 210 | //dialog used by datatable entries |
| 209 | - partial(jq_dialog_create(dialog_id("edit_table_dlg_ajax"), ajax("?a=ajax_edit_table&table_name="+rows.table_name))), | |
| 211 | + partial(jq_dialog_create(dialog_id(action_name+"_dlg_ajax"), ajax("?a=ajax_edit_table&table_name="+rows.table_name))), | |
| 210 | 212 | |
| 211 | 213 | table([core_attrs([id("table_view"), class("tableau display compact nowrap")])], |
| 212 | 214 | make_header(_T, rows.header.list, [action_header_cell]), | ... | ... |
web/jQuery/ui-addon/datetimepicker.anubis
| ... | ... | @@ -17,9 +17,9 @@ read calexium_lib/web/CXM_jquery.anubis |
| 17 | 17 | css(css_file("/css/jquery/ui/datetimepicker.css")), |
| 18 | 18 | js(js_file("js/jquery/ui/jquery-ui-timepicker-addon.js")), |
| 19 | 19 | js_inline(jquery_ready("// Datepicker\n |
| 20 | - $('.datepicker').datepicker({inline: true}); | |
| 21 | - $('.datetimepicker').datetimepicker({inline: true}); | |
| 22 | - ")) | |
| 20 | + $('.datepicker').datepicker({inline: true}); | |
| 21 | + $('.datetimepicker').datetimepicker({inline: true}); | |
| 22 | + ")) | |
| 23 | 23 | ] |
| 24 | 24 | . |
| 25 | 25 | |
| ... | ... | @@ -28,16 +28,43 @@ read calexium_lib/web/CXM_jquery.anubis |
| 28 | 28 | public define List(HTML_Head_Tag) |
| 29 | 29 | jq_datetimepicker_init |
| 30 | 30 | ( |
| 31 | - String lang | |
| 31 | + String lang, | |
| 32 | + Bool add_icon | |
| 32 | 33 | ) |
| 33 | 34 | = |
| 34 | 35 | [ |
| 35 | 36 | css(css_file("js/jquery/plug-in/datetimepicker/datetimepicker.css")), |
| 36 | 37 | js(js_file("js/jquery/plug-in/datetimepicker/datetimepicker.js")), |
| 37 | 38 | js_inline(jquery_ready("// Datetimepicker\n |
| 38 | - $('.datepicker').datetimepicker({lang:'"+lang+"',timepicker:false,format:'d/m/Y'}); | |
| 39 | - $('.datetimepicker').datetimepicker({lang:'"+lang+"',format:'Y-m-d H:i'}); | |
| 40 | - $('.timepicker').datetimepicker({lang:'"+lang+"',datepicker:false,format:'H:i',step:5}) | |
| 41 | - ")) | |
| 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 "")) | |
| 42 | 62 | ] |
| 43 | 63 | . |
| 64 | + | |
| 65 | +public define List(HTML_Head_Tag) | |
| 66 | + jq_datetimepicker_init | |
| 67 | + ( | |
| 68 | + String lang | |
| 69 | + ) | |
| 70 | + = jq_datetimepicker_init(lang, true). | ... | ... |