Skip to content
This repository was archived by the owner on Jul 19, 2021. It is now read-only.

Article comment status checking #100

Merged
merged 2 commits into from
Feb 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"email": "Courriel",
"message": "Message",
"post": "Publier le commentaire",
"moderated": "Veuillez noter que les commentaires doivent être approvés avant d'être affichés",
"moderated": "Veuillez noter que les commentaires doivent être approuvés avant d'être affichés",
"success_moderated": "Votre commentaire a été soumis avec succès. Nous le publierons sous peu, suite à notre processus de modération.",
"success": "Votre commentaire a été publié avec succès!",
"with_count": {
Expand Down
22 changes: 14 additions & 8 deletions src/templates/article.liquid
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
{% comment %}
If a valid comment is submitted, 1 is added to the number_of_comments even if awaiting moderation.

When a comment is submitted, the browser is redirected to a page that includes
the new comment id in its URL.
#comments is a required ID and is used as an anchor link by Shopify.
{% endcomment %}

{%- assign number_of_comments = article.comments_count -%}

{% if comment and comment.created_at %}
{%- assign number_of_comments = article.comments_count | plus: 1 -%}
{% comment %}
If a comment was just submitted but requires moderation, we have an extra comment to count.
{% endcomment %}
{% if comment and comment.status != 'published' %}
{% assign number_of_comments = article.comments_count | plus: 1 %}
{% endif %}

<article role="article" itemscope itemtype="http://schema.org/Article">
Expand Down Expand Up @@ -45,9 +49,9 @@
{% paginate article.comments by 5 %}

<div id="comments">
{% if comment and comment.created_at %}
{% if comment and comment.status and paginate.current_page == 1 %}
<p class="form-success">
{% if blog.moderated? %}
{% if blog.moderated? and comment.status != 'published' %}
{{ 'blogs.comments.success_moderated' | t }}
{% else %}
{{ 'blogs.comments.success' | t }}
Expand All @@ -57,15 +61,17 @@

{% if number_of_comments > 0 %}
<ul>
{% if comment and comment.created_at %}
{% comment %}
Display comment from URL parameters if it is waiting moderation
{% endcomment %}
{% if comment and comment.status != 'published' %}
<li id="{{ comment.id }}">
<div class="rte">
{{ comment.content }}
</div>
{% capture date %}{{ comment.created_at | time_tag: format: 'month_day_year' }}{% endcapture %}
<p>{{ 'blogs.article.comment_meta_html' | t: author: comment.author, date: date }}</p>
</li>

{% endif %}

{% for comment in article.comments %}
Expand Down