Commit 07e68e538e8ea4bd567c473f9a642ac937a9c814
1 parent
210cb395
add specific link in list view
Showing
5 changed files
with
37 additions
and
16 deletions
Show diff stats
calexium_lib @ f22102f85d5
hayamiki_lib @ f3cb0a1f425
src/generation/html.anubis
| ... | ... | @@ -41,17 +41,33 @@ public define String |
| 41 | 41 | "link(to_String("+data_name+".id), "+to_String(column, data_name, general_type_name)+")". |
| 42 | 42 | |
| 43 | 43 | public define String |
| 44 | + to_HTML_cell_link_id_action | |
| 45 | + ( | |
| 46 | + HK_Model_Column column, | |
| 47 | + String data_name, | |
| 48 | + String general_type_name, | |
| 49 | + String action_name | |
| 50 | + )= | |
| 51 | + "link_id_action(to_String("+data_name+".id), "+to_String(column, data_name, general_type_name)+", "+action_name+")". | |
| 52 | + | |
| 53 | + | |
| 54 | +public define String | |
| 44 | 55 | to_HTML_cell_link |
| 45 | 56 | ( |
| 46 | 57 | List(HK_Model_Column) columns, |
| 47 | 58 | String column_name, |
| 48 | 59 | String data_name, |
| 49 | - String general_type_name | |
| 60 | + String general_type_name, | |
| 61 | + String action_name | |
| 50 | 62 | )= |
| 51 | 63 | if get_column_type_from_name(columns, column_name) is |
| 52 | 64 | { |
| 53 | 65 | failure then "column name "+column_name+"doesn't exist", |
| 54 | - success(column) then to_HTML_cell_link(column, data_name, general_type_name) | |
| 66 | + success(column) then | |
| 67 | + if action_name = "" then | |
| 68 | + to_HTML_cell_link(column, data_name, general_type_name) | |
| 69 | + else | |
| 70 | + to_HTML_cell_link_id_action(column, data_name, general_type_name, action_name) | |
| 55 | 71 | }. |
| 56 | 72 | |
| 57 | 73 | |
| ... | ... | @@ -96,9 +112,14 @@ public define String |
| 96 | 112 | // since display is db_display(views, _), // |
| 97 | 113 | with current_list_column = if list_view is |
| 98 | 114 | { |
| 99 | - list_view_all then to_List_String(columns, false), //generate a list of columns string to view from columns model | |
| 100 | - list_view(v_name, v_col) then v_col | |
| 115 | + list_view_all then to_List_String(columns, false), //generate a list of columns string to view from columns model | |
| 116 | + list_view(v_name, v_col, _) then v_col | |
| 101 | 117 | }, |
| 118 | + with action_name = if list_view is | |
| 119 | + { | |
| 120 | + list_view_all then "" | |
| 121 | + list_view(_, _, an) then an | |
| 122 | + }, | |
| 102 | 123 | |
| 103 | 124 | if current_list_column is |
| 104 | 125 | { |
| ... | ... | @@ -106,7 +127,7 @@ public define String |
| 106 | 127 | [h . t] then |
| 107 | 128 | indent+join(",\n"+indent, |
| 108 | 129 | //Make first column as link |
| 109 | - [to_HTML_cell_link(columns, h, data_name, table_name)] + | |
| 130 | + [to_HTML_cell_link(columns, h, data_name, table_name, action_name)] + | |
| 110 | 131 | |
| 111 | 132 | //and the other set with list_view |
| 112 | 133 | map((String column_name) |-> to_HTML_cell(columns, column_name, data_name, table_name), t) | ... | ... |
src/generation/menu.anubis
| ... | ... | @@ -42,7 +42,7 @@ define String |
| 42 | 42 | since table is hk_table(table_name, short_name, model, display), |
| 43 | 43 | since display is hk_display(list_views, _), |
| 44 | 44 | map((HK_List_View view ) |-> |
| 45 | - with view_name = if view is list_view(v_name, _) then v_name else "default", | |
| 45 | + with view_name = if view is list_view(v_name, _, _) then v_name else "default", | |
| 46 | 46 | indent+" "+"hk_menu_item("+fill("\""+table_name+"\",",max_space)+ "\"view_table\", "+ |
| 47 | 47 | fill("help_text(\""+short_name+(if view_name="default" then "" else " "+view_name)+"\"),",max_space)+ |
| 48 | 48 | "[(\"table_name\", "+fill("\""+table_name+"\",",max_space)+"),(\"view_name\", \""+view_name+"\")])", list_views), tables))+"\n"+indent+"])", apps)). | ... | ... |
src/generation/types.anubis
| ... | ... | @@ -398,13 +398,13 @@ public define Maybe(One) |
| 398 | 398 | with type_name = to_upper(table_name, 1), //make the first character to upper case and be an Anubis Type. |
| 399 | 399 | with view_name = if list_view is |
| 400 | 400 | { |
| 401 | - list_view_all then "default", | |
| 402 | - list_view(view_name, _) then view_name | |
| 401 | + list_view_all then "default", | |
| 402 | + list_view(view_name, _, _) then view_name | |
| 403 | 403 | }, |
| 404 | 404 | with current_list_view = if list_view is |
| 405 | 405 | { |
| 406 | - list_view_all then to_List_String(columns, false), | |
| 407 | - list_view(_, cols)then cols | |
| 406 | + list_view_all then to_List_String(columns, false), | |
| 407 | + list_view(_, cols, _) then cols | |
| 408 | 408 | }, |
| 409 | 409 | //generate the type of the table that contain all components |
| 410 | 410 | if write_string(stream, |
| ... | ... | @@ -473,8 +473,8 @@ public define Maybe(One) |
| 473 | 473 | else |
| 474 | 474 | if view is |
| 475 | 475 | { |
| 476 | - list_view_all then true, //list_view_all is default view | |
| 477 | - list_view(view_name, _) then | |
| 476 | + list_view_all then true, //list_view_all is default view | |
| 477 | + list_view(view_name, _, _) then | |
| 478 | 478 | //if not we search for view named 'default' |
| 479 | 479 | if view_name = "default" then true else false |
| 480 | 480 | }, |
| ... | ... | @@ -501,8 +501,8 @@ public define String |
| 501 | 501 | [view . t] then |
| 502 | 502 | with view_name = if view is |
| 503 | 503 | { |
| 504 | - list_view_all then "default", | |
| 505 | - list_view(view_name, _) then view_name | |
| 504 | + list_view_all then "default", | |
| 505 | + list_view(view_name, _, _) then view_name | |
| 506 | 506 | }, |
| 507 | 507 | _generate_get_viewable_if_else( table_name, t, |
| 508 | 508 | so_far + | ... | ... |