# HG changeset patch # User domruf # Date 2016-09-20 21:12:56 # Node ID 103f07acad8396654608817a6f99d29d966b3aa7 # Parent ea818def1a09b303a531f11b256cd488068052fd templates: use bootstrap pagination The origiinal patch has been modified by Mads Kiilerich. diff --git a/kallithea/lib/page.py b/kallithea/lib/page.py --- a/kallithea/lib/page.py +++ b/kallithea/lib/page.py @@ -72,7 +72,7 @@ class Page(_Page): # Create a link to the first page (unless we are on the first page # or there would be no need to insert '..' spacers) if self.page != self.first_page and self.first_page < leftmost_page: - nav_items.append(self._pagerlink(self.first_page, self.first_page)) + nav_items.append(HTML.li(self._pagerlink(self.first_page, self.first_page))) # Insert dots if there are pages between the first page # and the currently displayed page range @@ -81,7 +81,7 @@ class Page(_Page): text_ = '..' if self.dotdot_attr: text_ = HTML.span(c=text_, **self.dotdot_attr) - nav_items.append(text_) + nav_items.append(HTML.li(text_)) for thispage in xrange(leftmost_page, rightmost_page + 1): # Highlight the current page number and do not use a link @@ -89,11 +89,11 @@ class Page(_Page): if thispage == self.page: # Wrap in a SPAN tag if nolink_attr is set if self.curpage_attr: - text_ = HTML.span(c=text_, **self.curpage_attr) + text_ = HTML.li(HTML.span(c=text_), **self.curpage_attr) nav_items.append(text_) # Otherwise create just a link to that page else: - nav_items.append(self._pagerlink(thispage, text_)) + nav_items.append(HTML.li(self._pagerlink(thispage, text_))) # Insert dots if there are pages between the displayed # page numbers and the end of the page range @@ -102,26 +102,26 @@ class Page(_Page): # Wrap in a SPAN tag if nolink_attr is set if self.dotdot_attr: text_ = HTML.span(c=text_, **self.dotdot_attr) - nav_items.append(text_) + nav_items.append(HTML.li(text_)) # Create a link to the very last page (unless we are on the last # page or there would be no need to insert '..' spacers) if self.page != self.last_page and rightmost_page < self.last_page: - nav_items.append(self._pagerlink(self.last_page, self.last_page)) + nav_items.append(HTML.li(self._pagerlink(self.last_page, self.last_page))) #_page_link = url.current() #nav_items.append(literal('' % (_page_link, str(int(self.page)+1)))) #nav_items.append(literal('' % (_page_link, str(int(self.page)+1)))) return self.separator.join(nav_items) - def pager(self, format='~2~', page_param='page', partial_param='partial', + def pager(self, format='$link_previous ~2~ $link_next', page_param='page', partial_param='partial', show_if_single_page=False, separator=' ', onclick=None, symbol_first='<<', symbol_last='>>', symbol_previous='<', symbol_next='>', link_attr=None, curpage_attr=None, dotdot_attr=None, **kwargs): - self.curpage_attr = curpage_attr or {'class': 'pager_curpage'} + self.curpage_attr = curpage_attr or {'class': 'active'} self.separator = separator self.pager_kwargs = kwargs self.page_param = page_param @@ -152,12 +152,12 @@ class Page(_Page): self._pagerlink(self.first_page, symbol_first) or '', 'link_last': self.page < self.last_page and \ self._pagerlink(self.last_page, symbol_last) or '', - 'link_previous': self.previous_page and \ + 'link_previous': HTML.li(self.previous_page and \ self._pagerlink(self.previous_page, symbol_previous) \ - or HTML.span(symbol_previous, class_="yui-pg-previous"), - 'link_next': self.next_page and \ + or HTML.a(symbol_previous)), + 'link_next': HTML.li(self.next_page and \ self._pagerlink(self.next_page, symbol_next) \ - or HTML.span(symbol_next, class_="yui-pg-next") + or HTML.a(symbol_next)) }) return literal(result) diff --git a/kallithea/public/css/style.css b/kallithea/public/css/style.css --- a/kallithea/public/css/style.css +++ b/kallithea/public/css/style.css @@ -1119,75 +1119,7 @@ div.form div.form-horizontal div.form-gr padding: 0; } -#content div.panel div.pagination { - height: 1%; - clear: both; - overflow: hidden; - margin: 10px 0 0; - padding: 0; -} - -#content div.panel div.pagination ul.pager { - float: right; - text-align: right; - margin: 0; - padding: 0; -} - -#content div.panel div.pagination ul.pager li { - height: 1%; - float: left; - list-style: none; - background: #ebebeb url("../images/pager.png") repeat-x; - border-top: 1px solid #dedede; - border-left: 1px solid #cfcfcf; - border-right: 1px solid #c4c4c4; - border-bottom: 1px solid #c4c4c4; - color: #4A4A4A; - font-weight: 700; - margin: 0 0 0 4px; - padding: 0; -} - -#content div.panel div.pagination ul.pager li.separator { - padding: 6px; -} - -#content div.panel div.pagination ul.pager li.current { - background: #b4b4b4 url("../images/pager_selected.png") repeat-x; - border-top: 1px solid #ccc; - border-left: 1px solid #bebebe; - border-right: 1px solid #b1b1b1; - border-bottom: 1px solid #afafaf; - color: #515151; - padding: 6px; -} - -#content div.panel div.pagination ul.pager li a { - height: 1%; - display: block; - float: left; - color: #515151; - text-decoration: none; - margin: 0; - padding: 6px; -} - -#content div.panel div.pagination ul.pager li a:hover, -#content div.panel div.pagination ul.pager li a:active { - background: #b4b4b4 url("../images/pager_selected.png") repeat-x; - border-top: 1px solid #ccc; - border-left: 1px solid #bebebe; - border-right: 1px solid #b1b1b1; - border-bottom: 1px solid #afafaf; - margin: -1px; -} - -#content div.panel div.pagination-right { - float: right; -} - -#content div.panel div.pagination-wh { +#content div.panel ul.pagination { height: 1%; overflow: hidden; text-align: right; @@ -1195,21 +1127,20 @@ div.form div.form-horizontal div.form-gr padding: 0; } -#content div.panel div.pagination-wh > :first-child { +#content div.panel ul.pagination > li { + display: inline; +} + +#content div.panel ul.pagination > :first-child { border-radius: 4px 0px 0px 4px; } -#content div.panel div.pagination-wh > :last-child { +#content div.panel ul.pagination > :last-child { border-radius: 0px 4px 4px 0px; border-right: 1px solid #cfcfcf; } -#content div.panel div.pagination-wh a, -#content div.panel div.pagination-wh span.pager_dotdot, -#content div.panel div.pagination-wh span.yui-pg-previous, -#content div.panel div.pagination-wh span.yui-pg-last, -#content div.panel div.pagination-wh span.yui-pg-next, -#content div.panel div.pagination-wh span.yui-pg-first { +#content div.panel ul.pagination > li { height: 1%; float: left; background: #ebebeb url("../images/pager.png") repeat-x; @@ -1221,20 +1152,16 @@ div.form div.form-horizontal div.form-gr padding: 6px; } -#content div.panel div.pagination-wh span.pager_curpage { - height: 1%; - float: left; +#content div.panel ul.pagination > li.active { background: #b4b4b4 url("../images/pager_selected.png") repeat-x; border-top: 1px solid #ccc; border-left: 1px solid #bebebe; border-bottom: 1px solid #afafaf; color: #515151; - font-weight: 700; - padding: 6px; -} - -#content div.panel div.pagination-wh a:hover, -#content div.panel div.pagination-wh a:active { +} + +#content div.panel ul.pagination > a:hover, +#content div.panel ul.pagination > a:active { background: #b4b4b4 url("../images/pager_selected.png") repeat-x; border-top: 1px solid #ccc; border-left: 1px solid #bebebe; @@ -1242,6 +1169,11 @@ div.form div.form-horizontal div.form-gr text-decoration: none; } +#content div.panel ul.pagination > li a { + color: inherit; + text-decoration: inherit; +} + #content div.panel div.traffic div.legend { clear: both; overflow: hidden; @@ -3465,36 +3397,6 @@ div.form div.form-horizontal div.buttons padding: 0; } -#content div.panel div.pagination div.results, -#content div.panel div.pagination-wh div.results { - text-align: left; - float: left; - margin: 0; - padding: 0; -} - -#content div.panel div.pagination div.results span, -#content div.panel div.pagination-wh div.results span { - height: 1%; - display: block; - float: left; - background: #ebebeb url("../images/pager.png") repeat-x; - border-top: 1px solid #dedede; - border-left: 1px solid #cfcfcf; - border-right: 1px solid #c4c4c4; - border-bottom: 1px solid #c4c4c4; - color: #4A4A4A; - font-weight: 700; - margin: 0; - padding: 6px 8px; -} - -#content div.panel div.pagination ul.pager li.disabled, -#content div.panel div.pagination-wh a.disabled { - color: #B4B4B4; - padding: 6px; -} - #login, #register { width: 520px; margin: 10% auto 0; @@ -4084,10 +3986,6 @@ input.status_change_radio { vertical-align: middle; } -.notification-paginator { - padding: 0px 0px 4px 16px; -} - .badge { padding: 4px 4px !important; text-align: center; diff --git a/kallithea/templates/admin/admin_log.html b/kallithea/templates/admin/admin_log.html --- a/kallithea/templates/admin/admin_log.html +++ b/kallithea/templates/admin/admin_log.html @@ -56,8 +56,9 @@ }); -
-${c.users_log.pager('$link_previous ~2~ $link_next')} +
%else: ${_('No actions yet')} diff --git a/kallithea/templates/admin/gists/index.html b/kallithea/templates/admin/gists/index.html --- a/kallithea/templates/admin/gists/index.html +++ b/kallithea/templates/admin/gists/index.html @@ -63,11 +63,9 @@ % endfor -
-
- ${c.gists_pager.pager('$link_previous ~2~ $link_next', **request.GET.mixed())} -
-
+ %else:
${_('There are no gists yet')}
%endif diff --git a/kallithea/templates/admin/notifications/notifications_data.html b/kallithea/templates/admin/notifications/notifications_data.html --- a/kallithea/templates/admin/notifications/notifications_data.html +++ b/kallithea/templates/admin/notifications/notifications_data.html @@ -27,11 +27,9 @@ unread = lambda n:{False:'unread'}.get(n %endfor -
-
- ${c.notifications.pager('$link_previous ~2~ $link_next',controller='admin/notifications',**request.GET.mixed())} -
-
+ %else:
${_('No notifications here yet')}
diff --git a/kallithea/templates/changelog/changelog.html b/kallithea/templates/changelog/changelog.html --- a/kallithea/templates/changelog/changelog.html +++ b/kallithea/templates/changelog/changelog.html @@ -182,9 +182,9 @@ ${self.repo_context_bar('changelog', c.f -
- ${c.pagination.pager('$link_previous ~2~ $link_next')} -
+ diff --git a/kallithea/templates/changelog/changelog_summary_data.html b/kallithea/templates/changelog/changelog_summary_data.html --- a/kallithea/templates/changelog/changelog_summary_data.html +++ b/kallithea/templates/changelog/changelog_summary_data.html @@ -75,9 +75,9 @@ -
-${c.repo_changesets.pager('$link_previous ~2~ $link_next')} -
+ %else: %if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name): diff --git a/kallithea/templates/followers/followers_data.html b/kallithea/templates/followers/followers_data.html --- a/kallithea/templates/followers/followers_data.html +++ b/kallithea/templates/followers/followers_data.html @@ -13,6 +13,6 @@ % endfor -
-${c.followers_pager.pager('$link_previous ~2~ $link_next')} -
+ diff --git a/kallithea/templates/forks/forks_data.html b/kallithea/templates/forks/forks_data.html --- a/kallithea/templates/forks/forks_data.html +++ b/kallithea/templates/forks/forks_data.html @@ -21,9 +21,9 @@
% endfor -
- ${c.forks_pager.pager('$link_previous ~2~ $link_next')} -
+ % else: ${_('There are no forks yet')} % endif diff --git a/kallithea/templates/journal/journal_data.html b/kallithea/templates/journal/journal_data.html --- a/kallithea/templates/journal/journal_data.html +++ b/kallithea/templates/journal/journal_data.html @@ -33,9 +33,9 @@ %endfor %endfor -
- ${c.journal_pager.pager('$link_previous ~2~ $link_next')} -
+ %else:
${_('No entries yet')} diff --git a/kallithea/templates/pullrequests/pullrequest_data.html b/kallithea/templates/pullrequests/pullrequest_data.html --- a/kallithea/templates/pullrequests/pullrequest_data.html +++ b/kallithea/templates/pullrequests/pullrequest_data.html @@ -80,11 +80,9 @@
%if hasattr(pullrequests, 'pager'): -
-
- ${pullrequests.pager('$link_previous ~2~ $link_next', **request.GET.mixed())} -
-
+ %endif diff --git a/kallithea/templates/search/search_commit.html b/kallithea/templates/search/search_commit.html --- a/kallithea/templates/search/search_commit.html +++ b/kallithea/templates/search/search_commit.html @@ -37,7 +37,7 @@ %endif %endfor %if c.cur_query and c.formated_results: -
- ${c.formated_results.pager('$link_previous ~2~ $link_next')} -
+ %endif diff --git a/kallithea/templates/search/search_content.html b/kallithea/templates/search/search_content.html --- a/kallithea/templates/search/search_content.html +++ b/kallithea/templates/search/search_content.html @@ -26,7 +26,7 @@ %endif %endfor %if c.cur_query and c.formated_results: -
- ${c.formated_results.pager('$link_previous ~2~ $link_next')} -
+ %endif diff --git a/kallithea/templates/search/search_path.html b/kallithea/templates/search/search_path.html --- a/kallithea/templates/search/search_path.html +++ b/kallithea/templates/search/search_path.html @@ -20,7 +20,7 @@ %endif %endfor %if c.cur_query and c.formated_results: -
- ${c.formated_results.pager('$link_previous ~2~ $link_next')} -
+ %endif