diff --git a/assets/css/admin.css b/assets/css/admin.css index df5e6e22..b0b29558 100644 --- a/assets/css/admin.css +++ b/assets/css/admin.css @@ -146,6 +146,7 @@ } .sp-data-table-container { + clear: both; overflow: auto; } diff --git a/assets/js/admin/sportspress-admin.js b/assets/js/admin/sportspress-admin.js index 7883a71b..efa67d3d 100644 --- a/assets/js/admin/sportspress-admin.js +++ b/assets/js/admin/sportspress-admin.js @@ -145,6 +145,7 @@ jQuery(document).ready(function($){ placeholder = parseFloat($el.attr("data-placeholder")); current_adjustment = parseFloat($el.attr("data-adjustment")); adjustment = parseFloat($(this).val()); + if(isNaN(placeholder)) placeholder = 0; if(isNaN(current_adjustment)) current_adjustment = 0; if(isNaN(adjustment)) adjustment = 0; placeholder += adjustment - current_adjustment; diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-list-data.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-list-data.php index d6c1a084..c549ca0f 100644 --- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-list-data.php +++ b/includes/admin/post-types/meta-boxes/class-sp-meta-box-list-data.php @@ -21,7 +21,7 @@ class SP_Meta_Box_List_Data { public static function output( $post ) { $list = new SP_Player_List( $post ); list( $columns, $usecolumns, $data, $placeholders, $merged ) = $list->data( true ); - $adjustments = get_post_meta( $post->ID, 'sp_adjustments', true ); + $adjustments = $list->adjustments; self::table( $columns, $usecolumns, $data, $placeholders, $adjustments ); } @@ -37,11 +37,15 @@ class SP_Meta_Box_List_Data { /** * Admin edit table */ - public static function table( $columns = array(), $usecolumns = null, $data = array(), $placeholders = array() ) { + public static function table( $columns = array(), $usecolumns = null, $data = array(), $placeholders = array(), $adjustments = array() ) { if ( is_array( $usecolumns ) ) $usecolumns = array_filter( $usecolumns ); ?> -
+ +
@@ -55,6 +59,66 @@ class SP_Meta_Box_List_Data { + + 0 ): + $i = 0; + foreach ( $data as $player_id => $player_stats ): + if ( !$player_id ) continue; + $div = get_term( $player_id, 'sp_season' ); + $number = get_post_meta( $player_id, 'sp_number', true ); + + $default_name = sp_array_value( $player_stats, 'name', '' ); + if ( $default_name == null ) + $default_name = get_the_title( $player_id ); + ?> + + + + $label ): + $value = sp_array_value( $player_stats, $column, '' ); + $placeholder = sp_array_value( sp_array_value( $placeholders, $player_id, array() ), $column, 0 ); + ?> + + + + + + + + + +
+ + + + + +
+ +
+
+