From d5812ea95703c0886d5c4b525ab41fd9a1d3721c Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Jul 29 2019 04:38:37 +0000 Subject: [frontend] extract code for rendering project box into its own macro --- diff --git a/frontend/coprs_frontend/coprs/templates/_helpers.html b/frontend/coprs_frontend/coprs/templates/_helpers.html index 7e76688..ed65088 100644 --- a/frontend/coprs_frontend/coprs/templates/_helpers.html +++ b/frontend/coprs_frontend/coprs/templates/_helpers.html @@ -684,3 +684,32 @@ https://admin.fedoraproject.org/accounts/group/view/{{name}} {% endmacro %} + + +{% macro render_project_box(copr) %} + +
+

+ {{ copr_name(copr) }} +

+ {% if copr.delete_after %} + (temporary project, {{ copr.delete_after_msg }}) + {% endif %} +
+ + {{ copr.description|markdown|remove_anchor|default('Description not filled in by author. Very likely personal repository for testing purpose, which you should not use.', true) }} +
    + {% for os in copr.active_chroots_grouped %} +
  • + {{ friendly_os_name(os[0].split()[0], os[0].split()[1]) }}: + + {% for arch in os[1] %} + {{ arch }}{% if not loop.last %}, {% endif %} + {% endfor %} + +
  • + {% endfor %} +
+
+
+{% endmacro %} diff --git a/frontend/coprs_frontend/coprs/templates/coprs/group_show.html b/frontend/coprs_frontend/coprs/templates/coprs/group_show.html index f3bafef..a715717 100644 --- a/frontend/coprs_frontend/coprs/templates/coprs/group_show.html +++ b/frontend/coprs_frontend/coprs/templates/coprs/group_show.html @@ -2,7 +2,7 @@ {% block title %}Project List{% endblock %} {% block header %}Project List{% endblock %} {% from "_helpers.html" import render_pagination, copr_details_href, copr_name, user_projects_panel %} -{% from "_helpers.html" import recent_builds_panel, task_queue_panel, friendly_os_name %} +{% from "_helpers.html" import recent_builds_panel, task_queue_panel, friendly_os_name, render_project_box %} {%block main_menu_projects %}active{% endblock %} {% block body %}
@@ -15,27 +15,7 @@
{% for copr in coprs %} - - -

- {{ copr_name(copr) }} -

- - {{ copr.description|markdown|remove_anchor|default('Description not filled in by author. Very likely personal repository for testing purpose, which you should not use.', true) }} -
    - {% for os in copr.active_chroots_grouped %} -
  • - {{ friendly_os_name(os[0].split()[0], os[0].split()[1]) }}: - - {% for arch in os[1] %} - {{arch}}{% if not loop.last %}, {% endif %} - {%endfor%} - -
  • - {% endfor %} -
-
-
+ {{ render_project_box(copr) }} {% else %}

No projects...

{% endfor %} diff --git a/frontend/coprs_frontend/coprs/templates/coprs/show.html b/frontend/coprs_frontend/coprs/templates/coprs/show.html index f71361f..e4f4df5 100644 --- a/frontend/coprs_frontend/coprs/templates/coprs/show.html +++ b/frontend/coprs_frontend/coprs/templates/coprs/show.html @@ -3,6 +3,7 @@ {% block header %}Project List{% endblock %} {% from "_helpers.html" import render_pagination, copr_details_href, copr_name, user_projects_panel %} {% from "_helpers.html" import recent_builds_panel, task_queue_panel, recent_blog_panel, friendly_os_name %} +{% from "_helpers.html" import render_project_box %} {%block main_menu_projects %}active{% endblock %} {% block body %}