From fc7052acb9110ade38b06047a67363769775a83b Mon Sep 17 00:00:00 2001 From: Wen YE Date: Tue, 24 Jul 2018 22:47:35 +0800 Subject: [PATCH] =?UTF-8?q?MOD:=20=E7=BB=9F=E4=B8=80=E5=AE=9E=E4=BD=93?= =?UTF-8?q?=E7=9A=84=E7=82=B9=E8=B5=9E=E5=92=8C=E8=AF=84=E8=AE=BA=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=8E=B7=E5=8F=96=E5=92=8C=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/scripts.js | 21 +++++++++++++-------- static/styles.css | 13 ++++++++++--- templates/album.html | 2 +- templates/album_list.html | 2 +- templates/status_list.html | 2 +- web.py | 21 +++++++++------------ 6 files changed, 35 insertions(+), 26 deletions(-) diff --git a/static/scripts.js b/static/scripts.js index 6403f7f..3972e33 100644 --- a/static/scripts.js +++ b/static/scripts.js @@ -1,28 +1,33 @@ -var showStatusDetail = function (e) { - var item = $(e.target).closest(".status-item"); +var showComments = function (e, id) { + var item = $(e.target).closest("div"); if (item.data('details')) { return; } - $.get('/status/' + item.attr('id').split('-')[1], function (res) { - var likes_html = $("
").addClass("status-like"); + $.get('/comments/' + id, function (res) { + var likes_html = $("
").addClass("item-like"); $.each(res.likes, function(idx, like) { if (idx > 0) { likes_html.append($("").text(",")); } likes_html.append($("").attr('href', 'http://www.renren.com/profile.do?id=' + like.uid).attr('target', '_blank').text(res.users[like.uid].name)); }); - likes_html.append($("").text(" " + (res.status.like > 8 ? '等 ' : '') + res.status.like + " 人点赞。" + res.status.comment + " 条评论")); + likes_html.append($("").text(" " + (res.likes.length > 8 ? '等 ' : '') + res.likes.length + " 人点赞。" + res.comments.length + " 条评论")); var popup_html = $("
").append(likes_html); - if (res.status.comment > 0) { - var comments_html = $("
").addClass("ui feed status-comment"); + if (res.comments.length > 0) { + var comments_html = $("
").addClass("ui feed item-comment"); $.each(res.comments, function(idx, comment) { + var label = $("
").addClass("label"); + var head_img = $("").attr("src", res.users[comment.authorId].headPic); + $("").attr('href', 'http://www.renren.com/profile.do?id=' + comment.authorId).attr('target', '_blank').append(head_img).appendTo(label); + var content = $("
").addClass("content"); var summary = $("
").addClass("summary").appendTo(content); $("").attr('href', 'http://www.renren.com/profile.do?id=' + comment.authorId).attr('target', '_blank').text(comment.authorName).appendTo(summary); $("
").addClass("date").text(moment(comment.t).format("YYYY-MM-DD hh:mm:ss")).appendTo(summary); $("
").addClass("extra text").html(comment.content).appendTo(content); - $("
").addClass("event").append(content).appendTo(comments_html) + + $("
").addClass("event").append(label).append(content).appendTo(comments_html) }); popup_html.append($("
").addClass("ui divider")).append(comments_html); diff --git a/static/styles.css b/static/styles.css index 1b3728b..29a7bf5 100644 --- a/static/styles.css +++ b/static/styles.css @@ -17,9 +17,12 @@ .status-info { margin-top: 1em; +} + +.entry-info { text-align: right; } -.status-info:hover { +.entry-info:hover { cursor: pointer; } @@ -27,7 +30,7 @@ margin-left: 4em; } -.status-comment { +.item-comment { max-height: 400px; overflow-y: auto; } @@ -48,11 +51,15 @@ margin-left: auto; margin-right: auto; } - .ui.feed.gossip-list > .event { padding: .5em 0; +} + +.ui.feed.gossip-list > .event, +.ui.feed.item-comment > .event { border-bottom: 1px solid #f2f2f2; } +.ui.feed.item-comment > .event:last-child, .ui.feed.gossip-list > .event:last-child { border-bottom: none; } diff --git a/templates/album.html b/templates/album.html index c2d8334..a5b2c3e 100644 --- a/templates/album.html +++ b/templates/album.html @@ -14,7 +14,7 @@

-
+
diff --git a/templates/album_list.html b/templates/album_list.html index 2ff5b0d..a4aa7a2 100644 --- a/templates/album_list.html +++ b/templates/album_list.html @@ -16,7 +16,7 @@
-
+
diff --git a/templates/status_list.html b/templates/status_list.html index f3b4d9e..9dce2d5 100644 --- a/templates/status_list.html +++ b/templates/status_list.html @@ -10,7 +10,7 @@ {{ s.rootUname }}: {{ s.rootContent|safe }}

{% endif %} -
+