Add chronological streak format to league table column equation generator
This commit is contained in:
@@ -94,6 +94,8 @@ class SP_Admin_Assets {
|
||||
|
||||
wp_register_script( 'sportspress-admin-equationbuilder', SP()->plugin_url() . '/assets/js/admin/equationbuilder.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-draggable', 'jquery-ui-droppable' ), SP_VERSION, true );
|
||||
|
||||
wp_register_script( 'sportspress-admin-colorpicker', SP()->plugin_url() . '/assets/js/admin/colorpicker.js', array( 'jquery', 'wp-color-picker', 'iris' ), SP_VERSION, true );
|
||||
|
||||
wp_register_script( 'sportspress-admin-widgets', SP()->plugin_url() . '/assets/js/admin/widgets.js', array( 'jquery' ), SP_VERSION, true );
|
||||
|
||||
wp_register_script( 'sportspress-admin-quickeditor', SP()->plugin_url() . '/assets/js/admin/quickeditor.js', array( 'jquery' ), SP_VERSION, true );
|
||||
@@ -137,6 +139,11 @@ class SP_Admin_Assets {
|
||||
wp_enqueue_script( 'sportspress-admin-locationpicker' );
|
||||
}
|
||||
|
||||
// Edit color
|
||||
if ( in_array( $screen->id, array( 'sp_outcome' ) ) ) {
|
||||
wp_enqueue_script( 'sportspress-admin-colorpicker' );
|
||||
}
|
||||
|
||||
// Edit equation
|
||||
if ( in_array( $screen->id, array( 'sp_result', 'sp_performance', 'sp_column', 'sp_statistic' ) ) ) {
|
||||
wp_enqueue_script( 'sportspress-admin-equationbuilder' );
|
||||
|
||||
@@ -43,7 +43,7 @@ class SP_Meta_Box_Equation {
|
||||
$options[ 'Outcomes' ] = self::optgroup( 'sp_outcome' );
|
||||
break;
|
||||
case 'preset':
|
||||
$options[ 'Presets' ] = array( '$gamesback' => __( 'Games Back', 'sportspress' ), '$homerecord' => __( 'Home Record', 'sportspress' ), '$awayrecord' => __( 'Away Record', 'sportspress' ), '$streak' => __( 'Streak', 'sportspress' ), '$last5' => __( 'Last 5', 'sportspress' ), '$last10' => __( 'Last 10', 'sportspress' ) );
|
||||
$options[ 'Presets' ] = array( '$gamesback' => __( 'Games Back', 'sportspress' ), '$homerecord' => __( 'Home Record', 'sportspress' ), '$awayrecord' => __( 'Away Record', 'sportspress' ), '$streak' => __( 'Streak', 'sportspress' ), '$form' => __( 'Form', 'sportspress' ), '$last5' => __( 'Last 5', 'sportspress' ), '$last10' => __( 'Last 10', 'sportspress' ) );
|
||||
break;
|
||||
case 'subset':
|
||||
$options[ 'Subsets' ] = array( '_home' => '@' . __( 'Home', 'sportspress' ), '_away' => '@' . __( 'Away', 'sportspress' ), '_venue' => '@' . __( 'Venue', 'sportspress' ) );
|
||||
|
||||
@@ -30,10 +30,13 @@ class SP_Meta_Box_Outcome_Details extends SP_Meta_Box_Config {
|
||||
$readonly = false;
|
||||
}
|
||||
$abbreviation = get_post_meta( $post->ID, 'sp_abbreviation', true );
|
||||
$color = get_post_meta( $post->ID, 'sp_color', true );
|
||||
$condition = get_post_meta( $post->ID, 'sp_condition', true );
|
||||
$main_result = get_option( 'sportspress_primary_result', null );
|
||||
$result = get_page_by_path( $main_result, ARRAY_A, 'sp_result' );
|
||||
$label = sp_array_value( $result, 'post_title', __( 'Primary', 'sportspress' ) );
|
||||
|
||||
if ( '' === $color ) $color = '#888888';
|
||||
?>
|
||||
<p><strong><?php _e( 'Variable', 'sportspress' ); ?></strong></p>
|
||||
<p>
|
||||
@@ -44,6 +47,13 @@ class SP_Meta_Box_Outcome_Details extends SP_Meta_Box_Config {
|
||||
<p>
|
||||
<input name="sp_abbreviation" type="text" id="sp_abbreviation" value="<?php echo $abbreviation; ?>" placeholder="<?php echo substr( $post->post_title, 0, 1 ); ?>">
|
||||
</p>
|
||||
<p><strong><?php _e( 'Color', 'sportspress' ); ?></strong></p>
|
||||
<p>
|
||||
<div class="sp-color-box">
|
||||
<input name="sp_color" id="sp_color" type="text" value="<?php echo $color; ?>" class="colorpick">
|
||||
<div id="sp_color" class="colorpickdiv"></div>
|
||||
</div>
|
||||
</p>
|
||||
<p><strong><?php _e( 'Condition', 'sportspress' ); ?></strong></p>
|
||||
<p>
|
||||
<select name="sp_condition">
|
||||
@@ -72,6 +82,7 @@ class SP_Meta_Box_Outcome_Details extends SP_Meta_Box_Config {
|
||||
*/
|
||||
public static function save( $post_id, $post ) {
|
||||
update_post_meta( $post_id, 'sp_abbreviation', sp_array_value( $_POST, 'sp_abbreviation', array() ) );
|
||||
update_post_meta( $post_id, 'sp_color', sp_array_value( $_POST, 'sp_color', array() ) );
|
||||
update_post_meta( $post_id, 'sp_condition', sp_array_value( $_POST, 'sp_condition', array() ) );
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user