From 0af871c7d6de2c1aa907def23a4fb563fc851cc4 Mon Sep 17 00:00:00 2001 From: totoro Date: Wed, 19 Apr 2017 16:33:59 +0900 Subject: [PATCH] add colspan and rowspan attributes for editor and form table lines --- hayamiki_lib | 2 +- src/generation/edit_view_table_form.anubis | 27 ++++++++++++++++++++++++--- src/model.3.0.0.anubis | 8 ++++---- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/hayamiki_lib b/hayamiki_lib index b0635c5..6a8c2f0 160000 --- a/hayamiki_lib +++ b/hayamiki_lib @@ -1 +1 @@ -Subproject commit b0635c56b0ff5113b85301a06aee7b71ce76bc22 +Subproject commit 6a8c2f09f96f7ac5e840c0ef4935a5641e83fc18 diff --git a/src/generation/edit_view_table_form.anubis b/src/generation/edit_view_table_form.anubis index 2b37ecb..af36ca0 100644 --- a/src/generation/edit_view_table_form.anubis +++ b/src/generation/edit_view_table_form.anubis @@ -76,8 +76,29 @@ public define String failure then edit_entries(t, type_name, indent, so_far) success(result) then edit_entries(t, type_name, indent, [result . so_far]) } - }. - + } +. + +define String + make_line_attribute + ( + HK_Editor_Table_Line_Attribute attr + )= + if attr is + { + colspan(n) then "colspan("+n+")", + rowspan(n) then "rowspan("+n+")" + } +. + +define String + make_line_attributes + ( + List(HK_Editor_Table_Line_Attribute) line_attrs + )= + join(", ", map((HK_Editor_Table_Line_Attribute attr) |-> make_line_attribute(attr), line_attrs)) +. + define String make_lines ( @@ -89,7 +110,7 @@ define String if is_empty(lines) then "" else - "\n"+indent+ join(",\n"+indent, map((HK_Editor_Table_Line line) |-> "hk_form_table_line(["+ make_cells(line.cells, columns, table_name, indent+" ") +"\n"+indent+"])", lines)) + "\n"+indent+ join(",\n"+indent, map((HK_Editor_Table_Line line) |-> "hk_form_table_line(["+make_line_attributes(line.line_attr)+"],\n"+indent+" ["+ make_cells(line.cells, columns, table_name, indent+" ") +"\n"+indent+"])", lines)) . diff --git a/src/model.3.0.0.anubis b/src/model.3.0.0.anubis index 0677d33..4610ee3 100644 --- a/src/model.3.0.0.anubis +++ b/src/model.3.0.0.anubis @@ -579,10 +579,10 @@ public define HK_Table role_table = [ edit_view_list_form("default", ["role_name", "description", "comments"]), form_table("table", table([ - line([label("role_name"), column("role_name")]), - line([empty, column("description")]), - line([label("comments"), column("comments")]), - line([label("date_created"),column("date_created"),label("last_modified"),column("last_modified")]) + line([],[label("role_name"), column("role_name")]), + line([],[empty, column("description")]), + line([],[label("comments"), column("comments")]), + line([colspan(2)], [label("date_created"),column("date_created"),label("last_modified"),column("last_modified")]) ]) ) ] -- libgit2 0.21.4