Commit 463b9c3d332076b3517f4af12945764627043ef6
1 parent
185ef079
move line attribute into cell attribute
Showing
4 changed files
with
36 additions
and
34 deletions
Show diff stats
calexium_lib @ 45e29b302fa
hayamiki_lib @ 95c6d5064c6
src/generation/edit_view_table_form.anubis
| ... | ... | @@ -19,6 +19,26 @@ define String |
| 19 | 19 | String indent |
| 20 | 20 | ). |
| 21 | 21 | |
| 22 | +define String | |
| 23 | + make_cell_attribute | |
| 24 | + ( | |
| 25 | + HK_Editor_Table_Cell_Attribute attr | |
| 26 | + )= | |
| 27 | + if attr is | |
| 28 | + { | |
| 29 | + colspan(n) then "colspan("+n+")", | |
| 30 | + rowspan(n) then "rowspan("+n+")" | |
| 31 | + } | |
| 32 | +. | |
| 33 | + | |
| 34 | +define String | |
| 35 | + make_cell_attributes | |
| 36 | + ( | |
| 37 | + List(HK_Editor_Table_Cell_Attribute) cell_attrs | |
| 38 | + )= | |
| 39 | + join(", ", map((HK_Editor_Table_Cell_Attribute attr) |-> make_cell_attribute(attr), cell_attrs)) | |
| 40 | +. | |
| 41 | + | |
| 22 | 42 | public define String |
| 23 | 43 | make_cell |
| 24 | 44 | ( |
| ... | ... | @@ -29,22 +49,22 @@ public define String |
| 29 | 49 | )= |
| 30 | 50 | if cell_description is |
| 31 | 51 | { |
| 32 | - empty then "hk_form_table_cell(empty)" | |
| 33 | - column(col_name) then | |
| 52 | + empty(attrs) then "hk_form_table_cell(["+make_cell_attributes(attrs)+"],\n"+indent+"empty)" | |
| 53 | + column(attrs, col_name) then | |
| 34 | 54 | if get_column_type_from_name(columns, col_name) is |
| 35 | 55 | { |
| 36 | - failure then "hk_form_table_cell(label(\"column ["+col_name+"] not found\"))", | |
| 56 | + failure then "hk_form_table_cell(["+make_cell_attributes(attrs)+"],\n"+indent+"label(\"column ["+col_name+"] not found\"))", | |
| 37 | 57 | success(col_type) then |
| 38 | 58 | if get_HK_Form_Entry(col_type, type_name) is |
| 39 | 59 | { |
| 40 | - failure then "hk_form_table_cell(label(\" form for column ["+col_name+"] not found\"))", | |
| 41 | - success(form_string) then "hk_form_table_cell("+form_string+")" | |
| 60 | + failure then "hk_form_table_cell(["+make_cell_attributes(attrs)+"],\n"+indent+"label(\" form for column ["+col_name+"] not found\"))", | |
| 61 | + success(form_string) then "hk_form_table_cell(["+make_cell_attributes(attrs)+"],\n"+indent+form_string+")" | |
| 42 | 62 | } |
| 43 | 63 | } |
| 44 | - column_label(col_name) then "hk_form_table_cell(label(\""+to_upper(col_name)+"\"))", | |
| 45 | - label(label_str) then "hk_form_table_cell(label(\""+label_str+"\"))" | |
| 46 | - table(lines) then | |
| 47 | - "hk_form_table_cell_table(["+ | |
| 64 | + column_label(attrs, col_name) then "hk_form_table_cell(["+make_cell_attributes(attrs)+"],\n"+indent+"label(\""+to_upper(col_name)+"\"))", | |
| 65 | + label(attrs, label_str) then "hk_form_table_cell(["+make_cell_attributes(attrs)+"],\n"+indent+"label(\""+label_str+"\"))" | |
| 66 | + table(attrs, lines) then | |
| 67 | + "hk_form_table_cell_table(["+make_cell_attributes(attrs)+"], [\n"+indent+ | |
| 48 | 68 | make_lines(lines, columns, type_name, indent+" ")+ |
| 49 | 69 | "\n"+indent+"])" |
| 50 | 70 | } |
| ... | ... | @@ -80,25 +100,7 @@ public define String |
| 80 | 100 | } |
| 81 | 101 | . |
| 82 | 102 | |
| 83 | -define String | |
| 84 | - make_line_attribute | |
| 85 | - ( | |
| 86 | - HK_Editor_Table_Line_Attribute attr | |
| 87 | - )= | |
| 88 | - if attr is | |
| 89 | - { | |
| 90 | - colspan(n) then "colspan("+n+")", | |
| 91 | - rowspan(n) then "rowspan("+n+")" | |
| 92 | - } | |
| 93 | -. | |
| 94 | 103 | |
| 95 | -define String | |
| 96 | - make_line_attributes | |
| 97 | - ( | |
| 98 | - List(HK_Editor_Table_Line_Attribute) line_attrs | |
| 99 | - )= | |
| 100 | - join(", ", map((HK_Editor_Table_Line_Attribute attr) |-> make_line_attribute(attr), line_attrs)) | |
| 101 | -. | |
| 102 | 104 | |
| 103 | 105 | define String |
| 104 | 106 | make_lines |
| ... | ... | @@ -111,7 +113,7 @@ define String |
| 111 | 113 | if is_empty(lines) then |
| 112 | 114 | "" |
| 113 | 115 | else |
| 114 | - "\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)) | |
| 116 | + "\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)) | |
| 115 | 117 | . |
| 116 | 118 | |
| 117 | 119 | ... | ... |
src/model.3.0.0.anubis
| ... | ... | @@ -579,10 +579,10 @@ public define HK_Table role_table = |
| 579 | 579 | [ edit_view_list_form("default", ["role_name", "description", "comments"]), |
| 580 | 580 | form_table("table", |
| 581 | 581 | table([ |
| 582 | - line([],[label("role_name"), column("role_name")]), | |
| 583 | - line([],[empty, column("description")]), | |
| 584 | - line([],[label("comments"), column("comments")]), | |
| 585 | - line([colspan(2)], [label("date_created"),column("date_created"),label("last_modified"),column("last_modified")]) | |
| 582 | + line([label([], "role_name"), column([], "role_name")]), | |
| 583 | + line([empty([]), column([], "description")]), | |
| 584 | + line([label([], "comments"), column([], "comments")]), | |
| 585 | + line([table([colspan(2)],[line( [label([], "date_created"),column([], "date_created"),label([], "last_modified"),column([], "last_modified")])])]) | |
| 586 | 586 | ]) |
| 587 | 587 | ) |
| 588 | 588 | ] | ... | ... |