Update to get mobile schedule to work.
authorSteve Sutton <steve@gaslightmedia.com>
Mon, 20 Mar 2017 16:33:35 +0000 (12:33 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Mon, 20 Mar 2017 16:33:35 +0000 (12:33 -0400)
Some rework for off canvas.

models/front/apis/schedule.php
setup/shortcodes.php
views/front/apis/schedule.html

index 62e077d..a64036f 100644 (file)
@@ -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 . '/',
         );
 
index e5a5961..a7525f7 100644 (file)
@@ -94,6 +94,7 @@ $glmMembersApisShortcodes = array(
         'table'      => false,
         'attributes' => array(
             'in_dropdown' => false,
+            'off_canvas'  => false,
         )
     ),
 );
index 9c7c999..4a27607 100644 (file)
@@ -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}
 });
 </script>
 
@@ -76,11 +126,20 @@ jQuery(document).ready(function(){
             method="get">
             <input type="hidden" id="formDockId" name="dockId">
             <input type="hidden" id="formSchedId" name="scheduleId">
+{else if $offCanvas}
+    <div id="oc_schedule_wrapper" class="common_schedule_wrapper">
+        <form
+            id="oc_dockForm"
+            name="oc_dockForm"
+            action="{$schedulePage}"
+            method="get">
+            <input type="hidden" id="oc_formDockId" name="dockId">
+            <input type="hidden" id="oc_formSchedId" name="scheduleId">
 {else}
     <div id="inside_schedule_wrapper" class="common_schedule_wrapper">
 {/if}
-    {$content}
-    {if $inDropDown}
-        </form>
-    {/if}
+{$content}
+{if $inDropDown}
+    </form>
+{/if}
 </div>