From f36d876aca5571f09032d0d2a67c8b1f1a3258c8 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sat, 12 May 2012 09:22:52 -0500 Subject: Change to new time access methods in pgpdump code Signed-off-by: Dan McGee --- templates/packages/details.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'templates/packages/details.html') diff --git a/templates/packages/details.html b/templates/packages/details.html index 4ab55ef2..4cb6032e 100644 --- a/templates/packages/details.html +++ b/templates/packages/details.html @@ -165,7 +165,7 @@

Versions Elsewhere

{% with pkg.signer as signer %}{% if signer %}{% pgp_key_link pkg.signature.key_id signer.get_full_name %}{% else %}Unknown ({% pgp_key_link pkg.signature.key_id %}){% endif %}{% endwith %} Signature Date: - {{ pkg.signature.datetime|date:"DATETIME_FORMAT" }} UTC + {{ pkg.signature.creation_time|date:"DATETIME_FORMAT" }} UTC {% else %} Signed By: Unsigned -- cgit v1.2.3-54-g00ecf 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.html | 12 ++++++------ templates/packages/details_relatedto.html | 10 ++++++++++ 2 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 templates/packages/details_relatedto.html (limited to 'templates/packages/details.html') diff --git a/templates/packages/details.html b/templates/packages/details.html index 4cb6032e..358ab525 100644 --- a/templates/packages/details.html +++ b/templates/packages/details.html @@ -120,22 +120,22 @@

Versions Elsewhere

{% endif %}{% endwith %} - {% with pkg.provides.all as provides %}{% if provides %} + {% with pkg.provides.all as all_related %}{% if all_related %} Provides: - {{ provides|join:", " }} + {% include "packages/details_relatedto.html" %} {% endif %}{% endwith %} - {% with pkg.conflicts.all as conflicts %}{% if conflicts %} + {% with pkg.conflicts.all as all_related %}{% if all_related %} Conflicts: - {{ conflicts|join:", " }} + {% include "packages/details_relatedto.html" %} {% endif %}{% endwith %} - {% with pkg.replaces.all as replaces %}{% if replaces %} + {% with pkg.replaces.all as all_related %}{% if all_related %} Replaces: - {{ replaces|join:", " }} + {% include "packages/details_relatedto.html" %} {% endif %}{% endwith %} 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 ca86b8d339ff3b8e74ac6d2ccf8a14458a690cf5 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Thu, 5 Jul 2012 17:36:22 -0500 Subject: Collapse the dependencies and required by lists when they are long For now, this happens when the lists are over 20 items. Using JS, hide the 21st and following packages listed in the list and replace them with a 'Show More...' link that users can click to get the full list. For a package such as glibc with 444 'Required By' entries, this can make quite a visual difference. Signed-off-by: Dan McGee --- sitestatic/archweb.js | 26 ++++++++++++++++++++++++-- templates/packages/details.html | 10 +++++++--- 2 files changed, 31 insertions(+), 5 deletions(-) (limited to 'templates/packages/details.html') diff --git a/sitestatic/archweb.js b/sitestatic/archweb.js index 248be7a6..12b7c702 100644 --- a/sitestatic/archweb.js +++ b/sitestatic/archweb.js @@ -126,9 +126,9 @@ if (typeof $.tablesorter !== 'undefined') { (function($) { $.fn.enableCheckboxRangeSelection = function() { var lastCheckbox = null; - var lastElement = null; + var lastElement = null; - var spec = this; + var spec = this; spec.unbind("click.checkboxrange"); spec.bind("click.checkboxrange", function(e) { if (lastCheckbox != null && e.shiftKey) { @@ -170,6 +170,28 @@ function ajaxifyFiles() { }); } +function collapseDependsList(list) { + var limit = 20; + // hide everything past a given limit, but don't do anything if we don't + // enough items that it is worth adding the link + list = $(list); + var items = list.find('li').slice(limit); + if (items.length == 0) { + return; + } + items.hide(); + var linkid = list.attr('id') + 'link'; + list.after('

Show More…

'); + + // add links and wire them up to show the hidden items + $('#' + linkid).click(function(event) { + event.preventDefault(); + list.find('li').show(); + // remove the full

node from the DOM + $(this).parent().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 358ab525..201e3074 100644 --- a/templates/packages/details.html +++ b/templates/packages/details.html @@ -186,7 +186,7 @@

Versions Elsewhere

Dependencies ({{deps|length}})

- {% if deps %}
    + {% if deps %}
      {% for depend in deps %}{% include "packages/details_depend.html" %}{% endfor %}
    {% endif %}
@@ -196,7 +196,7 @@

Required By ({{rqdby|length}})

- {% if rqdby %}
    + {% if rqdby %}
      {% for req in rqdby %}{% include "packages/details_requiredby.html" %}{% endfor %}
    {% endif %}
@@ -219,6 +219,10 @@

{% load cdn %}{% jquery %} {% endblock %} -- cgit v1.2.3-54-g00ecf From 7d9ed0b881bd05878e7a54f785c2551bc6e336d6 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Tue, 7 Aug 2012 01:16:51 -0500 Subject: Add reverse conflicts to package details This is a place where calling vercmp could come in really handy. Signed-off-by: Dan McGee --- main/models.py | 10 ++++++++++ templates/packages/details.html | 13 ++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) (limited to 'templates/packages/details.html') diff --git a/main/models.py b/main/models.py index 7d8ea755..b49edde3 100644 --- a/main/models.py +++ b/main/models.py @@ -258,6 +258,16 @@ def sort_key(val): return (sort_order.get(dep.deptype, 1000), dep.name) return sorted(deps, key=sort_key) + @cache_function(123) + def reverse_conflicts(self): + """ + Returns a list of packages with conflicts against this package. + """ + # TODO: fix this; right now we cheat since we can't do proper version + # number checking without using alpm or vercmp directly. + return Package.objects.filter(conflicts__name=self.pkgname, + conflicts__comparison='').distinct() + @cache_function(125) def base_package(self): """ diff --git a/templates/packages/details.html b/templates/packages/details.html index 201e3074..9e898b7f 100644 --- a/templates/packages/details.html +++ b/templates/packages/details.html @@ -126,16 +126,23 @@

Versions Elsewhere

{% include "packages/details_relatedto.html" %} {% endif %}{% endwith %} + {% with pkg.replaces.all as all_related %}{% if all_related %} + + Replaces: + {% include "packages/details_relatedto.html" %} + + {% endif %}{% endwith %} {% with pkg.conflicts.all as all_related %}{% if all_related %} Conflicts: {% include "packages/details_relatedto.html" %} {% endif %}{% endwith %} - {% with pkg.replaces.all as all_related %}{% if all_related %} + {% with pkg.reverse_conflicts as rev_conflicts %}{% if rev_conflicts %} - Replaces: - {% include "packages/details_relatedto.html" %} + Reverse Conflicts: + {% for conflict in rev_conflicts %} + {% pkg_details_link conflict %}{% if not forloop.last %}, {% endif %}{% endfor %} {% endif %}{% endwith %} -- cgit v1.2.3-54-g00ecf From 585b53a52a441761690ef81cd293597f38fa8a2f Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sat, 8 Sep 2012 11:08:36 -0500 Subject: Add structured data markup from schema.org to package details This might help out search engines show more helpful blurbs for our package details pages. Tested using the Google Rich Snippets Testing Tool at http://www.google.com/webmasters/tools/richsnippets. Signed-off-by: Dan McGee --- templates/packages/details.html | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'templates/packages/details.html') diff --git a/templates/packages/details.html b/templates/packages/details.html index 9e898b7f..5a5598a0 100644 --- a/templates/packages/details.html +++ b/templates/packages/details.html @@ -72,6 +72,17 @@

Versions Elsewhere

{% endif %}{% endwith %} +
+ + + + + + + +
+ +
@@ -102,10 +113,10 @@

Versions Elsewhere

{% endifequal %} - + - @@ -186,9 +197,9 @@

Versions Elsewhere

{{ flag_request.message|linebreaksbr|default:"{no message}" }}
{% endif %}{% endwith %}{% endif %}
Architecture:
Description:{{ pkg.pkgdesc|default:"" }}{{ pkg.pkgdesc|default:"" }}
Upstream URL:{% if pkg.url %}{% if pkg.url %}{% endif %}
License(s):
+
- {% with pkg.get_depends as deps %}

@@ -198,7 +209,6 @@

{% endif %}

{% endwith %} - {% with pkg.get_requiredby as rqdby %}

@@ -208,7 +218,6 @@

{% endif %}

{% endwith %} -

Package Contents

@@ -218,9 +227,7 @@

View the file list for {{ pkg.pkgname }}

- - {% load cdn %}{% jquery %} -- cgit v1.2.3-54-g00ecf From 6e1712b4d6c7525e03c5fac775fa16406dd4009f Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 30 Sep 2012 10:31:20 -0500 Subject: Show full date and time for package last update Now that we do updates on the fly and not just once an hour, we can afford to show a bit more granularity here. Signed-off-by: Dan McGee --- templates/packages/details.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'templates/packages/details.html') diff --git a/templates/packages/details.html b/templates/packages/details.html index 5a5598a0..5a93ce23 100644 --- a/templates/packages/details.html +++ b/templates/packages/details.html @@ -189,7 +189,7 @@

Versions Elsewhere

Unsigned {% endif %} Last Updated: - {{ pkg.last_update|date }} + {{ pkg.last_update|date:"DATETIME_FORMAT" }} UTC {% if user.is_authenticated %}{% with pkg.flag_request as flag_request %}{% if flag_request %} Last Flag Request: -- 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.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 From eea25558c766d5f3a32879d16e579d051906cbf3 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Tue, 27 Nov 2012 08:48:01 -0600 Subject: Don't cache package properties as aggressively For package signatures, it turns out it is way cheaper to just parse the signature again rather than going though all the decorator and cache_function_key business. This speeds up the mismatched signatures report significantly once this is removed. For base_package, given that we only call it once from our package details template, it makes little sense to cache the result. Signed-off-by: Dan McGee --- main/models.py | 3 --- templates/packages/details.html | 6 +++--- 2 files changed, 3 insertions(+), 6 deletions(-) (limited to 'templates/packages/details.html') diff --git a/main/models.py b/main/models.py index cc81637c..603d7ccc 100644 --- a/main/models.py +++ b/main/models.py @@ -141,7 +141,6 @@ def get_full_url(self, proto='https'): return '%s://%s%s' % (proto, domain, self.get_absolute_url()) @property - @cache_function(15) def signature(self): try: data = b64decode(self.pgp_signature) @@ -154,7 +153,6 @@ def signature(self): return packets[0] @property - @cache_function(15) def signer(self): sig = self.signature if sig and sig.key_id: @@ -318,7 +316,6 @@ def reverse_conflicts(self): new_pkgs.append(package) return new_pkgs - @cache_function(125) def base_package(self): """ Locate the base package for this package. It may be this very package, diff --git a/templates/packages/details.html b/templates/packages/details.html index aa073551..0a47217c 100644 --- a/templates/packages/details.html +++ b/templates/packages/details.html @@ -103,12 +103,12 @@

Versions Elsewhere

{% else %} Base Package: - {% if pkg.base_package %} - {% pkg_details_link pkg.base_package %} + {% with pkg.base_package as base %}{% if base %} + {% pkg_details_link base %} {% else %} {{ pkg.pkgbase }} - {% endif %} + {% endif %}{% endwith %} {% endifequal %} -- cgit v1.2.3-54-g00ecf