[extensions-web: 61/75] Warn users when they're viewing an old version.
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [extensions-web: 61/75] Warn users when they're viewing an old version.
- Date: Fri, 23 Sep 2011 03:19:33 +0000 (UTC)
commit 63aa7b118613316f032f9140f8751cdda3cf2aea
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu Sep 22 11:01:28 2011 -0400
Warn users when they're viewing an old version.
.../templates/extensions/detail-edit.html | 2 +-
.../extensions/templates/extensions/detail.html | 9 +++++++++
sweettooth/extensions/views.py | 2 ++
sweettooth/static/css/sweettooth.css | 14 ++++++--------
sweettooth/static/images/warning.png | Bin 0 -> 2844 bytes
5 files changed, 18 insertions(+), 9 deletions(-)
---
diff --git a/sweettooth/extensions/templates/extensions/detail-edit.html b/sweettooth/extensions/templates/extensions/detail-edit.html
index 14c26bc..c67fa78 100644
--- a/sweettooth/extensions/templates/extensions/detail-edit.html
+++ b/sweettooth/extensions/templates/extensions/detail-edit.html
@@ -1,8 +1,8 @@
{% extends "extensions/detail.html" %}
{% block extra-messages %}
+ {{ block.super }}
{% if is_preview %}
- {{ block.super }}
<p class="message info">
This is a preview of how your extension's page will look.
You can edit any of the things marked in yellow by clicking on them.
diff --git a/sweettooth/extensions/templates/extensions/detail.html b/sweettooth/extensions/templates/extensions/detail.html
index 01a007f..0e1e693 100644
--- a/sweettooth/extensions/templates/extensions/detail.html
+++ b/sweettooth/extensions/templates/extensions/detail.html
@@ -2,6 +2,15 @@
{% load thumbnail %}
{% block title %}{{ version.extension.name }} - {{ block.super }}{% endblock %}
+{% block extra-messages %}
+ {{ block.super }}
+ {% 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 %}
+{% endblock %}
+
{% block body %}
{% with extension=version.extension %}
<div class="extension"
diff --git a/sweettooth/extensions/views.py b/sweettooth/extensions/views.py
index 099131b..7df7cbb 100644
--- a/sweettooth/extensions/views.py
+++ b/sweettooth/extensions/views.py
@@ -97,10 +97,12 @@ 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['old_version'] = self.object != self.object.extension.latest_version
context['status'] = status
return self.render_to_response(context)
diff --git a/sweettooth/static/css/sweettooth.css b/sweettooth/static/css/sweettooth.css
index d2b76c7..6f2c5a8 100644
--- a/sweettooth/static/css/sweettooth.css
+++ b/sweettooth/static/css/sweettooth.css
@@ -355,14 +355,6 @@ li.extension {
/* Error & Messages */
/* ==================================================================== */
-.error-log {
- font-family: "Droid Sans", "Deja Vu Sans Mono", monospace;
- line-height 1.4;
- color: #00CC00;
- background-color: #121212;
- padding: 1em;
-}
-
p.message {
display: block;
padding: .5em;
@@ -385,6 +377,12 @@ p.message.info {
border-bottom: 1px solid #aad;
}
+p.message.warning {
+ background-color: #EBDE71;
+ background-image: url(../images/warning.png);
+ border-bottom: 1px solid #D1C466;
+}
+
.editable {
background-color: rgba(255, 255, 200, 0.4);
}
diff --git a/sweettooth/static/images/warning.png b/sweettooth/static/images/warning.png
new file mode 100644
index 0000000..a9ff09b
Binary files /dev/null and b/sweettooth/static/images/warning.png differ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]