Adjust admin list icons and style with tooltip
This commit is contained in:
@@ -10,6 +10,7 @@ function sportspress_admin_enqueue_scripts( $hook ) {
|
||||
|
||||
wp_enqueue_script( 'jquery' );
|
||||
wp_enqueue_script( 'jquery-chosen', SPORTSPRESS_PLUGIN_URL .'assets/js/chosen.jquery.min.js', array( 'jquery' ), '1.1.0', true );
|
||||
wp_enqueue_script( 'jquery-tiptip', SPORTSPRESS_PLUGIN_URL .'assets/js/jquery.tipTip.min.js', array( 'jquery' ), '1.3', true );
|
||||
wp_enqueue_script( 'jquery-caret', SPORTSPRESS_PLUGIN_URL .'assets/js/jquery.caret.min.js', array( 'jquery' ), '1.02', true );
|
||||
wp_enqueue_script( 'jquery-countdown', SPORTSPRESS_PLUGIN_URL .'assets/js/jquery.countdown.min.js', array( 'jquery' ), '2.0.2', true );
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ add_action( 'init', 'sportspress_player_post_init' );
|
||||
function sportspress_player_edit_columns() {
|
||||
$columns = array(
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'sp_number' => '<span class="sp-icon-tshirt" title="' . __( 'Number', 'sportspress' ) . '"></span>',
|
||||
'sp_number' => '<span class="dashicons sp-icon-tshirt tips" title="' . __( 'Number', 'sportspress' ) . '"></span>',
|
||||
'title' => __( 'Player', 'sportspress' ),
|
||||
'sp_position' => __( 'Positions', 'sportspress' ),
|
||||
'sp_team' => __( 'Teams', 'sportspress' ),
|
||||
|
||||
@@ -40,7 +40,7 @@ function sportspress_team_meta_init( $post ) {
|
||||
function sportspress_team_edit_columns() {
|
||||
$columns = array(
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'sp_icon' => '<span class="sp-icon-shield" title="' . __( 'Logo', 'sportspress' ) . '"></span>',
|
||||
'sp_icon' => '<span class="dashicons sp-icon-shield tips" title="' . __( 'Logo', 'sportspress' ) . '"></span>',
|
||||
'title' => __( 'Team', 'sportspress' ),
|
||||
'sp_league' => __( 'Leagues', 'sportspress' ),
|
||||
'sp_season' => __( 'Seasons', 'sportspress' ),
|
||||
|
||||
93
admin/templates/player-gallery.php
Normal file
93
admin/templates/player-gallery.php
Normal file
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
if ( !function_exists( 'sportspress_player_list' ) ) {
|
||||
function sportspress_player_list( $id = null, $args = '' ) {
|
||||
|
||||
if ( ! $id )
|
||||
$id = get_the_ID();
|
||||
|
||||
$defaults = array(
|
||||
'statistics' => null,
|
||||
'orderby' => 'default',
|
||||
'order' => 'ASC',
|
||||
);
|
||||
|
||||
$r = wp_parse_args( $args, $defaults );
|
||||
|
||||
$output = '<div class="sp-table-wrapper">' .
|
||||
'<table class="sp-player-list sp-data-table sp-responsive-table">' . '<thead>' . '<tr>';
|
||||
|
||||
$data = sportspress_get_player_list_data( $id );
|
||||
|
||||
// The first row should be column labels
|
||||
$labels = $data[0];
|
||||
|
||||
// Remove the first row to leave us with the actual data
|
||||
unset( $data[0] );
|
||||
|
||||
$statistics = sportspress_array_value( $r, 'statistics', null );
|
||||
|
||||
if ( $r['orderby'] == 'default' ):
|
||||
$r['orderby'] = get_post_meta( $id, 'sp_orderby', true );
|
||||
$r['order'] = get_post_meta( $id, 'sp_order', true );
|
||||
else:
|
||||
global $sportspress_statistic_priorities;
|
||||
$sportspress_statistic_priorities = array(
|
||||
array(
|
||||
'statistic' => $r['orderby'],
|
||||
'order' => $r['order'],
|
||||
),
|
||||
);
|
||||
uasort( $data, 'sportspress_sort_list_players' );
|
||||
endif;
|
||||
|
||||
if ( in_array( $r['orderby'], array( 'number', 'name' ) ) ):
|
||||
$output .= '<th class="data-number">#</th>';
|
||||
else:
|
||||
$output .= '<th class="data-rank">' . __( 'Rank', 'sportspress' ) . '</th>';
|
||||
endif;
|
||||
|
||||
foreach( $labels as $key => $label ):
|
||||
if ( ! is_array( $statistics ) || $key == 'name' || in_array( $key, $statistics ) )
|
||||
$output .= '<th class="data-' . $key . '">'. $label . '</th>';
|
||||
endforeach;
|
||||
|
||||
$output .= '</tr>' . '</thead>' . '<tbody>';
|
||||
|
||||
$i = 0;
|
||||
|
||||
foreach( $data as $player_id => $row ):
|
||||
|
||||
$output .= '<tr class="' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">';
|
||||
|
||||
// Rank or number
|
||||
if ( isset( $r['orderby'] ) && $r['orderby'] != 'number' ):
|
||||
$output .= '<td class="data-rank">' . ( $i + 1 ) . '</td>';
|
||||
else:
|
||||
$number = get_post_meta( $player_id, 'sp_number', true );
|
||||
$output .= '<td class="data-number">' . ( $number ? $number : ' ' ) . '</td>';
|
||||
endif;
|
||||
|
||||
// Name as link
|
||||
$permalink = get_post_permalink( $player_id );
|
||||
$name = sportspress_array_value( $row, 'name', sportspress_array_value( $row, 'name', ' ' ) );
|
||||
$output .= '<td class="data-name">' . '<a href="' . $permalink . '">' . $name . '</a></td>';
|
||||
|
||||
foreach( $labels as $key => $value ):
|
||||
if ( $key == 'name' )
|
||||
continue;
|
||||
if ( ! is_array( $statistics ) || in_array( $key, $statistics ) )
|
||||
$output .= '<td class="data-' . $key . '">' . sportspress_array_value( $row, $key, '—' ) . '</td>';
|
||||
endforeach;
|
||||
|
||||
$output .= '</tr>';
|
||||
|
||||
$i++;
|
||||
|
||||
endforeach;
|
||||
|
||||
$output .= '</tbody>' . '</table>' . '</div>';
|
||||
|
||||
return apply_filters( 'sportspress_player_list', $output );
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user