From e3ffb1b4a7f5942ff58991e799dcb9ffd05b0b71 Mon Sep 17 00:00:00 2001 From: totoro Date: Sun, 19 Feb 2017 22:04:18 +0100 Subject: [PATCH] add WEB_Action_Name to be compliant with the current Calexium_Lib --- view/view_table_renderer.anubis | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/view/view_table_renderer.anubis b/view/view_table_renderer.anubis index ed2e331..1929060 100644 --- a/view/view_table_renderer.anubis +++ b/view/view_table_renderer.anubis @@ -32,6 +32,13 @@ read calexium_lib/web/CXM_form.anubis read calexium_lib/web/widgets/css_helper.anubis read calexium_lib/web/widgets/button.anubis +public define WEB_Action_Name edit_table = controller_action("hk_c", "edit_table"). +public define WEB_Action_Name view_table = controller_action("hk_c", "view_table"). +public define WEB_Action_Name save_row = controller_action("hk_c", "save_row"). +public define WEB_Action_Name delete_row = controller_action("hk_c", "delete_row"). +public define WEB_Action_Name ajax_edit_table = controller_action("hk_c", "ajax_edit_table"). + + define CXM_Form_Field help_line ( @@ -112,7 +119,7 @@ public define HTML_Partial_Content partial_content(jq_datetimepicker_init(lang), cxm_form( table_name, lwa, edit_form_lines(db, _T, vt_elist.list, [])+ - [ submit("create", failure, button_name, [("table_name", table_name)]) ] + [ submit(save_row, failure, button_name, [("table_name", table_name)]) ] )). public define Maybe(HTML_Partial_Content) @@ -140,7 +147,7 @@ public define Maybe(HTML_Partial_Content) define HTML_Row(HTML_Off_Form) make_line ( String table_name, - String action_name, //default is "edit_table", but can be surcharged for own use + String _action_name, //default is "edit_table", but can be surcharged for own use List(VT_view_entry) entries, List(HTML_Cell(HTML_Off_Form)) so_far )= @@ -152,11 +159,11 @@ define HTML_Row(HTML_Off_Form) make_line { text(string) then cell((HTML_Off_Form)text(not_null_String(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)literal(jq_dialog_open(string, dialog_id(action_name+"_dlg_ajax"), "'id="+id+"'"))), - link_id_action(id, name, action) then cell((HTML_Off_Form)actioner(same,same, link(name), action, [("id",id)])), + link(id, string) then cell((HTML_Off_Form)literal(jq_dialog_open(string, dialog_id(_action_name+"_dlg_ajax"), "'id="+id+"'"))), + link_id_action(id, name, action) then cell((HTML_Off_Form)actioner(same,same, link(name), action_name(action), [("id",id)])), icon(icon_path) then cell((HTML_Off_Form)image([], icon_path, "")) }, - make_line(table_name, action_name, t, [cell . so_far]) + make_line(table_name, _action_name, t, [cell . so_far]) }. define List(HTML_Row(HTML_Off_Form)) @@ -177,7 +184,7 @@ 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(controller_action("hk_c", "delete_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)+"'"))], "", [])), ]) ), @@ -199,8 +206,8 @@ define HTML_Header_Row(HTML_Off_Form) with cell = if h is { text(string) then header_cell((HTML_Off_Form)text(_T(string))), - link(id, string) then header_cell((HTML_Off_Form)actioner(same,same, link(string),"edit_table",[])), //TODO - link_id_action(id, text, action) then header_cell((HTML_Off_Form)actioner(same,same, link(text),action,[("id",id)])), //TODO + link(id, string) then header_cell((HTML_Off_Form)actioner(same, same, link(string), edit_table,[])), //TODO + link_id_action(id, text, action) then header_cell((HTML_Off_Form)actioner(same,same, link(text),action_name(action),[("id",id)])), //TODO icon(icon_path) then header_cell((HTML_Off_Form)image([], icon_path, "")) }, make_header(_T, t, [cell . so_far]) @@ -220,9 +227,9 @@ public define HTML_Partial_Content div( [/*class("tableau")*/], sequence( [ - partial(jquery_button(jQuery_button(button, "edit_table_"+rows.table_name, "", _T("NEW"), jQuery_actioner(same, jqlink, "edit_table&table_name="+rows.table_name)))), + partial(jquery_button(jQuery_button(button, "edit_table_"+rows.table_name, "", _T("NEW"), jQuery_actioner(same, jqlink(controller_action("hk_c", "edit_table&table_name="+rows.table_name)))))), //dialog used by datatable entries - partial(jq_dialog_create(dialog_id(action_name+"_dlg_ajax"), ajax("?a=ajax_edit_table&table_name="+rows.table_name))), + partial(jq_dialog_create(dialog_id(action_name+"_dlg_ajax"), ajax(controller_action("hk_c", "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]), -- libgit2 0.21.4