diff --git a/assets/css/admin.css b/assets/css/admin.css index 0ca632b1..a717aaf6 100644 --- a/assets/css/admin.css +++ b/assets/css/admin.css @@ -23,6 +23,10 @@ content: "\f164"; } +.sp-dummy { + display: none; +} + #sp_videodiv .inside > fieldset > p:first-child { margin-top: 7px !important; } diff --git a/assets/js/admin/sportspress-admin.js b/assets/js/admin/sportspress-admin.js index 8ef35519..455ced27 100644 --- a/assets/js/admin/sportspress-admin.js +++ b/assets/js/admin/sportspress-admin.js @@ -127,6 +127,14 @@ jQuery(document).ready(function($){ // Activate self-cloning $(".sp-clone:last").find("select").change(); + // Dummy controller + $(".sp-has-dummy").change(function() { + val = $(this).val(); + if ( val == -1 ) val = 0; + name = $(this).attr("name"); + $(".sp-dummy."+name+"-dummy").val(val).trigger("change"); + }); + // Custom value editor $(".sp-data-table .sp-default-value").click(function() { $(this).hide().siblings(".sp-custom-value").show().find(".sp-custom-value-input").focus(); diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-details.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-details.php index fa1f607b..6845b520 100644 --- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-details.php +++ b/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-details.php @@ -30,6 +30,7 @@ class SP_Meta_Box_Event_Details { $args = array( 'taxonomy' => 'sp_league', 'name' => 'sp_league', + 'class' => 'sp-has-dummy', 'selected' => $league_id, 'values' => 'term_id', 'show_option_none' => __( '-- Not set --', 'sportspress' ), @@ -47,6 +48,7 @@ class SP_Meta_Box_Event_Details { $args = array( 'taxonomy' => 'sp_season', 'name' => 'sp_season', + 'class' => 'sp-has-dummy', 'selected' => $season_id, 'values' => 'term_id', 'show_option_none' => __( '-- Not set --', 'sportspress' ), diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-teams.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-teams.php index da7eb8e3..4fd927bc 100644 --- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-teams.php +++ b/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-teams.php @@ -21,10 +21,38 @@ class SP_Meta_Box_Event_Teams { public static function output( $post ) { $limit = get_option( 'sportspress_event_teams', 2 ); $teams = (array) get_post_meta( $post->ID, 'sp_team', false ); + $league_id = sp_get_the_term_id( $post->ID, 'sp_league', 0 ); + $season_id = sp_get_the_term_id( $post->ID, 'sp_season', 0 ); for ( $i = 0; $i < $limit; $i ++ ): $team = array_shift( $teams ); ?>
+ 'sp_league', + 'name' => 'sp_league_dummy', + 'class' => 'sp-dummy sp_league-dummy', + 'show_option_all' => __( 'All', 'sportspress' ), + 'selected' => $league_id, + 'values' => 'term_id', + ); + sp_dropdown_taxonomies( $args ); + ?> +
++ 'sp_season', + 'name' => 'sp_season_dummy', + 'class' => 'sp-dummy sp_season-dummy', + 'show_option_all' => __( 'All', 'sportspress' ), + 'selected' => $season_id, + 'values' => 'term_id', + ); + sp_dropdown_taxonomies( $args ); + ?> +
ID, 'sp_player', 'block', 'sp_current_team', $i ); - sp_post_checklist( $post->ID, 'sp_staff', 'none', 'sp_current_team', $i ); + sp_post_checklist( $post->ID, 'sp_player', 'block', array( 'sp_league', 'sp_season', 'sp_current_team' ), $i ); + sp_post_checklist( $post->ID, 'sp_staff', 'none', array( 'sp_league', 'sp_season', 'sp_current_team' ), $i ); ?>