Enable editing Key field in Metrics and Performance

This commit is contained in:
Brian Miyaji
2014-03-31 23:28:40 +11:00
parent f2018ce954
commit 71a2ae95d4
9 changed files with 83 additions and 25 deletions

View File

@@ -56,7 +56,14 @@
width: 6%; width: 6%;
} }
.fixed .column-sp_league, .fixed .column-sp_season, .fixed .column-sp_venue, .fixed .column-sp_position, .fixed .column-sp_views { .post-type-sp_event .fixed .column-sp_league,
.post-type-sp_calendar .fixed .column-sp_league,
.post-type-sp_event .fixed .column-sp_season,
.post-type-sp_calendar .fixed .column-sp_season,
.post-type-sp_event .fixed .column-sp_venue,
.post-type-sp_calendar .fixed .column-sp_venue,
.post-type-sp_player .fixed .column-sp_position,
.fixed .column-sp_views {
width: 10%; width: 10%;
} }

View File

@@ -81,11 +81,11 @@
} }
#sportspress_dashboard_status .sp_status_list li.events-scheduled a:before { #sportspress_dashboard_status .sp_status_list li.events-scheduled a:before {
color: #ffba00; color: #f9af4b;
} }
#sportspress_dashboard_status .sp_status_list li.events-published a:before { #sportspress_dashboard_status .sp_status_list li.events-published a:before {
color: #21759b; color: #00a69c;
} }
#sportspress_dashboard_status .sp_status_list li strong { #sportspress_dashboard_status .sp_status_list li strong {

View File

@@ -41,6 +41,7 @@ class SP_Admin_CPT_Metric extends SP_Admin_CPT {
$columns = array( $columns = array(
'cb' => '<input type="checkbox" />', 'cb' => '<input type="checkbox" />',
'title' => __( 'Label', 'sportspress' ), 'title' => __( 'Label', 'sportspress' ),
'sp_key' => __( 'Key', 'sportspress' ),
'sp_position' => __( 'Positions', 'sportspress' ), 'sp_position' => __( 'Positions', 'sportspress' ),
); );
return $columns; return $columns;

View File

@@ -32,6 +32,9 @@ class SP_Admin_Meta_Boxes {
// Save Outcome Meta Boxes // Save Outcome Meta Boxes
add_action( 'sportspress_process_sp_outcome_meta', 'SP_Meta_Box_Outcome_Details::save', 10, 2 ); add_action( 'sportspress_process_sp_outcome_meta', 'SP_Meta_Box_Outcome_Details::save', 10, 2 );
// Save Metric Meta Boxes
add_action( 'sportspress_process_sp_metric_meta', 'SP_Meta_Box_Metric_Details::save', 10, 2 );
// Save Performance Meta Boxes // Save Performance Meta Boxes
add_action( 'sportspress_process_sp_performance_meta', 'SP_Meta_Box_Performance_Details::save', 10, 2 ); add_action( 'sportspress_process_sp_performance_meta', 'SP_Meta_Box_Performance_Details::save', 10, 2 );
@@ -80,12 +83,15 @@ class SP_Admin_Meta_Boxes {
// Outcomes // Outcomes
add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'SP_Meta_Box_Outcome_Details::output', 'sp_outcome', 'normal', 'high' ); add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'SP_Meta_Box_Outcome_Details::output', 'sp_outcome', 'normal', 'high' );
// Performance
add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'SP_Meta_Box_Performance_Details::output', 'sp_performance', 'normal', 'high' );
// Columns // Columns
add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'SP_Meta_Box_Column_Details::output', 'sp_column', 'normal', 'high' ); add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'SP_Meta_Box_Column_Details::output', 'sp_column', 'normal', 'high' );
// Performance
add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'SP_Meta_Box_Metric_Details::output', 'sp_metric', 'normal', 'high' );
// Performance
add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'SP_Meta_Box_Performance_Details::output', 'sp_performance', 'normal', 'high' );
// Events // Events
add_meta_box( 'sp_formatdiv', __( 'Format', 'sportspress' ), 'SP_Meta_Box_Event_Format::output', 'sp_event', 'side', 'default' ); add_meta_box( 'sp_formatdiv', __( 'Format', 'sportspress' ), 'SP_Meta_Box_Event_Format::output', 'sp_event', 'side', 'default' );
add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'SP_Meta_Box_Event_Details::output', 'sp_event', 'side', 'default' ); add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'SP_Meta_Box_Event_Details::output', 'sp_event', 'side', 'default' );

View File

@@ -0,0 +1,38 @@
<?php
/**
* Metric Details
*
* @author ThemeBoy
* @category Admin
* @package SportsPress/Admin/Meta Boxes
* @version 0.7.3
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* SP_Meta_Box_Metric_Details
*/
class SP_Meta_Box_Metric_Details {
/**
* Output the metabox
*/
public static function output( $post ) {
wp_nonce_field( 'sportspress_save_data', 'sportspress_meta_nonce' );
$calculate = get_post_meta( $post->ID, 'sp_calculate', true );
?>
<p><strong><?php _e( 'Key', 'sportspress' ); ?></strong></p>
<p>
<input name="sp_key" type="text" id="sp_key" value="<?php echo $post->post_name; ?>">
</p>
<?php
}
/**
* Save meta box data
*/
public static function save( $post_id, $post ) {
sp_delete_duplicate_post( $_POST );
}
}

View File

@@ -5,7 +5,7 @@
* @author ThemeBoy * @author ThemeBoy
* @category Admin * @category Admin
* @package SportsPress/Admin/Meta Boxes * @package SportsPress/Admin/Meta Boxes
* @version 0.7 * @version 0.7.3
*/ */
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -22,6 +22,10 @@ class SP_Meta_Box_Performance_Details {
wp_nonce_field( 'sportspress_save_data', 'sportspress_meta_nonce' ); wp_nonce_field( 'sportspress_save_data', 'sportspress_meta_nonce' );
$calculate = get_post_meta( $post->ID, 'sp_calculate', true ); $calculate = get_post_meta( $post->ID, 'sp_calculate', true );
?> ?>
<p><strong><?php _e( 'Key', 'sportspress' ); ?></strong></p>
<p>
<input name="sp_key" type="text" id="sp_key" value="<?php echo $post->post_name; ?>">
</p>
<p><strong><?php _e( 'Calculate', 'sportspress' ); ?></strong></p> <p><strong><?php _e( 'Calculate', 'sportspress' ); ?></strong></p>
<p class="sp-calculate-selector"> <p class="sp-calculate-selector">
<?php sp_calculate_selector( $post->ID, $calculate ); ?> <?php sp_calculate_selector( $post->ID, $calculate ); ?>

View File

@@ -281,6 +281,7 @@ class SP_Settings_Config extends SP_Settings_Page {
<thead> <thead>
<tr> <tr>
<th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th> <th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th>
<th scope="col"><?php _e( 'Key', 'sportspress' ); ?></th>
<th scope="col"><?php _e( 'Positions', 'sportspress' ); ?></th> <th scope="col"><?php _e( 'Positions', 'sportspress' ); ?></th>
<th scope="col">&nbsp;</th> <th scope="col">&nbsp;</th>
<th scope="col" class="edit"></th> <th scope="col" class="edit"></th>
@@ -289,6 +290,7 @@ class SP_Settings_Config extends SP_Settings_Page {
<?php $i = 0; foreach ( $data as $row ): ?> <?php $i = 0; foreach ( $data as $row ): ?>
<tr<?php if ( $i % 2 == 0 ) echo ' class="alternate"'; ?>> <tr<?php if ( $i % 2 == 0 ) echo ' class="alternate"'; ?>>
<td class="row-title"><?php echo $row->post_title; ?></td> <td class="row-title"><?php echo $row->post_title; ?></td>
<td><?php echo $row->post_name; ?></td>
<td><?php echo get_the_terms ( $row->ID, 'sp_position' ) ? the_terms( $row->ID, 'sp_position' ) : '&mdash;'; ?></td> <td><?php echo get_the_terms ( $row->ID, 'sp_position' ) ? the_terms( $row->ID, 'sp_position' ) : '&mdash;'; ?></td>
<td>&nbsp;</td> <td>&nbsp;</td>
<td class="edit"><a class="button" href="<?php echo get_edit_post_link( $row->ID ); ?>"><?php _e( 'Edit', 'sportspress' ); ?></s></td> <td class="edit"><a class="button" href="<?php echo get_edit_post_link( $row->ID ); ?>"><?php _e( 'Edit', 'sportspress' ); ?></s></td>
@@ -297,7 +299,7 @@ class SP_Settings_Config extends SP_Settings_Page {
</table> </table>
<div class="tablenav bottom"> <div class="tablenav bottom">
<div class="alignleft actions"> <div class="alignleft actions">
<a class="button" id="doaction" href="<?php echo admin_url( 'edit.php?post_type=sp_metric' ); ?>"><?php _e( 'Edit', 'sportspress' ); ?></a> <a class="button" id="doaction" href="<?php echo admin_url( 'edit.php?post_type=sp_metric' ); ?>"><?php _e( 'View All', 'sportspress' ); ?></a>
<a class="button" id="doaction2" href="<?php echo admin_url( 'post-new.php?post_type=sp_metric' ); ?>"><?php _e( 'Add New', 'sportspress' ); ?></a> <a class="button" id="doaction2" href="<?php echo admin_url( 'post-new.php?post_type=sp_metric' ); ?>"><?php _e( 'Add New', 'sportspress' ); ?></a>
</div> </div>
<br class="clear"> <br class="clear">
@@ -330,6 +332,7 @@ class SP_Settings_Config extends SP_Settings_Page {
<thead> <thead>
<tr> <tr>
<th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th> <th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th>
<th scope="col"><?php _e( 'Key', 'sportspress' ); ?></th>
<th scope="col"><?php _e( 'Positions', 'sportspress' ); ?></th> <th scope="col"><?php _e( 'Positions', 'sportspress' ); ?></th>
<th scope="col"><?php _e( 'Calculate', 'sportspress' ); ?></th> <th scope="col"><?php _e( 'Calculate', 'sportspress' ); ?></th>
<th scope="col" class="edit"></th> <th scope="col" class="edit"></th>
@@ -338,6 +341,7 @@ class SP_Settings_Config extends SP_Settings_Page {
<?php $i = 0; foreach ( $data as $row ): ?> <?php $i = 0; foreach ( $data as $row ): ?>
<tr<?php if ( $i % 2 == 0 ) echo ' class="alternate"'; ?>> <tr<?php if ( $i % 2 == 0 ) echo ' class="alternate"'; ?>>
<td class="row-title"><?php echo $row->post_title; ?></td> <td class="row-title"><?php echo $row->post_title; ?></td>
<td><?php echo $row->post_name; ?></td>
<td><?php echo get_the_terms ( $row->ID, 'sp_position' ) ? the_terms( $row->ID, 'sp_position' ) : '&mdash;'; ?></td> <td><?php echo get_the_terms ( $row->ID, 'sp_position' ) ? the_terms( $row->ID, 'sp_position' ) : '&mdash;'; ?></td>
<td><?php echo sp_get_post_calculate( $row->ID ); ?></td> <td><?php echo sp_get_post_calculate( $row->ID ); ?></td>
<td class="edit"><a class="button" href="<?php echo get_edit_post_link( $row->ID ); ?>"><?php _e( 'Edit', 'sportspress' ); ?></s></td> <td class="edit"><a class="button" href="<?php echo get_edit_post_link( $row->ID ); ?>"><?php _e( 'Edit', 'sportspress' ); ?></s></td>

View File

@@ -4,7 +4,7 @@ Tags: sports, press, sports journalism, teams, team management, fixtures, result
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=support@themeboy.com&item_name=Donation+for+SportsPress Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=support@themeboy.com&item_name=Donation+for+SportsPress
Requires at least: 3.8 Requires at least: 3.8
Tested up to: 3.8.1 Tested up to: 3.8.1
Stable tag: 0.7.2 Stable tag: 0.7.3
License: GPLv3 License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html License URI: http://www.gnu.org/licenses/gpl-3.0.html
@@ -79,19 +79,6 @@ Automatic updates should work like a charm; as always though, ensure you backup
If on the off-chance you do encounter issues with the event/team/player/staff pages after an update you simply need to flush the permalinks by going to WordPress > Settings > Permalinks and hitting 'save'. That should return things to normal. If on the off-chance you do encounter issues with the event/team/player/staff pages after an update you simply need to flush the permalinks by going to WordPress > Settings > Permalinks and hitting 'save'. That should return things to normal.
== Screenshots ==
1. League Table in Twenty Fourteen theme.
2. Events List in Twenty Fourteen theme.
3. Events Calendar in Twenty Fourteen theme.
4. Player List in Twenty Fourteen theme.
5. League Table column configuration.
6. General Options page.
7. Player List widget settings.
8. SportsPress Status dashboard widget.
== Other Notes ==
= Sport Presets = = Sport Presets =
SportsPress comes with settings for some sports that you can apply by going to WordPress > Settings > SportsPress. By selecting a sport, presets will be applied to Events, League Tables, and Players. SportsPress comes with settings for some sports that you can apply by going to WordPress > Settings > SportsPress. By selecting a sport, presets will be applied to Events, League Tables, and Players.
@@ -137,6 +124,17 @@ Metrics are static values associated with players, and are useful for variables
Performance is for keeping track of the performance variables like goals, assists, yellow cards, and red cards. They are displayed on player profile pages, event pages, and player lists. Each player will have their own set of statistics for each event and league per season. You can choose whether to calculate the total or average of each variable by selecting from the “Calculate” dropdown menu. Be sure to select the position(s) that each statistic applies to so it shows up on the appropriate players' profile pages. Performance is for keeping track of the performance variables like goals, assists, yellow cards, and red cards. They are displayed on player profile pages, event pages, and player lists. Each player will have their own set of statistics for each event and league per season. You can choose whether to calculate the total or average of each variable by selecting from the “Calculate” dropdown menu. Be sure to select the position(s) that each statistic applies to so it shows up on the appropriate players' profile pages.
== Screenshots ==
1. League Table in Twenty Fourteen theme with default color scheme.
2. Events List in Twenty Fourteen theme with custom color scheme.
3. Events Calendar in Twenty Fourteen theme with custom color scheme.
4. Player List in Twenty Fourteen theme with custom color scheme.
5. League Table column configuration.
6. General Options page.
7. Player List widget settings.
8. SportsPress Status dashboard widget.
== Frequently Asked Questions == == Frequently Asked Questions ==
= Which sports does this plugin support? = = Which sports does this plugin support? =

View File

@@ -3,7 +3,7 @@
* Plugin Name: SportsPress * Plugin Name: SportsPress
* Plugin URI: http://wordpress.org/plugins/sportspress * Plugin URI: http://wordpress.org/plugins/sportspress
* Description: Manage your club and its players, staff, events, league tables, and player lists. * Description: Manage your club and its players, staff, events, league tables, and player lists.
* Version: 0.7.2 * Version: 0.7.3
* Author: ThemeBoy * Author: ThemeBoy
* Author URI: http://themeboy.com * Author URI: http://themeboy.com
* Requires at least: 3.8 * Requires at least: 3.8
@@ -26,14 +26,14 @@ if ( ! class_exists( 'SportsPress' ) ) :
* Main SportsPress Class * Main SportsPress Class
* *
* @class SportsPress * @class SportsPress
* @version 0.7.2 * @version 0.7.3
*/ */
final class SportsPress { final class SportsPress {
/** /**
* @var string * @var string
*/ */
public $version = '0.7.2'; public $version = '0.7.3';
/** /**
* @var SporsPress The single instance of the class * @var SporsPress The single instance of the class