From e848c4b3e67a107f52642d8ec60d173288c5887f Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Sat, 2 Apr 2016 03:56:53 +1100 Subject: [PATCH] Add visibility icons to config page --- assets/css/admin.css | 8 +++++ .../class-sp-meta-box-performance-details.php | 21 ++++++++++++ .../class-sp-meta-box-statistic-details.php | 2 +- includes/admin/views/html-admin-config.php | 33 +++++++++++++++++-- 4 files changed, 61 insertions(+), 3 deletions(-) diff --git a/assets/css/admin.css b/assets/css/admin.css index c14e3047..823db4e9 100644 --- a/assets/css/admin.css +++ b/assets/css/admin.css @@ -155,6 +155,14 @@ text-align: right; } +.sp-admin-config-table .sp-visibility-icon { + color: #ddd; +} + +.sp-admin-config-table .sp-visibility-icon-visible { + color: #555; +} + .sportspress table.form-table .sp-color-option { max-width: 225px; } diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-performance-details.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-performance-details.php index a7464234..fd4c36d7 100644 --- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-performance-details.php +++ b/includes/admin/post-types/meta-boxes/class-sp-meta-box-performance-details.php @@ -29,6 +29,11 @@ class SP_Meta_Box_Performance_Details extends SP_Meta_Box_Config { } else { $readonly = false; } + + // Options + $visibility_options = apply_filters( 'sportspress_statistic_visibility_options', array( 'sp_event', 'sp_player' ) ); + + // Post Meta $section = get_post_meta( $post->ID, 'sp_section', true ); if ( '' === $section ) { $section = -1; @@ -37,6 +42,10 @@ class SP_Meta_Box_Performance_Details extends SP_Meta_Box_Config { if ( '' === $format ) { $format = 'number'; } + $visibility = get_post_meta( $post->ID, 'sp_visibility', true ); + if ( ! is_array( $visibility ) ) { + $visibility = $visibility_options; + } ?>

@@ -65,6 +74,17 @@ class SP_Meta_Box_Performance_Details extends SP_Meta_Box_Config { ?>

+

+ ID, 'sp_visibility', true ); // Options - $visibility_options = apply_filters( 'sportspress_statistic_visibility_options', array( 'sp_event', 'sp_player', 'sp_list' ) ); + $visibility_options = apply_filters( 'sportspress_statistic_visibility_options', array( 'sp_event', 'sp_player' ) ); // Defaults if ( '' === $precision ) $precision = 0; diff --git a/includes/admin/views/html-admin-config.php b/includes/admin/views/html-admin-config.php index 83ec3fb8..32666906 100644 --- a/includes/admin/views/html-admin-config.php +++ b/includes/admin/views/html-admin-config.php @@ -1,3 +1,12 @@ +labels->singular_name; +} +?> +

@@ -152,7 +161,7 @@

- +
@@ -164,6 +173,7 @@ + @@ -185,6 +195,10 @@ + ID, 'sp_visibility', true ); + if ( ! is_array( $visibility ) ) $visibility = $visibility_options; + ?> > + @@ -348,22 +367,32 @@ + + ID, 'sp_visibility', true ); + if ( ! is_array( $visibility ) ) $visibility = $visibility_options; + ?> > + - +
post_name ); ?>> @@ -201,6 +215,11 @@ post_name; ?> ID ); ?> ID ); ?> + + + +

post_excerpt; ?>

post_title; ?> ID ); ?> ID ); ?> ID ); ?> + + + +

post_excerpt; ?>