From 463b9c3d332076b3517f4af12945764627043ef6 Mon Sep 17 00:00:00 2001 From: totoro Date: Fri, 28 Apr 2017 19:42:24 +0900 Subject: [PATCH] move line attribute into cell attribute --- calexium_lib | 2 +- hayamiki_lib | 2 +- src/generation/edit_view_table_form.anubis | 58 ++++++++++++++++++++++++++++++---------------------------- src/model.3.0.0.anubis | 8 ++++---- 4 files changed, 36 insertions(+), 34 deletions(-) diff --git a/calexium_lib b/calexium_lib index b3734f8..45e29b3 160000 --- a/calexium_lib +++ b/calexium_lib @@ -1 +1 @@ -Subproject commit b3734f8f0b4bf27ade1712f3c159380ddd828acb +Subproject commit 45e29b302fac0def4330ce9654cfa2cecd9e69f2 diff --git a/hayamiki_lib b/hayamiki_lib index 8bf8743..95c6d50 160000 --- a/hayamiki_lib +++ b/hayamiki_lib @@ -1 +1 @@ -Subproject commit 8bf8743ef98b0fada8bc776abbda3d7bff3933c3 +Subproject commit 95c6d5064c6062446d1d22c6b4cc3ad5a93f4df5 diff --git a/src/generation/edit_view_table_form.anubis b/src/generation/edit_view_table_form.anubis index 8884ae1..c10ee0b 100644 --- a/src/generation/edit_view_table_form.anubis +++ b/src/generation/edit_view_table_form.anubis @@ -19,6 +19,26 @@ define String String indent ). +define String + make_cell_attribute + ( + HK_Editor_Table_Cell_Attribute attr + )= + if attr is + { + colspan(n) then "colspan("+n+")", + rowspan(n) then "rowspan("+n+")" + } +. + +define String + make_cell_attributes + ( + List(HK_Editor_Table_Cell_Attribute) cell_attrs + )= + join(", ", map((HK_Editor_Table_Cell_Attribute attr) |-> make_cell_attribute(attr), cell_attrs)) +. + public define String make_cell ( @@ -29,22 +49,22 @@ public define String )= if cell_description is { - empty then "hk_form_table_cell(empty)" - column(col_name) then + empty(attrs) then "hk_form_table_cell(["+make_cell_attributes(attrs)+"],\n"+indent+"empty)" + column(attrs, col_name) then if get_column_type_from_name(columns, col_name) is { - failure then "hk_form_table_cell(label(\"column ["+col_name+"] not found\"))", + failure then "hk_form_table_cell(["+make_cell_attributes(attrs)+"],\n"+indent+"label(\"column ["+col_name+"] not found\"))", success(col_type) then if get_HK_Form_Entry(col_type, type_name) is { - failure then "hk_form_table_cell(label(\" form for column ["+col_name+"] not found\"))", - success(form_string) then "hk_form_table_cell("+form_string+")" + failure then "hk_form_table_cell(["+make_cell_attributes(attrs)+"],\n"+indent+"label(\" form for column ["+col_name+"] not found\"))", + success(form_string) then "hk_form_table_cell(["+make_cell_attributes(attrs)+"],\n"+indent+form_string+")" } } - column_label(col_name) then "hk_form_table_cell(label(\""+to_upper(col_name)+"\"))", - label(label_str) then "hk_form_table_cell(label(\""+label_str+"\"))" - table(lines) then - "hk_form_table_cell_table(["+ + column_label(attrs, col_name) then "hk_form_table_cell(["+make_cell_attributes(attrs)+"],\n"+indent+"label(\""+to_upper(col_name)+"\"))", + label(attrs, label_str) then "hk_form_table_cell(["+make_cell_attributes(attrs)+"],\n"+indent+"label(\""+label_str+"\"))" + table(attrs, lines) then + "hk_form_table_cell_table(["+make_cell_attributes(attrs)+"], [\n"+indent+ make_lines(lines, columns, type_name, indent+" ")+ "\n"+indent+"])" } @@ -80,25 +100,7 @@ public define String } . -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 @@ -111,7 +113,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_line_attributes(line.line_attr)+"],\n"+indent+" ["+ 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_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 4610ee3..21337a8 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([colspan(2)], [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([table([colspan(2)],[line( [label([], "date_created"),column([], "date_created"),label([], "last_modified"),column([], "last_modified")])])]) ]) ) ] -- libgit2 0.21.4