hydra/src/root/news.tt

40 lines
1.1 KiB
Plaintext
Raw Normal View History

[% WRAPPER layout.tt title="News items" %]
[% PROCESS common.tt %]
[% USE String %]
<h1>News items</h1>
[% IF newsItems.size == 0 %]
<p>No news items</p>
[% ELSE %]
<table class="table table-striped table-condensed">
<thead><th>Date</th><th>Contents</th><th></th></thead>
<tbody>
[% FOREACH i IN newsItems %]
[% contents = String.new(i.contents) %]
<tr>
<td>[% INCLUDE renderDateTime timestamp=i.createtime %]</td>
<td>[% contents.replace('\n','<br />\n') %]</td>
<td>[ [% INCLUDE maybeLink uri = c.uri_for(c.controller('Admin').action_for('news_delete') i.id) content = "Delete" confirmmsg = "Are you sure you want to delete this news item?" %] ]</td>
</tr>
[% END %]
</tbody>
</table>
[% END %]
<form action="[% c.uri_for('/admin/news/submit') %]" method="post">
<h2>Add news item</h2>
<p>
<textarea class="longString" name="contents"></textarea>
</p>
<p>
<button type="submit">Post</button>
</p>
</form>
[% END %]