adding sessionStorage to keep track of the events view after nav away from page
authorAnthony Talarico <talarico@gaslightmedia.com>
Fri, 30 Sep 2016 16:58:47 +0000 (12:58 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Fri, 30 Sep 2016 16:58:47 +0000 (12:58 -0400)
views/front/events/agenda.html

index 01d15da..1bedfdf 100644 (file)
@@ -85,6 +85,9 @@
         var main_content        = $("#main-content");
         var view                = '{$cal_view}';
 
+        if( sessionStorage.view ){
+            view = sessionStorage.view;
+        }
         // AJAX FUNCTION ************************************************
         // Get calendar month via AJAX
         function eventsCalMonthAJAX(month) {
             view_select.val('agenda');
         }
         $("#glm-event-view-select").on("change", function (){
+            console.log($(this).attr("value"));
+            sessionStorage.setItem("view", $(this).attr("value"));
             if($("#glm-event-view-select option:selected").val() === "calendar"){
                 eventsCalMonthAJAX(month_obj);
-                main_content.removeClass("small-8").addClass("small-12");
                 rows.fadeOut('slow', function(){});
                 calendar.fadeIn('slow', function(){});
                 calendar.fullCalendar('render');
 
             } else if ( $("#glm-event-view-select option:selected").val() === "agenda"){
-
                 rows.fadeIn('slow', function(){});
                 calendar.fadeOut('slow', function(){});
             }