fixing issues with the events widget not clearing when there are no events to display
authorAnthony Talarico <talarico@gaslightmedia.com>
Mon, 30 Jan 2017 21:06:37 +0000 (16:06 -0500)
committerAnthony Talarico <talarico@gaslightmedia.com>
Mon, 30 Jan 2017 21:06:37 +0000 (16:06 -0500)
models/admin/ajax/eventsCalMonthAJAX.php
views/front/events/sidebarEvents.html

index 664d60c..6fa7a3d 100644 (file)
@@ -156,17 +156,11 @@ class GlmMembersAdmin_ajax_eventsCalMonthAJAX extends GlmDataEventsTimes
                 $end_date = date('M d', strtotime($date[0]->end_time));
                 $start_timestamp = strtotime($start_date);
                 $end_timestamp = strtotime($end_date);
-                
-                if($start_timestamp === $end_timestamp){
-                    $end = $start_timestamp;
-                } else {
-                    $start_date = $start_date . "-" . $end_date;
-                }
-                
+             
                 $sidebar_events[$event->id] = 
                     array(
                         "start_date" => $start_date, 
-                        "end_date"   => $end, 
+                        "end_date"   => $end_date
                         "name"       => $event->name, 
                         "content"    => $event->descr, 
                         'image'      => $image,
index 29c5d63..60a834d 100644 (file)
@@ -7,6 +7,7 @@
 <script>
     jQuery(document).ready(function($) {
         
+        // set up the ajax function that will be called during different events
         function ajaxEvents(data_array){
             jQuery.ajax({
                 type: 'POST',
@@ -19,6 +20,7 @@
                     $('.sidebar-event').fadeIn("slow");
                 },
                 success: function(data){
+
                       if(data.array_dates !== null){
                         var num = 0;
                         $.each(data.array_dates, function(index, value){
@@ -39,6 +41,7 @@
                             num++;
                         });
                     } else {
+                        $(".sidebar-events").empty();
                         var event = $("<div> NO EVENTS </div>");
                         $('.sidebar-events').append(event);
                     }
@@ -46,6 +49,7 @@
             });
         }
         
+        // get the year and month from the datepicker's dropdown
         jQuery('#sidebar-date-select').datepicker( {
             changeMonth: true,
             changeYear: true,