changeset 51:102356338118

input(comment): new macro comment_or_login: this macro allow to comment if a session is started, else redirect to login/registration page
author Goffi <goffi@goffi.org>
date Fri, 27 Oct 2017 18:52:34 +0200
parents d8729eb9edb5
children 87680eed9e25
files default/input/comment.html
diffstat 1 files changed, 19 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/default/input/comment.html	Fri Oct 27 18:51:53 2017 +0200
+++ b/default/input/comment.html	Fri Oct 27 18:52:34 2017 +0200
@@ -19,3 +19,22 @@
     {{ submit() }}
 {% endcall %}
 {% endmacro %}
+
+{% macro comment_or_login(service, node, action='') %}
+    {# show comment form a a message asking to log in
+       login is checked using profile #}
+    {% if profile %}
+        {{ comment(service, node, action) }}
+    {% else %}
+        <div class="log_request">
+        <p class="not_logged">{% trans %}You are not logged. You need to log in to comment.{% endtrans %}</p>
+        {% if login_url is defined %}
+            <p class="log_in_url">
+                {% trans link_start=('<a href="',login_url,'">')|join|safe, link_end='</a>'|safe %}
+                    To log in {{link_start}}follow this link{{link_end}}
+                {% endtrans %}
+            </p>
+        {% endif %}
+        </div>
+    {% endif %}
+{% endmacro %}