52b914764732

Display a list of signoffs on the web UI changeset pages.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Sat, 27 Mar 2010 11:44:59 -0400
parents 1f723957f6e5
children 6df093d9f238
branches/tags (none)
files review/web_media/style.css review/web_templates/base.html review/web_templates/changeset.html review/web_templates/macros.html review/web_ui.py

Changes

--- a/review/web_media/style.css	Sat Mar 27 11:22:26 2010 -0400
+++ b/review/web_media/style.css	Sat Mar 27 11:44:59 2010 -0400
@@ -118,6 +118,35 @@
     background-color: #FBEAD0;
 }
 
+/* Signoffs. */
+.signoff {
+    white-space: normal;
+    border: 1px dashed #666;
+    font-family: Consolas, Monaco, "Courier New", Courier, monospace;
+    padding: 0.75em;
+    margin-bottom: 1.5em;
+}
+.signoff.yes {
+    background-color: #B4FF9D;
+}
+.signoff.no {
+    background-color: #FC9696;
+}
+.signoff.neutral {
+    background-color: #F0F0F0;
+}
+.signoff div.avatar {
+    border: 1px solid black;
+    float: right;
+}
+.signoff div.message {
+    margin-top: 1.5em;
+    white-space: pre;
+}
+.signoff .opinion {
+    font-weight: bold;
+}
+
 /* Diffs. */
 div.diff {
     overflow: auto;
--- a/review/web_templates/base.html	Sat Mar 27 11:22:26 2010 -0400
+++ b/review/web_templates/base.html	Sat Mar 27 11:44:59 2010 -0400
@@ -1,6 +1,8 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 
+{% import 'macros.html' as macros %}
+
 <html>
     <head>
         <title>Reviewing {{ utils["basename"](datastore.target.root) }}{% block title %}{% endblock %}</title>
--- a/review/web_templates/changeset.html	Sat Mar 27 11:22:26 2010 -0400
+++ b/review/web_templates/changeset.html	Sat Mar 27 11:44:59 2010 -0400
@@ -8,11 +8,7 @@
     
     {% for comment in rcset.review_level_comments() %}
         <div class="comment">
-            <div class="avatar">
-                <img height="52" width="52"
-                     src="{{ utils['comment_gravatar'](comment) }}?s=52"
-                />
-            </div>
+            {{ macros.gravatar(comment, utils) }}
             <div>
                 <div class="author">
                     <a href="mailto:${ email(comment.author) }">{{ utils['templatefilters'].person(comment.author) }}</a>
@@ -36,6 +32,26 @@
         </form>
     </div>
 
+    
+    <h2>Signoffs</h2>
+    
+    {% for signoff in rcset.signoffs %}
+        <div class="signoff {{ signoff.opinion }}">
+            {{ macros.gravatar(signoff, utils) }}
+            <div>
+                <div class="author">
+                    <a href="mailto:${ email(signoff.author) }">{{ utils['templatefilters'].person(signoff.author) }}</a>
+                    signed off as <span class="opinion">{{ signoff.opinion }}</span> on this changeset, saying:
+                </div>
+                <div class="message">{{ signoff.message }}</div>
+            </div>
+        </div>
+    {% endfor %}
+    
+    <div id="signoff-review">
+        <p class="signoff-activate"><a href="#">Sign off on this changeset (currently unimplemented)</a></p>
+    </div>
+
     <h2>Files</h2>
     
     {% for filename in rcset.files() %}
@@ -48,9 +64,7 @@
             <div class="file-review-contents">
                 {% for comment in rcset.file_level_comments(filename) %}
                     <div class="comment">
-                        <div class="avatar">
-                            <img height="52" width="52" src="{{ utils['comment_gravatar'](comment) }}?s=52"/>
-                        </div>
+                        {{ macros.gravatar(comment, utils) }}
                         <div>
                             <div class="author">
                                 <a href="mailto:{{ utils['email'](comment.author) }}">
@@ -93,7 +107,7 @@
                                     </tr>
                                     {% for comment in line['comments'] %}
                                         <tr><td class="comment">
-                                            <div class="avatar"><img height="52" width="52" src="{{ utils['comment_gravatar'](comment) }}?s=52"/></div>
+                                            {{ macros.gravatar(comment, utils) }}
                                             <div>
                                                 <div class="author">
                                                     <a href="mailto:{{ utils['email'](comment.author) }}">
@@ -110,7 +124,7 @@
                                         <td class="diff-line"><code>{{ line['number'] }}: {{ line['content'][1:]|escape }}</code></td>
                                         {% for comment in line['comments'] %}
                                             <tr><td class="comment">
-                                                <div class="avatar"><img height="52" width="52" src="{{ utils['comment_gravatar'](comment) }}?s=52"/></div>
+                                                {{ macros.gravatar(comment, utils) }}
                                                 <div>
                                                     <div class="author">
                                                         <a href="mailto:{{ utils['email'](comment.author) }}">
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/review/web_templates/macros.html	Sat Mar 27 11:44:59 2010 -0400
@@ -0,0 +1,7 @@
+{% macro gravatar(item, utils) -%}
+    <div class="avatar">
+        <img height="52" width="52"
+             src="{{ utils['item_gravatar'](item) }}?s=52"
+        />
+    </div>
+{%- endmacro %}
\ No newline at end of file
--- a/review/web_ui.py	Sat Mar 27 11:22:26 2010 -0400
+++ b/review/web_ui.py	Sat Mar 27 11:44:59 2010 -0400
@@ -30,8 +30,8 @@
 
 LOG_PAGE_LEN = 1000000
 
-def _comment_gravatar(comment):
-    return 'http://www.gravatar.com/avatar/%s/' % md5(email(comment.author)).hexdigest()
+def _item_gravatar(item):
+    return 'http://www.gravatar.com/avatar/%s/' % md5(email(item.author)).hexdigest()
 
 def _line_type(line):
     return 'rem' if line[0] == '-' else 'add' if line[0] == '+' else 'con'
@@ -43,7 +43,7 @@
     'email': email,
     'templatefilters': templatefilters,
     'len': len,
-    'comment_gravatar': _comment_gravatar,
+    'item_gravatar': _item_gravatar,
     'line_type': _line_type,
 }