Commit 1e9f2f6d417fcb640c98319ad9bb96dc108c2c47

Authored by totoro
1 parent 3fbc7cca

remove odd or even class in table because it's self managed by jq datatable

In the editor, the name of the submit button is set according to edit data (new = "CREATE" button or edit = "UPDATE" button)
Showing 1 changed file with 17 additions and 15 deletions   Show diff stats
database/vtm/view_table_renderer.anubis
... ... @@ -20,6 +20,7 @@ read system/convert.anubis
20 20 //read utils.anubis
21 21 read locale/L3LanguageInfo.anubis
22 22 read calexium_lib/web/CXM_common.anubis
  23 +read calexium_lib/web/CXM_web_arg_utils.anubis
23 24 read calexium_lib/web/CXM_making_a_web_site.anubis
24 25 read calexium_lib/web/CXM_multihost_http_server.anubis
25 26 read calexium_lib/web/jQuery/CXM_jquery_datatable.anubis
... ... @@ -76,9 +77,9 @@ public define List(CXM_Form_Field)
76 77 integer(s_name, c_name, value, help) then
77 78 [input(_T(s_name), wan(c_name), init(abs_to_decimal(value)), small, mandatory), help_line(help, _T)],
78 79 date(s_name, c_name, value, help) then
79   - [input([class("datepicker")], _T(s_name), htmlId(c_name), wan(c_name), init(value), narrow, non_mandatory), help_line(help, _T)],
  80 + [input([class("datepicker")], _T(s_name), htmlId(c_name), wan(c_name), init(value), small, non_mandatory), help_line(help, _T)],
80 81 datetime(s_name, c_name, value, help) then
81   - [input([class("datetimepicker")], _T(s_name), htmlId(c_name), wan(c_name), init(value), narrow, mandatory), help_line(help, _T)],
  82 + [input([class("datetimepicker")], _T(s_name), htmlId(c_name), wan(c_name), init(value), small, mandatory), help_line(help, _T)],
82 83 },
83 84 edit_form_lines(db, _T, t, reverse(line)+so_far)
84 85 }.
... ... @@ -93,13 +94,14 @@ public define HTML_Partial_Content
93 94 VT_edit vt_elist
94 95 ) =
95 96 //if tb is tool_box(lang, _T, _, _, db, _) then
96   - with table_name = vt_elist.table_name,
  97 + with table_name = vt_elist.table_name,
  98 + with button_name = if get_String(lwa, "id","none") = "none" then _T("CREATE") else _T("UPDATE"),
97 99 partial_content(jq_datetimepicker_init(lang),
98 100 partial(html_wave_box(
99 101 _T(to_upper(table_name)),
100 102 cxm_form( table_name, htmlId(table_name), lwa,
101 103 edit_form_lines(db, _T, vt_elist.list, [])+
102   - [ submit("create", failure, _T("CREATE"), [("table_name", table_name)]) ]
  104 + [ submit("create", failure, button_name, [("table_name", table_name)]) ]
103 105 )))).
104 106  
105 107 public define Maybe(HTML_Partial_Content)
... ... @@ -129,14 +131,14 @@ define HTML_Row(HTML_Off_Form) make_line
129 131 String table_name,
130 132 String action_name, //default is "edit_table", but can be surcharged for own use
131 133 List(VT_view_entry) entries,
132   - List(HTML_Cell(HTML_Off_Form)) so_far,
133   - Int odd_even
  134 + List(HTML_Cell(HTML_Off_Form)) so_far
  135 + //Int odd_even
134 136 )=
135 137 if entries is
136 138 {
137 139 [] then
138   - with line = if odd_even = 0 then "tr_even" else "tr_odd",
139   - row( [core_attrs([class(line)])], reverse(so_far)),
  140 + //with line = if odd_even = 0 then "tr_even" else "tr_odd",
  141 + row( [], reverse(so_far)),
140 142 [h . t] then
141 143 with cell = if h is
142 144 {
... ... @@ -144,7 +146,7 @@ define HTML_Row(HTML_Off_Form) make_line
144 146 link(id, string) then cell((HTML_Off_Form)actioner(same,same, link(string), action_name, [("table_name", table_name),("id",id)])),
145 147 icon(icon_path) then cell((HTML_Off_Form)image([], icon_path, ""))
146 148 },
147   - make_line(table_name, action_name, t, [cell . so_far], odd_even)
  149 + make_line(table_name, action_name, t, [cell . so_far])
148 150 }.
149 151  
150 152 define List(HTML_Row(HTML_Off_Form)) make_lines
... ... @@ -153,13 +155,13 @@ define List(HTML_Row(HTML_Off_Form)) make_lines
153 155 String table_name,
154 156 String action_name,
155 157 List(VT_view_row) entries,
156   - List(HTML_Row(HTML_Off_Form)) so_far,
157   - Int odd_even
  158 + List(HTML_Row(HTML_Off_Form)) so_far
  159 +// Int odd_even
158 160 )=
159 161 if entries is
160 162 {
161 163 [] then reverse(so_far),
162   - [h . t] then make_lines(table_name, action_name, t, [make_line(table_name, action_name, h.list, [], odd_even). so_far], 1 - odd_even )
  164 + [h . t] then make_lines(table_name, action_name, t, [make_line(table_name, action_name, h.list, []). so_far] )
163 165 }.
164 166  
165 167 // View table part
... ... @@ -192,12 +194,12 @@ public define HTML_Partial_Content view_table_form
192 194 VT_view rows
193 195 )=
194 196 //if tb is tool_box(_, _T, _, _, db, _) then
195   - partial_content(div( [class("tableau")],
  197 + partial_content(div( [/*class("tableau")*/],
196 198 sequence(
197 199 [ actioner(same,same, link([class("my_button")],_T("NEW")),"edit_table",[("table_name", rows.table_name)]),
198   - table([core_attrs([id("table_view"), class("display compact nowrap")])],
  200 + table([core_attrs([id("table_view"), class("tableau display compact nowrap")])],
199 201 make_header(_T, rows.header.list, []),
200   - make_lines(rows.table_name, action_name, rows.list, [], 0))
  202 + make_lines(rows.table_name, action_name, rows.list, []))
201 203 ]
202 204 )
203 205 ))
... ...