Changeset - 651e37ed51c6
[Not reviewed]
default
0 4 0
domruf - 9 years ago 2016-11-03 20:03:03
dominikruf@gmail.com
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.
4 files changed with 14 insertions and 14 deletions:
0 comments (0 inline, 0 general)
kallithea/controllers/changelog.py
Show inline comments
 
@@ -47,7 +47,7 @@ log = logging.getLogger(__name__)
 

	
 

	
 
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 @@ def _load_changelog_summary():
 

	
 
    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 @@ class ChangelogController(BaseRepoContro
 
                                                        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 @@ class ChangelogController(BaseRepoContro
 
                [(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()
kallithea/templates/changelog/changelog.html
Show inline comments
 
@@ -32,7 +32,7 @@ ${self.repo_context_bar('changelog', c.f
 
        ${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 @@ ${self.repo_context_bar('changelog', c.f
 

	
 
                <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 @@ ${self.repo_context_bar('changelog', c.f
 

	
 
                </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">
kallithea/templates/changelog/changelog_summary_data.html
Show inline comments
 
## -*- 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:
 

	
kallithea/templates/summary/summary.html
Show inline comments
 
@@ -170,7 +170,7 @@ ${self.repo_context_bar('summary')}
 
<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')}
0 comments (0 inline, 0 general)