From 1625cd31c334b017688a8c30631ddad60fafd8f4 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Fri, 18 May 2012 19:57:40 -0500 Subject: Link to provides/conflicts/replacements if we can in details template Use the newly implemented get_best_satisfier() method that is in the abstract base class for all of these types. Signed-off-by: Dan McGee --- templates/packages/details_relatedto.html | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 templates/packages/details_relatedto.html (limited to 'templates/packages/details_relatedto.html') diff --git a/templates/packages/details_relatedto.html b/templates/packages/details_relatedto.html new file mode 100644 index 00000000..1ffe2884 --- /dev/null +++ b/templates/packages/details_relatedto.html @@ -0,0 +1,10 @@ +{% load package_extras %} +{% for related in all_related %} +{% with related.get_best_satisfier as best_satisfier %} +{% ifequal best_satisfier None %} +{{ related.name }}{{ related.comparison|default:"" }}{{ related.version|default:"" }}{% if not forloop.last %}, {% endif %} +{% else %} +{% pkg_details_link best_satisfier %}{{ related.comparison|default:"" }}{{related.version|default:"" }}{% if not forloop.last %}, {% endif %} +{% endifequal %} +{% endwith %} +{% endfor %} -- cgit v1.2.3-54-g00ecf From febf5e92233738198107a69f66c9f3443b4306c7 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 30 Sep 2012 18:18:19 -0500 Subject: Collapse long lists of related packages Just like we did with the rows of depends and required by, collapse down conflicts, provides, etc. comma-separated lists if they grow too large. Signed-off-by: Dan McGee --- sitestatic/archweb.js | 24 +++++++++++++++++++++++- templates/packages/details.html | 13 +++++++------ templates/packages/details_relatedto.html | 12 ++---------- 3 files changed, 32 insertions(+), 17 deletions(-) (limited to 'templates/packages/details_relatedto.html') diff --git a/sitestatic/archweb.js b/sitestatic/archweb.js index 783f75c6..a42e0208 100644 --- a/sitestatic/archweb.js +++ b/sitestatic/archweb.js @@ -206,7 +206,7 @@ function collapseDependsList(list) { // enough items, or the link already exists. var linkid = list.attr('id') + 'link'; var items = list.find('li').slice(limit); - if (items.length == 0 || $('#' + linkid).length > 0) { + if (items.length <= 1 || $('#' + linkid).length > 0) { return; } items.hide(); @@ -221,6 +221,28 @@ function collapseDependsList(list) { }); } +function collapseRelatedTo(elements) { + var limit = 5; + $(elements).each(function(idx, ele) { + ele = $(ele); + // Hide everything past a given limit. Don't do anything if we don't + // have enough items, or the link already exists. + var items = ele.find('span.related').slice(limit); + if (items.length <= 1 || ele.find('a.morelink').length > 0) { + return; + } + items.hide(); + ele.append('Moreā€¦'); + + // add link and wire it up to show the hidden items + ele.find('a.morelink').click(function(event) { + event.preventDefault(); + ele.find('span.related').show(); + $(this).remove(); + }); + }); +} + /* packages/differences.html */ function filter_packages() { /* start with all rows, and then remove ones we shouldn't show */ diff --git a/templates/packages/details.html b/templates/packages/details.html index 5a93ce23..aa073551 100644 --- a/templates/packages/details.html +++ b/templates/packages/details.html @@ -97,7 +97,7 @@

Versions Elsewhere

{% with pkg.split_packages as splits %}{% if splits %} Split Packages: - {% for s in splits %}{% pkg_details_link s %}{% if not forloop.last %}, {% endif %}{% endfor %} + {% for s in splits %}{% pkg_details_link s %}{% if not forloop.last %}, {% endif %}{% endfor %} {% endif %}{% endwith %} {% else %} @@ -134,26 +134,26 @@

Versions Elsewhere

{% with pkg.provides.all as all_related %}{% if all_related %} Provides: - {% include "packages/details_relatedto.html" %} + {% include "packages/details_relatedto.html" %} {% endif %}{% endwith %} {% with pkg.replaces.all as all_related %}{% if all_related %} Replaces: - {% include "packages/details_relatedto.html" %} + {% include "packages/details_relatedto.html" %} {% endif %}{% endwith %} {% with pkg.conflicts.all as all_related %}{% if all_related %} Conflicts: - {% include "packages/details_relatedto.html" %} + {% include "packages/details_relatedto.html" %} {% endif %}{% endwith %} {% with pkg.reverse_conflicts as rev_conflicts %}{% if rev_conflicts %} Reverse Conflicts: - {% for conflict in rev_conflicts %} - {% pkg_details_link conflict %}{% if not forloop.last %}, {% endif %}{% endfor %} + {% for conflict in rev_conflicts %} + {% pkg_details_link conflict %}{% if not forloop.last %}, {% endif %}{% endfor %} {% endif %}{% endwith %} @@ -237,6 +237,7 @@

ajaxifyFiles(); collapseDependsList("#pkgdepslist"); collapseDependsList("#pkgreqslist"); + collapseRelatedTo(".relatedto"); }); {% endblock %} diff --git a/templates/packages/details_relatedto.html b/templates/packages/details_relatedto.html index 1ffe2884..e14375d3 100644 --- a/templates/packages/details_relatedto.html +++ b/templates/packages/details_relatedto.html @@ -1,10 +1,2 @@ -{% load package_extras %} -{% for related in all_related %} -{% with related.get_best_satisfier as best_satisfier %} -{% ifequal best_satisfier None %} -{{ related.name }}{{ related.comparison|default:"" }}{{ related.version|default:"" }}{% if not forloop.last %}, {% endif %} -{% else %} -{% pkg_details_link best_satisfier %}{{ related.comparison|default:"" }}{{related.version|default:"" }}{% if not forloop.last %}, {% endif %} -{% endifequal %} -{% endwith %} -{% endfor %} +{% load package_extras %}{% for related in all_related %}{% with related.get_best_satisfier as best_satisfier %}{% ifequal best_satisfier None %}{{ related.name }}{% else %}{% pkg_details_link best_satisfier %}{% endifequal %}{{ related.comparison|default:"" }}{{ related.version|default:"" }}{% if not forloop.last %}, {% endif %} +{% endwith %}{% endfor %} -- cgit v1.2.3-54-g00ecf