# HG changeset patch # User Steve Losh # Date 1276462595 14400 # Node ID daf7418e0d28d4a4e99d094e6c0f6bdd0d5eb804 # Parent ef7d67f7129358a99bda23d9200381ba7808b2c7 web: add navigation links and support empty diffs diff -r ef7d67f71293 -r daf7418e0d28 review/static/style.css --- a/review/static/style.css Sun Jun 13 16:12:22 2010 -0400 +++ b/review/static/style.css Sun Jun 13 16:56:35 2010 -0400 @@ -117,6 +117,11 @@ body .content { border-top: 1px solid #f8f7e8; } +body .content .navigation { + line-height: 1; + width: 780px; + margin: 10px auto; +} body .content .wrap { border: 1px solid #d8d685; -webkit-border-radius: 7px; @@ -125,7 +130,6 @@ box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.05); -moz-box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.05); -webkit-box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.05); - margin-top: 20px; padding: 21px 20px; width: 760px; background-color: #fafafa; @@ -251,6 +255,20 @@ #index .content .pagination a.older { float: right; } +#changeset .content .navigation .middle { + display: inline-block; + width: 49%; + text-align: center; +} +#changeset .content .navigation .right { + display: inline-block; + width: 25%; + text-align: right; +} +#changeset .content .navigation .left { + display: inline-block; + width: 25%; +} #changeset .content .head { position: relative; } diff -r ef7d67f71293 -r daf7418e0d28 review/static/style.less --- a/review/static/style.less Sun Jun 13 16:12:22 2010 -0400 +++ b/review/static/style.less Sun Jun 13 16:56:35 2010 -0400 @@ -150,13 +150,17 @@ .content { border-top: 1px solid lighten(@c-cream, 10%); + .navigation { + line-height: 1; + width: @content-width - 20px; + margin: 10px auto; + } .wrap { border: 1px solid darken(@c-cream, 20%); .border-radius(7px); .box-shadow(0px, 5px, 10px, rgba(0, 0, 0, 0.05)); @content-padding-horiz: 20px; - margin-top: 20px; padding: 21px @content-padding-horiz; width: @content-width - (@content-padding-horiz * 2); background-color: @content-background; @@ -302,6 +306,22 @@ } } #changeset .content { + .navigation { + .middle { + display: inline-block; + width: 49%; + text-align: center; + } + .right { + display: inline-block; + width: 25%; + text-align: right; + } + .left { + display: inline-block; + width: 25%; + } + } .head { position: relative; diff -r ef7d67f71293 -r daf7418e0d28 review/templates/base.html --- a/review/templates/base.html Sun Jun 13 16:12:22 2010 -0400 +++ b/review/templates/base.html Sun Jun 13 16:56:35 2010 -0400 @@ -49,6 +49,10 @@
+ {% block navigation %} + + {% endblock %} +
{% block content %}{% endblock %}
diff -r ef7d67f71293 -r daf7418e0d28 review/templates/changeset.html --- a/review/templates/changeset.html Sun Jun 13 16:12:22 2010 -0400 +++ b/review/templates/changeset.html Sun Jun 13 16:56:35 2010 -0400 @@ -3,6 +3,25 @@ {% block id %}changeset{% endblock %} {% block title %}Changeset {{ rev.rev() }} - {% endblock %} +{% block navigation %} + +{% endblock %} + + {% block content %}
 
diff -r ef7d67f71293 -r daf7418e0d28 review/templates/diff.html --- a/review/templates/diff.html Sun Jun 13 16:12:22 2010 -0400 +++ b/review/templates/diff.html Sun Jun 13 16:56:35 2010 -0400 @@ -9,6 +9,8 @@ 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'] %} @@ -64,6 +66,12 @@ {% endfor %} {% endwith %} {% endif %} + {% else %} + + + … no lines to show … + + {% endfor %} diff -r ef7d67f71293 -r daf7418e0d28 review/web_ui.py --- a/review/web_ui.py Sun Jun 13 16:12:22 2010 -0400 +++ b/review/web_ui.py Sun Jun 13 16:56:35 2010 -0400 @@ -140,9 +140,12 @@ cu_signoffs = rcset.signoffs_for_current_user() cu_signoff = cu_signoffs[0] if cu_signoffs else None - return _render('changeset.html', - rcset=rcset, rev=rev, cu_signoff=cu_signoff - ) + tip = g.datastore.target['tip'].rev() + newer = rcset.target[rev.rev() + 1] if rev.rev() < tip else None + older = rcset.target[rev.rev() - 1] if rev.rev() > 0 else None + + return _render('changeset.html', rcset=rcset, rev=rev, cu_signoff=cu_signoff, + newer=newer, older=older) @app.route('/pull/', methods=['POST'])