Add venue map zoom setting

This commit is contained in:
Brian Miyaji
2015-09-18 12:19:44 +10:00
parent 1d710b6e2b
commit cefbd283f2
3 changed files with 26 additions and 2 deletions

View File

@@ -9,7 +9,7 @@
var ll = new google.maps.LatLng(latitude,longitude); var ll = new google.maps.LatLng(latitude,longitude);
var mapOptions = { var mapOptions = {
scrollwheel: false, scrollwheel: false,
zoom: 12, zoom: parseInt(vars.zoom),
center: ll, center: ll,
mapTypeId: google.maps.MapTypeId[vars.map_type] mapTypeId: google.maps.MapTypeId[vars.map_type]
}; };

View File

@@ -214,6 +214,30 @@ class SP_Settings_Events extends SP_Settings_Page {
array( 'type' => 'sectionend', 'id' => 'event_options' ), array( 'type' => 'sectionend', 'id' => 'event_options' ),
), ),
array(
array( 'title' => __( 'Venues', 'sportspress' ), 'type' => 'title', 'desc' => '', 'id' => 'venue_options' ),
),
apply_filters( 'sportspress_venue_options', array(
array(
'title' => __( 'Zoom', 'sportspress' ),
'id' => 'sportspress_map_zoom',
'class' => 'small-text',
'default' => '15',
'desc' => '0 - 21',
'type' => 'number',
'custom_attributes' => array(
'min' => 0,
'max' => 21,
'step' => 1
),
),
) ),
array(
array( 'type' => 'sectionend', 'id' => 'venue_options' ),
),
array( array(
array( 'title' => __( 'Event Results', 'sportspress' ), 'type' => 'title', 'desc' => '', 'id' => 'result_options' ), array( 'title' => __( 'Event Results', 'sportspress' ), 'type' => 'title', 'desc' => '', 'id' => 'result_options' ),
), ),

View File

@@ -78,7 +78,7 @@ class SP_Frontend_Scripts {
if ( is_singular( 'sp_event' ) || is_tax( 'sp_venue' ) ): if ( is_singular( 'sp_event' ) || is_tax( 'sp_venue' ) ):
wp_enqueue_script( 'google-maps', 'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false', array(), '3.exp', true ); wp_enqueue_script( 'google-maps', 'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false', array(), '3.exp', true );
wp_enqueue_script( 'sp-maps', plugin_dir_url( SP_PLUGIN_FILE ) .'assets/js/sp-maps.js', array( 'jquery', 'google-maps' ), time(), true ); wp_enqueue_script( 'sp-maps', plugin_dir_url( SP_PLUGIN_FILE ) .'assets/js/sp-maps.js', array( 'jquery', 'google-maps' ), time(), true );
wp_localize_script( 'sp-maps', 'vars', array( 'map_type' => strtoupper( get_option( 'sportspress_map_type', 'ROADMAP' ) ) ) ); wp_localize_script( 'sp-maps', 'vars', array( 'map_type' => strtoupper( get_option( 'sportspress_map_type', 'ROADMAP' ) ), 'zoom' => get_option( 'sportspress_map_zoom', 15 ) ) );
endif; endif;
// Localize scripts // Localize scripts