From 282f86a86c9bcd6e523e0ed32330fa6f08ea1097 Mon Sep 17 00:00:00 2001 From: Richa Ferry Setyawan Date: Sat, 21 Sep 2024 04:49:22 +0700 Subject: [PATCH] hide empty tab --- .../checklists/assets/js/global-checklists.js | 3 + .../templates/global-checklists.php | 116 +++++++++++------- 2 files changed, 74 insertions(+), 45 deletions(-) diff --git a/modules/checklists/assets/js/global-checklists.js b/modules/checklists/assets/js/global-checklists.js index 0d1eeff9..bba12b19 100644 --- a/modules/checklists/assets/js/global-checklists.js +++ b/modules/checklists/assets/js/global-checklists.js @@ -145,6 +145,9 @@ //add active class to title tab $('.pp-checklists-tabs li:first-child a').addClass('active'); + $('.pp-checklists-tab-body').hide(); + $('#pp-checklists-tab-body-' + post_type).show(); + const current_data_tab = $('#list-' + post_type) .find('li a.active') diff --git a/modules/checklists/templates/global-checklists.php b/modules/checklists/templates/global-checklists.php index 8ddf0f0d..7515a88d 100644 --- a/modules/checklists/templates/global-checklists.php +++ b/modules/checklists/templates/global-checklists.php @@ -23,19 +23,24 @@ */ $i = 0; foreach ($context['post_types'] as $post_type_key => $post_type_label) { ?> - @@ -58,45 +63,66 @@ class="" - - $post_type_requirements) : ?> - - - - - get_setting_title_html(); - ?> - - - get_setting_action_list_html(); ?> - + $post_type_label) : ?> + + $tabInfo) : + foreach ($context['requirements'] as $post_type => $post_type_requirements) : ?> - - get_setting_field_html(); + + group === $group) : + $group_has_requirements = true; ?> - - + + + + get_setting_title_html(); + ?> + + + get_setting_action_list_html(); ?> + + + + get_setting_field_html(); + ?> + + + + + + + + + + + + - - + +