TTPac: Hide pagination for 1-page hits
authorBill Erickson <berick@esilibrary.com>
Tue, 16 Aug 2011 12:24:38 +0000 (08:24 -0400)
committerBill Erickson <berick@esilibrary.com>
Tue, 16 Aug 2011 12:24:38 +0000 (08:24 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/web/templates/default/opac/parts/result/paginate.tt2

index 521776e..6582c01 100644 (file)
                         [%  # 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;
+                            IF page_count > 1; # no need to paginate 1 page
+                                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;
                             END;
                         %]
                     </span>