testing off canvas functionality for staffords location menus
authorAnthony Talarico <talarico@gaslightmedia.com>
Wed, 22 Aug 2018 17:59:21 +0000 (13:59 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Wed, 22 Aug 2018 17:59:21 +0000 (13:59 -0400)
footer.php
functions.php
js/app.js
js/custom/pageSetup.js

index b919f04..9af7708 100644 (file)
         <a class="exit-off-canvas"></a>
         </div><!--End of inner-wrap-->
       </div><!--End of off-canvas-->
-
+        <?php 
+            global $post; 
+            $properties = array(
+                187 => "Stafford's Bay View Inn",
+                188 => "Stafford's Crooked River Lodge",
+                189 => "Stafford's Perry Hotel",
+                190 => "Stafford's Pier Restaurant",
+                191 => "Stafford's Weathervayne Restaurant",
+                192 => "Stafford's Noggin Room Pub",
+                230 => "Stafford's Pointer Boat",
+                197 => "Stafford's Vacation Rentals",
+                194 => "Stafford's Wedding Specials"
+            ); 
+        ?>
+      <script>
+        (function(){
+            window.glmData = {
+                location: '<?php echo isProperty($post->ID, $properties); ?>'
+            }
+        })()
+      </script>
   <?php wp_footer();?>
 <script charset="utf-8" type="text/javascript">var switchTo5x=true;</script>
 <script charset="utf-8" type="text/javascript" src="https://ws.sharethis.com/button/buttons.js"></script>
index 130fd88..d039e47 100644 (file)
@@ -152,6 +152,23 @@ function is_tree( $pid ) {
     }
     return false;
 }
+function isProperty($page_id, $props_array, $deep = false){
+    $post = get_post($page_id);
+    $is_property = false;
+    
+    foreach($props_array as $id=>$property){
+        if( $deep ){
+            if( is_page($id) || $id == $post->post_parent || is_tree($id) ){
+                $is_property = true;
+            }
+        }else{
+            if( is_page($id) ){
+                $is_property = true;
+            }
+        } 
+    }
+    return $is_property;
+}
 function setReservationWidgetProperty($page_id, $props_array){
     $post = get_post($page_id);
     $property_name = '';
index c338a90..d9c7397 100644 (file)
--- a/js/app.js
+++ b/js/app.js
@@ -27,6 +27,11 @@ $(document).ready(function () {
             $("#res-tab-open").attr("id", "res-tab");
         }
     });
+    if(window.glmData.location){
+        console.log( $('a.toggle'))
+        $('a.toggle').trigger("click");
+        $('.off-canvas-wrap').foundation('offcanvas', 'show', 'move-right');
+    }
     var extraDay,currentDate, currentDate2, requiredDate,minDays, departure, stay, d, dd,  m, y, bayView = 'vD4ZpIFk4%2b7FyPsaBnkCqP1cBHWnJili9k5D83MqJq4%3d&',
         crookedRiver = 'ZhWXD46i2%2fq319vcR%2fcw69rZvA2bz%2fttOOxO9t1%2fBJ0%3d&',
         adults,
@@ -83,54 +88,6 @@ $(document).ready(function () {
             $("#nightsOff").val( 1 ) 
             stay = `stay_nights=1&`;
         }
-        
-
-        // currentDate = $("#arriveOff").val();
-        // currentDate = new Date(currentDate);
-        // console.log(currentDate);
-        // currentDate = new Date(currentDate.getUTCFullYear(), currentDate.getUTCMonth(), currentDate.getUTCDate());
-        // currentDate.setDate(currentDate.getDate());
-        // dd = currentDate.getDate() + 1;
-        // if (dd <= 9) {
-        //     dd = '0' + dd;
-        // }
-        // d = currentDate.getDate();
-        // if (d <= 9) {
-        //     d = '0' + d;
-        // }
-        // m = currentDate.getMonth() + 1;
-        // if (m <= 9) {
-        //     m = '0' + m;
-        // }
-        // y = currentDate.getFullYear();
-
-        // // this variable is for passing to booking site
-        // start = "arrival_date=" + y + '-' + m + '-' + d + '&';
-
-        // requiredDate = y + '-' + m + '-' + d;
-        // minDays = y + '-' + m + '-' + dd;
-        // console.log(minDays);
-
-        // $("#departOff").attr("min", minDays).val(minDays);
-        // if( !$("#departOff").val() <= 1 ){
-        //     $("#departOff").val(minDays);
-        // }
-        // if (requiredDate < $("#arriveOff").attr("min")) {
-        //     minDays = $("#arriveOff").attr("min");
-        //     $("#arriveOff").val(minDays);
-        // }
-        // $("#nightsOff").val( $("#departOff").val() - $("#arriveOff".val()))
-
-        // if ($("#departOff").val() === "Departure Date" || $("#departOff").val() === "") {
-        //     $("#nightsOff").val("");
-        // } else {
-        //     $("#nightsOff").val(Math.ceil(currentDate2 - currentDate) / (1000 * 60 * 60 * 24));
-        // }
-
-        // if ($("#nightsOff").val() <= 0) {
-        //     // $("#departOff").val("Minimum 1 Night");
-        //     $("#nightsOff").val("");
-        // }
     });
     // // restrict departure date ///////////////////////////////
     $(document).on('change', '#departOff', function () {
index 26cb735..399bdda 100644 (file)
@@ -18,6 +18,11 @@ $(document).ready(function () {
             $("#res-tab-open").attr("id", "res-tab");
         }
     });
+    if(window.glmData.location){
+        console.log( $('a.toggle'))
+        $('a.toggle').trigger("click");
+        $('.off-canvas-wrap').foundation('offcanvas', 'show', 'move-right');
+    }
     var extraDay,currentDate, currentDate2, requiredDate,minDays, departure, stay, d, dd,  m, y, bayView = 'vD4ZpIFk4%2b7FyPsaBnkCqP1cBHWnJili9k5D83MqJq4%3d&',
         crookedRiver = 'ZhWXD46i2%2fq319vcR%2fcw69rZvA2bz%2fttOOxO9t1%2fBJ0%3d&',
         adults,
@@ -74,54 +79,6 @@ $(document).ready(function () {
             $("#nightsOff").val( 1 ) 
             stay = `stay_nights=1&`;
         }
-        
-
-        // currentDate = $("#arriveOff").val();
-        // currentDate = new Date(currentDate);
-        // console.log(currentDate);
-        // currentDate = new Date(currentDate.getUTCFullYear(), currentDate.getUTCMonth(), currentDate.getUTCDate());
-        // currentDate.setDate(currentDate.getDate());
-        // dd = currentDate.getDate() + 1;
-        // if (dd <= 9) {
-        //     dd = '0' + dd;
-        // }
-        // d = currentDate.getDate();
-        // if (d <= 9) {
-        //     d = '0' + d;
-        // }
-        // m = currentDate.getMonth() + 1;
-        // if (m <= 9) {
-        //     m = '0' + m;
-        // }
-        // y = currentDate.getFullYear();
-
-        // // this variable is for passing to booking site
-        // start = "arrival_date=" + y + '-' + m + '-' + d + '&';
-
-        // requiredDate = y + '-' + m + '-' + d;
-        // minDays = y + '-' + m + '-' + dd;
-        // console.log(minDays);
-
-        // $("#departOff").attr("min", minDays).val(minDays);
-        // if( !$("#departOff").val() <= 1 ){
-        //     $("#departOff").val(minDays);
-        // }
-        // if (requiredDate < $("#arriveOff").attr("min")) {
-        //     minDays = $("#arriveOff").attr("min");
-        //     $("#arriveOff").val(minDays);
-        // }
-        // $("#nightsOff").val( $("#departOff").val() - $("#arriveOff".val()))
-
-        // if ($("#departOff").val() === "Departure Date" || $("#departOff").val() === "") {
-        //     $("#nightsOff").val("");
-        // } else {
-        //     $("#nightsOff").val(Math.ceil(currentDate2 - currentDate) / (1000 * 60 * 60 * 24));
-        // }
-
-        // if ($("#nightsOff").val() <= 0) {
-        //     // $("#departOff").val("Minimum 1 Night");
-        //     $("#nightsOff").val("");
-        // }
     });
     // // restrict departure date ///////////////////////////////
     $(document).on('change', '#departOff', function () {