]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/templates/kpac/parts/grid.tt2
2e1b459f6a8f7cdecf7752246f36cac314044fc3
[working/Evergreen.git] / Open-ILS / src / templates / kpac / parts / grid.tt2
1 [% 
2 PROCESS 'kpac/parts/util.tt2';
3
4 # Renders a single 'page' grid
5
6 MACRO render_kpac_grid(page_id) BLOCK;
7     page = ctx.kpac_config.pages.page.$page_id;
8     ncols = page.columns || 3; # avoid divide-by-zero
9     name = page.name;
10     idx = 0 %]
11 <table cellpadding="0" cellspacing="0" border="0" class="main_category_table">
12     <tr> [% 
13     width = 100 / ncols;
14     FOR cell IN page.cell;
15         IF idx == ncols; 
16             %]</tr><tr>[%  
17             idx = 0; 
18         END;
19         idx = idx + 1;
20
21         IF cell.type == 'topic';
22             tpage_id = cell.content;
23             topic_page = ctx.kpac_config.pages.page.$tpage_id %]
24
25         <td width="[% width %]%"><a href="[% mkurl(ctx.kpac_root _ '/category', {trail => trail_append(tpage_id)}) %]"><img 
26             src="[% kpac_img_path(topic_page.img) %]" alt="" /><span>[% topic_page.name %]</span></a></td>
27
28         [% ELSIF cell.type == 'search'; %]
29
30         <td width="[% width %]%"><a href="[% mkurl(ctx.kpac_root _ '/results', {query => cell.content}, ['page']) %]"><img 
31             src="[% kpac_img_path(cell.img) %]" alt="" /><span>[% cell.name %]</span></a></td>
32
33         [% ELSIF cell.type == 'link'; %]
34
35         <td width="[% width %]%"><a href="[% cell.content | html %]"><img 
36             src="[% kpac_img_path(cell.img) %]" alt="" /><span>[% cell.name %]</span></a></td>
37
38         [% END %]
39     [% END %]
40     </tr>
41 </table>
42 [% END %]