From 06cc7940daddd71796322a1fddf250df7c460314 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Mon, 20 Mar 2017 12:33:35 -0400 Subject: [PATCH] Update to get mobile schedule to work. Some rework for off canvas. --- models/front/apis/schedule.php | 13 +++++-- setup/shortcodes.php | 1 + views/front/apis/schedule.html | 67 ++++++++++++++++++++++++++++++++-- 3 files changed, 73 insertions(+), 8 deletions(-) diff --git a/models/front/apis/schedule.php b/models/front/apis/schedule.php index 62e077d..a64036f 100644 --- a/models/front/apis/schedule.php +++ b/models/front/apis/schedule.php @@ -64,17 +64,21 @@ class GlmMembersFront_apis_schedule // Setup the url. $url = $starlineUrl . 'ferrySchedule.php'; $inDropDown = filter_var( $actionData['request']['in_dropdown'], FILTER_VALIDATE_BOOLEAN ); + $offCanvas = filter_var( $actionData['request']['off_canvas'], FILTER_VALIDATE_BOOLEAN ); $urlParams = array(); - if ( isset( $actionData['request']['in_dropdown'] ) && $inDropDown ) { + if ( $inDropDown ) { $urlParams[] = 'dropdown=1'; } - if ( isset( $_REQUEST['mapLink'] ) && !$inDropDown ) { + if ( $offCanvas ) { + $urlParams[] = 'offcanvas=1'; + } + if ( isset( $_REQUEST['mapLink'] ) && !$inDropDown && !$offCanvas ) { $urlParams[] = 'mapLink=' . $_REQUEST['mapLink']; } - if ( isset( $_REQUEST['dockId'] ) && !$inDropDown ) { + if ( isset( $_REQUEST['dockId'] ) && !$inDropDown && !$offCanvas ) { $urlParams[] = 'dockId=' . $_REQUEST['dockId']; } - if ( isset( $_REQUEST['scheduleId'] ) && !$inDropDown ) { + if ( isset( $_REQUEST['scheduleId'] ) && !$inDropDown && !$offCanvas ) { $urlParams[] = 'scheduleId=' . $_REQUEST['scheduleId']; } if ( !empty( $urlParams ) ) { @@ -90,6 +94,7 @@ class GlmMembersFront_apis_schedule 'mainSchedId' => $mainSchedId, 'content' => $content, 'inDropDown' => $inDropDown, + 'offCanvas' => $offCanvas, 'schedulePage' => get_home_url(null, '/' ) . $starlinePageSlug . '/', ); diff --git a/setup/shortcodes.php b/setup/shortcodes.php index e5a5961..a7525f7 100644 --- a/setup/shortcodes.php +++ b/setup/shortcodes.php @@ -94,6 +94,7 @@ $glmMembersApisShortcodes = array( 'table' => false, 'attributes' => array( 'in_dropdown' => false, + 'off_canvas' => false, ) ), ); diff --git a/views/front/apis/schedule.html b/views/front/apis/schedule.html index 9c7c999..4a27607 100644 --- a/views/front/apis/schedule.html +++ b/views/front/apis/schedule.html @@ -64,6 +64,56 @@ jQuery(document).ready(function(){ return false; }); {/if} + {if $offCanvas} + // For the drop down docks schedules + var offcanvas_dockForm = $("#oc_dockForm"); + var offcanvas_formDockId = $("#oc_formDockId"); + var offcanvas_formSchedId = $("#oc_formSchedId"); + var offcanvas_dock1Sel = $('#oc-sched-1'); + offcanvas_dock1Sel.change(function(){ + offcanvas_formSchedId.val(1); + offcanvas_formDockId.val(offcanvas_dock1Sel.val()); + offcanvas_dockForm.submit(); + }); + var offcanvas_dock2Sel = $('#oc-sched-2'); + offcanvas_dock2Sel.change(function(){ + offcanvas_formSchedId.val(2); + offcanvas_formDockId.val(offcanvas_dock2Sel.val()); + offcanvas_dockForm.submit(); + }); + var offcanvas_dock3Sel = $('#oc-sched-3'); + offcanvas_dock3Sel.change(function(){ + offcanvas_formSchedId.val(3); + offcanvas_formDockId.val(offcanvas_dock3Sel.val()); + offcanvas_dockForm.submit(); + }); + var offcanvas_dock4Sel = $('#oc-sched-4'); + offcanvas_dock4Sel.change(function(){ + offcanvas_formSchedId.val(4); + offcanvas_formDockId.val(offcanvas_dock4Sel.val()); + offcanvas_dockForm.submit(); + }); + var offcanvas_mapLink1 = $('#offcanvas-google-map-link1'); + offcanvas_mapLink1.click(function(){ + window.location = '{$schedulePage}/?mapLink=1'; + return false; + }); + var offcanvas_mapLink2 = $('#offcanvas-google-map-link2'); + offcanvas_mapLink2.click(function(){ + window.location = '{$schedulePage}/?mapLink=2'; + return false; + }); + var offcanvas_mapLink3 = $('#offcanvas-google-map-link3'); + offcanvas_mapLink3.click(function(){ + window.location = '{$schedulePage}/?mapLink=3'; + return false; + }); + var offcanvas_mapLink4 = $('#offcanvas-google-map-link4'); + offcanvas_mapLink4.click(function(){ + window.location = '{$schedulePage}/?mapLink=4'; + return false; + }); + {/if} }); @@ -76,11 +126,20 @@ jQuery(document).ready(function(){ method="get"> +{else if $offCanvas} +
+
+ + {else}
{/if} - {$content} - {if $inDropDown} - - {/if} +{$content} +{if $inDropDown} + +{/if}
-- 2.17.1