diff options
author | Vitaly Takmazov | 2017-07-28 14:21:01 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2017-08-18 09:39:11 +0000 |
commit | f5a87d2b7072426cfe36527db1270e5f85b73e01 (patch) | |
tree | 66c2e2834b7bcd28a083e2239b23a7ee12ae06d9 /juick-www/src/main/webapp | |
parent | 6110f14830a9345aeac7eccfe4919c109b4a6434 (diff) |
user thread is on pebble now
Diffstat (limited to 'juick-www/src/main/webapp')
6 files changed, 214 insertions, 3 deletions
diff --git a/juick-www/src/main/webapp/WEB-INF/layouts/content.html b/juick-www/src/main/webapp/WEB-INF/layouts/content.html index 420d4e0c..c059678e 100644 --- a/juick-www/src/main/webapp/WEB-INF/layouts/content.html +++ b/juick-www/src/main/webapp/WEB-INF/layouts/content.html @@ -31,7 +31,8 @@ </head> <body id="body"> {% include "views/partial/navigation" %} -<section id="content"> +<section id="content" style="{{ contentStyle | default('') }}" + {% if msg | default('') is not empty %}data-mid="{{ msg.mid }}"{% endif %}> {% block content %} {% endblock %} </section> diff --git a/juick-www/src/main/webapp/WEB-INF/views/macros/tree.html b/juick-www/src/main/webapp/WEB-INF/views/macros/tree.html new file mode 100644 index 00000000..3e35f92a --- /dev/null +++ b/juick-www/src/main/webapp/WEB-INF/views/macros/tree.html @@ -0,0 +1,54 @@ +{% macro tree(replies, visitor, level, margin, hidden) %} +{% for msg in replies %} + {% if msg.replyto == level %} + <li id="{{ msg.rid }}" style="margin-left: {{ margin }}px;{% if hidden %}display: none;{% endif %}" class="msg"> + <div class="msg-cont"> + <div class="msg-header"> +{% if not msg.user.banned %} + @<a href="/{{ msg.user.name }}/">{{ msg.user.name }}</a>: + <div class="msg-avatar"><a href="/{{ msg.user.name }}/"> + <img src="//i.juick.com/a/{{ msg.user.uid }}.png" alt="{{ msg.user.name }}"/></a> + </div> +{% else %} + [удалено]: + <div class="msg-avatar"> + <img src="//i.juick.com/av-96.png"/> + </div> +{% endif %} + <div class="msg-menu"> + <a href="#" class="a-thread-links"></a> + </div> + <div class="msg-ts"> + <a href="/{{ msg.mid }}#{{ msg.rid }}"> + <time datetime="{{ msg.date | date('yyyy-MM-dd HH:mm:ss') }}Z" + title="{{ msg.date | date('yyyy-MM-dd HH:mm:ss') }} GMT"> + {{ msg.date | prettyTime }} + </time> + </a> + </div> + </div> + <div class="msg-txt">{{ msg | formatMessage }}</div> + <div class="msg-media"></div> + <div class="msg-links">/{{ msg.rid }} +{% if msg.replyto > 0 %} + в ответ на <a href="#{{ msg.replyto }}">/{{ msg.replyto }}</a> +{% endif %} +{% if msg.VisitorCanComment %} + · <a href="/post?body=%23{{ msg.mid }}/{{ msg.rid }}%20" class="a-thread-comment">Ответить</a></div> + <div class="msg-comment" style="display: none"></div> +{% elseif visitor.uid == 0 %} + · <a href="#" class="a-login">Ответить</a></div> +{% endif %} + +{% if level == 0 and msg.childsCount > 1 and replies.size() > 10 %} + <div class="msg-comments"><a href="#">{{ msg | formatReplies }}</a></div> +{% endif %} + </li> + {% if (level == 0 and msg.childsCount > 1 and replies.size() > 10) %} + {{ tree(msg.childs, visitor, msg.rid, margin + 20, true) }} + {% elseif (msg.childsCount > 0) %} + {{ tree(msg.childs, visitor, msg.rid, margin + 20, hidden) }} + {% endif %} + {% endif %} +{% endfor %} +{% endmacro %}
\ No newline at end of file diff --git a/juick-www/src/main/webapp/WEB-INF/views/partial/message.html b/juick-www/src/main/webapp/WEB-INF/views/partial/message.html index cdfad6b6..f67362ce 100644 --- a/juick-www/src/main/webapp/WEB-INF/views/partial/message.html +++ b/juick-www/src/main/webapp/WEB-INF/views/partial/message.html @@ -1,7 +1,9 @@ <article data-mid="{{ msg.mid }}"> - <header class="h">@<a href="/{{ msg.user.name }}/">{{ msg.user.name }}</a>: + <header class="h"> + @<a href="/{{ msg.user.name }}/">{{ msg.user.name }}</a>: <div class="msg-avatar"><a href="/{{ msg.user.name }}/"> - <img src="//i.juick.com/a/{{ msg.user.uid }}.png" alt="{{ msg.user.name }}"/></a></div> + <img src="//i.juick.com/a/{{ msg.user.uid }}.png" alt="{{ msg.user.name }}"/></a> + </div> <div class="msg-menu"><a href="#"></a></div> <div class="msg-ts"> <a href="/{{ msg.user.name }}/{{ msg.mid }}"> diff --git a/juick-www/src/main/webapp/WEB-INF/views/partial/thread_list.html b/juick-www/src/main/webapp/WEB-INF/views/partial/thread_list.html new file mode 100644 index 00000000..b59d8b22 --- /dev/null +++ b/juick-www/src/main/webapp/WEB-INF/views/partial/thread_list.html @@ -0,0 +1,44 @@ +{% for msg in replies %} +<li id="{{ msg.rid }}" class="msg"> + <div class="msg-cont"> + <div class="msg-header"> + {% if not msg.user.banned %} + @<a href="/{{ msg.user.name }}/">{{ msg.user.name }}</a>: + <div class="msg-avatar"><a href="/{{ msg.user.name }}/"> + <img src="//i.juick.com/a/{{ msg.user.uid }}.png" alt="{{ msg.user.name }}"/></a> + </div> + {% else %} + [удалено]: + <div class="msg-avatar"> + <img src="//i.juick.com/av-96.png"/> + </div> + {% endif %} + <div class="msg-menu"> + <a href="#" class="a-thread-links"></a> + </div> + <div class="msg-ts"> + <a href="/{{ msg.mid }}#{{ msg.rid }}"> + <time datetime="{{ msg.date | date('yyyy-MM-dd HH:mm:ss') }}Z" + title="{{ msg.date | date('yyyy-MM-dd HH:mm:ss') }} GMT"> + {{ msg.date | prettyTime }} + </time> + </a> + </div> + </div> + <div class="msg-txt">{{ msg | formatMessage }}</div> + <div class="msg-media"></div> + <div class="msg-links">/{{ msg.rid }} + {% if msg.replyto > 0 %} + в ответ на <a href="#{{ msg.replyto }}">/{{ msg.replyto }}</a> + {% endif %} + {% if msg.VisitorCanComment %} + · <a href="/post?body=%23{{ msg.mid }}/{{ msg.rid }}%20" class="a-thread-comment">Ответить</a> + </div> + <div class="msg-comment" style="display: none;"></div> + {% else %} + </div> + {% endif %} + </div> + </div> +</li> +{% endfor %}
\ No newline at end of file diff --git a/juick-www/src/main/webapp/WEB-INF/views/partial/thread_tree.html b/juick-www/src/main/webapp/WEB-INF/views/partial/thread_tree.html new file mode 100644 index 00000000..f207b8e0 --- /dev/null +++ b/juick-www/src/main/webapp/WEB-INF/views/partial/thread_tree.html @@ -0,0 +1,2 @@ +{% import "views/macros/tree" %} +{{ tree(replies, visitor, 0, 0, false) }}
\ No newline at end of file diff --git a/juick-www/src/main/webapp/WEB-INF/views/thread.html b/juick-www/src/main/webapp/WEB-INF/views/thread.html new file mode 100644 index 00000000..301ad8f8 --- /dev/null +++ b/juick-www/src/main/webapp/WEB-INF/views/thread.html @@ -0,0 +1,108 @@ +{% extends "layouts/content" %} +{% import "views/macros/tags" %} +{% block content %} +<ul> + <li id="msg-{{ msg.mid }}" class="msg msgthread"> + <div class="msg-cont"> + <div class="msg-menu"><a href="#"></a></div> + <div class="msg-ts"><a href="/{{ msg.user.name }}/{{ msg.mid }}"> + <time datetime="{{ msg.date | date('yyyy-MM-dd HH:mm:ss') }}Z" + title="{{ msg.date | date('yyyy-MM-dd HH:mm:ss') }} GMT"> + {{ msg.date | prettyTime }} + </time> + </a> + </div> + <div class="msg-avatar"> + <a href="/{{ msg.user.name }}/"> + <img src="//i.juick.com/a/{{ msg.user.uid }}.png" alt="{{ msg.user.name }}"/></a> + </div> + <div class="msg-header">@<a href="/{{ msg.user.name }}/">{{ msg.user.name }}</a>: + <div class="msg-tags"> + {{ tags(msg.user.name, msg.tags | tagsList) }} + </div> + </div> + <div class="msg-txt">{{ msg | formatMessage }}</div> + {% if msg.AttachmentType is not empty %} + <div class="msg-media"> + <a href="//i.juick.com/p/{{ msg.mid }}.{{ msg.AttachmentType }}"> + <img src="//i.juick.com/photos-512/{{ msg.mid }}.{{ msg.AttachmentType }}" alt=""/> + </a> + </div> + {% endif %} + {% if msg.VisitorCanComment %} + <form action="/comment" method="POST" enctype="multipart/form-data"> + <input type="hidden" name="mid" value="{{ msg.mid }}"/> + <div class="msg-comment"> + <div class="ta-wrapper"> + <textarea name="body" rows="1" class="reply" placeholder="Написать комментарий"> + + </textarea> + </div> + </div> + </form> + {% endif %} + {% if recomm is not empty %} + <div class="msg-recomms">Рекомендовали ({{ recomm.size() }}): + {% for rec in recomm %} + <a href="/{{ rec }}/">@{{ rec }}</a>{% if loop.index < (loop.length - 1) %}, {% endif %} + {% endfor %} + </div> + {% endif %} + </div> + </li> + + <li class="toolbar"> + <ul> + <li><a href="/{{ msg.mid }}"> + <div style="background-position: -64px 0"></div> + {{ msg.mid }}</a> + </li> + {% if visitor.uid > 0 %} + {% if visitor.uid != msg.user.uid %} + {% if visitorSubscribed %} + <li><a href="/post?body=U+%23{{ msg.mid }}"> + <div style="background-position: -48px 0"></div> + Подписан</a></li> + {% else %} + <li><a href="/post?body=S+%23{{ msg.mid }}"> + <div style="background-position: -16px 0"></div> + Подписаться</a></li> + {% endif %} + {% if not visitorInBL %} + <li><a href="/post?body=%21+%23{{ msg.mid }}"> + <div style="background-position: -32px 0"></div> + Рекомендовать</a></li> + {% endif %} + {% else %} + <li><a href="/post?body=D+%23{{ msg.mid }}"> + <div style="background-position: 0"></div> + Удалить</a></li> + {% endif %} + {% endif %} + </ul> + </li> +</ul> +<div class="title2"> + <div class="title2-right"> + {% if listview %} + <a href="?view=tree" rel="nofollow">Показать деревом</a> + {% else %} + {% if foldable %} + <span id="unfoldall"><a href="#">Раскрыть все</a> · </span> + {% endif %} + <a href="?view=list" rel="nofollow">Показать списком</a> + {% endif %} + </div> + <h2>Ответы ({{ replies.size() }})</h2> +</div> + +<ul id="replies"> + {% if (listview) %} + {% include "views/partial/thread_list" %} + {% else %} + {% include "views/partial/thread_tree" %} + {% endif %} +</ul> +{% endblock %} +{% block "column" %} +{% endblock %}
\ No newline at end of file |