Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
...
  • 3 commits
  • 4 files changed
  • 0 commit comments
  • 3 contributors
Commits on May 06, 2013
@ubernostrum ubernostrum Fix bug 676379: UI for quick review.
This adds a couple of utility functions on Revision which can tell if
it needs technical/editorial review, and then in the template for
document display adds, as needed, a block containing a form with
checkboxes for technical/editorial quick review.
f4f0b6b
Commits on May 09, 2013
@groovecoder groovecoder fix bug 676379 - clean up the quick review form ef95f15
Commits on May 13, 2013
@darkwing darkwing Merge pull request #1072 from groovecoder/mark-as-reviewed-676379
Mark as reviewed 676379
ffdade9
Showing with 49 additions and 20 deletions.
  1. +6 −0 apps/wiki/models.py
  2. +36 −12 apps/wiki/templates/wiki/document.html
  3. +2 −3 apps/wiki/tests/test_views.py
  4. +5 −5 apps/wiki/views.py
View
6 apps/wiki/models.py
@@ -1761,6 +1761,12 @@ def get_previous(self):
else:
return None
+ def needs_editorial_review(self):
+ return 'editorial' in [t.name for t in self.review_tags.all()]
+
+ def needs_technical_review(self):
+ return 'technical' in [t.name for t in self.review_tags.all()]
+
# FirefoxVersion and OperatingSystem map many ints to one Document. The
# enumeration table of int-to-string is not represented in the DB because of
View
48 apps/wiki/templates/wiki/document.html
@@ -196,19 +196,17 @@ <h1 class="page-title">{{ document.title }}</h1>
{% endif %}
#}
- {# There's no .has() method on review_tags; need to iterate for now #}
{% if document.current_revision %}
- {% for tag in document.current_revision.review_tags.all() %}
- {% if 'technical' == tag.name %}
- <div class="warning review-technical">{% trans %}
- <p>This article is in need of a technical review.</p>
- {% endtrans %}</div>
- {% elif 'editorial' == tag.name %}
- <div class="warning review-editorial">{% trans %}
- <p>This article is in need of an editorial review.</p>
- {% endtrans %}</div>
- {% endif %}
- {% endfor %}
+ {% if document.current_revision.needs_technical_review() %}
+ <div class="warning review-technical">{% trans %}
+ <p>This article is in need of a technical review.</p>
+ {% endtrans %}</div>
+ {% endif %}
+ {% if document.current_revision.needs_editorial_review() %}
+ <div class="warning review-editorial">{% trans %}
+ <p>This article is in need of an editorial review.</p>
+ {% endtrans %}</div>
+ {% endif %}
{% endif %}
{% if fallback_reason %}
<div id="doc-pending-fallback" class="warning">
@@ -286,6 +284,32 @@ <h1 class="page-title">{{ document.title }}</h1>
{% include 'wiki/includes/attachment_list.html' %}
{% endif %}
+ {% if document.current_revision and document.allows_revision_by(request.user) %}
+ {% if document.current_revision.needs_technical_review() or document.current_revision.needs_editorial_review() %}
+ <section class="page-meta">
+ <h2>{{ _('Quick review') }}</h2>
+ <section id="quick-review">
+ <form method="post" action="{{url('wiki.quick_review', document.full_path)}}">
+ {{ csrf() }}
+ <input type="hidden" name="revision_id" value="{{ document.current_revision.id }}"/>
+ <p>{% trans %}The following review(s) have been requested for this article:{% endtrans %}
+ <dl>
+ {% if document.current_revision.needs_technical_review() %}
+ <dt>{% trans %}Technical review:{% endtrans %}</dt>
+ <dd><input type="checkbox" value="approve_technical" id="id_approve_technical" name="approve_technical"> <label for="id_approve_technical">{% trans %}I have completed this review{% endtrans %}</label></dd>
+ {% endif %}
+ {% if document.current_revision.needs_editorial_review() %}
+ <dt>{% trans %}Editorial review:{% endtrans %}</dt>
+ <dd><input type="checkbox" value="approve_editorial" id="id_approve_editorial" name="approve_editorial"> <label for="id_approve_editorial">{% trans %}I have completed this review{% endtrans %}</label></dd>
+ {% endif %}
+ </dl>
+ <p><input type="submit" value="{{ _('Confirm reviews') }}"></p>
+ </form>
+ </section>
+ </section>
+ {% endif %}
+ {% endif %}
+
<section id="doc-contributors" role="contentinfo">
{% trans contributors=user_list(contributors) %}
Contributors to this page: {{ contributors }}
View
5 apps/wiki/tests/test_views.py
@@ -1907,15 +1907,14 @@ def test_quick_review(self):
data.update({'review_tags': ['editorial', 'technical'],
'slug': slug})
resp = client.post(reverse('wiki.new_document'), data)
-
+
doc = Document.objects.get(slug=slug)
rev = doc.revisions.order_by('-id').all()[0]
review_url = reverse('wiki.quick_review',
args=[doc.full_path])
params = dict(data_dict['params'], revision_id=rev.id)
- resp = client.post(urlparams(review_url, **params))
-
+ resp = client.post(review_url, params)
eq_(302, resp.status_code)
doc = Document.objects.get(locale=settings.WIKI_DEFAULT_LANGUAGE, slug=slug)
View
10 apps/wiki/views.py
@@ -1940,7 +1940,7 @@ def quick_review(request, document_slug, document_locale):
raise Http404
if not doc.allows_revision_by(request.user):
raise PermissionDenied
- rev_id = request.GET.get('revision_id')
+ rev_id = request.POST.get('revision_id')
if not rev_id:
raise Http404
try:
@@ -1953,17 +1953,17 @@ def quick_review(request, document_slug, document_locale):
# fully-filled-out editing forms, and we don't have those
# here.
raise PermissionDenied(_lazy("Document has been edited; please re-review."))
-
+
current_tags = [t.name for t in rev.review_tags.all()]
needs_technical = 'technical' in current_tags
needs_editorial = 'editorial' in current_tags
if not any((needs_technical, needs_editorial)):
# No need to "approve" something that doesn't need it.
return HttpResponseRedirect(doc.get_absolute_url())
-
- approve_technical = request.GET.get('approve_technical', False)
- approve_editorial = request.GET.get('approve_editorial', False)
+
+ approve_technical = request.POST.get('approve_technical', False)
+ approve_editorial = request.POST.get('approve_editorial', False)
new_tags = []
messages = []

No commit comments for this range

Something went wrong with that request. Please try again.