From 7977214c578ecde1dd6a0d99d60b83116ca3dfa9 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Mon, 6 Feb 2012 23:34:29 -0600 Subject: Clean up details dependency display logic This moves this lengthy conditional block of template into an include so it is a bit more manageable. This makes the fix for FS#28286, where provided optional dependencies were not displayed as expected. Signed-off-by: Dan McGee --- templates/packages/details.html | 48 ++++++++-------------------------- templates/packages/details_depend.html | 15 +++++++++++ 2 files changed, 26 insertions(+), 37 deletions(-) create mode 100644 templates/packages/details_depend.html (limited to 'templates') diff --git a/templates/packages/details.html b/templates/packages/details.html index 1e3a294..f68aefa 100644 --- a/templates/packages/details.html +++ b/templates/packages/details.html @@ -71,7 +71,7 @@ {% endif %}{% endwith %} - + {% cache 300 package-details-pkginfo pkg.id %} @@ -167,40 +167,19 @@ {% with pkg.get_depends as deps %}
-

Dependencies ({{deps|length}})

- - {% if deps %} -
    - {% for depend in deps %} - {% ifequal depend.pkg None %} - {% if depend.providers %} -
  • {{ depend.dep.depname }} ({% multi_pkg_details depend.providers %})
  • - {% else %}
  • {{ depend.dep.depname }} (virtual)
  • - {% endif %} - {% else %} -
  • {% pkg_details_link depend.pkg %}{{ depend.dep.depvcmp|default:"" }} - {% if depend.pkg.repo.testing %}(testing){% endif %} - {% if depend.dep.optional %}(optional){% endif %} - {% if depend.dep.description %}- {{ depend.dep.description }}{% endif %} -
  • - {% endifequal %} - {% endfor %} -
- {% endif %} - -
+ {% if deps %}{% endif %} + {% endwith %} {% with pkg.get_requiredby as rqdby %}
-

Required By ({{rqdby|length}})

- - {% if rqdby %} -
    + {% if rqdby %}
      {% for req in rqdby %}
    • {% pkg_details_link req.pkg %} {% if req.depname != pkg.pkgname %}(requires {{ req.depname }}){% endif %} @@ -208,29 +187,24 @@ {% if req.optional %}(optional){% endif %}
    • {% endfor %} -
    - {% endif %} - -
+ {% endif %} + {% endwith %} - - - + {% endcache %} - + {% load cdn %}{% jquery %} diff --git a/templates/packages/details_depend.html b/templates/packages/details_depend.html new file mode 100644 index 0000000..0226dd2 --- /dev/null +++ b/templates/packages/details_depend.html @@ -0,0 +1,15 @@ +{% load package_extras %} +
  • +{% ifequal depend.pkg None %} +{% if depend.providers %} +{{ depend.dep.depname }} ({% multi_pkg_details depend.providers %}) +{% else %} +{{ depend.dep.depname }} (virtual) +{% endif %} +{% else %} +{% pkg_details_link depend.pkg %}{{ depend.dep.depvcmp|default:"" }} +{% if depend.pkg.repo.testing %} (testing){% endif %} +{% endifequal %} +{% if depend.dep.optional %} (optional){% endif %} +{% if depend.dep.description %}- {{ depend.dep.description }}{% endif %} +
  • -- cgit v1.2.3-24-g4f1b