[PATCH 2/2] (koji-web) Markup scratch builds.

Ralph Bean rbean at redhat.com
Mon Apr 27 18:20:31 UTC 2015


With this we can markup scratch builds, deemphasize them, etc.
---
 www/kojiweb/index.chtml |  3 ++-
 www/lib/kojiweb/util.py | 13 +++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/www/kojiweb/index.chtml b/www/kojiweb/index.chtml
index 7613fe6..738256c 100644
--- a/www/kojiweb/index.chtml
+++ b/www/kojiweb/index.chtml
@@ -50,7 +50,8 @@
       <th>State</th>
     </tr>
     #for $task in $tasks
-    <tr class="$util.rowToggle($self)">
+    #set $scratch = $util.taskScratchClass($task)
+    <tr class="$util.rowToggle($self) $scratch">
       #set $state = $util.taskState($task.state)
       <td>$task.id</td>
       <td><a href="taskinfo?taskID=$task.id" class="task$state" title="$state">$koji.taskLabel($task)</a></td>
diff --git a/www/lib/kojiweb/util.py b/www/lib/kojiweb/util.py
index ae00757..89a5ddb 100644
--- a/www/lib/kojiweb/util.py
+++ b/www/lib/kojiweb/util.py
@@ -458,6 +458,19 @@ def rowToggle(template):
     else:
         return 'row-even'
 
+
+def taskScratchClass(task_object):
+    """ Return a css class indicating whether or not this task is a scratch
+    build.
+    """
+    request = task_object['request']
+    if len(request) >= 3:
+        opts = request[2]
+        if opts.get('scratch'):
+            return "scratch"
+    return ""
+
+
 _fileFlags = {1: 'configuration',
               2: 'documentation',
               4: 'icon',
-- 
2.1.0



More information about the buildsys mailing list