From e3040d99fa3464996fb2421f19c4d2662f453115 Mon Sep 17 00:00:00 2001 From: DELL Date: Sat, 19 Nov 2022 23:02:45 +0700 Subject: [PATCH] add function share , comment button and write comments --- templates/actionbar/list.html | 4 +-- templates/comments/list.html | 62 ++++++++++++++++---------------- templates/comments/media-js.html | 22 +++++++++++- 3 files changed, 54 insertions(+), 34 deletions(-) diff --git a/templates/actionbar/list.html b/templates/actionbar/list.html index da0c078..64b8389 100644 --- a/templates/actionbar/list.html +++ b/templates/actionbar/list.html @@ -17,7 +17,7 @@ {% if not hide_actionbar_comment %} - + {{_("Comment")}} @@ -33,7 +33,7 @@ {{_("Bookmark")}} - + {{_("Share")}} diff --git a/templates/comments/list.html b/templates/comments/list.html index dcffd48..db61a76 100644 --- a/templates/comments/list.html +++ b/templates/comments/list.html @@ -1,5 +1,36 @@

{{ _('Comments') }}

+

Write comments

+ {% if request.user.is_authenticated and comment_form and not comment_lock %} + + {% endif %} {% if has_comments %}
    {% set logged_in = request.user.is_authenticated %} @@ -121,37 +152,6 @@

    {{ _('There are no comments at the moment.') }}

    {% endif %} - {% if request.user.is_authenticated and comment_form and not comment_lock %} -
    - {% block comment_submit_title %} -

    {{ _('New comment') }}

    -
    - {% endblock %} - {% if is_new_user %} -
    - {{ _('You need to have solved at least one problem before your voice can be heard.') }} -
    - {% else %} -
    - {% csrf_token %} - {% if comment_form.errors %} -
    - {{ comment_form.non_field_errors() }} - {{ comment_form.parent.errors }} - {% if comment_form.body.errors %}{{ _('Invalid comment body.') }}{% endif %} -
    - {% endif %} - {{ comment_form.parent }} -
    -
    {{ comment_form.body }}
    -
    -
    - -
    - {% endif %} -
    - {% endif %} - {% if comment_lock %}
    {{ _('Comments are disabled on this page.') }} diff --git a/templates/comments/media-js.html b/templates/comments/media-js.html index 1ca2d4c..4e92461 100644 --- a/templates/comments/media-js.html +++ b/templates/comments/media-js.html @@ -211,6 +211,26 @@ $comment.find('.comment-body').show(); $comment.find('.bad-comment-body').hide(); }; + + $("#share-button").click( function() { + navigator.clipboard + .writeText(window.location.href) + .then( () => { + alert("Copied link to this post"); + }); + }); + + $("#write-comments").click( function(event) { + event.preventDefault(); + $("#new-comment").show("slow"); + $("#write-comments").hide(); + }); + + $('#comment-button').click( function() { + $('#comment-section').show(); + $('#comment-announcement').hide(); + }) + }); - + {% endcompress %}