From 07e68e538e8ea4bd567c473f9a642ac937a9c814 Mon Sep 17 00:00:00 2001 From: totoro Date: Thu, 28 Apr 2016 13:32:50 +0200 Subject: [PATCH] add specific link in list view --- calexium_lib | 2 +- hayamiki_lib | 2 +- src/generation/html.anubis | 31 ++++++++++++++++++++++++++----- src/generation/menu.anubis | 2 +- src/generation/types.anubis | 16 ++++++++-------- 5 files changed, 37 insertions(+), 16 deletions(-) diff --git a/calexium_lib b/calexium_lib index 89e465d..f22102f 160000 --- a/calexium_lib +++ b/calexium_lib @@ -1 +1 @@ -Subproject commit 89e465d6f9d8461c1168c798ab69ddcdea5ae832 +Subproject commit f22102f85d5212fe6133456d65ec6be48ae5ca3e diff --git a/hayamiki_lib b/hayamiki_lib index 32c3ae4..f3cb0a1 160000 --- a/hayamiki_lib +++ b/hayamiki_lib @@ -1 +1 @@ -Subproject commit 32c3ae42670d5161a3229642ed62a96194dfa3e1 +Subproject commit f3cb0a1f4255b7c9a03256ab1b5d4f424789d139 diff --git a/src/generation/html.anubis b/src/generation/html.anubis index 231950e..6060cf2 100644 --- a/src/generation/html.anubis +++ b/src/generation/html.anubis @@ -41,17 +41,33 @@ public define String "link(to_String("+data_name+".id), "+to_String(column, data_name, general_type_name)+")". public define String + to_HTML_cell_link_id_action + ( + HK_Model_Column column, + String data_name, + String general_type_name, + String action_name + )= + "link_id_action(to_String("+data_name+".id), "+to_String(column, data_name, general_type_name)+", "+action_name+")". + + +public define String to_HTML_cell_link ( List(HK_Model_Column) columns, String column_name, String data_name, - String general_type_name + String general_type_name, + String action_name )= if get_column_type_from_name(columns, column_name) is { failure then "column name "+column_name+"doesn't exist", - success(column) then to_HTML_cell_link(column, data_name, general_type_name) + success(column) then + if action_name = "" then + to_HTML_cell_link(column, data_name, general_type_name) + else + to_HTML_cell_link_id_action(column, data_name, general_type_name, action_name) }. @@ -96,9 +112,14 @@ public define String // since display is db_display(views, _), // with current_list_column = if list_view is { - list_view_all then to_List_String(columns, false), //generate a list of columns string to view from columns model - list_view(v_name, v_col) then v_col + list_view_all then to_List_String(columns, false), //generate a list of columns string to view from columns model + list_view(v_name, v_col, _) then v_col }, + with action_name = if list_view is + { + list_view_all then "" + list_view(_, _, an) then an + }, if current_list_column is { @@ -106,7 +127,7 @@ public define String [h . t] then indent+join(",\n"+indent, //Make first column as link - [to_HTML_cell_link(columns, h, data_name, table_name)] + + [to_HTML_cell_link(columns, h, data_name, table_name, action_name)] + //and the other set with list_view map((String column_name) |-> to_HTML_cell(columns, column_name, data_name, table_name), t) diff --git a/src/generation/menu.anubis b/src/generation/menu.anubis index 42de70d..dc61d60 100644 --- a/src/generation/menu.anubis +++ b/src/generation/menu.anubis @@ -42,7 +42,7 @@ define String since table is hk_table(table_name, short_name, model, display), since display is hk_display(list_views, _), map((HK_List_View view ) |-> - with view_name = if view is list_view(v_name, _) then v_name else "default", + with view_name = if view is list_view(v_name, _, _) then v_name else "default", indent+" "+"hk_menu_item("+fill("\""+table_name+"\",",max_space)+ "\"view_table\", "+ fill("help_text(\""+short_name+(if view_name="default" then "" else " "+view_name)+"\"),",max_space)+ "[(\"table_name\", "+fill("\""+table_name+"\",",max_space)+"),(\"view_name\", \""+view_name+"\")])", list_views), tables))+"\n"+indent+"])", apps)). diff --git a/src/generation/types.anubis b/src/generation/types.anubis index 5c3ab39..71c6620 100644 --- a/src/generation/types.anubis +++ b/src/generation/types.anubis @@ -398,13 +398,13 @@ public define Maybe(One) with type_name = to_upper(table_name, 1), //make the first character to upper case and be an Anubis Type. with view_name = if list_view is { - list_view_all then "default", - list_view(view_name, _) then view_name + list_view_all then "default", + list_view(view_name, _, _) then view_name }, with current_list_view = if list_view is { - list_view_all then to_List_String(columns, false), - list_view(_, cols)then cols + list_view_all then to_List_String(columns, false), + list_view(_, cols, _) then cols }, //generate the type of the table that contain all components if write_string(stream, @@ -473,8 +473,8 @@ public define Maybe(One) else if view is { - list_view_all then true, //list_view_all is default view - list_view(view_name, _) then + list_view_all then true, //list_view_all is default view + list_view(view_name, _, _) then //if not we search for view named 'default' if view_name = "default" then true else false }, @@ -501,8 +501,8 @@ public define String [view . t] then with view_name = if view is { - list_view_all then "default", - list_view(view_name, _) then view_name + list_view_all then "default", + list_view(view_name, _, _) then view_name }, _generate_get_viewable_if_else( table_name, t, so_far + -- libgit2 0.21.4