Files @ 3fcb60a152f3
Branch filter:

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

Mads Kiilerich
controllers: avoid setting constants as controller instance variables in __before__

Setting constants in __before__ is a weird pattern and we can do fine without doing it.
That makes it more clear that there is no state in the controller instances.

Real constants can just be set at the module level.

Some values depend on configuration and can thus probably not be set as
constants at module import time but could perhaps be set in __init__. But
reading configuration directly when needed will probably be just as good.
<%inherit file="/base/base.html"/>

<%namespace name="pullrequest_data" file="pullrequest_data.html"/>

<%block name="title">
    ${_('%s Pull Requests') % c.repo_name}
</%block>

<%def name="breadcrumbs_links()">
%if c.from_:
    ${_("Pull Requests from '%s'") % c.repo_name}
%else:
    ${_("Pull Requests to '%s'") % c.repo_name}
%endif
</%def>

<%block name="header_menu">
    ${self.menu('repositories')}
</%block>

<%def name="main()">
${self.repo_context_bar('showpullrequest')}

<div class="panel panel-primary">
    <div class="panel-heading clearfix">
        <div class="pull-left">
            ${self.breadcrumbs()}
        </div>
        <div class="pull-right">
            %if c.authuser.username != 'default':
                <a id="open_new_pr" class="btn btn-success btn-xs" href="${h.url('pullrequest_home',repo_name=c.repo_name)}"><i class="icon-plus"></i> ${_('Open New Pull Request')}</a>
            %endif
            %if c.from_:
                <a class="btn btn-default btn-xs" href="${h.url('pullrequest_show_all',repo_name=c.repo_name,closed=c.closed)}"><i class="icon-git-compare"></i> ${_('Show Pull Requests to %s') % c.repo_name}</a>
            %else:
                <a class="btn btn-default btn-xs" href="${h.url('pullrequest_show_all',repo_name=c.repo_name,closed=c.closed,from_=1)}"><i class="icon-git-compare"></i> ${_("Show Pull Requests from '%s'") % c.repo_name}</a>
            %endif
        </div>
    </div>

    <div class="panel-body">
        <div>
        %if c.closed:
            ${h.link_to(_('Hide closed pull requests (only show open pull requests)'), h.url('pullrequest_show_all',repo_name=c.repo_name,from_=c.from_))}
        %else:
            ${h.link_to(_('Show closed pull requests (in addition to open pull requests)'), h.url('pullrequest_show_all',repo_name=c.repo_name,from_=c.from_,closed=1))}
        %endif
        </div>

        ${pullrequest_data.pullrequest_overview(c.pullrequests_pager)}
    </div>

</div>
</%def>