Commits

Benoît Allard committed 566f175

web: same for releases

Comments (0)

Files changed (3)

web/templates/release.html

+{% extends "layout.html" %}
+
+{% import "macros.j2" as macros %}
+
+{% block body %}
+<div class="release">
+  {{ release }} (<tt>{{ release.identifier }}</tt>)
+  <div>
+    Binaries:
+    <ul>
+      {% for binary in release.binaries %}
+      <li>
+        {{ macros.render_binary(binary)|safe }}
+      </li>
+      {% endfor %}
+    </ul>
+  </div>
+  <div>
+    Changesets:
+    <ul>
+      {% for changeset in release.changesets %}
+      <li>
+        {{ macros.render_changeset(changeset)|safe }} (
+        {{ macros.render_repository(changeset.repository)|safe }})
+      </li>
+      {% endfor %}
+    </ul>
+  </div>
+</div>
+{% endblock %}

web/templates/releases.html

 {% block items %}
 {% for release in releases %}
   <li class="release">
-    {{ release }} (<tt>{{ release.identifier }}</tt>)
-    <div>
-    Binaries:
-    <ul>
-      {% for binary in release.binaries %}
-      <li>
-        {{ macros.render_binary(binary)|safe }}
-      </li>
-      {% endfor %}
-    </ul>
-    </div>
-    <div>
-    Changesets:
-    <ul>
-      {% for changeset in release.changesets %}
-      <li>
-        {{ macros.render_changeset(changeset)|safe }} (
-        {{ macros.render_repository(changeset.repository)|safe }})
-      </li>
-      {% endfor %}
-    </ul>
-    </div>
+    <h3><a href="{{ url_for('views.release', ref=release.ref, rc=release.rc) }}">{{ release }}</a></h3>
+    <p>Identifier: <pre>{{ release.identifier }}</pre></p>
+    <p>{{ release.binaries | count}} binaries.</p>
+    <p>{{ release.changesets | count }} changesets.</p>
   </li>
 {% else %}
   <li> No release in DB (yet)</li>
                            pagination=pgnation,
                            releases=items)
 
+@views.route('/release/<ref>/<int:rc>')
+@views.route('/release/<ref>', defaults={'rc': -1})
+def release(ref, rc):
+    query = request.dbsession.query(models.Release) \
+                             .filter_by(ref=ref)
+    if rc == -1:
+        query = query.filter_by(final=True)
+    else:
+        query = query.filter_by(rc=rc)
+
+    try:
+        release = query.one()
+    except sqlalchemy.orm.exc.NoResultFound:
+        abort(404)
+    return render_template('release.html', release=release)
+
 @views.route('/binaries/', defaults={'page': 1})
 @views.route('/binaries/page/<int:page>')
 def listbinaries(page):