Mercurial > kallithea
changeset 6842:651e37ed51c6
controllers: consistently use c.cs_pagination for changeset paginators
More consistency makes it easier and less confusion to introduce a shared
changelog_table implementation. Just rename context variables.
author | domruf <dominikruf@gmail.com> |
---|---|
date | Thu, 03 Nov 2016 20:03:03 +0100 |
parents | f0ec7be78077 |
children | ff5caafa26dc |
files | kallithea/controllers/changelog.py kallithea/templates/changelog/changelog.html kallithea/templates/changelog/changelog_summary_data.html kallithea/templates/summary/summary.html |
diffstat | 4 files changed, 14 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/controllers/changelog.py Mon Aug 28 05:25:40 2017 +0200 +++ b/kallithea/controllers/changelog.py Thu Nov 03 20:03:03 2016 +0100 @@ -47,7 +47,7 @@ def _load_changelog_summary(): - # also used from summary ... + # only used from summary ... p = safe_int(request.GET.get('page'), 1) size = safe_int(request.GET.get('size'), 10) @@ -57,10 +57,10 @@ collection = c.db_repo_scm_instance - c.repo_changesets = RepoPage(collection, page=p, + c.cs_pagination = RepoPage(collection, page=p, items_per_page=size, url=url_generator) - page_revisions = [x.raw_id for x in list(c.repo_changesets)] + page_revisions = [x.raw_id for x in list(c.cs_pagination)] c.cs_comments = c.db_repo.get_comments(page_revisions) c.cs_statuses = c.db_repo.statuses(page_revisions) @@ -146,10 +146,10 @@ branch_name=branch_name) c.total_cs = len(collection) - c.pagination = RepoPage(collection, page=p, item_count=c.total_cs, + c.cs_pagination = RepoPage(collection, page=p, item_count=c.total_cs, items_per_page=c.size, branch=branch_name,) - page_revisions = [x.raw_id for x in c.pagination] + page_revisions = [x.raw_id for x in c.cs_pagination] c.cs_comments = c.db_repo.get_comments(page_revisions) c.cs_statuses = c.db_repo.statuses(page_revisions) except EmptyRepositoryError as e: @@ -169,11 +169,11 @@ [(k, prefix + k) for k in c.db_repo_scm_instance.closed_branches.keys()] revs = [] if not f_path: - revs = [x.revision for x in c.pagination] + revs = [x.revision for x in c.cs_pagination] c.jsdata = graph_data(c.db_repo_scm_instance, revs) c.revision = revision # requested revision ref - c.first_revision = c.pagination[0] # pagination is never empty here! + c.first_revision = c.cs_pagination[0] # pagination is never empty here! return render('changelog/changelog.html') @LoginRequired()
--- a/kallithea/templates/changelog/changelog.html Mon Aug 28 05:25:40 2017 +0200 +++ b/kallithea/templates/changelog/changelog.html Thu Nov 03 20:03:03 2016 +0100 @@ -32,7 +32,7 @@ ${self.breadcrumbs()} </div> <div class="panel-body changelog-panel"> - %if c.pagination: + %if c.cs_pagination: <div class="changelog-heading clearfix" style="${'display:none' if c.changelog_for_path else ''}"> <div class="pull-left"> ${h.form(h.url.current(),method='get',class_="form-inline")} @@ -71,7 +71,7 @@ <table class="table" id="changesets"> <tbody> - %for cnt,cs in enumerate(c.pagination): + %for cnt,cs in enumerate(c.cs_pagination): <tr id="chg_${cnt+1}" class="${'mergerow' if len(cs.parents) > 1 else ''}"> <td class="checkbox-column"> %if c.changelog_for_path: @@ -181,7 +181,7 @@ </div> - ${c.pagination.pager()} + ${c.cs_pagination.pager()} <script type="text/javascript" src="${h.url('/js/graph.js', ver=c.kallithea_version)}"></script> <script type="text/javascript">
--- a/kallithea/templates/changelog/changelog_summary_data.html Mon Aug 28 05:25:40 2017 +0200 +++ b/kallithea/templates/changelog/changelog_summary_data.html Thu Nov 03 20:03:03 2016 +0100 @@ -1,5 +1,5 @@ ## -*- coding: utf-8 -*- -%if c.repo_changesets: +%if c.cs_pagination: <table class="table"> <tr> <th class="left"></th> @@ -10,7 +10,7 @@ <th class="left">${_('Author')}</th> <th class="left">${_('Refs')}</th> </tr> -%for cnt,cs in enumerate(c.repo_changesets): +%for cnt,cs in enumerate(c.cs_pagination): <tr class="parity${cnt%2} ${'mergerow' if len(cs.parents) > 1 else ''}"> <td class="compact"> %if c.cs_statuses.get(cs.raw_id): @@ -71,7 +71,7 @@ </table> -${c.repo_changesets.pager()} +${c.cs_pagination.pager()} %else:
--- a/kallithea/templates/summary/summary.html Mon Aug 28 05:25:40 2017 +0200 +++ b/kallithea/templates/summary/summary.html Thu Nov 03 20:03:03 2016 +0100 @@ -170,7 +170,7 @@ <div class="panel panel-primary"> <div class="panel-heading"> <div class="breadcrumbs panel-title"> - %if c.repo_changesets: + %if c.cs_pagination: ${h.link_to(_('Latest Changes'),h.url('changelog_home',repo_name=c.repo_name))} %else: ${_('Quick Start')}