diff --git a/assets/js/admin/editor-lang.php b/assets/js/admin/editor-lang.php index 4f8ed23c..4bf69df6 100644 --- a/assets/js/admin/editor-lang.php +++ b/assets/js/admin/editor-lang.php @@ -12,9 +12,7 @@ $strings = 'tinyMCE.addI18n({' . _WP_Editors::$mce_locale . ':{ countdown: "' . esc_js( __( 'Countdown', 'sportspress' ) ) . '", performance: "' . esc_js( __( 'Performance', 'sportspress' ) ) . '", calendar: "' . esc_js( __( 'Calendar', 'sportspress' ) ) . '", - team: "' . esc_js( __( 'Team', 'sportspress' ) ) . '", statistics: "' . esc_js( __( 'Statistics', 'sportspress' ) ) . '", - table_columns: "' . esc_js( __( 'Table Columns', 'sportspress' ) ) . '", league_table: "' . esc_js( __( 'League Table', 'sportspress' ) ) . '", player_list: "' . esc_js( __( 'Player List', 'sportspress' ) ) . '", list: "' . esc_js( __( 'List', 'sportspress' ) ) . '", diff --git a/assets/js/admin/editor.js b/assets/js/admin/editor.js index c1762afb..ac9d4f15 100644 --- a/assets/js/admin/editor.js +++ b/assets/js/admin/editor.js @@ -88,21 +88,6 @@ } ] }, - { - text: ed.getLang( 'sportspress.team' ), - menu: [ - { - text: ed.getLang( 'sportspress.table_columns' ), - onclick: function() { - // triggers the thickbox - var width = jQuery(window).width(), H = jQuery(window).height(), W = ( 720 < width ) ? 720 : width; - W = W - 80; - H = H - 84; - tb_show( ed.getLang( 'sportspress.team' ) + ' - ' + ed.getLang( 'sportspress.table_columns' ), 'admin-ajax.php?action=sportspress_team_columns_shortcode&width=' + W + '&height=' + H ); - } - } - ] - }, { text: ed.getLang( 'sportspress.league_table' ), onclick : function() { diff --git a/includes/admin/post-types/class-sp-admin-meta-boxes.php b/includes/admin/post-types/class-sp-admin-meta-boxes.php index e46305a7..acb64f5e 100644 --- a/includes/admin/post-types/class-sp-admin-meta-boxes.php +++ b/includes/admin/post-types/class-sp-admin-meta-boxes.php @@ -63,6 +63,7 @@ class SP_Admin_Meta_Boxes { add_action( 'sportspress_process_sp_team_meta', 'SP_Meta_Box_Team_Details::save', 10, 2 ); add_action( 'sportspress_process_sp_team_meta', 'SP_Meta_Box_Team_Columns::save', 20, 2 ); add_action( 'sportspress_process_sp_team_meta', 'SP_Meta_Box_Team_Lists::save', 30, 2 ); + add_action( 'sportspress_process_sp_team_meta', 'SP_Meta_Box_Team_Tables::save', 40, 2 ); // Save Table Meta Boxes add_action( 'sportspress_process_sp_table_meta', 'SP_Meta_Box_Table_Details::save', 10, 2 ); @@ -141,6 +142,7 @@ class SP_Admin_Meta_Boxes { if ( isset( $post ) && isset( $post->ID ) ): add_meta_box( 'sp_columnssdiv', __( 'Table Columns', 'sportspress' ), 'SP_Meta_Box_Team_Columns::output', 'sp_team', 'normal', 'high' ); add_meta_box( 'sp_listsdiv', __( 'Player Lists', 'sportspress' ), 'SP_Meta_Box_Team_Lists::output', 'sp_team', 'normal', 'high' ); + add_meta_box( 'sp_tablesdiv', __( 'League Tables', 'sportspress' ), 'SP_Meta_Box_Team_Tables::output', 'sp_team', 'normal', 'high' ); endif; add_meta_box( 'sp_editordiv', __( 'Profile', 'sportspress' ), 'SP_Meta_Box_Team_Editor::output', 'sp_team', 'normal', 'low' ); @@ -161,7 +163,7 @@ class SP_Admin_Meta_Boxes { add_meta_box( 'sp_editordiv', __( 'Profile', 'sportspress' ), 'SP_Meta_Box_Player_Editor::output', 'sp_player', 'normal', 'low' ); // Lists - add_meta_box( 'sp_shortcodediv', __( 'Shortcode', 'sportspress' ), 'SP_Meta_Box_List_Shortcode::output', 'sp_list', 'side', 'default' ); + add_meta_box( 'sp_shortcodediv', __( 'Shortcode', 'sportspress' ), 'SP_Meta_Box_List_Shortcode::output', 'sp_table', 'side', 'default' ); add_meta_box( 'sp_formatdiv', __( 'Layout', 'sportspress' ), 'SP_Meta_Box_List_Format::output', 'sp_list', 'side', 'default' ); add_meta_box( 'sp_columnsdiv', __( 'Columns', 'sportspress' ), 'SP_Meta_Box_List_Columns::output', 'sp_list', 'side', 'default' ); add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'SP_Meta_Box_List_Details::output', 'sp_list', 'side', 'default' ); diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-team-shortcode.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-team-shortcode.php deleted file mode 100644 index 2bb82fdb..00000000 --- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-team-shortcode.php +++ /dev/null @@ -1,32 +0,0 @@ - -
- -
-- -
- - tables( true ); + self::table( $data, $checked ); + + else: + + printf( __( 'No results found.', 'sportspress' ) ); + + endif; + } + + /** + * Save meta box data + */ + public static function save( $post_id, $post ) { + sp_update_post_meta_recursive( $post_id, 'sp_table', sp_array_value( $_POST, 'sp_table', array() ) ); + } + + /** + * Admin edit table + */ + public static function table( $data = array(), $checked = array() ) { + ?> +| + | + + | ++ + | ++ + | ++ + | +|
|---|---|---|---|---|---|
| + ID, $checked ) ); ?>> + | ++ + post_title; ?> + + | ++ | ID, 'sp_league' ) ? the_terms( $table->ID, 'sp_league' ) : '—'; ?> | +ID, 'sp_season' ) ? the_terms( $table->ID, 'sp_season' ) : '—'; ?> | +|
| + + | +|||||
| + + | +|||||
| ' . $label . ' | '; - endforeach; - - $output .= '
|---|
| ' . sp_array_value( $row, $key, '—' ) . ' | '; - endforeach; - - $output .= '