Files @ 0f9a48e0adc3
Branch filter:

Location: kallithea/kallithea/templates/pullrequests/pullrequest_data.html

Thomas De Schampheleire
pullrequest overview: create overview from a function to allow re-use

In anticipation of re-use of the pullrequest overview, create a def to
generate this overview given a list of pullrequests.

This also adds a check if the given list is empty, and a check if there is a
pager before displaying the paging links.
## -*- coding: utf-8 -*-

<%def name="pullrequest_overview(pullrequests)">

%if not len(pullrequests):
    <div class="normal-indent empty_data">${_('No entries')}</div>
    <% return %>
%endif

<div class="table">
  <table>
    <thead>
      <tr>
        <th></th>
        <th class="left">${_('Title')}</th>
        <th class="left">${_('Author')}</th>
        <th class="left">${_('Date')}</th>
        <th class="left">${_('From')}</th>
        <th class="left">${_('To')}</th>
      </tr>
    </thead>
% for pr in pullrequests:
    <tr class="${'pr-closed' if pr.is_closed() else ''}">
      <td>
        %if pr.last_review_status:
          <i class="icon-circle changeset-status-${pr.last_review_status}" title="${_("Someone voted: %s") % pr.last_review_status}"></i>
        %else:
          <i class="icon-circle changeset-status-not_reviewed" title="${_("Nobody voted")}"></i>
        %endif
      </td>
      <td>
        <a href="${pr.url()}">
        ${pr.title or _("(no title)")}
        %if pr.is_closed():
          <span class="pr-closed-tag">${_('Closed')}</span>
        %endif
        </a>
      </td>
      <td>
        ${pr.author.username_and_name}
      </td>
      <td>
        ${h.fmt_date(pr.created_on)}
      </td>
      <td>
        <% org_ref_name=pr.org_ref.rsplit(':', 2)[-2] %>
        <a href="${h.url('summary_home', repo_name=pr.org_repo.repo_name, anchor=org_ref_name)}">
          ${pr.org_repo.repo_name}#${org_ref_name}
        </a>
      </td>
      <td>
        <% other_ref_name=pr.other_ref.rsplit(':', 2)[-2] %>
        <a href="${h.url('summary_home', repo_name=pr.other_repo.repo_name, anchor=other_ref_name)}">
          ${pr.other_repo.repo_name}#${other_ref_name}
        </a>
      </td>
    </tr>
% endfor
  </table>
</div>

%if pager in pullrequests:
<div class="notification-paginator">
  <div class="pagination-wh pagination-left">
  ${pullrequests.pager('$link_previous ~2~ $link_next', **request.GET.mixed())}
  </div>
</div>
%endif

</%def>

${pullrequest_overview(c.pullrequests_pager)}