-
Notifications
You must be signed in to change notification settings - Fork 4
Mobile: Campus Home
The process for updating the campus home page template/assets for the responsive stylesheet.
Replace the content in: _library/campus-home/templates/Home Page
(link) with the content of app/cascade/templates/Campus-Home.html
in this repository.
- In
site://_library/campus-home/blocks/xhtml/common/html-head
, replace the content with this:
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<!-- Link to development stylesheet. @change before going live -->
<link href="http://ucsc.github.io/webtemplates2014/css/ucsc.css" rel="stylesheet" type="text/css" />
<!-- jQuery and Modernizr -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.js" type="text/javascript"></script>
<script src="/render/file.act?path=site://static/js/modernizr-1.5.min.js" type="text/javascript"></script>
Why: Standardized naming conventions: scope
-component
.
- Scope:
global
,site
, orpage
. - Component:
nav
,search
, etc.
- In
site://_library/campus-home/blocks/xhtml/common/campus-home-links
, add the classglobal-nav
to the<ul>
.
Why: Adds .js
class to body tag, and provides menu toggle functionality for browsers with js enabled.
<script>
$(document).ready(function() {
$('body').addClass('js');
var $globalmenu = $('.page-top'),
$mainmenu = $('#mainNav'),
$menulink = $('.menu-toggle');
$menulink.click(function() {
$globalmenu.toggleClass('active');
$mainmenu.toggleClass('active');
return false;
});
});
</script>
Why: Responsive menu toggle and header needs an h1.
In site://_library/campus-home/blocks/xhtml/common/campus-home-logo
,
- The logo should be an
<h1>
. - Add the menu toggle button for toggling the menus on smaller screens.
The block code should now look like this:
<h1>
<a href="site://www/index" id="logo" title="Return the UCSC home page">UC Santa Cruz home</a>
</h1>
<a class="menu-toggle" href="#mainNav">Menu <i class="icon-arrow-down-md"> </i></a>
Note the  
in the menu button. Unfortunately, it was necessary because the browsers don't like an empty tag.
- We will change the
<div>
to a<section>
, which is more semantic and accessible. - The first headline in a page region such as a section should be an
<h1>
, so we will change the<h2>
to an<h1>
in the code. - We will move the "more" link to the bottom of the block, which makes more sense from a flow perspective, especially on smaller screens, where the old way makes even less sense (offering a link to more before the user had a chance to read the ones on the page). Additionally, we will stop using just the word, "more" and instead say, "more events" to make the link text more understandable when read aloud.
In /campus-home/formats/home-page/block-home-events
, replace the code with:
## Get events for an Featured Events listing
#set ($events = $_XPathTool.selectNodes($contentRoot,"//system-data-structure/event"))
<section id="events">
<h1>Featured <span>Events</span></h1>
<dl>
#foreach($item in $events)
## Get/set vars
#set ($line1 = $item.getChild("line-one").text.replace("&","&"))
#set ($line2 = $item.getChild("line-two").text.replace("&","&"))
#set ($link = $item.getChild("url").text)
#set ($dateNode = $item.getChild("date").text)
## Get date from text date
#set($pageDate = $_DateTool.toDate("M-d-y",$dateNode))
## Set vars for month and day
#set ($pageDateMonth = $_DateTool.format('MMM',$pageDate))
#set ($pageDateDay = $_DateTool.format('d',$pageDate))
## Output HTML
<dt>${pageDateMonth} <strong>${pageDateDay}</strong></dt>
<dd><a href="${link}">${line1}<br />${line2}</a></dd>
#end
</dl>
<p><a class="more" title="More events" href="https://events.ucsc.edu">More events »</a></p>
</section>
In /campus-home/formats/home-page/block-home-news
make the following changes:
- Add a class,
news
to the#news
div. - Change the
<div>
to a<section>
. So,<div id="news" class="news">
becomes<section id="news" class="news">
. - Change the headline level from
<h2>
to<h1>
. - Wrap news items in a single
<a>
element to remove superfluous links; accessibility best practice.
So this:
<li>
#if($imgLink && $imgLink != "")
<a href="${path}" title="Read more about: ${title}"><img class="fltlft" src="${imgLink}" alt="${_EscapeTool.xml($imgAlt)}" height="52px" /></a>
#end
<span class="date">${pageDateText}</span>
<a href="${path}">${title}</a>
</li>
becomes this:
<li>
<a href="${path}">
#if($imgLink && $imgLink != "")
<span class="thumbnail">
<img alt="${_EscapeTool.xml($imgAlt)}" class="fltlft" src="${imgLink}" />
</span>
#end
<span class="date">${pageDateText}</span>
<span class="headline">${title}</span>
</a>
</li>