From c8a9e1df89c8a4f9b6ddd65eb94a77feb8eeaa4c Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Fri, 6 May 2016 22:07:49 +1000 Subject: [PATCH] Display squad numbers in defense section and sync statistics when editing event --- assets/js/admin/sportspress-admin.js | 20 +++++++++++++++++ .../class-sp-meta-box-event-performance.php | 22 +++++++++---------- templates/event-performance-table.php | 8 +++---- 3 files changed, 35 insertions(+), 15 deletions(-) diff --git a/assets/js/admin/sportspress-admin.js b/assets/js/admin/sportspress-admin.js index 5d85e537..ddad9827 100644 --- a/assets/js/admin/sportspress-admin.js +++ b/assets/js/admin/sportspress-admin.js @@ -262,6 +262,26 @@ jQuery(document).ready(function($){ // Trigger total stats calculator $(".sp-data-table .sp-total input").trigger("updateTotal"); + // Sync inputs + $(".sp-sync-input").on("keyup", function() { + name = $(this).attr("name"); + $el = $("input[name='"+name+"']"); + if ( $el.length > 1 ) { + val = $(this).val(); + $el.val(val); + } + }); + + // Sync selects + $(".sp-sync-select").on("change", function() { + name = $(this).attr("name"); + $el = $("select[name='"+name+"']") + if ( $el.length > 1 ) { + val = $(this).val(); + $el.val(val); + } + }); + // Select all checkboxes $(".sp-select-all-range").on("change", ".sp-select-all", function() { $range = $(this).closest(".sp-select-all-range"); diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-performance.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-performance.php index b997d596..ec609e18 100644 --- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-performance.php +++ b/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-performance.php @@ -5,7 +5,7 @@ * @author ThemeBoy * @category Admin * @package SportsPress/Admin/Meta_Boxes - * @version 2.0 + * @version 2.0.6 */ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly @@ -238,7 +238,7 @@ class SP_Meta_Box_Event_Performance {   - + # @@ -259,7 +259,7 @@ class SP_Meta_Box_Event_Performance { - + @@ -281,7 +281,7 @@ class SP_Meta_Box_Event_Performance {   - +   @@ -297,7 +297,7 @@ class SP_Meta_Box_Event_Performance { ?> - +   @@ -318,9 +318,9 @@ class SP_Meta_Box_Event_Performance { - + - + @@ -356,10 +356,10 @@ class SP_Meta_Box_Event_Performance { $placeholder = sp_get_format_placeholder( sp_array_value( $formats, $column, 'number' ) ); ?> - + - + @@ -382,7 +382,7 @@ class SP_Meta_Box_Event_Performance { 'sub' => __( 'Substitute', 'sportspress' ), ) ); - $output = ''; foreach( $options as $key => $name ): $output .= ''; @@ -402,7 +402,7 @@ class SP_Meta_Box_Event_Performance { if ( ! $team_id || ! $player_id ) return '—'; - $output = ''; $output .= ''; diff --git a/templates/event-performance-table.php b/templates/event-performance-table.php index 09a24f99..b45deadc 100644 --- a/templates/event-performance-table.php +++ b/templates/event-performance-table.php @@ -4,7 +4,7 @@ * * @author ThemeBoy * @package SportsPress/Templates - * @version 2.0 + * @version 2.0.6 */ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly @@ -30,7 +30,7 @@ if ( ! isset( $subs ) ) $subs = array(); - + # @@ -77,7 +77,7 @@ if ( ! isset( $subs ) ) $subs = array(); echo ''; - if ( $show_numbers && 1 !== $section ) { + if ( apply_filters( 'sportspress_event_performance_show_numbers', $show_numbers, $section ) ) { $number = sp_array_value( $row, 'number', ' ' ); // Player number @@ -171,7 +171,7 @@ if ( ! isset( $subs ) ) $subs = array();  '; } echo '' . __( 'Total', 'sportspress' ) . '';