added newsitems, added some admin options to clear various caches.
This commit is contained in:
19
src/root/admin.tt
Normal file
19
src/root/admin.tt
Normal file
@ -0,0 +1,19 @@
|
||||
[% WRAPPER layout.tt title="Admin" %]
|
||||
[% PROCESS common.tt %]
|
||||
|
||||
<h1>Admin</h1>
|
||||
|
||||
<ul>
|
||||
<li>[% INCLUDE maybeLink uri = c.uri_for(c.controller('Project').action_for('create')) content = "Create project" %]</li>
|
||||
<li>Caching
|
||||
<ul>
|
||||
<li>[% INCLUDE maybeLink uri = c.uri_for(c.controller('Admin').action_for('clearfailedcache')) content = "Clear failed builds cache" confirmmsg = "Are you sure you want to clear the failed builds cache?" %]</li>
|
||||
<li>[% INCLUDE maybeLink uri = c.uri_for(c.controller('Admin').action_for('clearevalcache')) content = "Clear evaluation cache" confirmmsg = "Are you sure you want to clear the evaluation cache?" %]</li>
|
||||
<li>[% INCLUDE maybeLink uri = c.uri_for(c.controller('Admin').action_for('clearvcscache')) content = "Clear VCS caches" confirmmsg = "Are you sure you want to clear the VCS caches?" %]</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>[% INCLUDE maybeLink uri = c.uri_for(c.controller('Admin').action_for('managenews')) content = "News" %]</li>
|
||||
</ul>
|
||||
|
||||
|
||||
[% END %]
|
@ -174,7 +174,7 @@
|
||||
|
||||
|
||||
[% BLOCK maybeLink -%]
|
||||
[% IF uri %]<a [% HTML.attributes(href => uri) %]>[% content %]</a>[% ELSE; content; END -%]
|
||||
[% IF uri %]<a [% HTML.attributes(href => uri) %][% IF confirmmsg %]onclick="javascript:return confirm('[% confirmmsg %]')"[% END %]>[% content %]</a>[% ELSE; content; END -%]
|
||||
[% END -%]
|
||||
|
||||
|
||||
|
@ -90,7 +90,7 @@
|
||||
</div>
|
||||
<div id="footer">
|
||||
<div id="last-modified">
|
||||
<em>Hydra [% HTML.escape(version) %] (using [% HTML.escape(nixVersion) %]).</em>
|
||||
<em><a href="http://nixos.org/hydra" target="_new">Hydra</a> [% HTML.escape(version) %] (using [% HTML.escape(nixVersion) %]).</em>
|
||||
Page generated on [% INCLUDE renderDateTime %].
|
||||
[% IF c.user_exists %]
|
||||
You are logged in as <tt>[% c.user.username %]</tt>.
|
||||
|
39
src/root/news.tt
Normal file
39
src/root/news.tt
Normal file
@ -0,0 +1,39 @@
|
||||
[% 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>
|
||||
<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 %]
|
@ -1,6 +1,15 @@
|
||||
[% WRAPPER layout.tt title="Overview" %]
|
||||
[% PROCESS common.tt %]
|
||||
|
||||
[% IF newItems.size != 0 %]
|
||||
<div class="newsbar">
|
||||
[% FOREACH i IN newsItems %]
|
||||
[% contents = String.new(i.contents) %]
|
||||
<p><b>[% INCLUDE renderDateTime timestamp=i.createtime %]</b> <tt>by [% i.author.fullname %]</tt> <br/>[% contents.replace('\n','<br />\n') %]
|
||||
[% END %]
|
||||
</div>
|
||||
[% END %]
|
||||
|
||||
<h2>Projects</h2>
|
||||
|
||||
<p>The following projects are hosted on this server:</p>
|
||||
@ -33,5 +42,4 @@
|
||||
</p>
|
||||
[% END %]
|
||||
|
||||
|
||||
[% END %]
|
||||
|
@ -187,6 +187,10 @@ input.longString {
|
||||
width: 40em;
|
||||
}
|
||||
|
||||
textarea.longString {
|
||||
width: 40em;
|
||||
}
|
||||
|
||||
select {
|
||||
background-color: #fffff0;
|
||||
}
|
||||
@ -208,3 +212,14 @@ form.inline {
|
||||
.green {
|
||||
color: green;
|
||||
}
|
||||
|
||||
.newsbar {
|
||||
background-color:#D9E3EA;
|
||||
border:1px solid #999999;
|
||||
float:right;
|
||||
font-size:x-small;
|
||||
margin:0 0 0.5em 0.5em;
|
||||
overflow:hidden;
|
||||
padding:0.5em;
|
||||
width:30em;
|
||||
}
|
@ -33,10 +33,12 @@
|
||||
[% INCLUDE makeLink
|
||||
uri = c.uri_for(c.controller('Root').action_for('errors'))
|
||||
title = "Errors" %]
|
||||
[% INCLUDE makeLink
|
||||
uri = "http://nixos.org/hydra"
|
||||
title = "About" %]
|
||||
[% IF c.user_exists %]
|
||||
[% IF c.check_user_roles('admin') %]
|
||||
[% INCLUDE makeLink
|
||||
uri = c.uri_for(c.controller('Admin').action_for('admin'))
|
||||
title = "Admin" %]
|
||||
[% END %]
|
||||
[% INCLUDE makeLink
|
||||
uri = c.uri_for(c.controller('Root').action_for('logout'))
|
||||
title = "Sign out" %]
|
||||
|
Reference in New Issue
Block a user