From 05c441e82fcc2a4d31ced7b2efd349035c3cd7db Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Mon, 6 Jan 2014 12:56:41 +1100 Subject: [PATCH] Add status column to event player row --- assets/js/admin.js | 18 ++++++++++++ sportspress-functions.php | 59 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 75 insertions(+), 2 deletions(-) diff --git a/assets/js/admin.js b/assets/js/admin.js index 25bf58e9..e672b164 100644 --- a/assets/js/admin.js +++ b/assets/js/admin.js @@ -116,11 +116,29 @@ jQuery(document).ready(function($){ } else { $equationselector.prop( 'disabled', false ) } + }); // Trigger format selector $('.sp-format-selector select:first').change(); + // Status selector + $('.sp-status-selector select:first-child').change(function() { + + $subselector = $(this).siblings(); + + // Sub settings + if($(this).val() == 'sub') { + $subselector.show(); + } else { + $subselector.hide(); + } + + }); + + // Trigger status selector + $('.sp-status-selector select:first-child').change(); + // Remove slug editor in quick edit for slug-sensitive post types $('.inline-edit-sp_result, .inline-edit-sp_outcome, .inline-edit-sp_column, .inline-edit-sp_statistic').find('input[name=post_name]').closest('label').remove(); diff --git a/sportspress-functions.php b/sportspress-functions.php index b231de23..975ecbcd 100644 --- a/sportspress-functions.php +++ b/sportspress-functions.php @@ -716,6 +716,53 @@ if ( !function_exists( 'sp_event_results_table' ) ) { } } +if ( !function_exists( 'sp_event_player_status_selector' ) ) { + function sp_event_player_status_selector( $team_id, $player_id, $value ) { + + if ( ! $team_id || ! $player_id ) + return '—'; + + $options = array( + 'lineup' => __( 'Starting Lineup', 'sportspress' ), + 'sub' => __( 'Substitute', 'sportspress' ), + ); + + $output = ''; + + return $output; + + } +} + +if ( !function_exists( 'sp_event_player_sub_selector' ) ) { + function sp_event_player_sub_selector( $team_id, $player_id, $value, $data = array() ) { + + if ( ! $team_id || ! $player_id ) + return '—'; + + $output = ''; + + return $output; + + } +} + if ( !function_exists( 'sp_event_players_table' ) ) { function sp_event_players_table( $columns = array(), $data = array(), $team_id ) { ?> @@ -726,6 +773,7 @@ if ( !function_exists( 'sp_event_players_table' ) ) { + @@ -739,10 +787,16 @@ if ( !function_exists( 'sp_event_players_table' ) ) { $label ): - $value = sp_array_value( $player_statistics, $column, '' ); + $value = sp_array_value( $player_statistics, $column, '' ); ?> - + + + + + + + +