TTPac: move results pageing chunk to new template
authorBill Erickson <berick@esilibrary.com>
Mon, 15 Aug 2011 18:56:50 +0000 (14:56 -0400)
committerBill Erickson <berick@esilibrary.com>
Mon, 15 Aug 2011 18:56:50 +0000 (14:56 -0400)
table.tt2 and paging are complex enough and will likely result in much
local customization.  Break them up into 2 page to simplify.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/web/templates/default/opac/parts/result/paginate.tt2 [new file with mode: 0644]
Open-ILS/web/templates/default/opac/parts/result/table.tt2

diff --git a/Open-ILS/web/templates/default/opac/parts/result/paginate.tt2 b/Open-ILS/web/templates/default/opac/parts/result/paginate.tt2
new file mode 100644 (file)
index 0000000..521776e
--- /dev/null
@@ -0,0 +1,57 @@
+[% BLOCK results_count_header %]
+<div class="results_header_nav1">
+    <table cellpadding="0" cellspacing="0" border="0" width="100%">
+        <tr>
+            <td class="h1" width="116">[% l('Search Results') %]</td>
+            <td valign="bottom" nowrap="nowrap" class="result_number">
+                [% |l(ctx.result_start, ctx.result_stop, ctx.hit_count) %]
+                Results <strong>[_1]</strong> - <strong>[_2]</strong> of <strong>[_3]</strong>
+                [% END %]
+                <span style='padding-left: 6px;'>
+                    [% |l(page + 1, page_count) %](page <strong>[_1]</strong> of <strong>[_2]</strong>)[% END %]
+                </span>
+            </td>
+            <td align="right" valign="bottom">
+                <span class='start_end_links_span'>
+
+                    [%  class = 'search_page_nav_link';
+                        href = '#';
+                        IF page > 0;
+                            href = mkurl('', {page => page - 1});
+                        ELSE; class = class _ ' invisible'; END;
+                    %]
+                    <a class='[% class %]' href='[% href %]' 
+                        title='[% l("Previous page") %]'><span class="nav_arrow_fix">&#9668;</span> [% l('Previous') %] </a>
+
+                    <span style='padding-left: 11px; padding-right:11px;'>
+                        [%  # show links to 4 previous pages, the current page, and 3 more pages.
+                            added = 0;
+                            pageitr = page - 5; 
+                            WHILE (pageitr = pageitr + 1) < page_count;
+                                IF pageitr < 0; NEXT; END;
+                                IF pageitr == page; %]
+                                    <span class='results-paginator-selected'>[% pageitr + 1%]</span>
+                                [% ELSE %]
+                                    <a href="[% mkurl('', {page => pageitr}) %]">[% pageitr + 1%]</a>
+                            [%  END;
+                                added = added + 1;
+                                IF added == 8; LAST; END;
+                            END;
+                        %]
+                    </span>
+
+                    [%  class = 'search_page_nav_link';
+                        href = '#';
+                        IF (page + 1) < page_count;
+                            href = mkurl('', {page => page + 1});
+                        ELSE; class = class _ ' invisible'; END;
+                    %]
+                    <a class='[% class %]' href='[% href %]' 
+                        title='[% l("Next page") %]'> [% l('Next') %] <span class="nav_arrow_fix">&#9658;</span></a>
+                </span>
+            </td>
+        </tr>
+    </table>
+</div>
+[% END %]
+
index 6abafab..955f68c 100644 (file)
@@ -7,64 +7,11 @@
     result_count = ctx.result_start;
 %]
 <div style="height: 10px;"></div>
-[% BLOCK results_count_header %]
-<div class="results_header_nav1">
-    <table cellpadding="0" cellspacing="0" border="0" width="100%">
-        <tr>
-            <td class="h1" width="116">[% l('Search Results') %]</td>
-            <td valign="bottom" nowrap="nowrap" class="result_number">
-                [% |l(ctx.result_start, ctx.result_stop, ctx.hit_count) %]
-                Results <strong>[_1]</strong> - <strong>[_2]</strong> of <strong>[_3]</strong>
-                [% END %]
-                <span style='padding-left: 6px;'>
-                    [% |l(page + 1, page_count) %](page <strong>[_1]</strong> of <strong>[_2]</strong>)[% END %]
-                </span>
-            </td>
-            <td align="right" valign="bottom">
-                <span class='start_end_links_span'>
-
-                    [%  class = 'search_page_nav_link';
-                        href = '#';
-                        IF page > 0;
-                            href = mkurl('', {page => page - 1});
-                        ELSE; class = class _ ' invisible'; END;
-                    %]
-                    <a class='[% class %]' href='[% href %]' 
-                        title='[% l("Previous page") %]'><span class="nav_arrow_fix">&#9668;</span> [% l('Previous') %] </a>
-
-                    <span style='padding-left: 11px; padding-right:11px;'>
-                        [%  # show links to 4 previous pages, the current page, and 3 more pages.
-                            added = 0;
-                            pageitr = page - 5; 
-                            WHILE (pageitr = pageitr + 1) < page_count;
-                                IF pageitr < 0; NEXT; END;
-                                IF pageitr == page; %]
-                                    <span class='results-paginator-selected'>[% pageitr + 1%]</span>
-                                [% ELSE %]
-                                    <a href="[% mkurl('', {page => pageitr}) %]">[% pageitr + 1%]</a>
-                            [%  END;
-                                added = added + 1;
-                                IF added == 8; LAST; END;
-                            END;
-                        %]
-                    </span>
 
-                    [%  class = 'search_page_nav_link';
-                        href = '#';
-                        IF (page + 1) < page_count;
-                            href = mkurl('', {page => page + 1});
-                        ELSE; class = class _ ' invisible'; END;
-                    %]
-                    <a class='[% class %]' href='[% href %]' 
-                        title='[% l("Next page") %]'> [% l('Next') %] <span class="nav_arrow_fix">&#9658;</span></a>
-                </span>
-            </td>
-        </tr>
-    </table>
-</div>
-[% END %]
+[% PROCESS "default/opac/parts/result/paginate.tt2" %] 
 [% ctx.results_count_header = PROCESS results_count_header;
     ctx.results_count_header %]
+
 <div id="result_table_div">
     <table cellpadding="0" cellspacing="0" border="0" width="100%">
         <tr>
                                         </tr>
                                         <tr>
                                             <td/>
-                                            <td colspan='5'> <!-- Chilifrehs reviews panel -->
+                                            <td colspan='5'> <!-- Chilifresh reviews panel -->
                                                 <div id="chili_review_[% attrs.isbn_clean %]" style="display: none;" align="center" width="100%"></div>
                                             </td>
                                         </tr>