source: trunk/templates/display_metadata.tt @ 1095

Last change on this file since 1095 was 1095, checked in by Dominic Hargreaves, 14 years ago

Only linkify categories and locales if they exist (fixes #15)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.6 KB
Line 
1[% USE CGI %]
2<!-- METADATA STARTS -->
3[% IF phone OR fax OR address OR postcode OR formatted_website_text
4       OR hours_text OR map_link OR categories.size OR locales.size OR
5       node_image %]
6<div id="metadata" class="vcard">
7[% IF node_image %]
8  <div id="node_image_box">
9    [% IF node_image_url %]<a href="[% node_image_url %]">[% END %]
10    <img id="node_image" src="[% node_image %]"
11         alt="Picture of [% node_name %]" />
12    [% IF node_image_url %]</a>[% END %]
13    [% IF node_image_copyright %]
14      <div id="node_image_copyright">
15        [% IF node_image_licence %]
16          <a href="[% node_image_licence %]">&copy;
17            [% node_image_copyright %]</a>
18        [% ELSE %]
19          &copy; [% node_image_copyright %]
20        [% END %]
21      </div>
22    [% END %]
23  </div>
24[% ELSE %]
25  <span id="node_no_image" />
26[% END %]
27
28  <!-- For the vcard -->
29  <span class="fn" style="display:none">[% node_name %]</span>
30[% IF phone OR fax OR address OR postcode OR formatted_website_text
31      OR hours_text OR map_link %]
32  <ul id="general_metadata">
33
34    [% IF phone %]
35      <li class="telephone">
36        <span class="metadata_label">Telephone:</span> <span class="tel">[% CGI.escapeHTML(phone) %]</span>
37      </li>
38    [% END %]
39    [% IF fax %]
40      <li class="fax">
41        <span class="metadata_label">Fax:</span> [% CGI.escapeHTML(fax) %]
42      </li>
43    [% END %]
44    [% IF address %]
45      <li class="address">
46        <span class="metadata_label">Address:</span>
47        <span class="adr"><span class="street-address">[% CGI.escapeHTML(address) %]</span></span><!--, [% default_city %] --> [%# uncomment at left to show city %]
48        [% IF map_link %]
49          <a href="[% map_link %]">(map of this place)</a>
50        [% END %]
51      </li>
52    [% ELSIF map_link %]
53      <li class="map">
54        <span class="metadata_label"><a href="[% map_link %]">Map of this place</a></span>
55      </li>
56    [% END %]
57    [% IF postcode %]
58      <li class="postcode">
59        <span class="metadata_label">Postcode:</span>
60        <span class="adr"><span class="postal-code">[% CGI.escapeHTML(postcode) %]</span></span>
61      </li>
62    [% END %]
63    [% IF formatted_website_text %]
64      <li class="website_link">
65        <span class="metadata_label">Website:</span> <span class="url">[% formatted_website_text %]</span>
66      </li>
67    [% END %]
68    [% IF hours_text %]
69      <li class="opening_hours">
70        <span class="metadata_label">Opening Hours:</span>
71        [% CGI.escapeHTML(hours_text) %]
72      </li>
73    [% END %]
74  </ul>
75[% END %]
76
77[% IF (categories.size AND categories.size > 0)
78   OR (locales.size AND locales.size > 0) %]
79  <ul id="categories_and_locales">
80    [% IF categories.size AND categories.size > 0 %]
81      <li class="categories_list">
82        <span class="metadata_label">Categories:</span>
83        [% FOREACH category = categories %]
84          [% IF category.url != "" %]
85            <a href="[% category.url %]" class="category">[% category.name %]</a>[%- "," UNLESS loop.last %]
86          [% ELSE %]
87            [% category.name %][%- "," UNLESS loop.last %]
88          [% END %]
89        [% END %]
90      </li>
91    [% END %]
92
93    [% IF locales.size AND locales.size > 0 %]
94      <li class="locales_list">
95        <span class="metadata_label">Locales:</span>
96        [% FOREACH locale = locales %]
97          [% IF locale.url != "" %]
98            <a href="[% locale.url %]" class="addr locality">[% locale.name %]</a>[%- "," UNLESS loop.last %]
99          [% ELSE %]
100            [% locale.name %][%- "," UNLESS loop.last %]
101          [% END %]
102        [% END %]
103      </li>
104    [% END %]
105  </ul>
106[% END %]
107</div>
108[% END %]
109<!-- METADATA ENDS -->
Note: See TracBrowser for help on using the repository browser.