From 083dbf8bb33c61edb28c4144668ed2729fc85e35 Mon Sep 17 00:00:00 2001
From: Corey Maynard <me@coreymaynard.com>
Date: Thu, 28 Apr 2011 15:41:27 -0400
Subject: [PATCH] Some minor changes to the templates: fix add additional
 buildroot override duplicating search box. Make Submit new
 override match other similar links

Add new metric to tools/metrics.py to findout what updates spent the longest time in Testing.
---
 bodhi/controllers.py             |    2 +-
 bodhi/static/css/layout.css      |    1 +
 bodhi/templates/list.kid         |    2 +-
 bodhi/templates/master.kid       |   13 +++++--------
 bodhi/templates/metrics.kid      |    2 +-
 bodhi/templates/mine.kid         |    2 +-
 bodhi/templates/new.kid          |    2 +-
 bodhi/templates/overrideform.kid |    4 ++--
 bodhi/templates/overrides.kid    |    4 ++--
 bodhi/tools/metrics.py           |    4 ++++
 10 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/bodhi/controllers.py b/bodhi/controllers.py
index 068053e..9d4249b 100644
--- a/bodhi/controllers.py
+++ b/bodhi/controllers.py
@@ -477,7 +477,7 @@ class Root(controllers.RootController):
         updates = PackageUpdate.select(
                        PackageUpdate.q.submitter == identity.current.user_name,
                     orderBy=PackageUpdate.q.date_submitted).reversed()
-        return dict(updates=updates, title='%s\'s updates' %
+        return dict(updates=updates, title='%s\'s Updates' %
                     identity.current.user_name, num_items=updates.count())
 
     @expose(allow_json=True)
diff --git a/bodhi/static/css/layout.css b/bodhi/static/css/layout.css
index bbcfc0b..1be0a69 100644
--- a/bodhi/static/css/layout.css
+++ b/bodhi/static/css/layout.css
@@ -26,6 +26,7 @@ a[name] {
     color: inherit;
     text-decoration: inherit;
 }
+a img { border:0; }
 
 #fedora-header {
     background-color: #fff;
diff --git a/bodhi/templates/list.kid b/bodhi/templates/list.kid
index 0f6c3e9..3456513 100644
--- a/bodhi/templates/list.kid
+++ b/bodhi/templates/list.kid
@@ -8,7 +8,7 @@
 </head>
 
 <body>
-    <h1 class="padded">${title}</h1>
+    <h2 class="padded">${title}</h2>
     <div py:if="num_items" class="list">
         <span py:for="page in tg.paginate.pages">
             <a py:if="page != tg.paginate.current_page"
diff --git a/bodhi/templates/master.kid b/bodhi/templates/master.kid
index 9dfbc47..0e3467b 100644
--- a/bodhi/templates/master.kid
+++ b/bodhi/templates/master.kid
@@ -39,19 +39,16 @@ $(document).ready(function() {
         $("div[@id=bodhi-logo]").hide();
         $("div[@id=wait]").show();
     } );
-} );
-</script>
-<script type="text/javascript">
-    $(document).ready(function() {
-        $('div.flash').corner();
-        $('div.flash').show("slow");
-    });
+
+    $('div.flash').corner();
+    $('div.flash').show("slow");
+});
 </script>
 
     <!-- header BEGIN -->
     <div id="fedora-header">
         <div id="fedora-header-logo">
-            <a href="${tg.url('/')}"><img src="${tg.url('/static/images/header-fedora_logo.png')}" /></a>
+            <a href="${tg.url('/')}"><img src="${tg.url('/static/images/header-fedora_logo.png')}" alt="Fedora" /></a>
         </div>
 
         <div id="fedora-header-items">
diff --git a/bodhi/templates/metrics.kid b/bodhi/templates/metrics.kid
index 09563e0..ea57317 100644
--- a/bodhi/templates/metrics.kid
+++ b/bodhi/templates/metrics.kid
@@ -9,7 +9,7 @@
 </head>
 <body>
   <center>
-    <h1>${title}</h1><br/>
+    <h2>${title}</h2>
       <div py:for="metric in metrics">
         ${metric.display()}
         <br/><br/>
diff --git a/bodhi/templates/mine.kid b/bodhi/templates/mine.kid
index cb38bc0..1c4ae24 100644
--- a/bodhi/templates/mine.kid
+++ b/bodhi/templates/mine.kid
@@ -8,7 +8,7 @@
 </head>
 
 <body>
-    &nbsp;&nbsp;<b>${title}</b>
+    <h2 class="padded">${title}</h2>
     <div py:if="num_items" class="list">
         <span py:for="page in tg.paginate.pages">
             <a py:if="page != tg.paginate.current_page"
diff --git a/bodhi/templates/new.kid b/bodhi/templates/new.kid
index d605d61..d154fa3 100644
--- a/bodhi/templates/new.kid
+++ b/bodhi/templates/new.kid
@@ -13,7 +13,7 @@
     <script type="text/javascript">
     $(document).ready(function() {
         $("#addField").click( function() {
-            o = $("input[@id=form_builds_text]:eq(0)");
+            o = $("#form_builds_text");
             o.clone().val(" "+o.val()).insertAfter(o.parent().parent()).show();
             o.focus().val("");
         } );
diff --git a/bodhi/templates/overrideform.kid b/bodhi/templates/overrideform.kid
index c9ee2ec..4865b6a 100644
--- a/bodhi/templates/overrideform.kid
+++ b/bodhi/templates/overrideform.kid
@@ -4,7 +4,7 @@
     method="${method}"
     py:attrs="form_attrs" width="100%">
 
-    <h2>Buildroot Override Form</h2>
+    <h2 class="padded">Buildroot Override Form</h2>
 
     <table border="0" cellspacing="0" cellpadding="0">
     <tr py:for="i, field in enumerate(fields)">
@@ -34,7 +34,7 @@
     <script type="text/javascript">
     $(document).ready(function() {
         $("#addField").click( function() {
-            o = $("input[@id=form_builds_text]:eq(0)");
+            o = $("#form_builds_text");
             o.clone().val(" "+o.val()).insertAfter(o.parent().parent()).show();
             o.focus().val("");
         } );
diff --git a/bodhi/templates/overrides.kid b/bodhi/templates/overrides.kid
index 887d5df..cc523e5 100644
--- a/bodhi/templates/overrides.kid
+++ b/bodhi/templates/overrides.kid
@@ -8,8 +8,8 @@
 </head>
 
 <body>
-    &nbsp;&nbsp;<h2>${title}</h2>
-    &nbsp;&nbsp;<a href="${tg.url('/override/new')}"><img src="${tg.url('/static/images/plus.png')}"/>Submit a new override</a>
+    <h2 class="padded">${title}</h2>
+    <a class="padded list" href="${tg.url('/override/new')}"><img src="${tg.url('/static/images/plus.png')}"/> Submit a new override</a>
     <br/>
     <div py:if="num_items" class="list">
         <span py:for="page in tg.paginate.pages">
diff --git a/bodhi/tools/metrics.py b/bodhi/tools/metrics.py
index bd40eff..f3c12b7 100755
--- a/bodhi/tools/metrics.py
+++ b/bodhi/tools/metrics.py
@@ -191,6 +191,10 @@ def main():
                 data['deltas'][len(data['deltas']) / 2].days)
         print "   * mode = %d days" % (
                 sorted(data['occurrences'].items(), key=itemgetter(1))[-1][0])
+        print " * Updates that spent longest time in testing:"
+        for update in sorted(release.updates, key=lambda package: package.days_in_testing, reverse=True)[:10]:
+            print "   * %s (%s days)" % (update.title, update.days_in_testing)
+        
         print " * %d packages updated" % (len(data['packages']))
         #for package in sorted(data['packages'].items(), key=itemgetter(1), reverse=True):
         #    print "    * %s: %d" % (package[0].name, package[1])
-- 
1.7.4.4

