From e41b7b8aac5b29c0413c3593aa5c5bac5391bbf1 Mon Sep 17 00:00:00 2001 From: totoro Date: Sat, 28 Mar 2026 12:10:53 +0900 Subject: [PATCH] add a new web_action hkc_create_row. Until now the create or update was managed by update. The behavior of update is to create a row if not exist or update it if exists. But this behavior introduce a bug I didn't notice until now. By calling only update_row function the trigger belonging to create function are never applied. So the core was updated to distinguish the creation or update and then apply the correct trigger. --- view/view_table_renderer.anubis | 6 +++--- view/web_action.anubis | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/view/view_table_renderer.anubis b/view/view_table_renderer.anubis index a3dc0a5..0eab35c 100644 --- a/view/view_table_renderer.anubis +++ b/view/view_table_renderer.anubis @@ -975,7 +975,7 @@ public define HTML_Partial_Content (if length(list_entries) > 5 then [ one_line_fields([ - partial(jquery_button(jQuery_button(button, dialog_id+button_name, button_name, button_label, jQuery_actioner(same, jqscript(jq_form_submit_and_close(dialog_id, form_id, hkc_update_row, [("table_name", table_name), ("sub_dialog", sub_dialog)], after_close_cb)))))), + partial(jquery_button(jQuery_button(button, dialog_id+button_name, button_name, button_label, jQuery_actioner(same, jqscript(jq_form_submit_and_close(dialog_id, form_id, if create then hkc_create_row else hkc_update_row, [("table_name", table_name), ("sub_dialog", sub_dialog)], after_close_cb)))))), partial(jquery_button(jQuery_button(button, dialog_id+"cancel", "cancel", _T("CANCEL"), jQuery_actioner(same, jqscript("$('#"+dialog_id+"').dialog('close')"))))), ]), hr @@ -1003,7 +1003,7 @@ public define HTML_Partial_Content [ hr, one_line_fields([ - partial(jquery_button(jQuery_button(button, dialog_id+button_name+"_bt", button_name, button_label, jQuery_actioner(same, jqscript(jq_form_submit_and_close(dialog_id, form_id, hkc_update_row, [("table_name", table_name), ("sub_dialog", sub_dialog)], after_close_cb)))))), + partial(jquery_button(jQuery_button(button, dialog_id+button_name+"_bt", button_name, button_label, jQuery_actioner(same, jqscript(jq_form_submit_and_close(dialog_id, form_id, if create then hkc_create_row else hkc_update_row, [("table_name", table_name), ("sub_dialog", sub_dialog)], after_close_cb)))))), partial(jquery_button(jQuery_button(button, dialog_id+"cancel_bt", "cancel", _T("CANCEL"), jQuery_actioner(same, jqscript("$('#"+dialog_id+"').dialog('close')"))))), ]) ] @@ -1281,7 +1281,7 @@ public define HTML_Partial_Content // submit(if create then hkc_save_row else hkc_update_row, failure, button_name, [("table_name", table_name)]), // submit(if create then hkc_save_row_and_new else hkc_update_row_and_new, failure, button_name_and_new, [("table_name", table_name)]), // submit(hkc_cancel, failure, _T("CANCEL")) - partial(jquery_button(jQuery_button(button, dialog_id+button_name, button_name, button_label, jQuery_actioner(same, jqscript(jq_form_submit_and_close(dialog_id, form_id, hkc_update_row, [("table_name", table_name), ("sub_dialog", sub_dialog)], after_close_cb)))))), + partial(jquery_button(jQuery_button(button, dialog_id+button_name, button_name, button_label, jQuery_actioner(same, jqscript(jq_form_submit_and_close(dialog_id, form_id, if create then hkc_create_row else hkc_update_row, [("table_name", table_name), ("sub_dialog", sub_dialog)], after_close_cb)))))), partial(jquery_button(jQuery_button(button, dialog_id+"cancel", "cancel", _T("CANCEL"), jQuery_actioner(same, jqscript("$('#"+dialog_id+"').dialog('close')"))))), ]) diff --git a/view/web_action.anubis b/view/web_action.anubis index 6e7c5d9..5f87b37 100644 --- a/view/web_action.anubis +++ b/view/web_action.anubis @@ -21,6 +21,7 @@ public define WEB_Action_Name hkc_query = controller_action("hk_c" public define WEB_Action_Name hkc_list_view = controller_action("hk_c", "view_table"). public define WEB_Action_Name hkc_list_view_name = controller_action("hk_c", "hkc_list_view_name"). public define WEB_Action_Name hkc_list_view_filter = controller_action("hk_c", "hkc_list_view_filter"). +public define WEB_Action_Name hkc_create_row = controller_action("hk_c", "create_row"). public define WEB_Action_Name hkc_save_row = controller_action("hk_c", "save_row"). public define WEB_Action_Name hkc_save_row_and_new = controller_action("hk_c", "save_row_and_new"). public define WEB_Action_Name hkc_update_row = controller_action("hk_c", "update_row"). -- libgit2 0.21.4