From 8aaa0a1a8ae36c878dea386a709c55b78b2d4bca Mon Sep 17 00:00:00 2001
From: Rob Vermaas <rob.vermaas@gmail.com>
Date: Thu, 12 Apr 2012 21:50:06 +0200
Subject: [PATCH] Move 'keep build' and 'restart' to toplevel menu

---
 src/root/build.tt  | 10 ----------
 src/root/common.tt |  5 -----
 src/root/topbar.tt | 13 ++++++++++++-
 3 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/src/root/build.tt b/src/root/build.tt
index 2f0fb678..a4712d2a 100644
--- a/src/root/build.tt
+++ b/src/root/build.tt
@@ -362,18 +362,8 @@
 		          <em>Build output is no longer available</em>
 		        [% ELSIF build.keep %]
 		          <em>Build output will be kept permanently</em>
-		          [% IF c.user_exists %]
-		            <form action="[% c.uri_for('/build' build.id 'keep' 0) %]" method="post" class="inline">
-		              <button id="unkeep" type="submit">Unkeep</button>
-		            </form>
-		          [% END %]
 		        [% ELSE %]
 		          <em>Build output is available, but may be garbage-collected</em>
-		          [% IF c.user_exists %]
-		            <form action="[% c.uri_for('/build' build.id 'keep' 1) %]" method="post" class="inline">
-		              <button id="keep" type="submit">Keep</button>
-		            </form>
-		          [% END %]
 		        [% END %]
 		      </td>
 		    </tr>
diff --git a/src/root/common.tt b/src/root/common.tt
index 266085e0..04c216eb 100644
--- a/src/root/common.tt
+++ b/src/root/common.tt
@@ -262,11 +262,6 @@
       <span class="error">Build failed</span>
       (see <a href="#nix-error">below</a>)
     [% END %]  
-    [% IF c.user_exists && (buildstatus == 3 || buildstatus == 4) %]
-      <form action="[% c.uri_for('/build' build.id 'restart') %]" method="post" class="inline">
-        <button id="restart" type="submit">Restart</button>
-      </form>
-    [% END %]
   [% ELSIF build.busy %]
     <strong>Build in progress</strong>
     since [% INCLUDE renderDateTime timestamp = build.starttime %]
diff --git a/src/root/topbar.tt b/src/root/topbar.tt
index c8dbfc16..6cd43270 100644
--- a/src/root/topbar.tt
+++ b/src/root/topbar.tt
@@ -114,8 +114,19 @@
       [% INCLUDE makeLink
         uri = c.uri_for('/build' build.id 'clone')
         title = "Clone build" %]
+      [% IF !available %]
+      [% ELSIF build.keep %]
+          [% INCLUDE makeLink
+            uri = c.uri_for('/build' build.id 'keep' 0)
+            title = "Unkeep build" %]
+      [% ELSE %]
+          [% INCLUDE makeLink
+            uri = c.uri_for('/build' build.id 'keep' 1)
+            title = "Keep build" %]
+      [% END %]
+
       [% INCLUDE makeLink
-        uri = '#'
+        uri = c.uri_for('/build' build.id 'restart')
         title = "Restart build" %]
     [% END %]