add permalinks for review replies (bug aw-naw)

This commit is contained in:
Chris Van 2012-08-06 16:12:30 -07:00
Родитель a8bda0b126
Коммит 21b2b38339
4 изменённых файлов: 34 добавлений и 37 удалений

Просмотреть файл

@ -25,6 +25,10 @@ li a.delete {
}
}
.replies .review.reply {
display: block;
}
.listing {
header img {
float: left;
@ -56,8 +60,11 @@ li a.delete {
position: relative;
}
#reviews {
.detail #reviews {
margin: 55px 0 15px 0;
}
#reviews {
position: relative;
> div {
.border-box;

Просмотреть файл

@ -14,41 +14,25 @@
{% endblock %}
{% block content %}
{{ mkt_breadcrumbs(product, [(None, _('Reviews'))]) }}
<section id="review-listing">
{{ mkt_breadcrumbs(product, [(None if page == 'list' else product.get_ratings_url('list'),
_('Reviews'))]) }}
{% block review_header %}
{{ rating_header(product, title) }}
{% if product.can_review(amo_user) %}
<p id="add-review">
<a href="{{ product.get_ratings_url('add') }}" class="button fat">
{{ _('Add a review') if not has_review else _('Edit review') }}
</a></p>
{% endif %}
<!--
{% if page == 'list' %}
<img src="{{ product.get_icon_url(64) }}">
<h1>{{ title }}</h1>
{% elif reply %}
{# L10n: {0} is a developer's name. #}
<h1>{{ _('Developer reply by {0}')|f(reply.user.name) }}</h1>
{% elif ratings.object_list %}
<h1>
{% trans cnt=ratings.object_list|length, addon=product.name,
user=ratings.object_list[0].user.name %}
Review for {{ addon }} by {{ user }}
{% pluralize %}
Reviews for {{ addon }} by {{ user }}
{% endtrans %}
</h1>
{% else %}
<h1>{{ _('No reviews found.') }}</h1>
{% endif %}
-->
<section id="review-listing">
{{ rating_header(product, title) }}
{% if product.can_review(amo_user) %}
<p id="add-review">
<a href="{{ product.get_ratings_url('add') }}" class="button fat">
{{ _('Add a review') if not has_review else _('Edit review') }}
</a></p>
{% endif %}
{% if reply %}
<h3>{{ _('Developer reply by {0}')|f(reply.user.name) }}</h3>
{% endif %}
</section>
{% endblock %}
<section class="reviews c" id="reviews">
{% if ratings.object_list %}
<section class="reviews{{ ' replies' if reply }} c" id="reviews">
{% if ratings.object_list or reply %}
{{ rating_flag() }}
<div class="c" id="reviews-info">
</div>
@ -57,12 +41,17 @@
{% for review in ratings.object_list %}
{% include 'ratings/rating.html' %}
{% endfor %}
{% if reply %}
{% with review=reply %}
{% include 'ratings/rating.html' %}
{% endwith %}
{% endif %}
</ul>
{% if ratings.object_list|length > 5 %}
<a href="{{ ratings.next_page_number() if ratings.has_next() else '#' }}" class="load-more post">{{ _('More reviews') }}</a>
{% endif %}
{{ ratings|impala_paginator }}
{% else %}
{% elif not reply %}
{% if product.can_review(amo_user) %}
<p id="add-first-review"><a href="{{ product.get_ratings_url('add') }}">
{{ _('Be the first to write a review.') }}</a><p>

Просмотреть файл

@ -33,6 +33,8 @@
{% if is_reply %}
<b>{{ _('(Developer)') }}</b>
{% endif %}
<a href="{{ review.get_url_path() }}" class="timestamp"
title="{{ _('Permalink') }}">{{ _('Permalink') }}</a>
</span>
<div class="body">
{{ review.body|nl2br }}

Просмотреть файл

@ -11,13 +11,11 @@ import amo.log
from amo.urlresolvers import reverse
from addons.decorators import addon_view_factory, has_purchased_or_refunded
from addons.models import Addon
from amo.helpers import absolutify
from amo.decorators import (json_view, login_required, post_required,
restricted_content)
from reviews.forms import ReviewReplyForm
from reviews.models import Review
from reviews.helpers import user_can_delete_review
from reviews.tasks import addon_review_aggregates
from reviews.views import get_flags
from stats.models import ClientData, Contribution
@ -62,7 +60,8 @@ def review_list(request, addon, review_id=None, user_id=None, rating=None):
qs = qs.filter(is_latest=True)
ctx['ratings'] = ratings = amo.utils.paginate(request, qs, 20)
ctx['replies'] = Review.get_replies(ratings.object_list)
if not ctx.get('reply'):
ctx['replies'] = Review.get_replies(ratings.object_list)
if request.user.is_authenticated():
ctx['review_perms'] = {
'is_admin': acl.action_allowed(request, 'Addons', 'Edit'),