University of Oregon

Drupal 7 – resizing the content area based on publish date

I was asked to look at a site where the content created before Jan. 15th 2013 was crafted to display nicely in a 600px wide area.
New content is being added with a much wider area and with some thought given to the possibility of a fluid width (potentially responsive).

So while setting a fixed width isn’t ideal I came up with a proof of concept that demonstrated the possibility using jQuery to resize the content area on page load.
The content in question has two key elements to identify for jQuery:

  1. The publish date:
    $('.field-name-field-publish-date .date-display-single')
  2. The content area:
    $('.field-name-body')

Here’s a sample of the code that could re-format the older content based on the published date:
$(‘.field-name-field-publish-date .date-display-single’).length
//if( (currentContentDate < narrowContentCutOffDate)) { if ( ( new Date($('.field-name-field-publish-date .date-display-single').text()).getTime() < new Date('January 15, 2013').getTime() ) ) { $('.field-name-body').css('width','600px'); }//end if [/code] Wrapped in a Drupal.behaviors function it could be added to the site in a js file like so, to run once on each page load: (more…)

Summer Camp site launched

We launched a new Drupal site a few weeks ago showcasing the available summer camps in the valley: Site
http://hr2.uoregon.edu/summer_camps/

It’s a self-signup site incorporating several modules to make that work:
•    Invite
•    Workflow
•    Rules
•    Auto Assign Role
•    Page Route
•    Node Reference Formatters
•    Moderation
(more…)