c92ca10967c3

web: refactor the templates a bit
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Mon, 14 Jun 2010 19:06:46 -0400
parents 1a2f5b8da6ef
children a88dd00c4079
branches/tags (none)
files review/static/style.css review/static/style.less review/templates/base.html review/templates/changeset.html review/templates/diff.html review/templates/macros.html review/templates/pieces/comment.html review/templates/pieces/diff.html

Changes

--- a/review/static/style.css	Mon Jun 14 18:53:02 2010 -0400
+++ b/review/static/style.css	Mon Jun 14 19:06:46 2010 -0400
@@ -120,7 +120,7 @@
 body .content .navigation {
   line-height: 1;
   width: 780px;
-  margin: 10px auto;
+  margin: 15px auto;
 }
 body .content .wrap {
   border: 1px solid #d8d685;
--- a/review/static/style.less	Mon Jun 14 18:53:02 2010 -0400
+++ b/review/static/style.less	Mon Jun 14 19:06:46 2010 -0400
@@ -153,7 +153,7 @@
         .navigation {
             line-height: 1;
             width: @content-width - 20px;
-            margin: 10px auto;
+            margin: 15px auto;
         }
         .wrap {
             border: 1px solid darken(@c-cream, 20%);
--- a/review/templates/base.html	Mon Jun 14 18:53:02 2010 -0400
+++ b/review/templates/base.html	Mon Jun 14 19:06:46 2010 -0400
@@ -1,8 +1,6 @@
 <!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>{% block title %}{% endblock %}Reviewing {{ title }} with hg-review</title>
--- a/review/templates/changeset.html	Mon Jun 14 18:53:02 2010 -0400
+++ b/review/templates/changeset.html	Mon Jun 14 19:06:46 2010 -0400
@@ -44,16 +44,7 @@
         {% if comments %}
             <div class="review-level-comments item-listing">
                 {% for comment in comments %}
-                    <div class="comment group">
-                        {{ macros.gravatar(comment, utils) }}
-                        <div>
-                            <div class="author">
-                                <a href="mailto:{{ utils['email'](comment.author) }}">{{ utils['templatefilters'].person(comment.author) }}</a>
-                                said:
-                            </div>
-                            <div class="message">{{ comment.message }}</div>
-                        </div>
-                    </div>
+                    {% include "pieces/comment.html" %}
                 {% endfor %}
             </div>
         {% else %}
@@ -84,7 +75,10 @@
             <div class="signoffs item-listing">
                 {% for signoff in signoffs %}
                     <div class="signoff group {{ signoff.opinion or 'neutral' }}">
-                        {{ macros.gravatar(signoff, utils) }}
+                        <div class="avatar">
+                            <img src="{{ utils['item_gravatar'](signoff, 30) }}" />
+                        </div>
+
                         <div class="signoff-opinion {{ signoff.opinion or "neutral" }}">{{ signoff.opinion or "meh" }}</div>
                         
                         <div>
@@ -147,17 +141,7 @@
                     {% if comments %}
                         <div class="comments item-listing">
                             {% for comment in comments %}
-                                <div class="comment">
-                                    {{ macros.gravatar(comment, utils) }}
-                                    <div>
-                                        <div class="author">
-                                            <a href="mailto:{{ utils['email'](comment.author) }}">
-                                                {{ utils['templatefilters'].person(comment.author) }}</a>
-                                                said:
-                                        </div>
-                                        <div class="message">{{ comment.message }}</div>
-                                    </div>
-                                </div>
+                                {% include "pieces/comment.html" %}
                             {% endfor %}
                         </div>
                     {% endif %}
@@ -180,7 +164,7 @@
                     </div>
                 {% endif %}
 
-                {% include "diff.html" %}
+                {% include "pieces/diff.html" %}
             </div>
         </div>
     {% endfor %}
--- a/review/templates/diff.html	Mon Jun 14 18:53:02 2010 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-{% import 'macros.html' as macros %}
-
-<div class="diff">
-
-<table>
-    <tbody>
-        {% set annotated_diff = rcset.annotated_diff(filename) %}
-        {# We need to ignore the first item from this generator, because
-           we don't care about providing a line-number prefix (for now!). #}
-        {% set ignore_this_variable = annotated_diff.next() %}
-
-        {% for line in annotated_diff %}
-            {% if line['skipped'] %}
-                <tr class="skipped">
-                    <td colspan="3" class="skip">
-                        &hellip; skipped {{ line['skipped'] }} lines &hellip;
-                    </td>
-                </tr>
-
-                {% for comment in line['comments'] %}
-                    <tr><td class="comment">
-                        {{ macros.gravatar(comment, utils) }}
-                        <div>
-                            <div class="author">
-                                <a href="mailto:{{ utils['email'](comment.author) }}">
-                                    {{ utils['templatefilters'].person(comment.author) }}
-                                </a>
-                                said (on a skipped line):
-                            </div>
-                            <div class="message">{{ comment.message|escape }}</div>
-                        </div>
-                    </td></tr>
-                {% endfor %}
-            {% else %}
-                {% with %}
-                    {% set line_type = utils['line_type'](line['content']) %}
-
-                    <tr class="{{ line_type }} {% if not read_only or allow_anon %} commentable {% endif %} line-{{ line['number'] }}">
-                        <td class="linenumber">{{ line['number'] }}</td>
-                        <td class="addrem-{{ line_type }}">{% if line_type == 'add' %}+{% elif line_type == 'rem' %}-{% endif %}</td>
-                        <td class="code"><code>{{ utils['decode'](line['content'][1:])|escape }}</code></td>
-                    </tr>
-                {% endwith %}
-
-                {% with %}
-                    {% set comments = line['comments'] %}
-
-                    {% for comment in comments %}
-                        <tr class="comment">
-                            <td class="comment group" colspan="3">
-                                <span class="commentlines disabled">{{ ','.join(utils['map'](utils['str'], comment.lines)) }}</span>
-                                {{ macros.gravatar(comment, utils) }}
-                                <div>
-                                    <div class="author">
-                                        <a href="mailto:{{ utils['email'](comment.author) }}">
-                                            {{ utils['templatefilters'].person(comment.author) }}
-                                        </a>
-                                        said:
-                                    </div>
-                                    <div class="message">{{ comment.message }}</div>
-                                </div>
-                            </td>
-                        </tr>
-                    {% endfor %}
-                {% endwith %}
-            {% endif %}
-        {% else %}
-            <tr class="skipped">
-                <td colspan="3" class="skip">
-                    &hellip; no lines to show &hellip;
-                </td>
-            </tr>
-        {% endfor %}
-    </tbody>
-</table>
-
-</div>
--- a/review/templates/macros.html	Mon Jun 14 18:53:02 2010 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-{% macro gravatar(item, utils, size=30) -%}
-    <div class="avatar">
-        <img src="{{ utils['item_gravatar'](item, size) }}" />
-    </div>
-{%- endmacro %}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/review/templates/pieces/comment.html	Mon Jun 14 19:06:46 2010 -0400
@@ -0,0 +1,12 @@
+<div class="comment group">
+    <div class="avatar">
+        <img src="{{ utils['item_gravatar'](comment, 30) }}" />
+    </div>
+    <div>
+        <div class="author">
+            <a href="mailto:{{ utils['email'](comment.author) }}">{{ utils['templatefilters'].person(comment.author) }}</a>
+            said:
+        </div>
+        <div class="message">{{ comment.message }}</div>
+    </div>
+</div>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/review/templates/pieces/diff.html	Mon Jun 14 19:06:46 2010 -0400
@@ -0,0 +1,81 @@
+<div class="diff">
+
+<table>
+    <tbody>
+        {% set annotated_diff = rcset.annotated_diff(filename) %}
+        {# We need to ignore the first item from this generator, because
+           we don't care about providing a line-number prefix (for now!). #}
+        {% set ignore_this_variable = annotated_diff.next() %}
+
+        {% for line in annotated_diff %}
+            {% if line['skipped'] %}
+                <tr class="skipped">
+                    <td colspan="3" class="skip">
+                        &hellip; skipped {{ line['skipped'] }} lines &hellip;
+                    </td>
+                </tr>
+
+                {% for comment in line['comments'] %}
+                    <tr><td class="comment">
+                        <div class="avatar">
+                            <img src="{{ utils['item_gravatar'](comment, 30) }}" />
+                        </div>
+
+                        <div>
+                            <div class="author">
+                                <a href="mailto:{{ utils['email'](comment.author) }}">
+                                    {{ utils['templatefilters'].person(comment.author) }}
+                                </a>
+                                said (on a skipped line):
+                            </div>
+                            <div class="message">{{ comment.message|escape }}</div>
+                        </div>
+                    </td></tr>
+                {% endfor %}
+            {% else %}
+                {% with %}
+                    {% set line_type = utils['line_type'](line['content']) %}
+
+                    <tr class="{{ line_type }} {% if not read_only or allow_anon %} commentable {% endif %} line-{{ line['number'] }}">
+                        <td class="linenumber">{{ line['number'] }}</td>
+                        <td class="addrem-{{ line_type }}">{% if line_type == 'add' %}+{% elif line_type == 'rem' %}-{% endif %}</td>
+                        <td class="code"><code>{{ utils['decode'](line['content'][1:])|escape }}</code></td>
+                    </tr>
+                {% endwith %}
+
+                {% with %}
+                    {% set comments = line['comments'] %}
+
+                    {% for comment in comments %}
+                        <tr class="comment">
+                            <td class="comment group" colspan="3">
+                                <span class="commentlines disabled">{{ ','.join(utils['map'](utils['str'], comment.lines)) }}</span>
+                                <div class="avatar">
+                                    <img src="{{ utils['item_gravatar'](comment, 30) }}" />
+                                </div>
+
+                                <div>
+                                    <div class="author">
+                                        <a href="mailto:{{ utils['email'](comment.author) }}">
+                                            {{ utils['templatefilters'].person(comment.author) }}
+                                        </a>
+                                        said:
+                                    </div>
+                                    <div class="message">{{ comment.message }}</div>
+                                </div>
+                            </td>
+                        </tr>
+                    {% endfor %}
+                {% endwith %}
+            {% endif %}
+        {% else %}
+            <tr class="skipped">
+                <td colspan="3" class="skip">
+                    &hellip; no lines to show &hellip;
+                </td>
+            </tr>
+        {% endfor %}
+    </tbody>
+</table>
+
+</div>