2020-07-10 20:01:58 +02:00
|
|
|
{% macro render_reviews(reviews, current_user, show_package_link=False) -%}
|
2020-07-09 05:10:09 +02:00
|
|
|
<ul class="comments mt-4 mb-0">
|
|
|
|
{% for review in reviews %}
|
|
|
|
<li class="row my-2 mx-0">
|
|
|
|
<div class="col-md-1 p-1">
|
|
|
|
<a href="{{ url_for('users.profile', username=review.author.username) }}">
|
|
|
|
<img class="img-responsive user-photo img-thumbnail img-thumbnail-1" src="{{ review.author.getProfilePicURL() }}">
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
<div class="col-md-auto pl-1 pr-3 pt-2 text-center" style=" font-size: 200%;">
|
|
|
|
{% if review.recommends %}
|
|
|
|
<i class="fas fa-thumbs-up" style="color:#6f6;"></i>
|
|
|
|
{% else %}
|
|
|
|
<i class="fas fa-thumbs-down" style="color:#f66;"></i>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
{% if review.thread %}
|
|
|
|
{% set reply = review.thread.replies[0] %}
|
|
|
|
<div class="col pr-0">
|
|
|
|
<div class="card">
|
|
|
|
<div class="card-header">
|
|
|
|
<a class="author {{ reply.author.rank.name }}"
|
|
|
|
href="{{ url_for('users.profile', username=reply.author.username) }}">
|
|
|
|
{{ reply.author.display_name }}
|
|
|
|
</a>
|
|
|
|
|
|
|
|
<a name="reply-{{ reply.id }}" class="text-muted float-right"
|
|
|
|
href="{{ url_for('threads.view', id=review.thread.id) }}#reply-{{ reply.id }}">
|
|
|
|
{{ reply.created_at | datetime }}
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="card-body">
|
2020-07-10 20:01:58 +02:00
|
|
|
{% if current_user == review.author %}
|
|
|
|
<a class="btn btn-primary btn-sm ml-1 float-right"
|
|
|
|
href="{{ review.package.getReviewURL() }}">
|
|
|
|
<i class="fas fa-edit"></i>
|
|
|
|
</a>
|
|
|
|
{% endif %}
|
|
|
|
|
2020-07-09 05:10:09 +02:00
|
|
|
<p>
|
|
|
|
<strong>{{ review.thread.title }}</strong>
|
|
|
|
</p>
|
|
|
|
|
|
|
|
{{ reply.comment | markdown }}
|
|
|
|
|
2020-07-09 06:22:58 +02:00
|
|
|
<p class="mt-2 mb-0">
|
|
|
|
{% if show_package_link %}
|
|
|
|
<a class="btn btn-primary mr-1" href="{{ review.package.getDetailsURL() }}">
|
|
|
|
{{ _("View %(title)s by %(author)s", title=review.package.title, author=review.package.author.display_name) }}
|
|
|
|
</a>
|
|
|
|
{% endif %}
|
|
|
|
|
2020-07-09 06:31:41 +02:00
|
|
|
<a class="btn btn-secondary" href="{{ url_for('threads.view', id=review.thread.id) }}">
|
2020-07-09 06:22:58 +02:00
|
|
|
<i class="fas fa-comments mr-2"></i>
|
|
|
|
{{ _("%(num)d comments", num=review.thread.replies.count() - 1) }}
|
|
|
|
</a>
|
|
|
|
</p>
|
2020-07-09 05:10:09 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
</li>
|
|
|
|
{% endfor %}
|
|
|
|
</ul>
|
|
|
|
{% endmacro %}
|
|
|
|
|
|
|
|
|
|
|
|
{% macro render_review_form(package, current_user) -%}
|
|
|
|
<div class="card mt-0 mb-4 ">
|
|
|
|
<div class="card-header">
|
|
|
|
{{ _("Review") }}
|
|
|
|
</div>
|
2020-07-10 20:01:58 +02:00
|
|
|
<form method="post" action="{{ package.getReviewURL() }}" class="card-body">
|
2020-07-09 05:10:09 +02:00
|
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
|
|
|
|
<p>
|
|
|
|
{{ _("Do you recommend this %(type)s?", type=package.type.value | lower) }}
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<div class="btn-group btn-group-toggle" data-toggle="buttons">
|
|
|
|
<label class="btn btn-primary">
|
|
|
|
<i class="fas fa-thumbs-up mr-2"></i>
|
|
|
|
<input type="radio" name="recommends" id="yes" autocomplete="off"> {{ _("Yes") }}
|
|
|
|
</label>
|
|
|
|
<label class="btn btn-primary">
|
|
|
|
<i class="fas fa-thumbs-down mr-2"></i>
|
|
|
|
<input type="radio" name="recommends" id="no" autocomplete="off"> {{ _("No") }}
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<p class="mt-4 mb-3">
|
|
|
|
{{ _("Why or why not? Try to be constructive") }}
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="title">{{ _("Title") }}</label>
|
|
|
|
<input class="form-control" id="title" name="title" required="" type="text">
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<textarea class="form-control markdown" required maxlength=500 name="comment"></textarea><br />
|
|
|
|
<input class="btn btn-primary" type="submit" value="{{ _('Post Review') }}" />
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
{% endmacro %}
|
|
|
|
|
|
|
|
|
|
|
|
{% macro render_review_preview(package, current_user) -%}
|
|
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
|
|
|
|
<div class="card mt-0 mb-4 ">
|
|
|
|
<div class="card-header">
|
|
|
|
{{ _("Review") }}
|
|
|
|
</div>
|
|
|
|
<div class="card-body">
|
|
|
|
<p>
|
|
|
|
{{ _("Do you recommend this %(type)s?", type=package.type.value | lower) }}
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<div class="btn-group">
|
2020-07-10 20:01:58 +02:00
|
|
|
<a class="btn btn-primary" href="{{ url_for('user.login', r=package.getReviewURL()) }}">
|
2020-07-09 05:10:09 +02:00
|
|
|
<i class="fas fa-thumbs-up mr-2"></i>
|
|
|
|
{{ _("Yes") }}
|
|
|
|
</a>
|
2020-07-10 20:01:58 +02:00
|
|
|
<a class="btn btn-primary" href="{{ url_for('user.login', r=package.getReviewURL()) }}">
|
2020-07-09 05:10:09 +02:00
|
|
|
<i class="fas fa-thumbs-down mr-2"></i>
|
|
|
|
{{ _("No") }}
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endmacro %}
|