From f730f7886e33543b3fe4389639ac70764976f68e Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Sat, 22 Mar 2014 00:01:02 +1100 Subject: [PATCH] Enable custom event teams delimiter --- admin/hooks/wp-insert-post-data.php | 3 ++- admin/settings/options-event.php | 23 +++++++++++++++++++++++ admin/tools/event-importer.php | 4 ++-- assets/js/admin.js | 13 +++++++++++++ 4 files changed, 40 insertions(+), 3 deletions(-) diff --git a/admin/hooks/wp-insert-post-data.php b/admin/hooks/wp-insert-post-data.php index 4fc5faf1..6811afcf 100644 --- a/admin/hooks/wp-insert-post-data.php +++ b/admin/hooks/wp-insert-post-data.php @@ -1,5 +1,6 @@ options, 'event_teams_delimiter', __( 'vs', 'sportspress' ) ); + ?> +
+ + + +
+ + + +
+ options, 'main_result', 0 ); diff --git a/admin/tools/event-importer.php b/admin/tools/event-importer.php index f624d104..778b47bb 100644 --- a/admin/tools/event-importer.php +++ b/admin/tools/event-importer.php @@ -95,7 +95,7 @@ if ( class_exists( 'WP_Importer' ) ) { * @return void */ function import( $file ) { - global $wpdb; + global $wpdb, $sportspress_options; $this->imported = $this->skipped = 0; @@ -311,7 +311,7 @@ if ( class_exists( 'WP_Importer' ) ) { // Add delimiter if event name is set if ( $title ): - $title .= ' ' . __( 'vs', 'sportspress' ) . ' '; + $title .= ' ' . sportspress_array_value( $sportspress_options, 'event_teams_delimiter', 'vs' ) . ' '; endif; // Append team name to event name diff --git a/assets/js/admin.js b/assets/js/admin.js index fb955275..666a6d89 100644 --- a/assets/js/admin.js +++ b/assets/js/admin.js @@ -303,6 +303,19 @@ jQuery(document).ready(function($){ // Trigger status selector $(".sp-status-selector select:first-child").change(); + // Preset field modifier + $(".sp-custom-input-wrapper .preset").click(function() { + val = $(this).val(); + if(val == "\\c\\u\\s\\t\\o\\m") return true; + example = $(this).attr("data-example"); + $(this).closest(".sp-custom-input-wrapper").find(".value").val(val).siblings(".example").html(example); + }); + + // Select custom preset when field is brought to focus + $(".sp-custom-input-wrapper .value").focus(function() { + $(this).siblings("label").find(".preset").prop("checked", true); + }); + // Remove slug editor in quick edit for slug-sensitive post types $(".inline-edit-sp_result, .inline-edit-sp_outcome, .inline-edit-sp_column, .inline-edit-sp_statistic").find("input[name=post_name]").closest("label").remove();