[% WRAPPER layout.tt title="News items" %] [% PROCESS common.tt %] [% USE String %] [% 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?" class = "btn btn-sm btn-danger" %]</td> </tr> [% END %] </tbody> </table> [% END %] <form action="[% c.uri_for('/admin/news/submit') %]" method="post"> <div class="page-header">Add news item</div> <div class="form-group"> <label for="newscontents">News text (HTML)</label> <textarea class="form-control" id="newscontents" name="contents"></textarea> </div> <button type="submit" class="btn btn-primary"> <i class="fas fa-check"></i> Post </button> </form> [% END %]