Commit 07e68e538e8ea4bd567c473f9a642ac937a9c814

Authored by totoro
1 parent 210cb395

add specific link in list view

calexium_lib @ f22102f85d5
1 -Subproject commit 89e465d6f9d8461c1168c798ab69ddcdea5ae832 1 +Subproject commit f22102f85d5212fe6133456d65ec6be48ae5ca3e
hayamiki_lib @ f3cb0a1f425
1 -Subproject commit 32c3ae42670d5161a3229642ed62a96194dfa3e1 1 +Subproject commit f3cb0a1f4255b7c9a03256ab1b5d4f424789d139
src/generation/html.anubis
@@ -41,17 +41,33 @@ public define String @@ -41,17 +41,33 @@ public define String
41 "link(to_String("+data_name+".id), "+to_String(column, data_name, general_type_name)+")". 41 "link(to_String("+data_name+".id), "+to_String(column, data_name, general_type_name)+")".
42 42
43 public define String 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 to_HTML_cell_link 55 to_HTML_cell_link
45 ( 56 (
46 List(HK_Model_Column) columns, 57 List(HK_Model_Column) columns,
47 String column_name, 58 String column_name,
48 String data_name, 59 String data_name,
49 - String general_type_name 60 + String general_type_name,
  61 + String action_name
50 )= 62 )=
51 if get_column_type_from_name(columns, column_name) is 63 if get_column_type_from_name(columns, column_name) is
52 { 64 {
53 failure then "column name "+column_name+"doesn't exist", 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,9 +112,14 @@ public define String
96 // since display is db_display(views, _), // 112 // since display is db_display(views, _), //
97 with current_list_column = if list_view is 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 if current_list_column is 124 if current_list_column is
104 { 125 {
@@ -106,7 +127,7 @@ public define String @@ -106,7 +127,7 @@ public define String
106 [h . t] then 127 [h . t] then
107 indent+join(",\n"+indent, 128 indent+join(",\n"+indent,
108 //Make first column as link 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 //and the other set with list_view 132 //and the other set with list_view
112 map((String column_name) |-> to_HTML_cell(columns, column_name, data_name, table_name), t) 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,7 +42,7 @@ define String
42 since table is hk_table(table_name, short_name, model, display), 42 since table is hk_table(table_name, short_name, model, display),
43 since display is hk_display(list_views, _), 43 since display is hk_display(list_views, _),
44 map((HK_List_View view ) |-> 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 indent+" "+"hk_menu_item("+fill("\""+table_name+"\",",max_space)+ "\"view_table\", "+ 46 indent+" "+"hk_menu_item("+fill("\""+table_name+"\",",max_space)+ "\"view_table\", "+
47 fill("help_text(\""+short_name+(if view_name="default" then "" else " "+view_name)+"\"),",max_space)+ 47 fill("help_text(\""+short_name+(if view_name="default" then "" else " "+view_name)+"\"),",max_space)+
48 "[(\"table_name\", "+fill("\""+table_name+"\",",max_space)+"),(\"view_name\", \""+view_name+"\")])", list_views), tables))+"\n"+indent+"])", apps)). 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,13 +398,13 @@ public define Maybe(One)
398 with type_name = to_upper(table_name, 1), //make the first character to upper case and be an Anubis Type. 398 with type_name = to_upper(table_name, 1), //make the first character to upper case and be an Anubis Type.
399 with view_name = if list_view is 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 with current_list_view = if list_view is 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 //generate the type of the table that contain all components 409 //generate the type of the table that contain all components
410 if write_string(stream, 410 if write_string(stream,
@@ -473,8 +473,8 @@ public define Maybe(One) @@ -473,8 +473,8 @@ public define Maybe(One)
473 else 473 else
474 if view is 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 //if not we search for view named 'default' 478 //if not we search for view named 'default'
479 if view_name = "default" then true else false 479 if view_name = "default" then true else false
480 }, 480 },
@@ -501,8 +501,8 @@ public define String @@ -501,8 +501,8 @@ public define String
501 [view . t] then 501 [view . t] then
502 with view_name = if view is 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 _generate_get_viewable_if_else( table_name, t, 507 _generate_get_viewable_if_else( table_name, t,
508 so_far + 508 so_far +