aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/http/www/PageTemplates.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick/http/www/PageTemplates.java')
-rw-r--r--src/main/java/com/juick/http/www/PageTemplates.java80
1 files changed, 33 insertions, 47 deletions
diff --git a/src/main/java/com/juick/http/www/PageTemplates.java b/src/main/java/com/juick/http/www/PageTemplates.java
index 3eb66877..2ae945a5 100644
--- a/src/main/java/com/juick/http/www/PageTemplates.java
+++ b/src/main/java/com/juick/http/www/PageTemplates.java
@@ -22,6 +22,7 @@ import com.juick.Tag;
import com.juick.server.Endpoints;
import com.juick.server.MessagesQueries;
import com.juick.server.UserQueries;
+import org.rythmengine.Rythm;
import org.springframework.jdbc.core.JdbcTemplate;
import ru.sape.Sape;
@@ -51,58 +52,43 @@ public class PageTemplates {
private static String tagsHTML = null;
public static void pageHead(PrintWriter out, String title, String headers) {
- out.println("<!DOCTYPE html>");
- out.print("<html>");
- out.print("<head>");
- out.println("<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">");
- out.print("<link rel=\"stylesheet\" href=\"/style.css\"/>");
- out.print("<script type=\"text/javascript\" src=\"//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js\"></script>");
- out.print("<script type=\"text/javascript\" src=\"/scripts.js\"></script>");
- if (headers != null) {
- out.print(headers);
- }
- out.print("<title>" + title + "</title>");
- out.println("<meta name=\"viewport\" content=\"width=device-width,initial-scale=1,user-scalable=no\"/>");
- out.println("<link rel=\"icon\" href=\"//i.juick.com/favicon.png\"/>");
- out.println("<!--[if lt IE 9 & (!IEMobile 7)]>");
- out.println("<script src=\"//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js\"></script>");
- out.println("<![endif]-->");
- out.println("</head>");
+ out.print(Rythm.render("parts/page_header.html", headers, title));
out.flush();
out.println("<body>");
}
public static void pageNavigation(PrintWriter out, com.juick.User visitor, String search) {
- out.println("<header>");
- out.println(" <div id=\"logo\"><a href=\"/\">Juick</a></div>");
- out.print(" <nav id=\"global\"><ul>");
- out.print("<li><a href=\"/\">Популярные</a></li>");
- out.print("<li><a href=\"/?show=all\" rel=\"nofollow\">Все сообщения</a></li>");
- out.print("<li><a href=\"/?show=photos\" rel=\"nofollow\">Фотографии</a></li>");
- out.println("</ul></nav>");
- out.print(" <div id=\"search\"><form action=\"/\"><input type=\"text\" name=\"search\" class=\"text\" placeholder=\"Поиск\"");
- if (search != null) {
- out.print(" value=\"" + Utils.encodeHTML(search) + "\"");
- }
- out.println("/></form></div>");
- out.println(" <section id=\"headdiv\">");
- if (visitor != null) {
- out.print(" <nav id=\"user\"><ul>");
- out.print("<li><a href=\"/?show=my\">Моя лента</a></li>");
- out.print("<li><a href=\"/pm/inbox\">Приватные</a></li>");
- out.print("<li><a href=\"/?show=discuss\">Обсуждения</a></li>");
- out.print("<li><a href=\"/?show=recommended\">Рекомендации</a></li>");
- out.println("</ul></nav>");
- out.print(" <nav id=\"actions\"><ul>");
- out.print("<li><a href=\"/#post\">Написать</a></li>");
- out.print("<li><a href=\"/" + visitor.getUName() + "\">@" + visitor.getUName() + "</a></li>");
- out.print("<li><a href=\"/logout\">Выйти</a></li>");
- out.println("</ul></nav>");
- } else {
- out.println("<p>Чтобы добавлять сообщения и комментарии, <a href=\"#\" onclick=\"return openDialogLogin()\">представьтесь</a>.</p>");
- }
- out.println(" </section>");
- out.println("</header>");
+ out.print(Rythm.render("parts/page_navigation.html", search, visitor));
+// out.println("<header>");
+// out.println(" <div id=\"logo\"><a href=\"/\">Juick</a></div>");
+// out.print(" <nav id=\"global\"><ul>");
+// out.print("<li><a href=\"/\">Популярные</a></li>");
+// out.print("<li><a href=\"/?show=all\" rel=\"nofollow\">Все сообщения</a></li>");
+// out.print("<li><a href=\"/?show=photos\" rel=\"nofollow\">Фотографии</a></li>");
+// out.println("</ul></nav>");
+// out.print(" <div id=\"search\"><form action=\"/\"><input type=\"text\" name=\"search\" class=\"text\" placeholder=\"Поиск\"");
+// if (search != null) {
+// out.print(" value=\"" + Utils.encodeHTML(search) + "\"");
+// }
+// out.println("/></form></div>");
+// out.println(" <section id=\"headdiv\">");
+// if (visitor != null) {
+// out.print(" <nav id=\"user\"><ul>");
+// out.print("<li><a href=\"/?show=my\">Моя лента</a></li>");
+// out.print("<li><a href=\"/pm/inbox\">Приватные</a></li>");
+// out.print("<li><a href=\"/?show=discuss\">Обсуждения</a></li>");
+// out.print("<li><a href=\"/?show=recommended\">Рекомендации</a></li>");
+// out.println("</ul></nav>");
+// out.print(" <nav id=\"actions\"><ul>");
+// out.print("<li><a href=\"/#post\">Написать</a></li>");
+// out.print("<li><a href=\"/" + visitor.getUName() + "\">@" + visitor.getUName() + "</a></li>");
+// out.print("<li><a href=\"/logout\">Выйти</a></li>");
+// out.println("</ul></nav>");
+// } else {
+// out.println("<p>Чтобы добавлять сообщения и комментарии, <a href=\"#\" onclick=\"return openDialogLogin()\">представьтесь</a>.</p>");
+// }
+// out.println(" </section>");
+// out.println("</header>");
}
public static void pageYandexAd728(PrintWriter out, int YandexID) {