[extensions-web: 63/75] Allow the user to view rejected versions, but not install them.
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [extensions-web: 63/75] Allow the user to view rejected versions, but not install them.
- Date: Fri, 23 Sep 2011 03:19:43 +0000 (UTC)
commit 715bcab9593dd9057a08fb37ff0e510d1bcbbe4f
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu Sep 22 11:29:36 2011 -0400
Allow the user to view rejected versions, but not install them.
sweettooth/extensions/models.py | 1 +
.../extensions/templates/extensions/detail.html | 13 ++++++++++---
sweettooth/extensions/views.py | 2 +-
3 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/sweettooth/extensions/models.py b/sweettooth/extensions/models.py
index b554189..2164f54 100644
--- a/sweettooth/extensions/models.py
+++ b/sweettooth/extensions/models.py
@@ -28,6 +28,7 @@ STATUSES = {
}
VISIBLE_STATUSES = (STATUS_ACTIVE,)
+REJECTED_STATUSES = (STATUS_REJECTED,)
EDITABLE_STATUSES = (STATUS_NEW, STATUS_ACTIVE)
REVIEWED_STATUSES = (STATUS_REJECTED, STATUS_INACTIVE, STATUS_ACTIVE)
diff --git a/sweettooth/extensions/templates/extensions/detail.html b/sweettooth/extensions/templates/extensions/detail.html
index 0e1e693..367e513 100644
--- a/sweettooth/extensions/templates/extensions/detail.html
+++ b/sweettooth/extensions/templates/extensions/detail.html
@@ -4,11 +4,18 @@
{% block extra-messages %}
{{ block.super }}
- {% if old_version %}
+ {% if is_rejected %}
+ {% spaceless %}
+ <p class="message error">
+ This version of {{ version.extension.name }} was rejected.
+ <a href="{% url extension-detail pk=version.extension.pk %}">View the latest accepted version.</a>
+ </p>
+ {% endspaceless %}
+ {% else %} {% if old_version %}
<p class="message warning">
You are viewing an old version of <a href="{% url extension-detail pk=version.extension.pk %}">{{ version.extension.name }}</a>
</p>
- {% endif %}
+ {% endif %} {% endif %}
{% endblock %}
{% block body %}
@@ -67,7 +74,7 @@
{% block document-ready %}{{ block.super }}
require(['jquery.timeago', 'jquery.rating', 'extensions'], function() {
$("abbr.timestamp").timeago();
- {% if is_review %}
+ {% if is_review or is_rejected %}
$(".extension .switch").addClass("insensitive");
{% endif %}
$(".extension").addExtensionsSwitches();
diff --git a/sweettooth/extensions/views.py b/sweettooth/extensions/views.py
index 7df7cbb..5f2ebde 100644
--- a/sweettooth/extensions/views.py
+++ b/sweettooth/extensions/views.py
@@ -97,11 +97,11 @@ class ExtensionVersionView(DetailView):
extpk = None
if slug == self.object.extension.slug and extpk == self.object.extension.pk:
-
context = self.get_context_data(object=self.object)
context['is_preview'] = is_preview
context['is_editable'] = status in models.EDITABLE_STATUSES
context['is_visible'] = status in models.VISIBLE_STATUSES
+ context['is_rejected'] = status in models.REJECTED_STATUSES
context['old_version'] = self.object != self.object.extension.latest_version
context['status'] = status
return self.render_to_response(context)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]