diff options
author | Vitaly Takmazov | 2017-05-05 17:42:27 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2017-05-23 15:50:10 +0300 |
commit | 237739950a305b13c9f29e3ca25c2e835d563a3f (patch) | |
tree | 14eea79fe63d0a5b9586aebdbaa9795ed858532e /juick-www | |
parent | cde3f26ef2779ec08335b1d2197151231d5cce3f (diff) |
User controller -> pebble
Diffstat (limited to 'juick-www')
8 files changed, 280 insertions, 169 deletions
diff --git a/juick-www/src/main/java/com/juick/www/controllers/User.java b/juick-www/src/main/java/com/juick/www/controllers/User.java index bb58a739..6091f398 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/User.java +++ b/juick-www/src/main/java/com/juick/www/controllers/User.java @@ -17,8 +17,8 @@ */ package com.juick.www.controllers; -import com.juick.server.helpers.TagStats; import com.juick.server.util.HttpForbiddenException; +import com.juick.server.util.HttpNotFoundException; import com.juick.service.MessagesService; import com.juick.service.TagService; import com.juick.service.UserService; @@ -29,18 +29,21 @@ import org.apache.commons.lang3.CharEncoding; import org.apache.commons.lang3.StringEscapeUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.CookieValue; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.servlet.support.ServletUriComponentsBuilder; +import org.springframework.web.util.UriComponents; +import ru.sape.Sape; import javax.inject.Inject; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; -import java.io.UnsupportedEncodingException; import java.net.URLEncoder; -import java.util.Comparator; import java.util.List; import java.util.stream.Collectors; @@ -60,40 +63,38 @@ public class User { MessagesService messagesService; @Inject PageTemplates templates; + @Inject + private Sape sape; @GetMapping("/{uname}/") - protected void doGetBlog(HttpServletRequest request, HttpServletResponse response, - @PathVariable String uname, - @RequestParam(required = false, defaultValue = "0") Integer before) throws IOException { + protected String doGetBlog( + @RequestParam(required = false, name = "show") String paramShow, + @RequestParam(required = false, name = "tag") String paramTagStr, + @RequestParam(required = false, name = "search") String paramSearch, + @PathVariable String uname, + @RequestParam(required = false, defaultValue = "0") Integer before, + @CookieValue(name = "sape_cookie", required = false, defaultValue = StringUtils.EMPTY) String sapeCookie, + ModelMap model) throws IOException { com.juick.User user = userService.getUserByName(uname); com.juick.User visitor = UserUtils.getCurrentUser(); if (user.isBanned()) { - response.sendError(HttpServletResponse.SC_NOT_FOUND); - return; + throw new HttpForbiddenException(); } List<Integer> mids; - String paramShow = request.getParameter("show"); - com.juick.Tag paramTag = null; - String paramTagStr = request.getParameter("tag"); if (paramTagStr != null) { if (paramTagStr.length() < 64) { paramTag = tagService.getTag(paramTagStr, false); } if (paramTag == null) { - response.sendError(HttpServletResponse.SC_NOT_FOUND); - return; + throw new HttpNotFoundException(); } else if (!paramTag.getName().equals(paramTagStr)) { - String url = "/" + user.getName() + "/?tag=" + URLEncoder.encode(paramTag.getName(), CharEncoding.UTF_8); - Utils.sendPermanentRedirect(response, url); - return; + String url = user.getName() + "/?tag=" + URLEncoder.encode(paramTag.getName(), CharEncoding.UTF_8); + return "redirect:/" + url; } } - - - String paramSearch = request.getParameter("search"); if (paramSearch != null && paramSearch.length() > 64) { paramSearch = null; } @@ -126,80 +127,94 @@ public class User { title = "Фотографии " + user.getName(); mids = messagesService.getUserPhotos(user.getUid(), privacy, before); } else { - response.sendError(HttpServletResponse.SC_NOT_FOUND); - return; + throw new HttpNotFoundException(); } - response.setContentType("text/html; charset=UTF-8"); - try (PrintWriter out = response.getWriter()) { - String head = "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"@" + - user.getName() + "\" href=\"//rss.juick.com/" + user.getName() + "/blog\"/>"; - if (paramTag != null && tagService.getTagNoIndex(paramTag.TID)) { - head += "<meta name=\"robots\" content=\"noindex,nofollow\"/>"; - } else if (before > 0 || paramShow != null) { - head += "<meta name=\"robots\" content=\"noindex\"/>"; + String head = "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"@" + + user.getName() + "\" href=\"//rss.juick.com/" + user.getName() + "/blog\"/>"; + if (paramTag != null && tagService.getTagNoIndex(paramTag.TID)) { + head += "<meta name=\"robots\" content=\"noindex,nofollow\"/>"; + } else if (before > 0 || paramShow != null) { + head += "<meta name=\"robots\" content=\"noindex\"/>"; + } + model.addAttribute("title", title); + model.addAttribute("headers", head); + model.addAttribute("visitor", visitor); + model.addAttribute("user", user); + model.addAttribute("noindex", paramShow == null && before == 0); + model.addAttribute("readonly", messagesService.isReadonly()); + model.addAttribute("isSubscribed", userService.isSubscribed(visitor.getUid(), user.getUid())); + model.addAttribute("isInBL", userService.isInBL(visitor.getUid(), user.getUid())); + model.addAttribute("isInBLAny", userService.isInBLAny(user.getUid(), visitor.getUid())); + model.addAttribute("statsIRead", userService.getStatsIRead(user.getUid())); + model.addAttribute("statsMyReaders", userService.getStatsMyReaders(user.getUid())); + model.addAttribute("statsMessages", userService.getStatsMessages(user.getUid())); + model.addAttribute("statsReplies", userService.getStatsReplies(user.getUid())); + model.addAttribute("iread", userService.getUserReadLeastPopular(user.getUid(), 8)); + model.addAttribute("tagStats", tagService.getUserTagStats(user.getUid()) + .stream().map(t -> t.getTag().getName()).collect(Collectors.toList())); + model.addAttribute("paramTag", paramTag); + List<com.juick.Message> msgs = messagesService.getMessages(mids); + + if (visitor.getUid() != 0) { + List<Integer> blUIDs = userService.checkBL(visitor.getUid(), + msgs.stream().map(m -> m.getUser().getUid()).collect(Collectors.toList())); + msgs.forEach(m -> m.ReadOnly |= blUIDs.contains(m.getUser().getUid())); + } + model.addAttribute("msgs", msgs); + model.addAttribute("tags", tagService.getUserTagStats(user.getUid()).stream() + .sorted((e1, e2) -> Integer.compare(e2.getUsageCount(), e1.getUsageCount())).limit(20).collect(Collectors.toList())); + model.addAttribute("headers", head); + model.addAttribute("showAdv", + paramShow == null && before == 0 && paramSearch == null && visitor.getUid() == 0); + if (mids.size() >= 20) { + String nextpage = "?before=" + mids.get(mids.size() - 1); + if (paramShow != null) { + nextpage += "&show=" + paramShow; } - templates.pageHead(out, visitor, title, head); - templates.pageNavigation(out, visitor, null); - pageUserColumn(out, user, visitor); - - if (mids.size() > 0) { - out.println("<section id=\"content\">"); - - if (paramTag != null) { - out.println("<p class=\"page\"><a href=\"/tag/" + - URLEncoder.encode(paramTag.getName(), CharEncoding.UTF_8) + "\">← Все записи с тегом <b>" + - StringEscapeUtils.escapeHtml4(paramTag.getName()) + "</b></a></p>"); - } - - templates.printMessages(out, user, mids, visitor); - - if (mids.size() >= 20) { - String nextpage = "?before=" + mids.get(mids.size() - 1); - if (paramShow != null) { - nextpage += "&show=" + paramShow; - } - if (paramTag != null) { - nextpage += "&tag=" + URLEncoder.encode(paramTag.getName(), CharEncoding.UTF_8); - } - if (paramSearch != null) { - nextpage += "&search=" + URLEncoder.encode(paramSearch, CharEncoding.UTF_8); - } - out.println("<p class=\"page\"><a href=\"" + nextpage + "\" rel=\"prev\">Читать дальше →</a></p>"); - } - - out.println("</section>"); + if (paramSearch != null) { + nextpage += "&search=" + URLEncoder.encode(paramSearch, CharEncoding.UTF_8); } - templates.pageFooter(request, out, visitor, true); - templates.pageEnd(out); + String next = "<p class=\"page\"><a href=\"" + nextpage + "\" rel=\"prev\">Читать дальше →</a></p>"; + model.addAttribute("next", next); + } + UriComponents builder = ServletUriComponentsBuilder.fromCurrentRequestUri().build(); + String queryString = builder.getQuery(); + String requestURI = builder.toUri().getPath(); + if (sape != null && visitor.getUid() == 0 && queryString == null) { + String links = sape.getPageLinks(requestURI, sapeCookie).render(); + model.addAttribute("links", links); } + model.addAttribute("isModerator", visitor.getUid() == 3694); + return "views/blog"; } @GetMapping("/{uname}/tags") - protected void doGetTags(HttpServletRequest request, HttpServletResponse response, - @PathVariable String uname) throws IOException { + protected String doGetTags(@PathVariable String uname, ModelMap model) throws IOException { com.juick.User user = userService.getUserByName(uname); com.juick.User visitor = UserUtils.getCurrentUser(); if (visitor.isBanned()) { - response.sendError(HttpServletResponse.SC_NOT_FOUND); - return; + throw new HttpNotFoundException(); } - response.setContentType("text/html; charset=UTF-8"); - try (PrintWriter out = response.getWriter()) { - String head = "<meta name=\"robots\" content=\"noindex,nofollow\"/>"; - templates.pageHead(out, visitor, "Теги " + user.getName(), head); - templates.pageNavigation(out, visitor, null); - pageUserColumn(out, user, visitor); - - out.println("<section id=\"content\">"); - out.println("<p>" + pageUserTags(user, visitor, 0) + "</p>"); - out.println("</section>"); - - templates.pageFooter(request, out, visitor, false); - templates.pageEnd(out); - } + model.addAttribute("title", "Теги " + user.getName()); + model.addAttribute("headers", "<meta name=\"robots\" content=\"noindex,nofollow\"/>"); + model.addAttribute("visitor", visitor); + model.addAttribute("user", user); + model.addAttribute("readonly", messagesService.isReadonly()); + model.addAttribute("isSubscribed", userService.isSubscribed(visitor.getUid(), user.getUid())); + model.addAttribute("isInBL", userService.isInBL(visitor.getUid(), user.getUid())); + model.addAttribute("isInBLAny", userService.isInBLAny(user.getUid(), visitor.getUid())); + model.addAttribute("statsIRead", userService.getStatsIRead(user.getUid())); + model.addAttribute("statsMyReaders", userService.getStatsMyReaders(user.getUid())); + model.addAttribute("statsMessages", userService.getStatsMessages(user.getUid())); + model.addAttribute("statsReplies", userService.getStatsReplies(user.getUid())); + model.addAttribute("iread", userService.getUserReadLeastPopular(user.getUid(), 8)); + model.addAttribute("tagStats", tagService.getUserTagStats(user.getUid()) + .stream().map(t -> t.getTag().getName()).collect(Collectors.toList())); + + return "views/blog_tags"; } @GetMapping("/{uname}/friends") @@ -216,7 +231,7 @@ public class User { String head = "<meta name=\"robots\" content=\"noindex\"/>"; templates.pageHead(out, visitor, "Подписки " + user.getName(), head); templates.pageNavigation(out, visitor, null); - pageUserColumn(out, user, visitor); + //pageUserColumn(out, user, visitor); out.println("<section id=\"content\">"); out.println("<table class=\"users\"><tr>"); @@ -253,7 +268,7 @@ public class User { String head = "<meta name=\"robots\" content=\"noindex\"/>"; templates.pageHead(out, visitor, "Читатели " + user.getName(), head); templates.pageNavigation(out, visitor, null); - pageUserColumn(out, user, visitor); + //pageUserColumn(out, user, visitor); out.println("<section id=\"content\">"); out.println("<table class=\"users\"><tr>"); @@ -275,86 +290,4 @@ public class User { templates.pageEnd(out); } } - - public void pageUserColumn(PrintWriter out, com.juick.User user, com.juick.User visitor) { - out.println("<aside id=\"column\">"); - out.println(" <div id=\"ctitle\"><a href=\"./\"><img src=\"//i.juick.com/as/" + user.getUid() + ".png\" alt=\"\"/>" + user.getName() + "</a></div>"); - if (visitor.getUid() > 0 && visitor.getUid() != user.getUid()) { - out.println(" <ul class=\"toolbar\">"); - if (userService.isSubscribed(visitor.getUid(), user.getUid())) { - out.println(" <li><a href=\"/post?body=U+%40" + user.getName() + "\" title=\"Подписан\"><div style=\"background-position: -48px 0\"></div></a></li>"); - } else { - out.println(" <li><a href=\"/post?body=S+%40" + user.getName() + "\" title=\"Подписаться\"><div style=\"background-position: -16px 0\"></div></a></li>"); - } - if (userService.isInBL(visitor.getUid(), user.getUid())) { - out.println(" <li><a href=\"/post?body=BL+%40" + user.getName() + "\" title=\"Разблокировать\"><div style=\"background-position: -96px 0\"></div></a></li>"); - } else { - out.println(" <li><a href=\"/post?body=BL+%40" + user.getName() + "\" title=\"Заблокировать\"><div style=\"background-position: -80px 0\"></div></a></li>"); - } - if (!userService.isInBLAny(user.getUid(), visitor.getUid())) { - out.println(" <li><a href=\"/pm/sent?uname=" + user.getName() + "\" title=\"Написать приватное сообщение\"><div style=\"background-position: -112px 0\"></div></a></li>"); - } - out.println(" </ul>"); - } else { - out.println(" <hr/>"); - } - out.println(" <ul>"); - out.println(" <li><a href=\"./\">Блог</a></li>"); - out.println(" <li><a href=\"./?show=recomm\" rel=\"nofollow\">Рекомендации</a></li>"); - out.println(" <li><a href=\"./?show=photos\" rel=\"nofollow\">Фотографии</a></li>"); - out.println(" </ul>"); - out.println(" <hr/>"); - out.println(" <form action=\"./\">"); - out.println(" <p><input type=\"text\" name=\"search\" class=\"inp\" placeholder=\"Поиск\"/></p>"); - out.println(" </form>"); - out.println(" <p class=\"tags\">" + pageUserTags(user, visitor, 20) + "<a href=\"./tags\" rel=\"nofollow\">...</a></p>"); - out.println(" <hr/>"); - out.println(" <div id=\"ustats\"><ul>"); - out.println(" <li><a href=\"./friends\">Я читаю: " + userService.getStatsIRead(user.getUid()) + "</a></li>"); - out.println(" <li><a href=\"./readers\">Мои подписчики: " + userService.getStatsMyReaders(user.getUid()) + "</a></li>"); - out.println(" <li>Сообщений: " + userService.getStatsMessages(user.getUid()) + "</li>"); - out.println(" <li>Комментариев: " + userService.getStatsReplies(user.getUid()) + "</li>"); - out.println(" </ul>"); - - List<com.juick.User> iread = userService.getUserReadLeastPopular(user.getUid(), 8); - if (!iread.isEmpty()) { - out.println("<table class=\"iread\"><tr>"); - for (int i = 0; i < iread.size(); i++) { - if (i == 4) { - out.println("</tr><tr>"); - } - com.juick.User u = iread.get(i); - out.println("<td><a href=\"/" + u.getName() + "/\"><img src=\"//i.juick.com/a/" + u.getUid() + ".png\" alt=\"" + u.getName() + "\"/></a></td>"); - } - out.println("</tr></table>"); - } - - out.println(" </div>"); - out.println("</aside>"); - } - - public String pageUserTags(com.juick.User user, com.juick.User visitor, int cnt) { - List<TagStats> tags = tagService.getUserTagStats(user.getUid()).stream() - .sorted((e1, e2) -> Integer.compare(e2.getUsageCount(), e1.getUsageCount())).collect(Collectors.toList()); - int maxUsageCnt = tags.stream().map(TagStats::getUsageCount).max(Comparator.naturalOrder()).orElse(0); - String ret = StringUtils.EMPTY; - int count = cnt > 0 ? Math.min(tags.size(), cnt) : tags.size(); - for (int i = 0; i < count; i++) { - String tag = StringEscapeUtils.escapeHtml4(tags.get(i).getTag().getName()); - try { - tag = "<a href=\"./?tag=" + URLEncoder.encode(tags.get(i).getTag().getName(), CharEncoding.UTF_8) + "\" title=\"" - + tags.get(i).getUsageCount() + "\" rel=\"nofollow\">" + tag + "</a>"; - } catch (UnsupportedEncodingException e) { - } - - if (tags.get(i).getUsageCount() > maxUsageCnt / 3 * 2) { - ret += "<big>" + tag + "</big> "; - } else if (tags.get(i).getUsageCount() > maxUsageCnt / 3) { - ret += "<small>" + tag + "</small> "; - } else { - ret += tag + " "; - } - } - return ret; - } } diff --git a/juick-www/src/main/resources/messages.properties b/juick-www/src/main/resources/messages.properties index 6f587853..8ad0fa09 100644 --- a/juick-www/src/main/resources/messages.properties +++ b/juick-www/src/main/resources/messages.properties @@ -48,4 +48,12 @@ message.comment=Comment postForm.writeReply=Write a reply messages.next=Next error.pageNotFound=Page not found -error.pageNotFound.description=Probably, user deleted this post, or this page never existed.
\ No newline at end of file +error.pageNotFound.description=Probably, user deleted this post, or this page never existed. + +blog.blog=Blog +blog.recommendations=Recommendations +blog.photos=Photos +blog.iread=I read +blog.readers=My readers +blog.messages=Messages +blog.comments=Comments
\ No newline at end of file diff --git a/juick-www/src/main/resources/messages_ru.properties b/juick-www/src/main/resources/messages_ru.properties index 4d8c2c0f..5c00055e 100644 --- a/juick-www/src/main/resources/messages_ru.properties +++ b/juick-www/src/main/resources/messages_ru.properties @@ -48,4 +48,12 @@ message.comment=Комментировать postForm.writeReply=Написать ответ messages.next=Читать далее error.pageNotFound=Страница не найдена -error.pageNotFound.description=Сожалеем, но страницу с этим адресом удалил её автор, либо её никогда не существовало.
\ No newline at end of file +error.pageNotFound.description=Сожалеем, но страницу с этим адресом удалил её автор, либо её никогда не существовало. + +blog.blog=Блог +blog.recommendations=Рекомендации +blog.photos=Фотографии +blog.iread=Я читаю +blog.readers=Мои подписчики +blog.messages=Сообщения +blog.comments=Комментарии
\ No newline at end of file diff --git a/juick-www/src/main/webapp/WEB-INF/views/blog.html b/juick-www/src/main/webapp/WEB-INF/views/blog.html new file mode 100644 index 00000000..6672adff --- /dev/null +++ b/juick-www/src/main/webapp/WEB-INF/views/blog.html @@ -0,0 +1,85 @@ +{% extends "layouts/content" %} +{% import "views/macros/tags" %} +{% block content %} +{% if noindex %} +<!--noindex--> +{% endif %} +{% if paramTag | default('') is not empty %} +<p class="page"><a href="/tag/{{ paramTag.name | urlencode }}">← Все записи с тегом <b>{{ paramTag.name | escape }}</b></a></p> +{% endif %} +{% if paramTag | default('') is not empty %} +<p class="page"><a href="/tag/{{ paramTag.name | urlencode }}">← Все записи с тегом <b>{{ paramTag.name | escape }}</b></a></p> +{% endif %} +{% for msg in msgs %} +<article data-mid="{{ msg.mid }}"> + <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> + <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-tags"> + {{ tags(msg.user.name, msg.tags) }} + </div> + </header> + + {% if msg.AttachmentType is not empty %} + <p class="ir"><a href="//i.juick.com/photos-512/{{ msg.mid }}.{{ msg.AttachmentType }}" + onclick="return showPhotoDialog('{{ msg.mid }}.{{ msg.AttachmentType }}')"> + <img src="//i.juick.com/photos-512/{{ msg.mid }}.{{ msg.AttachmentType }}" alt=""/></a> + </p> + {% endif %} + <p>{{ msg | formatMessage }}</p> + {% if msg.AttachmentType is not empty %} + <div class="irbr"></div> + {% endif %} + {% if not readonly %} + <nav class="l"> + {% if visitor.uid > 0 %} + <a href="/post?body=!+%23{{ msg.getMid() }}" class="a-like">{{ i18n("messages","message.recommend") }}</a> + {% else %} + <a href="/login" class="a-login">{{ i18n("messages","message.recommend") }}</a> + {% endif %} + {% if visitor.uid > 0 and (not msg.ReadOnly or visitor.uid == msg.user.uid) %} + <a href="/{{ msg.getMid() }}" class="a-comment">{{ i18n("messages","message.comment") }}</a> + {% elseif visitor.uid == 0 and not msg.ReadOnly %} + <a href="/login" class="a-login">{{ i18n("messages","message.comment") }}</a> + {% endif %} + {% if msg.FriendsOnly %} + <a href="#" class="a-privacy">Открыть доступ</a> + {% endif %} + {% if isModerator %} + <a href="#" class="a-popular-plus">+</a> + <a href="#" class="a-popular-minus">-</a> + <a href="#" class="a-popular-delete">x</a> + {% endif %} + </nav> + {% endif %} + <nav class="s"> + {% if msg.Likes > 0 %} + <a href="/{{ msg.getUser().getName() }}/{{ msg.getMid() }}" class="likes"> + <i data-icon="ei-heart" data-size="s"></i> {{ msg.Likes }}</a> + {% endif %} + {% if msg.Replies > 0 %} + <a href="/{{ msg.getUser().getName() }}/{{ msg.getMid() }}" class="replies"> + <i data-icon="ei-comment" data-size="s"></i> {{ msg.Replies }}</a> + {% endif %} + </nav> +</article> +{% endfor %} +{% if (next | default('')) is not empty %} +{{ next | raw }} +{% endif %} +{% endblock %} +{% block "column" %} +{% include "views/partial/usercolumn" %} +{% if noindex %} +<!--/noindex--> +{% endif %} +{% endblock %}
\ No newline at end of file diff --git a/juick-www/src/main/webapp/WEB-INF/views/index.html b/juick-www/src/main/webapp/WEB-INF/views/index.html index 0e4eb6ba..0bf2a2fd 100644 --- a/juick-www/src/main/webapp/WEB-INF/views/index.html +++ b/juick-www/src/main/webapp/WEB-INF/views/index.html @@ -68,9 +68,7 @@ </nav> </article> {% endfor %} -{% if (next | default('')) is not empty %} -{{ next | raw }} -{% endif %} +{{ next | default ('') | raw }} {% endblock %} {% block "column" %} {% include "views/partial/homecolumn" %} diff --git a/juick-www/src/main/webapp/WEB-INF/views/macros/tags.html b/juick-www/src/main/webapp/WEB-INF/views/macros/tags.html index ffd81ddd..b34e6ecc 100644 --- a/juick-www/src/main/webapp/WEB-INF/views/macros/tags.html +++ b/juick-www/src/main/webapp/WEB-INF/views/macros/tags.html @@ -1,5 +1,5 @@ {% macro tags(uname="", tagsList) %} {% for tag in tagsList %} -<a href="/{{ uname }}/?tag={{ tag }}">{{ tag }}</a> +<a href="/{{ uname }}/?tag={{ tag.name | urlencode }}">{{ tag.name }}</a> {% endfor %} {% endmacro %}
\ No newline at end of file diff --git a/juick-www/src/main/webapp/WEB-INF/views/partial/usercolumn.html b/juick-www/src/main/webapp/WEB-INF/views/partial/usercolumn.html new file mode 100644 index 00000000..7e3b8a64 --- /dev/null +++ b/juick-www/src/main/webapp/WEB-INF/views/partial/usercolumn.html @@ -0,0 +1,76 @@ +<div id="ctitle"><a href="./"> + <img src="//i.juick.com/as/{{ user.uid }}.png" alt=""/>{{ user.name }}</a></div> +{% if visitor is not empty and visitor.uid > 0 and visitor.uid != user.uid %} +<ul id="ctoolbar"> + {% if isSubscribed %} + <li> + <a href="/post?body=U+%40{{ user.name }}" title="Подписан"> + <div style="background-position: -48px 0"></div> + </a> + </li> + {% else %} + <li> + <a href="/post?body=S+%40{{ user.name }}" title="Подписаться"> + <div style="background-position: -16px 0"></div> + </a> + </li> + {% endif %} + {% if isInBL %} + <li> + <a href="/post?body=BL+%40{{ user.name }}" title="Разблокировать"> + <div style="background-position: -96px 0"></div> + </a> + </li> + {% else %} + <li> + <a href="/post?body=BL+%40{{ user.name }}" title="Заблокировать"> + <div style="background-position: -80px 0"></div> + </a> + </li> + {% endif %} + {% if not isInBLAny %} + <li> + <a href="/pm/sent?uname={{ user.name }}" title="Написать приватное сообщение"> + <div style="background-position: -112px 0"></div> + </a> + </li> + {% endif %} +</ul> +{% else %} +<hr/> +{% endif %} +<ul> + <li><a href="/{{ user.name }}/">{{ i18n("messages","blog.blog") }}</a></li> + <li><a href="/{{ user.name }}/?show=recomm" rel="nofollow">{{ i18n("messages","blog.recommendations") }}</a></li> + <li><a href="/{{ user.name }}/?show=photos" rel="nofollow">{{ i18n("messages","blog.photos") }}</a></li> + {% if visitor is not empty and visitor.uid == user.uid and false %} + <li><a href="/?show=mycomments" rel="nofollow">{{ i18n("messages","blog.comments") }}</a></li> + <li><a href="/?show=unanswered" rel="nofollow">Неотвеченные</a></li> + {% endif %} +</ul> +<hr/> +<form action="/{{ user.name }}/"> + <p><input type="text" name="search" class="inp" placeholder="Поиск"/></p> +</form> +{% include "views/partial/usertags" %} +<hr/> +<div id="ustats"> + <ul> + <li><a href="/{{ user.name }}/friends">{{ i18n("messages","blog.iread") }}: {{ statsIRead }}</a></li> + <li><a href="/{{ user.name }}/readers">{{ i18n("messages","blog.readers") }}: {{ statsMyReaders }}</a></li> + <li>{{ i18n("messages","blog.messages") }}: {{ statsMessages }}</li> + <li>{{ i18n("messages","blog.comments") }}: {{ statsReplies }}</li> + </ul> + {% if iread is not empty %} + <div class="iread"> + {% for u in iread %} + <span> + <a href="/{{ u.name }}/"> + <img src="//i.juick.com/as/{{ u.uid }}.png" alt="{{ u.name }}"/> + </a> + </span> + {% endfor %} + </div> + {% endif %} + +</div> diff --git a/juick-www/src/main/webapp/WEB-INF/views/partial/usertags.html b/juick-www/src/main/webapp/WEB-INF/views/partial/usertags.html new file mode 100644 index 00000000..78e1416e --- /dev/null +++ b/juick-www/src/main/webapp/WEB-INF/views/partial/usertags.html @@ -0,0 +1,3 @@ +{% import "views/macros/tags" %} +{{ tags(uname=user.name, tagsStats) }} +<a href="/{{ user.name }}/tags" rel="nofollow">...</a>
\ No newline at end of file |