diff --git a/database/vtm/view_table_renderer.anubis b/database/vtm/view_table_renderer.anubis index 84bb77e..a492c29 100644 --- a/database/vtm/view_table_renderer.anubis +++ b/database/vtm/view_table_renderer.anubis @@ -25,6 +25,7 @@ read calexium_lib/web/CXM_making_a_web_site.anubis read calexium_lib/web/CXM_multihost_http_server.anubis read calexium_lib/web/jQuery/CXM_jquery_datatable.anubis read calexium_lib/web/jQuery/CXM_jquery_datatable_types.anubis +read calexium_lib/web/jQuery/CXM_jquery_dialog.anubis read calexium_lib/web/jQuery/ui-addon/datetimepicker.anubis read calexium_lib/web/CXM_form.anubis read calexium_lib/web/widgets/css_helper.anubis @@ -97,12 +98,10 @@ public define HTML_Partial_Content with table_name = vt_elist.table_name, with button_name = if get_String(lwa, "id","none") = "none" then _T("CREATE") else _T("UPDATE"), partial_content(jq_datetimepicker_init(lang), - partial(html_wave_box( - _T(to_upper(table_name)), cxm_form( table_name, htmlId(table_name), lwa, edit_form_lines(db, _T, vt_elist.list, [])+ [ submit("create", failure, button_name, [("table_name", table_name)]) ] - )))). + )). public define Maybe(HTML_Partial_Content) edit_table_content @@ -139,7 +138,8 @@ define HTML_Row(HTML_Off_Form) make_line with cell = if h is { text(string) then cell((HTML_Off_Form)text(string)), - link(id, string) then cell((HTML_Off_Form)actioner(same,same, link(string), action_name, [("table_name", table_name),("id",id)])), +// link(id, string) then cell((HTML_Off_Form)actioner(same,same, link(string), action_name, [("table_name", table_name),("id",id)])), + link(id, string) then cell((HTML_Off_Form)literal(jq_dialog_open(string, dialog_id(action_name+"_dlg_ajax"), "'id="+id+"'"))), icon(icon_path) then cell((HTML_Off_Form)image([], icon_path, "")) }, make_line(table_name, action_name, t, [cell . so_far]) @@ -163,7 +163,8 @@ define List(HTML_Row(HTML_Off_Form)) with actions_cell = (HTML_Cell(HTML_Off_Form)) cell([], sequence([ - partial(img_button_confirm(icn16_cross, _T("CONFIRMATION_REQUEST"), _T("CONFIRM_LINE_DELETION") , _T("OK"), _T("CANCEL"), jQuery_actioner(same, jqlink, "hk_del_row" + format_extra_operands([("table_name", table_name),("id",to_String(h.db_id))])))) + partial(img_button_confirm(icn16_cross, _T("CONFIRMATION_REQUEST"), _T("CONFIRM_LINE_DELETION") , _T("OK"), _T("CANCEL"), jQuery_actioner(same, jqlink, "hk_del_row" + format_extra_operands([("table_name", table_name),("id",to_String(h.db_id))])))), + partial(img_button(icn16_edit, [event(onclick, jq_dialog_open(dialog_id(action_name+"_dlg_ajax"), "'id="+to_String(h.db_id)+"'"))], "", [])), ]) ), make_lines(_T, table_name, action_name, t, [make_line(table_name, action_name, h.list, [actions_cell]). so_far] ) @@ -200,9 +201,13 @@ public define HTML_Partial_Content VT_view rows )= with action_header_cell = header_cell((HTML_Off_Form)text(_T("ACTION"))), - partial_content(div( [/*class("tableau")*/], + partial_content( + div( [/*class("tableau")*/], sequence( [ actioner(same,same, link([class("my_button")],_T("NEW")),"edit_table",[("table_name", rows.table_name)]), + //dialog used by datatable entries + partial(jq_dialog_create(dialog_id("edit_table_dlg_ajax"), ajax("?a=ajax_edit_table&table_name="+rows.table_name))), + table([core_attrs([id("table_view"), class("tableau display compact nowrap")])], make_header(_T, rows.header.list, [action_header_cell]), make_lines(_T, rows.table_name, action_name, rows.list, [])) @@ -224,9 +229,9 @@ public define HTML_Partial_Content // if tb is tool_box(lang, _T, _, _, db, _) then // println("view_table_page - lang : "+lang); // println("view_table_page - web_site_directory : "+web_site_directory); - partial_content( - [html_wave_box_wide(_T(to_upper(rows.table_name)), - jquery_datatable("table_view", view_table_form(_T, action_name, rows), true, false, jq_dt_pt_full_numbers, scrollY(500), true, true, true, lang, no_extra, web_site_directory))]). + partial_content(jq_dialog_init + jq_datetimepicker_init(lang), + [partial(html_wave_box_wide(_T(to_upper(rows.table_name)), + jquery_datatable("table_view", view_table_form(_T, action_name, rows), true, false, jq_dt_pt_full_numbers, scrollY(500), true, true, true, lang, no_extra, web_site_directory)))]). public define Maybe(HTML_Partial_Content) view_table_content diff --git a/web/CXM_making_a_web_site.anubis b/web/CXM_making_a_web_site.anubis index 4db5113..15c04f6 100644 --- a/web/CXM_making_a_web_site.anubis +++ b/web/CXM_making_a_web_site.anubis @@ -3464,10 +3464,17 @@ define Printable_tree "" ], img_link(options, img, alt_text) then - [ - "\""" - ], + //if action name is empty, format options on image because maybe there onclick action + if action_name ="" then + [ + "\""" + ] + else + [ + "\""" + ], push_button(options, text) then [ if action is diff --git a/web/jQuery/CXM_jquery_dialog.anubis b/web/jQuery/CXM_jquery_dialog.anubis index aca36e2..c1e97df 100644 --- a/web/jQuery/CXM_jquery_dialog.anubis +++ b/web/jQuery/CXM_jquery_dialog.anubis @@ -100,7 +100,25 @@ public define String String params )= _jq_dialog_open(success(html), dialog_id, params). - + +public define HTML_Partial_Content + jq_dialog_open + ( + String html, + JQuery_dialog_id dialog_id, + String params + )= + partial_content([], + literal(_jq_dialog_open(success(html), dialog_id, params))). + +public define String + jq_dialog_open + ( + JQuery_dialog_id dialog_id, + String params + )= + _jq_dialog_open(failure, dialog_id, params). + public define String jq_dialog_open ( diff --git a/web/widgets/button.anubis b/web/widgets/button.anubis index 987d1fa..c87b1a9 100644 --- a/web/widgets/button.anubis +++ b/web/widgets/button.anubis @@ -51,7 +51,7 @@ public define HTML_Partial_Content String url, List((String, String)) extra_ops )= - partial_content(actioner(same, same, img_link(core_attrs, img_path, ""), url, extra_ops)). + partial_content(actioner(same, same, img_link(core_attrs+[style("cursor: pointer")], img_path, ""), url, extra_ops)). public define HTML_Partial_Content img_button -- libgit2 0.21.4