Commit b4e04d88 authored by Jake Strawn's avatar Jake Strawn
Browse files

year view of calendar now sucks a lot less

parent d439c52e
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -3430,6 +3430,33 @@ div.more-link {
.view-display-id-year .calendar-calendar .year-view {
  margin-bottom: 20px; }

.calendar-calendar .year-view .calendar-calendar {
  margin-bottom: 20px; }
  .calendar-calendar .year-view .calendar-calendar .month-view {
    border: 1px solid #DDD;
    background-color: #f8f8f8;
    padding: 10px;
    box-sizing: border-box;
    -moz-box-shadow: 0 1px 3px 3px rgba(0, 0, 0, 0.1);
    -webkit-box-shadow: 0 1px 3px 3px rgba(0, 0, 0, 0.1);
    -o-box-shadow: 0 1px 3px 3px rgba(0, 0, 0, 0.1);
    box-shadow: 0 1px 3px 3px rgba(0, 0, 0, 0.1); }
  .calendar-calendar .year-view .calendar-calendar .date-nav {
    background: none;
    padding: 0;
    margin-bottom: 5px; }
  .calendar-calendar .year-view .calendar-calendar .date-heading a {
    font-size: 18px;
    line-height: 18px;
    font-family: "Open Sans", sans-serif;
    font-weight: 800;
    font-weight: normal;
    display: block;
    padding: 10px; }
  .calendar-calendar .year-view .calendar-calendar table th, .calendar-calendar .year-view .calendar-calendar table td {
    width: 14.28571428571429%;
    padding: 4px 8px; }

#block-views-nm-events-upcoming .attachment {
  margin-bottom: 20px;
  padding-bottom: 20px;
+67 −1
Original line number Diff line number Diff line
@@ -337,7 +337,73 @@ Drupal.nodemaker = Drupal.nodemaker || {};
  
  
  
  // add jquery isotope/masonry to various elements
  Drupal.behaviors.nodemakerCalendarIsotope = {
    attach: function(context, settings) {  
                 
      $('body').one('responsivelayout', function(e, d) {  
        // default columns
        
        container = $('#block-system-main .view-display-id-year .year-view');
        item = '.calendar-calendar';
        gutter = 20;
        cols = 2;
        
        // override the width and number of columns for the narrow layout
        if (d.to == 'normal') {
          cols = 2;
        }
        // override the width and number of columns for the narrow layout
        if (d.to == 'narrow') {
          cols = 1;
        }
        
        // don't invoke if we are loading up on mobile mode
        // it causes suckage. We'll only invoke it once we are above handheld "stacked" mode.
        if (d.to != 'mobile') {
          Drupal.nodemaker.isotopeInvoke(container, item, cols, gutter);
          isotopeInvoked = true;
        }
      });
      
      
      // handle resize of isotope plugin
      $(window).resize(function() {
  		  $('body').one('responsivelayout', function(e, d) {  		  
  		    if(d.from != d.to) {
    		    
    		    container = $('#block-system-main .view-display-id-year .year-view');
            item = '.calendar-calendar';
            gutter = 20;
            cols = 2;
            
            // override the width and number of columns for the narrow layout
            if (d.to == 'normal') {
              cols = 2;
            }
            // override the width and number of columns for the narrow layout
            if (d.to == 'narrow') {
              cols = 1;
            }
            
            
            // we came from mobile where isotope is not invoked, we should call it now
            if (d.from == 'mobile') {
              Drupal.nodemaker.isotopeInvoke(container, item, cols, gutter);
            }
            
            // we are going TO a mobile device, get rid of isotope
            if (d.to == 'mobile') {
              Drupal.nodemaker.isotopeDestroy(container, item);
            }
            else {
              Drupal.nodemaker.isotopeResize(container, item, cols, gutter);  
            }
  		    }
  		  });
  	  });    
    }
  };
  
  
  
+34 −0
Original line number Diff line number Diff line
@@ -260,6 +260,40 @@ div.more-link {
  }
}

// fix the year calendar
.calendar-calendar {
  .year-view {
    
    .calendar-calendar {
      
      margin-bottom: 20px;
      .month-view {
        @include element-background();  
      }
      
      .date-nav {
        background: none;
        padding: 0;
        margin-bottom: 5px;
      }
      .date-heading {
        a {
          @include h5();
          font-weight: normal;
          display: block;
          padding: 10px;
        }
      }
      
      table {
        th, td {
          width: 14.28571428571429%;
          padding: 4px 8px;
        }
      }
    }
  }
}

#block-views-nm-events-upcoming {
  
+24 −0
Original line number Diff line number Diff line
<?php
/**
 * @file
 * Template to display a view as a calendar year.
 * 
 * @see template_preprocess_calendar_year.
 *
 * $view: The view.
 * $months: An array with a formatted month calendar for each month of the year.
 * $min_date_formatted: The minimum date for this calendar in the format YYYY-MM-DD HH:MM:SS.
 * $max_date_formatted: The maximum date for this calendar in the format YYYY-MM-DD HH:MM:SS.
 * 
 */
//dsm('Display: '. $display_type .': '. $min_date_formatted .' to '. $max_date_formatted);
?>

<div class="calendar-calendar">
  <div class="year-view">
    <?php
      for ($i = 1; $i <= 12; $i++) {
        print $months[$i];
      }
    ?>
</div></div>
 No newline at end of file