From f18d48087a8cbb45f0b45d6d832a0fdd2e919d09 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Feb 20 2017 14:12:17 +0000 Subject: Use a macro to render the issue table in the roadmap --- diff --git a/pagure/templates/roadmap.html b/pagure/templates/roadmap.html index c92b69a..6cdec80 100644 --- a/pagure/templates/roadmap.html +++ b/pagure/templates/roadmap.html @@ -4,9 +4,113 @@ repo.namespace + '/' if repo.namespace }}{{ repo.name }}{% endblock %} {% set tag = "home"%} - {% block repo %} +{% macro render_issue_list(issues, title, id, milestone) %} +
+
+ + + + + + {% if status and status|lower == 'closed' %} + + {% else %} + + {% endif %} + + + + + + + + {% for issue in issues |sort(attribute='priority') %} + {% if status is none or status|lower == 'all' or issue.status == status %} + + + + + + + + + {% endif %} + {% else %} + + + + {% endfor %} + +
{{ title }} + {% if milestone and repo.milestones[milestone] %} +   (Due: {{ repo.milestones[milestone] }}) + {% endif %} + OpenedClosedModified + Priority + + Assignee + Status
+ #{{ issue.id }} + {% if issue.private %} + + {% endif %} + + {{ issue.title | noJS("img") | safe }} + +    + {% if issue.comments | count > 0 %} + + + {{ issue.comments | count }} + + {% endif %} + {% for tag in issue.tags %} + {{ tag.tag }} + {% endfor %} + + {{ + issue.date_created | humanize }} + + {% if status and status|lower == 'closed' %} + {{ + issue.closed_at | humanize }} + {% else %} + {{ + issue.last_updated | humanize }} + {% endif %} + + {% if issue.priority %} + {{ repo.priorities[issue.priority | string] }} + {% endif %} + + {% if issue.assignee %} + {{ issue.assignee.default_email | avatar(16) | safe }} + {{ issue.assignee.user }} + {% else %} + unassigned + {% endif %} + + {{ issue.status }} +
No issues found
+
+
+{% endmacro %} +

Milestone Roadmap @@ -150,218 +254,23 @@ {% if not issues %}
- - No issues found - + + No issues found +
{% endif %} {% if no_stones %} -
-
- - - - - - {% if status and status|lower == 'closed' %} - - {% else %} - - {% endif %} - - - - - - - - {% for issue in issues |sort(attribute='priority') %} - {% if status is none or status|lower == 'all' or issue.status == status %} - - - - - - - - - {% endif %} - {% else %} - - - - {% endfor %} - -
No Milestone - OpenedClosedModified - Priority - - Assignee - Status
- #{{ issue.id }} - {% if issue.private %} - - {% endif %} - - {{ issue.title | noJS("img") | safe }} - -    - {% if issue.comments|count > 0 %} - - - {{issue.comments|count}} - - {% endif %} - {% for tag in issue.tags%} - {{tag.tag}} - {% endfor%} - - {{ - issue.date_created | humanize}} - - {% if status and status|lower == 'closed' %} - {{ - issue.closed_at | humanize}} - {% else %} - {{ - issue.last_updated | humanize}} - {% endif %} - - {% if issue.priority %} - {{ repo.priorities[issue.priority | string] }} - {% endif %} - - {% if issue.assignee %} - {{ issue.assignee.default_email | avatar(16) | safe }} - {{ issue.assignee.user }} - {% else %} - unassigned - {% endif %} - - {{ issue.status }} -
No issues found
-
-
+ {{ render_issue_list( + issues, title='No Milestone', + id='no_stones', milestone=None) }} {% endif %} {% for milestone in milestones %} {% if issues[milestone] %} -
-
- - - - - - {% if status and status|lower == 'closed' %} - - {% else %} - - {% endif %} - - - - - - - - {% for issue in issues[milestone] |sort(attribute='priority') %} - {% if status is none or status|lower == 'all' or issue.status == status %} - - - - - - - - - {% endif %} - {% else %} - - - - {% endfor %} - -
{{ milestone }} - {% if repo.milestones[milestone] %} -   (Due: {{ repo.milestones[milestone] }}) - {% endif %} - OpenedClosedModified - Priority - - Assignee - Status
- #{{ issue.id }} - {% if issue.private %} - - {% endif %} - - {{ issue.title | noJS("img") | safe }} - -    - {% if issue.comments|count > 0 %} - - - {{issue.comments|count}} - - {% endif %} - {% for tag in issue.tags%} - {{tag.tag}} - {% endfor%} - - {{ - issue.date_created | humanize}} - - {% if status and status|lower == 'closed' %} - {{ - issue.closed_at | humanize}} - {% else %} - {{ - issue.last_updated | humanize}} - {% endif %} - - {% if issue.priority %} - {{ repo.priorities[issue.priority | string] }} - {% endif %} - - {% if issue.assignee %} - {{ issue.assignee.default_email | avatar(16) | safe }} - {{ issue.assignee.user }} - {% else %} - unassigned - {% endif %} - - {{ issue.status }} -
No issues found
-
-
+ {{ render_issue_list( + issues[milestone], title=milestone, + id=loop.index, milestone=milestone) }} {% endif %} {% endfor %} {% endblock %}