Split library hours into its own display template
authorDan Scott <dscott@laurentian.ca>
Mon, 16 Dec 2013 20:02:41 +0000 (15:02 -0500)
committerDan Scott <dscott@laurentian.ca>
Mon, 16 Dec 2013 20:17:09 +0000 (15:17 -0500)
There is enough complexity in the template that it is likely to
undergo churn and customization. So break it out.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
Open-ILS/src/templates/opac/library.tt2
Open-ILS/src/templates/opac/parts/library/hours.tt2 [new file with mode: 0644]

index 7fd8fb4..0c51050 100644 (file)
     -%]
 
     [%- IF ctx.hours; %]
-    <h2>[% l('Opening hours') %]</h2>
-    <div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Monday" />[%
-        l('Monday: [_1]-[_2]', '<span property="opens">' _ ctx.hours.dow_0_open.substr(0, 5) _ '</span>',
-         '<span property="closes">' _ ctx.hours.dow_0_close.substr(0, 5) _ '</span>') -%]
-    </div>
-    <div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Tuesday" />[%
-        l('Tuesday: [_1]-[_2]', '<span property="opens">' _ ctx.hours.dow_1_open.substr(0, 5) _ '</span>',
-         '<span property="closes">' _ ctx.hours.dow_1_close.substr(0, 5) _ '</span>') -%]
-    </div>
-    <div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Wednesday" />[%
-        l('Wednesday: [_1]-[_2]', '<span property="opens">' _ ctx.hours.dow_2_open.substr(0, 5) _ '</span>',
-         '<span property="closes">' _ ctx.hours.dow_2_close.substr(0, 5) _ '</span>') -%]
-    </div>
-    <div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Thursday" />[%
-        l('Thursday: [_1]-[_2]', '<span property="opens">' _ ctx.hours.dow_3_open.substr(0, 5) _ '</span>',
-         '<span property="closes">' _ ctx.hours.dow_3_close.substr(0, 5) _ '</span>') -%]
-    </div>
-    <div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Friday" />[%
-        l('Friday: [_1]-[_2]', '<span property="opens">' _ ctx.hours.dow_4_open.substr(0, 5) _ '</span>',
-         '<span property="closes">' _ ctx.hours.dow_4_close.substr(0, 5) _ '</span>') -%]
-    </div>
-    <div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Saturday" />[%
-        l('Saturday: [_1]-[_2]', '<span property="opens">' _ ctx.hours.dow_5_open.substr(0, 5) _ '</span>',
-         '<span property="closes">' _ ctx.hours.dow_5_close.substr(0, 5) _ '</span>') -%]
-    </div>
-    <div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Sunday" />[%
-        l('Sunday: [_1]-[_2]', '<span property="opens">' _ ctx.hours.dow_6_open.substr(0, 5) _ '</span>',
-         '<span property="closes">' _ ctx.hours.dow_6_close.substr(0, 5) _ '</span>') -%]
-    </div>
+        [%- INCLUDE "opac/parts/library/hours.tt2"; %]
     [% END; -%]
 
     [%- IF (ctx.library.email OR ctx.library.phone); %]
diff --git a/Open-ILS/src/templates/opac/parts/library/hours.tt2 b/Open-ILS/src/templates/opac/parts/library/hours.tt2
new file mode 100644 (file)
index 0000000..07c559f
--- /dev/null
@@ -0,0 +1,29 @@
+<h2>[% l('Opening hours') %]</h2>
+<div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Monday" />[%
+    l('Monday: [_1]-[_2]', '<span property="opens">' _ ctx.hours.dow_0_open.substr(0, 5) _ '</span>',
+     '<span property="closes">' _ ctx.hours.dow_0_close.substr(0, 5) _ '</span>') -%]
+</div>
+<div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Tuesday" />[%
+    l('Tuesday: [_1]-[_2]', '<span property="opens">' _ ctx.hours.dow_1_open.substr(0, 5) _ '</span>',
+     '<span property="closes">' _ ctx.hours.dow_1_close.substr(0, 5) _ '</span>') -%]
+</div>
+<div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Wednesday" />[%
+    l('Wednesday: [_1]-[_2]', '<span property="opens">' _ ctx.hours.dow_2_open.substr(0, 5) _ '</span>',
+     '<span property="closes">' _ ctx.hours.dow_2_close.substr(0, 5) _ '</span>') -%]
+</div>
+<div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Thursday" />[%
+    l('Thursday: [_1]-[_2]', '<span property="opens">' _ ctx.hours.dow_3_open.substr(0, 5) _ '</span>',
+     '<span property="closes">' _ ctx.hours.dow_3_close.substr(0, 5) _ '</span>') -%]
+</div>
+<div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Friday" />[%
+    l('Friday: [_1]-[_2]', '<span property="opens">' _ ctx.hours.dow_4_open.substr(0, 5) _ '</span>',
+     '<span property="closes">' _ ctx.hours.dow_4_close.substr(0, 5) _ '</span>') -%]
+</div>
+<div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Saturday" />[%
+    l('Saturday: [_1]-[_2]', '<span property="opens">' _ ctx.hours.dow_5_open.substr(0, 5) _ '</span>',
+     '<span property="closes">' _ ctx.hours.dow_5_close.substr(0, 5) _ '</span>') -%]
+</div>
+<div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Sunday" />[%
+    l('Sunday: [_1]-[_2]', '<span property="opens">' _ ctx.hours.dow_6_open.substr(0, 5) _ '</span>',
+     '<span property="closes">' _ ctx.hours.dow_6_close.substr(0, 5) _ '</span>') -%]
+</div>