Commit 7c92546d6a8f860d18427d42da64d4f9fee34ea9
1 parent
627c1be7
change the VTM_view signature by adding list of all view string
add view selector on top of table if there is more than 1 view exists some clean up
Showing
4 changed files
with
49 additions
and
28 deletions
Show diff stats
view/view_table_manager.anubis
| @@ -12,18 +12,17 @@ transmit hayamiki_lib/view/view_table_manager_types.anubis | @@ -12,18 +12,17 @@ transmit hayamiki_lib/view/view_table_manager_types.anubis | ||
| 12 | public define Maybe(VTM_view) | 12 | public define Maybe(VTM_view) |
| 13 | _vtm_get_view | 13 | _vtm_get_view |
| 14 | ( | 14 | ( |
| 15 | - String table_name, | 15 | + String _table_name, |
| 16 | List(VTM_view) list | 16 | List(VTM_view) list |
| 17 | ) = | 17 | ) = |
| 18 | if list is | 18 | if list is |
| 19 | { | 19 | { |
| 20 | - [] then println("_vtm_get_view "+table_name+" not found"); failure, | 20 | + [] then println("_vtm_get_view "+_table_name+" not found"); failure, |
| 21 | [ h . t ] then | 21 | [ h . t ] then |
| 22 | - if h is vtm_view(tb_name, get_view) then | ||
| 23 | - if tb_name = table_name then | ||
| 24 | - success(h) | ||
| 25 | - else | ||
| 26 | - _vtm_get_view(table_name, t) | 22 | + if h.table_name = _table_name then |
| 23 | + success(h) | ||
| 24 | + else | ||
| 25 | + _vtm_get_view(_table_name, t) | ||
| 27 | }. | 26 | }. |
| 28 | 27 | ||
| 29 | public define Maybe(VTM_view) | 28 | public define Maybe(VTM_view) |
view/view_table_manager_types.anubis
| @@ -33,7 +33,7 @@ public type TM_delete_list: | @@ -33,7 +33,7 @@ public type TM_delete_list: | ||
| 33 | tm_delete_list(List(TM_delete) list). | 33 | tm_delete_list(List(TM_delete) list). |
| 34 | 34 | ||
| 35 | public type VTM_view: | 35 | public type VTM_view: |
| 36 | - vtm_view(String table_name, (String view_name) -> VT_view get_view). | 36 | + vtm_view(String table_name, (String view_name) -> VT_view get_view, (One) -> List(String) get_all_view_name). |
| 37 | 37 | ||
| 38 | public type VTM_view_list: | 38 | public type VTM_view_list: |
| 39 | vtm_view_list(List(VTM_view) list). | 39 | vtm_view_list(List(VTM_view) list). |
view/view_table_renderer.anubis
| @@ -36,6 +36,28 @@ read calexium_lib/web/widgets/css_helper.anubis | @@ -36,6 +36,28 @@ read calexium_lib/web/widgets/css_helper.anubis | ||
| 36 | read calexium_lib/web/widgets/button.anubis | 36 | read calexium_lib/web/widgets/button.anubis |
| 37 | read calexium_lib/web/CXM_urllib.anubis | 37 | read calexium_lib/web/CXM_urllib.anubis |
| 38 | 38 | ||
| 39 | +define HTML_Off_Form | ||
| 40 | + table_view_selector | ||
| 41 | + ( | ||
| 42 | + (String) -> String _T, //translator function | ||
| 43 | + VTM_view vtm_v, //virtual table manager view | ||
| 44 | + String current_view // | ||
| 45 | + )= | ||
| 46 | + if length(vtm_v.get_all_view_name(unique)) = 1 then | ||
| 47 | + empty | ||
| 48 | + else | ||
| 49 | + form( "table_view_selector", [], "", [], | ||
| 50 | + actioner(same, same, | ||
| 51 | + immediate_selector([id("select_view")], | ||
| 52 | + wan("view_name"), //web arg name of the selected entry | ||
| 53 | + 1, | ||
| 54 | + map((String view_name) |-> ([], wav(view_name), _T(view_name)), vtm_v.get_all_view_name(unique)), | ||
| 55 | + success(init(_T(current_view))), | ||
| 56 | + "" | ||
| 57 | + ), | ||
| 58 | + hkc_view_table, | ||
| 59 | + [("table_name", vtm_v.table_name)], [])) | ||
| 60 | +. | ||
| 39 | 61 | ||
| 40 | 62 | ||
| 41 | // View table part | 63 | // View table part |
| @@ -212,20 +234,21 @@ public define HTML_Partial_Content | @@ -212,20 +234,21 @@ public define HTML_Partial_Content | ||
| 212 | String lang, | 234 | String lang, |
| 213 | String web_site_directory, | 235 | String web_site_directory, |
| 214 | String action_name, | 236 | String action_name, |
| 215 | - VT_view rows, | 237 | + VTM_view vtm_v, |
| 238 | + String view_name, | ||
| 216 | String clause | 239 | String clause |
| 217 | ) = | 240 | ) = |
| 218 | - | ||
| 219 | -// if tb is tool_box(lang, _T, _, _, db, _) then | ||
| 220 | -// println("view_table_page - lang : "+lang); | ||
| 221 | -// println("view_table_page - web_site_directory : "+web_site_directory); | 241 | + with current_view = vtm_v.get_view(view_name), |
| 222 | with uid = generate_random_string(20)+"_", | 242 | with uid = generate_random_string(20)+"_", |
| 223 | partial_content(jq_dialog_init + jq_datetimepicker_init(lang), | 243 | partial_content(jq_dialog_init + jq_datetimepicker_init(lang), |
| 224 | - [html_wave_box_wide(_T(to_upper(rows.table_name)), | 244 | + [html_wave_box_wide(_T(to_upper(current_view.table_name)), |
| 225 | sequence([ | 245 | sequence([ |
| 226 | - partial(jq_dialog_create(dialog_id(uid+action_name+"_dlg_ajax"), ajax(controller_action("hk_c", "ajax_edit_table&table_name="+rows.table_name)))), | ||
| 227 | - partial(img_button(icn16_add, [event(onclick, jq_dialog_open(dialog_id(uid+action_name+"_dlg_ajax")))], "", [])), | ||
| 228 | - partial(jqGrid_table(db, uid, rows, _T, lang, clause)) | 246 | + partial(jq_dialog_create(dialog_id(uid+action_name+"_dlg_ajax"), ajax(controller_action("hk_c", "ajax_edit_table&table_name="+current_view.table_name)))), |
| 247 | + div([class("inline")], sequence([ | ||
| 248 | + partial(img_button(icn16_add, [event(onclick, jq_dialog_open(dialog_id(uid+action_name+"_dlg_ajax")))], "", [])), | ||
| 249 | + table_view_selector(_T, vtm_v, view_name), | ||
| 250 | + ])), | ||
| 251 | + partial(jqGrid_table(db, uid, current_view, _T, lang, clause)) | ||
| 229 | //partial(jquery_datatable(uid+"table_view", view_table_form(_T, uid, action_name, rows), true, false, jq_dt_pt_full_numbers, false, scrollY(500), true, true, true, lang, no_extra, web_site_directory)) | 252 | //partial(jquery_datatable(uid+"table_view", view_table_form(_T, uid, action_name, rows), true, false, jq_dt_pt_full_numbers, false, scrollY(500), true, true, true, lang, no_extra, web_site_directory)) |
| 230 | ]))]). | 253 | ]))]). |
| 231 | 254 | ||
| @@ -237,21 +260,20 @@ public define HTML_Partial_Content | @@ -237,21 +260,20 @@ public define HTML_Partial_Content | ||
| 237 | String lang, | 260 | String lang, |
| 238 | String web_site_directory, | 261 | String web_site_directory, |
| 239 | String action_name, | 262 | String action_name, |
| 240 | - VT_view rows, | 263 | + VTM_view vtm_v, |
| 264 | + String view_name, | ||
| 241 | String clause | 265 | String clause |
| 242 | ) = | 266 | ) = |
| 243 | - | ||
| 244 | -// if tb is tool_box(lang, _T, _, _, db, _) then | ||
| 245 | -// println("view_table_page - lang : "+lang); | ||
| 246 | -// println("view_table_page - web_site_directory : "+web_site_directory); | 267 | + with current_view = vtm_v.get_view(view_name), |
| 247 | with uid = generate_random_string(20)+"_", | 268 | with uid = generate_random_string(20)+"_", |
| 248 | partial_content( | 269 | partial_content( |
| 249 | jq_dialog_init + | 270 | jq_dialog_init + |
| 250 | jq_datetimepicker_init(lang), | 271 | jq_datetimepicker_init(lang), |
| 251 | [ | 272 | [ |
| 252 | - partial(jq_dialog_create(dialog_id(uid+action_name+"_dlg_ajax"), ajax(controller_action("hk_c", "ajax_edit_table&table_name="+rows.table_name)))), | ||
| 253 | - partial(img_button(icn16_add, [event(onclick, jq_dialog_open(dialog_id(uid+action_name+"_dlg_ajax")))], "", [])), | ||
| 254 | - partial(jqGrid_table(db, uid, rows, _T, lang, clause)), | 273 | + partial(jq_dialog_create(dialog_id(uid+action_name+"_dlg_ajax"), ajax(controller_action("hk_c", "ajax_edit_table&table_name="+current_view.table_name)))), |
| 274 | + partial(img_button(icn16_add, [event(onclick, jq_dialog_open(dialog_id(uid+action_name+"_dlg_ajax")))], "", [])), | ||
| 275 | + //table_view_selector(_T, vtm_v, view_name), | ||
| 276 | + partial(jqGrid_table(db, uid, current_view, _T, lang, clause)), | ||
| 255 | //partial(jquery_datatable(uid+"table_view", view_table_form(_T, uid, action_name, rows), true, false, jq_dt_pt_full_numbers, false, scrollY(200), true, true, true, lang, no_extra, web_site_directory)) | 277 | //partial(jquery_datatable(uid+"table_view", view_table_form(_T, uid, action_name, rows), true, false, jq_dt_pt_full_numbers, false, scrollY(200), true, true, true, lang, no_extra, web_site_directory)) |
| 256 | ]). | 278 | ]). |
| 257 | 279 | ||
| @@ -272,7 +294,7 @@ public define Maybe(HTML_Partial_Content) | @@ -272,7 +294,7 @@ public define Maybe(HTML_Partial_Content) | ||
| 272 | { | 294 | { |
| 273 | failure then failure, | 295 | failure then failure, |
| 274 | success(vtm_v) then | 296 | success(vtm_v) then |
| 275 | - success(view_table_page(db, _T, lang, web_site_directory, action_name, vtm_v.get_view(view_name), clause)) | 297 | + success(view_table_page(db, _T, lang, web_site_directory, action_name, vtm_v, view_name, clause)) |
| 276 | }. | 298 | }. |
| 277 | 299 | ||
| 278 | public define Maybe(HTML_Partial_Content) | 300 | public define Maybe(HTML_Partial_Content) |
| @@ -292,7 +314,7 @@ public define Maybe(HTML_Partial_Content) | @@ -292,7 +314,7 @@ public define Maybe(HTML_Partial_Content) | ||
| 292 | { | 314 | { |
| 293 | failure then failure, | 315 | failure then failure, |
| 294 | success(vtm_v) then | 316 | success(vtm_v) then |
| 295 | - success(view_table(db, _T, lang, web_site_directory, action_name, vtm_v.get_view(view_name), clause)) | 317 | + success(view_table(db, _T, lang, web_site_directory, action_name, vtm_v, view_name, clause)) |
| 296 | }. | 318 | }. |
| 297 | 319 | ||
| 298 | define CXM_Form_Field | 320 | define CXM_Form_Field |
view/view_table_types.anubis
| @@ -88,7 +88,7 @@ public type VT_View_DB_Calls: | @@ -88,7 +88,7 @@ public type VT_View_DB_Calls: | ||
| 88 | . | 88 | . |
| 89 | 89 | ||
| 90 | public type VT_view: | 90 | public type VT_view: |
| 91 | - vt_view(String table_name, String view_name, VT_view_model view_model, VT_view_row_header header, VT_View_DB_Calls db_calls). , List(VT_view_row) list). | 91 | + vt_view(String table_name, String view_name, VT_view_model view_model, VT_view_row_header header, VT_View_DB_Calls db_calls). |
| 92 | 92 | ||
| 93 | 93 | ||
| 94 | public type VT_action: | 94 | public type VT_action: |