[extensions-web] review: Simplify templates and codebase
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [extensions-web] review: Simplify templates and codebase
- Date: Tue, 14 Feb 2012 18:14:49 +0000 (UTC)
commit 8c153499194ae36702dcd196b052ad7fd36e5664
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Tue Feb 14 12:33:26 2012 -0500
review: Simplify templates and codebase
Use a boolean flag rather than template inheritance
sweettooth/review/templates/review/review.html | 20 +++++++++++++++-
.../review/templates/review/review_reviewer.html | 23 --------------------
sweettooth/review/views.py | 11 +++------
3 files changed, 22 insertions(+), 32 deletions(-)
---
diff --git a/sweettooth/review/templates/review/review.html b/sweettooth/review/templates/review/review.html
index 559ca9c..08cd661 100644
--- a/sweettooth/review/templates/review/review.html
+++ b/sweettooth/review/templates/review/review.html
@@ -104,8 +104,24 @@
</div>
{% endif %}
-{% block extra %}
-{% endblock %}
+{% if can_review %}
+<h2 class="expanded"> Review </h2>
+
+<div id="review">
+ <form id="review_form" action="{% url review-submit pk=version.pk %}" method="POST">
+ {% csrf_token %}
+ <textarea id="comments" name="comments"></textarea>
+{% if can_approve %}
+ <select name="status">
+ <option value="none" selected>No change</option>
+ <option value="approve" class="approve">Approve</option>
+ <option value="reject" class="reject">Reject</option>
+ </select>
+{% endif %}
+ <input type="submit" value="Submit">
+ </form>
+</div>
+{% endif %}
{% endblock %}
diff --git a/sweettooth/review/views.py b/sweettooth/review/views.py
index 367fadf..d7f4588 100644
--- a/sweettooth/review/views.py
+++ b/sweettooth/review/views.py
@@ -295,19 +295,16 @@ def review_version_view(request, obj):
previous_reviews = version.reviews.all()
can_approve = can_approve_extension(request.user, extension)
+ can_review = can_review_extension(request.user, extension)
context = dict(extension=extension,
version=version,
all_versions=all_versions,
previous_reviews=previous_reviews,
- can_approve=can_approve)
+ can_approve=can_approve,
+ can_review=can_review)
- if can_review_extension(request.user, extension):
- template_name = "review/review_reviewer.html"
- else:
- template_name = "review/review.html"
-
- return render(request, template_name, context)
+ return render(request, 'review/review.html', context)
def send_email_on_submitted(sender, request, version, **kwargs):
extension = version.extension
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]