diff options
author | Alex Bitney | 2016-02-07 00:00:41 +0200 |
---|---|---|
committer | Alex Bitney | 2016-02-07 00:00:41 +0200 |
commit | c2d316449f85bd2b74ae9ffaa3d08b7a5ee282cf (patch) | |
tree | ce808c6d65e4a61913497f5d397473f75fadc701 /src/main/resources | |
parent | 1fffebc18bbdbe87b456e2b3bd66e9ce5a6afcb8 (diff) |
added tags when posting new message
added templates engine (rythm engine) and moved something to it.
WARNING: textext plugin does not work when minimized, and also I fixed bug in it.
Diffstat (limited to 'src/main/resources')
-rw-r--r-- | src/main/resources/templates/parts/page_header.html | 33 | ||||
-rw-r--r-- | src/main/resources/templates/parts/page_navigation.html | 40 | ||||
-rw-r--r-- | src/main/resources/templates/parts/post_form.html | 64 | ||||
-rw-r--r-- | src/main/resources/templates/parts/test.html | 3 |
4 files changed, 140 insertions, 0 deletions
diff --git a/src/main/resources/templates/parts/page_header.html b/src/main/resources/templates/parts/page_header.html new file mode 100644 index 00000000..63087d6c --- /dev/null +++ b/src/main/resources/templates/parts/page_header.html @@ -0,0 +1,33 @@ +@args String headers, String title +<!DOCTYPE html> +<html> +<head> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <link rel="stylesheet" href="/style.css"/> + <link rel="stylesheet" href="/textext/textext.core.css"/> + <link rel="stylesheet" href="/textext/textext.plugin.arrow.css"/> + <link rel="stylesheet" href="/textext/textext.plugin.autocomplete.css"/> + <link rel="stylesheet" href="/textext/textext.plugin.focus.css"/> + <link rel="stylesheet" href="/textext/textext.plugin.prompt.css"/> + <link rel="stylesheet" href="/textext/textext.plugin.tags.css"/> + <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> + <script type="text/javascript" src="/textext/textext.core.js"></script> + <script type="text/javascript" src="/textext/textext.plugin.ajax.js"></script> + <script type="text/javascript" src="/textext/textext.plugin.arrow.js"></script> + <script type="text/javascript" src="/textext/textext.plugin.autocomplete.js"></script> + <script type="text/javascript" src="/textext/textext.plugin.filter.js"></script> + <script type="text/javascript" src="/textext/textext.plugin.focus.js"></script> + <script type="text/javascript" src="/textext/textext.plugin.prompt.js"></script> + <script type="text/javascript" src="/textext/textext.plugin.suggestions.js"></script> + <script type="text/javascript" src="/textext/textext.plugin.tags.js"></script> + <script type="text/javascript" src="/scripts.js"></script> + @if (headers != null) { + @raw() {@headers} + } + <title>@title</title> + <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no"/> + <link rel="icon" href="//i.juick.com/favicon.png"/> + <!--[if lt IE 9 & (!IEMobile 7)]> + <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script> + <![endif]--> +</head> diff --git a/src/main/resources/templates/parts/page_navigation.html b/src/main/resources/templates/parts/page_navigation.html new file mode 100644 index 00000000..018818b0 --- /dev/null +++ b/src/main/resources/templates/parts/page_navigation.html @@ -0,0 +1,40 @@ +@args String search, com.juick.User visitor +<header> + <div id="logo"><a href="/">Juick</a></div> + <nav id="global"> + <ul> + <li><a href="/">Популярные</a></li> + <li><a href="/?show=all" rel="nofollow">Все сообщения</a></li> + <li><a href="/?show=photos" rel="nofollow">Фотографии</a></li> + </ul> + </nav> + <div id="search"> + <form action="/"><input type="text" name="search" class="text" placeholder="Поиск" + @if (search !=null) { + value="@search" + } + /></form> + </div> + <section id="headdiv"> + @if (visitor != null) { + <nav id="user"> + <ul> + <li><a href="/?show=my">Моя лента</a></li> + <li><a href="/pm/inbox">Приватные</a></li> + <li><a href="/?show=discuss">Обсуждения</a></li> + <li><a href="/?show=recommended">Рекомендации</a></li> + </ul> + </nav> + <nav id="actions"> + <ul> + <li><a href="/#post">Написать</a></li> + <li><a href="/@visitor.getUName()">@@ @visitor.getUName()</a></li> + <li><a href="/logout">Выйти</a></li> + </ul> + </nav> + } else { + <p>Чтобы добавлять сообщения и комментарии, <a href="#" onclick="return openDialogLogin()">представьтесь</a>. + </p> + } + </section> +</header> diff --git a/src/main/resources/templates/parts/post_form.html b/src/main/resources/templates/parts/post_form.html new file mode 100644 index 00000000..56184f55 --- /dev/null +++ b/src/main/resources/templates/parts/post_form.html @@ -0,0 +1,64 @@ +<form action="/post" method="post" enctype="multipart/form-data" onsubmit="return onsubmitNewMessage()"> + <section id="newmessage"> + <textarea name="body" placeholder="Новое сообщение..." + onclick="newmessage_toggleOpen()" + onkeypress="postformListener(this.form,event)"></textarea> + <div> + <input type="text" class="img" name="img" placeholder="Ссылка на изображение (JPG/PNG, до 10Мб)" style="margin-bottom: 8pt"/> или <a + href="#" onclick="return attachMessagePhoto(this)">загрузить</a><br/> + + <!--<textarea class="tags" name="tags" rows="1" id="post_tags" style="resize: none;" type="text"></textarea>--> + <input type="text" class="tags" name="tags" id="post_tags"/><br/> + <input type="submit" class="subm" value="Отправить"/> + </div> + <div id="newmessage_tags" style="padding-top: 10pt"> + <span style="display: none; border: 1px solid black; background-color: #1277aa; color: white; padding: 2pt 2pt; font-size: 9pt; margin: 2pt 2pt"> + sample + </span> + </div> + <script> + function newmessage_toggleOpen() { + $('#newmessage>div').css('display','block'); + $('#newmessage textarea').css('min-height','70px'); + + $.ajax({url:"/my_tags.json"}).done(function(data) { + $('#post_tags').textext({ + plugins: 'tags prompt focus autocomplete suggestions arrow', + tagsItems: [], + prompt: 'Теги (через ENTER)', + suggestions: data + }); + var plugin = $('#post_tags').textext()[0]; + var mtags = document.getElementById("newmessage_tags"); + var template = mtags.firstElementChild; + for(var i=0; i<data.length; i++) { + var nextItem = template.cloneNode(true); + nextItem.innerText = data[i]; + nextItem.style.display = "inline"; + var q = function(item) { + item.onclick = function() { + window.setTimeout(function() { + if (plugin.tags().getTagElement(item.innerText)) { + plugin.tags().removeTag(item.innerText); + } + plugin.tags().addTags([item.innerText]); + }, 50) + }; + item.onmouseover = function() { + item.style.fontStyle = "bold"; + item.style.backgroundColor = "#2ba4e3"; + }; + item.onmouseout = function() { + item.style.fontStyle = ""; + item.style.backgroundColor = template.style.backgroundColor; + }; + }; + q(nextItem); + mtags.appendChild(nextItem); + } + }); + newmessage_toggleOpen = function() {} + } + </script> + </section> +</form>
\ No newline at end of file diff --git a/src/main/resources/templates/parts/test.html b/src/main/resources/templates/parts/test.html new file mode 100644 index 00000000..95e5d093 --- /dev/null +++ b/src/main/resources/templates/parts/test.html @@ -0,0 +1,3 @@ + + +this is a test!!22
\ No newline at end of file |