mirror of
https://github.com/openresty/openresty.git
synced 2024-10-13 00:29:41 +00:00
checked in mising files in the blog demo.
This commit is contained in:
27
demo/Blog/template/elem/archive-list.tt
Normal file
27
demo/Blog/template/elem/archive-list.tt
Normal file
@ -0,0 +1,27 @@
|
||||
<ul class="module-list">
|
||||
[% FOREACH archive IN archives -%]
|
||||
<li class="module-list-item">
|
||||
[%- index = archive.month %]
|
||||
<a href="#archive/[% archive.year %]/[% archive.month %]">[% months.$index %] [% archive.year %] ([% archive.count %])</a>
|
||||
</li>
|
||||
[% END -%]
|
||||
</ul>
|
||||
|
||||
<p class="module-more">
|
||||
|
||||
[% IF offset > 0 %]
|
||||
<a href="javascript:getArchiveList([% offset - count %])"><<</a>
|
||||
[% END %]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[% IF archives.size == count %]
|
||||
<a id="more-archives" href="javascript:getArchiveList([% offset + count %]);">
|
||||
Next...
|
||||
</a>
|
||||
[% END %]
|
||||
|
||||
</p>
|
||||
|
16
demo/Blog/template/elem/archive-nav.tt
Normal file
16
demo/Blog/template/elem/archive-nav.tt
Normal file
@ -0,0 +1,16 @@
|
||||
[% IF next %]
|
||||
[%- index = next.month %]
|
||||
<a href="#archive/[% next.year %]/[% next.month %]">
|
||||
« [% months.$index %] [% next.year %]
|
||||
</a>
|
||||
[% END %]
|
||||
|
|
||||
<a href="#posts/1"> Main </a>
|
||||
|
|
||||
[% IF prev %]
|
||||
[%- index = prev.month %]
|
||||
<a href="#archive/[% prev.year %]/[% prev.month %]">
|
||||
[% months.$index %] [% prev.year %] »
|
||||
</a>
|
||||
[% END %]
|
||||
|
71
demo/Blog/template/elem/calendar.tt
Normal file
71
demo/Blog/template/elem/calendar.tt
Normal file
@ -0,0 +1,71 @@
|
||||
[%- index = month + 1 %]
|
||||
<h2 class="module-header">[% months.$index %] [% year %]</h2>
|
||||
<div class="module-content">
|
||||
<table id="calendar-nav">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>
|
||||
<a class="nav-arrow"
|
||||
href="javascript:void(0)"
|
||||
onclick="getCalendar([% year - 1 %], [% month %])">
|
||||
<<
|
||||
</a>
|
||||
</th>
|
||||
<th>
|
||||
<a class="nav-arrow"
|
||||
href="javascript:void(0)"
|
||||
onclick="getCalendar([% month - 1 < 0 ? year - 1 : year %], [% month - 1 < 0 ? 11 : month - 1 %])">
|
||||
<
|
||||
</a>
|
||||
</th>
|
||||
<th> </th>
|
||||
<th> </th>
|
||||
<th> </th>
|
||||
<th>
|
||||
<a class="nav-arrow"
|
||||
href="javascript:void(0)"
|
||||
onclick="getCalendar([% month + 1 > 11 ? year + 1: year %], [% month + 1 > 11 ? 0 : month + 1 %])">
|
||||
>
|
||||
</a>
|
||||
</th>
|
||||
<th>
|
||||
<a class="nav-arrow"
|
||||
href="javascript:void(0)"
|
||||
onclick="getCalendar([% year + 1 %], [% month %])">
|
||||
>>
|
||||
</a>
|
||||
</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table summary="Monthly calendar with links to each day's posts">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Sun</th>
|
||||
<th>Mon</th>
|
||||
<th>Tue</th>
|
||||
<th>Wed</th>
|
||||
<th>Thu</th>
|
||||
<th>Fri</th>
|
||||
<th>Sat</th>
|
||||
</tr>
|
||||
[%- day = 1; %]
|
||||
[%- WHILE day <= end_of_month %]
|
||||
<tr>
|
||||
[%- day_of_week = 0 %]
|
||||
[%- WHILE day_of_week <= 6 %]
|
||||
[%- today_mark = day == today ? 'class="today-cell"' : '' %]
|
||||
[%- IF (day > end_of_month) || (day == 1 && day_of_week < first_day_of_week) -%]
|
||||
<td> </td>
|
||||
[%- ELSE -%]
|
||||
<td id="day-[% year %]-[% month %]-[% day %]" [% today_mark %]>[% day %]</td>
|
||||
[%- day = day + 1 %]
|
||||
[%- END %]
|
||||
[%- day_of_week = day_of_week + 1 %]
|
||||
[%- END %]
|
||||
[%- END %]
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
29
demo/Blog/template/elem/comments.tt
Normal file
29
demo/Blog/template/elem/comments.tt
Normal file
@ -0,0 +1,29 @@
|
||||
[%- FOREACH comment IN comments -%]
|
||||
<a name="post-[% comment.post %]:comment-[% comment.id %]" id="post-[% comment.post %]:comment-[% comment.id %]"></a>
|
||||
<div class="comment" id="comment-95523406">
|
||||
<div class="comment-content">
|
||||
[%- IF comment.body %]
|
||||
[%- comment.body.replace('&', '&')
|
||||
.replace('<', '<')
|
||||
.replace('>', '>')
|
||||
.replace('\n', '<br/>')
|
||||
.replace(' ', ' ')
|
||||
.replace('(http://(?:\%[A-Fa-f0-9]{2}|[-A-Za-z./0-9~_])+)', '<a href="$1">$1</a>') %]
|
||||
[%- END %]
|
||||
</div>
|
||||
<p class="comment-footer">
|
||||
Posted by:
|
||||
[% IF comment.url %]
|
||||
[%- url = comment.url %]
|
||||
[% IF NOT url.match('^\\w+://');
|
||||
url = 'http://' _ url;
|
||||
END -%]
|
||||
<a href="[% url | html %]">[% comment.sender | html %]</a>
|
||||
[% ELSE %]
|
||||
[% comment.sender | html %] |
|
||||
[% END %]
|
||||
[% comment.created | html %]
|
||||
</p>
|
||||
</div>
|
||||
[%- END %]
|
||||
|
24
demo/Blog/template/elem/nav.tt
Normal file
24
demo/Blog/template/elem/nav.tt
Normal file
@ -0,0 +1,24 @@
|
||||
[%
|
||||
SET prev_post = undef;
|
||||
SET next_post = undef;
|
||||
FOREACH post IN posts;
|
||||
IF post.id < current;
|
||||
prev_post = post;
|
||||
ELSE;
|
||||
next_post = post;
|
||||
END;
|
||||
END -%]
|
||||
[% IF next_post %]
|
||||
<a href="#post-[% next_post.id %]">
|
||||
« [% next_post.title %]
|
||||
</a>
|
||||
[% END %]
|
||||
|
|
||||
<a href="#post-list"> Main </a>
|
||||
|
|
||||
[% IF prev_post %]
|
||||
<a href="#post-[% prev_post.id %]">
|
||||
[% prev_post.title %] »
|
||||
</a>
|
||||
[% END %]
|
||||
|
51
demo/Blog/template/elem/pager.tt
Normal file
51
demo/Blog/template/elem/pager.tt
Normal file
@ -0,0 +1,51 @@
|
||||
[% DEFAULT
|
||||
page = 1,
|
||||
page_count = undef,
|
||||
title = 'Pages',
|
||||
prefix = 'post-list/',
|
||||
suffix = ''
|
||||
-%]
|
||||
|
||||
[% IF page_count <= 10;
|
||||
from = 1;
|
||||
to = page_count;
|
||||
ELSE;
|
||||
from = page - 10 >= 1 ? page - 10 : 1
|
||||
to = page + 9 >= page_count ? page_count : page + 9;
|
||||
END -%]
|
||||
|
||||
<center>
|
||||
<table class="paging">
|
||||
<tr>
|
||||
<td>
|
||||
[% title %]:
|
||||
</td>
|
||||
<td>
|
||||
[%- IF page > 1 %]
|
||||
<span class="prev-page">
|
||||
<a href="#[% prefix _ (page - 1) _ suffix %]">Previous</a>
|
||||
</span>
|
||||
[%- END %]
|
||||
</td>
|
||||
|
||||
[%- i = from; %]
|
||||
[%- WHILE i <= to %]
|
||||
[%- IF i == page %]
|
||||
<td class="highlight">[% i %]</td>
|
||||
[%- ELSE %]
|
||||
<td><a href="#[% prefix _ i _ suffix %]">[% i %]</a></td>
|
||||
[%- END %]
|
||||
[%- i = i + 1 %]
|
||||
[%- END %]
|
||||
|
||||
<td>
|
||||
[%- IF page < page_count %]
|
||||
<span class="next-page">
|
||||
<a href="#[% prefix _ (page + 1) _ suffix %]">Next</a>
|
||||
</span>
|
||||
[%- END %]
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
<br/>
|
5
demo/Blog/template/elem/post-list.tt
Normal file
5
demo/Blog/template/elem/post-list.tt
Normal file
@ -0,0 +1,5 @@
|
||||
<div id="post-list-nav" class="content-nav"></div>
|
||||
[% FOREACH post IN post_list %]
|
||||
[% PROCESS 'post.tt' %]
|
||||
[% END %]
|
||||
|
55
demo/Blog/template/elem/post-page.tt
Normal file
55
demo/Blog/template/elem/post-page.tt
Normal file
@ -0,0 +1,55 @@
|
||||
<p class="content-nav">
|
||||
</p>
|
||||
<!-- entry -->
|
||||
|
||||
[% PROCESS 'post.tt' -%]
|
||||
|
||||
<a id="post-[%post.id%]:comments" name="post-[%post.id%]-comments"></a>
|
||||
<div class="comments">
|
||||
<h3 class="comments-header">Comments</h3>
|
||||
<div class="comments-content">
|
||||
<!-- comment list -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- comment form -->
|
||||
<form id="comment-form" onsubmit="return false;" method="post">
|
||||
<div class="comments-open">
|
||||
<input id="comment-for" type="hidden" value="[% post.id %]"></input>
|
||||
<h2 class="comments-open-header">Post a comment</h2>
|
||||
<div class="comments-open-content">
|
||||
<div id="comments-open-data">
|
||||
<p>
|
||||
<label for="comment-author">Name:</label>
|
||||
<input id="comment-author" name="author" size="30" class="required"/>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
<label for="comment-email">Email Address: <span class="comment-form-note">(Not displayed with comment.)</span></label>
|
||||
<input id="comment-email" name="email" size="30" class="required" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="comment-url">URL:</label>
|
||||
<input id="comment-url" name="url" size="30" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="comment-bake-cookie"><input type="checkbox"
|
||||
id="comment-bake-cookie" name="bakecookie" value="1" />
|
||||
Remember personal info?</label>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<p id="comments-open-text">
|
||||
<label for="comment-text">Comments:</label>
|
||||
<textarea id="comment-text" name="text" rows="10" cols="30" class="required"></textarea>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div id="comments-open-footer" class="comments-open-footer">
|
||||
<!-- <button name="preview" id="comment-preview"> Preview </button> -->
|
||||
<button name="post" id="comment-post" onclick="postComment([% post.id %]);"> Post </button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
|
32
demo/Blog/template/elem/post.tt
Normal file
32
demo/Blog/template/elem/post.tt
Normal file
@ -0,0 +1,32 @@
|
||||
<h2 class="date-header">[% post.created %]</h2>
|
||||
<div class="entry">
|
||||
<h3 class="entry-header">
|
||||
<a href="#post-[% post.id %]">
|
||||
[%- post.title -%]
|
||||
</a>
|
||||
</h3>
|
||||
<div class="entry-content">
|
||||
<div class="entry-body">
|
||||
[%- post.content -%]
|
||||
<p/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="entry-footer">
|
||||
<p class="entry-footer-info">
|
||||
<span class="post-footers">
|
||||
Posted by [% post.author %] at
|
||||
[% post.created %] in
|
||||
<a href="#post-[% post.id %]">Articles</a>
|
||||
</span>
|
||||
<span class="separator">|</span>
|
||||
<a class="permalink" href="#post-[% post.id %]">Permalink</a>
|
||||
<span class="separator">|</span>
|
||||
<a href="#post-[% post.id %]:comments">Comments
|
||||
(<span class="comment-count" post="[% post.id %]">[% post.comments %]</span>)
|
||||
</a>
|
||||
</p>
|
||||
<!-- technorati tags -->
|
||||
<!-- post footer links -->
|
||||
</div>
|
||||
</div>
|
||||
|
30
demo/Blog/template/elem/recent-comments.tt
Normal file
30
demo/Blog/template/elem/recent-comments.tt
Normal file
@ -0,0 +1,30 @@
|
||||
<ul class="module-list">
|
||||
[% last_id %]
|
||||
[% FOREACH comment IN comments -%]
|
||||
<li class="module-list-item">
|
||||
<a href="#post-[% comment.post %]:comment-[% comment.id %]">
|
||||
[% comment.sender | html %]</a> on
|
||||
<a href="#post-[% comment.post %]">[% comment.title | html %]</a>
|
||||
</li>
|
||||
[%- last_id = comment.id %]
|
||||
[% END -%]
|
||||
</ul>
|
||||
|
||||
<p class="module-more">
|
||||
|
||||
[% IF offset > 0 %]
|
||||
<a href="javascript:getRecentComments([% offset - count %])"><<</a>
|
||||
[% END %]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[% IF last_id > 1 && comments.size == count %]
|
||||
<a id="more-recent-comments" href="javascript:getRecentComments([% offset + count %]);">
|
||||
Next...
|
||||
</a>
|
||||
[% END %]
|
||||
|
||||
</p>
|
||||
|
28
demo/Blog/template/elem/recent-posts.tt
Normal file
28
demo/Blog/template/elem/recent-posts.tt
Normal file
@ -0,0 +1,28 @@
|
||||
<ul class="module-list">
|
||||
[% last_id %]
|
||||
[% FOREACH post IN posts -%]
|
||||
<li class="module-list-item">
|
||||
<a href="#post-[% post.id %]">[% post.title %]</a>
|
||||
</li>
|
||||
[%- last_id = post.id %]
|
||||
[% END -%]
|
||||
</ul>
|
||||
|
||||
<p class="module-more">
|
||||
|
||||
[% IF offset > 0 %]
|
||||
<a href="javascript:getRecentPosts([% offset - count %])"><<</a>
|
||||
[% END %]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[% IF last_id > 1 && posts.size == count %]
|
||||
<a id="more-recent-posts" href="javascript:getRecentPosts([% offset + count %]);">
|
||||
Next...
|
||||
</a>
|
||||
[% END %]
|
||||
|
||||
</p>
|
||||
|
Reference in New Issue
Block a user