| |
@@ -11,54 +11,49 @@
|
| |
<h4 class="mb-0 font-weight-bold">
|
| |
Pull Requests for {{ username | avatar(20) | safe }} {{ username }}
|
| |
</h4>
|
| |
+
|
| |
+ <div class="ml-auto">
|
| |
+ <span class="btn-group btn-group-sm issues-tagbar" role="group">
|
| |
+ <a data-togglebutton="pr-type-filed" href="?type=filed&status={{ pr_status }}" id="toggle-open"
|
| |
+ class="btn {{ 'btn-primary' if pr_type == 'filed' else 'btn-outline-primary' }} btn-sm">PR I filed</a>
|
| |
+ <a data-togglebutton="pr-type-actionable" href="?type=actionable&status={{ pr_status }}" id="toggle-merged"
|
| |
+ class="btn {{ 'btn-primary' if pr_type == 'actionable' else 'btn-outline-primary' }} btn-sm">PR I can act on</a>
|
| |
+ </span>
|
| |
+ </div>
|
| |
<div class="ml-auto">
|
| |
<span class="btn-group btn-group-sm issues-tagbar" role="group">
|
| |
- <a data-togglebutton="pr-status-open" href="#" id="toggle-open"
|
| |
- class="btn btn-primary btn-sm">Open</a>
|
| |
- <a data-togglebutton="pr-status-merged" href="#" id="toggle-merged"
|
| |
- class="btn btn-outline-primary btn-sm">Merged</a>
|
| |
- <a data-togglebutton="pr-status-closed" href="#" id="toggle-closed"
|
| |
- class="btn btn-outline-primary btn-sm">Cancelled</a>
|
| |
- <a data-togglebutton="pr-status-all" href="#"
|
| |
- class="btn btn-outline-primary btn-sm">All</a>
|
| |
+ <a data-togglebutton="pr-status-open" href="?type={{ pr_type }}&status=open" id="toggle-open"
|
| |
+ class="btn {{ 'btn-primary' if pr_status == 'open' else 'btn-outline-primary' }} btn-sm">Open</a>
|
| |
+ <a data-togglebutton="pr-status-merged" href="?type={{ pr_type }}&status=merged" id="toggle-merged"
|
| |
+ class="btn {{ 'btn-primary' if pr_status == 'merged' else 'btn-outline-primary' }} btn-sm">Merged</a>
|
| |
+ <a data-togglebutton="pr-status-closed" href="?type={{ pr_type }}&status=cancelled" id="toggle-closed"
|
| |
+ class="btn {{ 'btn-primary' if pr_status == 'cancelled' else 'btn-outline-primary' }} btn-sm">Cancelled</a>
|
| |
+ <a data-togglebutton="pr-status-all" href="?type={{ pr_type }}&status=all"
|
| |
+ class="btn {{ 'btn-primary' if pr_status == 'all' else 'btn-outline-primary' }} btn-sm">All</a>
|
| |
</span>
|
| |
</div>
|
| |
</div>
|
| |
|
| |
<div class="d-flex mt-4 mb-2 align-items-center">
|
| |
+ {% if pr_type == "filed" %}
|
| |
<h5 class="font-weight-bold mb-0">Pull Requests Created</h5>
|
| |
+ {% else %}
|
| |
+ <h5 class="font-weight-bold mb-0">Pull Requests {{username}} can act on</h5>
|
| |
+ {% endif %}
|
| |
<span class="ml-auto btn btn-outline-secondary border-0 o-100 disabled font-weight-bold">
|
| |
<span id="opened_pr_count"></span> PRs
|
| |
</span>
|
| |
</div>
|
| |
|
| |
- {% for request in requests|selectattr("user.username", "equalto", username) %}
|
| |
- {% if request.status|lower != "open" %}
|
| |
- {% set hidden = "hidden "%}
|
| |
- {% else %}
|
| |
- {% set hidden = "" %}
|
| |
- {% endif %}
|
| |
- {% set htmlclass = hidden+"pr-created pr-status pr-status-"+request.status|lower%}
|
| |
+ {% for request in requests %}
|
| |
+ {% set htmlclass = "pr-created pr-status pr-status-"+request.status|lower%}
|
| |
{{render_pullrequest_row(request, request.project, username, class=htmlclass, showproject=True)}}
|
| |
{% endfor %}
|
| |
|
| |
+ {% if total_pages > 1 %}
|
| |
+ {{ pagination_link('page', page, total_pages) }}
|
| |
+ {% endif %}
|
| |
|
| |
- <div class="d-flex mt-4 mb-2 align-items-center">
|
| |
- <h5 class="font-weight-bold mb-0">Pull Requests {{username}} can act on</h5>
|
| |
- <span class="ml-auto btn btn-outline-secondary border-0 o-100 disabled font-weight-bold">
|
| |
- <span id="assigned_pr_count"></span> PRs
|
| |
- </span>
|
| |
- </div>
|
| |
-
|
| |
- {% for request in requests|rejectattr("user.username", "equalto", username) %}
|
| |
- {% if request.status|lower != "open" %}
|
| |
- {% set hidden = "hidden "%}
|
| |
- {% else %}
|
| |
- {% set hidden = "" %}
|
| |
- {% endif %}
|
| |
- {% set htmlclass = hidden+"pr-assigned pr-status pr-status-"+request.status|lower%}
|
| |
- {{render_pullrequest_row(request, request.project, username, class=htmlclass, showproject=True)}}
|
| |
- {% endfor %}
|
| |
</div>
|
| |
</div>
|
| |
|
| |
@@ -69,31 +64,6 @@
|
| |
<script type="text/javascript" nonce="{{ g.nonce }}" src="{{
|
| |
url_for('static', filename='tags.js') }}?version={{ g.version}}"></script>
|
| |
<script type="text/javascript" nonce="{{ g.nonce }}">
|
| |
- count_issues(status='.pr-status-open');
|
| |
- $(function(){
|
| |
- $('.issues-tagbar .btn').click(function(){
|
| |
- var current_btn = $(this).attr("data-togglebutton");
|
| |
- count_issues(status='.'+current_btn);
|
| |
- $('.issues-tagbar .btn-primary').addClass("btn-outline-primary");
|
| |
- $('.issues-tagbar .btn-primary').removeClass("btn-primary");
|
| |
- $(this).removeClass("btn-outline-primary");
|
| |
- $(this).addClass("btn-primary");
|
| |
- if (current_btn == "pr-status-all"){
|
| |
- count_issues(status='');
|
| |
- $(".pr-status").show();
|
| |
- } else {
|
| |
- $(".pr-status").hide();
|
| |
- $("."+$(this).attr("data-togglebutton")).show();
|
| |
- }
|
| |
- showNoResultMessage();
|
| |
- });
|
| |
- });
|
| |
-
|
| |
- function count_issues(status='.pr-status-open') {
|
| |
- var assigned_pr_count = $(status + '.pr-assigned').length;
|
| |
- var opened_pr_count = $(status + '.pr-created').length;
|
| |
- $('#assigned_pr_count').text(assigned_pr_count);
|
| |
- $('#opened_pr_count').text(opened_pr_count);
|
| |
- }
|
| |
+ $('#opened_pr_count').text($('.request-row').length);
|
| |
</script>
|
| |
{% endblock %}
|
| |
This also adds pagination too, also to reduce the amount of data
retrieved from the DB and thus lower the amount of HTML to generate and
send back.
Fixes https://pagure.io/fedora-infrastructure/issue/9165 (hopefully)
Signed-off-by: Pierre-Yves Chibon pingou@pingoured.fr