[extensions-web/wip/ne0sight: 2/2] comments: fixed preview and comments format



commit d443964cdf2cb822cbdc6f901dffb87ae6e6fa66
Author: Yuri Konotopov <ykonotopov gnome org>
Date:   Mon Nov 25 21:34:33 2019 +0400

    comments: fixed preview and comments format
    
    Closes: https://gitlab.gnome.org/Infrastructure/extensions-web/issues/87
    Closes: https://gitlab.gnome.org/Infrastructure/extensions-web/issues/46

 sweettooth/ratings/views.py                                 | 3 ++-
 sweettooth/static/css/sweettooth.css                        | 4 ++++
 sweettooth/static/js/templates/extensions/comments_list.mst | 4 +++-
 3 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/sweettooth/ratings/views.py b/sweettooth/ratings/views.py
index 0c304ff..ec45e03 100644
--- a/sweettooth/ratings/views.py
+++ b/sweettooth/ratings/views.py
@@ -4,6 +4,7 @@ import json
 import django_comments as comments
 from django.contrib.messages import info
 from django.shortcuts import redirect
+from django.template.defaultfilters import linebreaks
 from django.urls import reverse
 from django.utils.dateformat import format as format_date
 
@@ -25,7 +26,7 @@ def comment_details(request, comment):
 
     details = dict(gravatar = gravatar,
                    is_extension_creator = is_extension_creator,
-                   comment = comment.comment,
+                   comment = linebreaks(comment.comment, autoescape=True),
                    author = dict(username=username,
                                  url=reverse('auth-profile', kwargs=dict(user=username))),
                    date = dict(timestamp = comment.submit_date.isoformat(),
diff --git a/sweettooth/static/css/sweettooth.css b/sweettooth/static/css/sweettooth.css
index 9442f33..ea7c272 100644
--- a/sweettooth/static/css/sweettooth.css
+++ b/sweettooth/static/css/sweettooth.css
@@ -626,6 +626,10 @@ li.extension:last-child,
     margin-top: 20px;
 }
 
+.preview blockquote {
+    font-size: inherit;
+}
+
 /* Errors & Messages */
 /* ==================================================================== */
 
diff --git a/sweettooth/static/js/templates/extensions/comments_list.mst 
b/sweettooth/static/js/templates/extensions/comments_list.mst
index 2915ccd..14408bf 100644
--- a/sweettooth/static/js/templates/extensions/comments_list.mst
+++ b/sweettooth/static/js/templates/extensions/comments_list.mst
@@ -9,7 +9,9 @@
         <div class="rating" data-rating-value="{{rating}}"></div> by
       {{/rating}}
       <a class="comment-author" href="{{author.url}}">{{author.username}}</a>
-      <p>{{comment}}</p>
+      <div>
+        {{{comment}}}
+      </div>
       <time datetime="{{date.timestamp}}Z">{{date.standard}}</time>
     </div>
   </div>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]