Commits

Benoît Allard committed d625630

web: Make the modules/module page looks like the other ones

Comments (0)

Files changed (3)

web/templates/module.html

+{% extends "layout.html" %}
+
+{% block body %}
+
+<h3>{{ module.name }}</h3>
+<ul class="nobulett">
+  {% for binary in module.binaries %}
+  <li>
+    {% set attrs={} %}
+    {% if not binary.build.changesets %}
+    {% set attrs ={'rel': 'tooltip', 'data-original-title': 'No changesets associated'} %}
+    <span class="label label-important">
+      {% endif %}
+      <a href="{{ url_for('views.build', number=binary.build.number) }}" {{ attrs|xmlattr }}>
+	{% if not binary.build.changesets %}
+	<i class="icon-warning-sign icon-white"></i>
+	{% endif %}
+	{{ binary.build.number }}
+      </a>
+      {% if not binary.build.changesets %}
+    </span>
+    {% endif %}
+    {{ ", " if not loop.last }}
+  </li>
+  {% endfor %}
+</ul>
+<script type="text/javascript">
+  $("[rel=tooltip]").tooltip();
+</script>
+{% endblock %}

web/templates/modules.html

 {% block items %}
 {% for module in modules %}
   <li class="module">
-    {{ module.name }}
-    <ul class="nobulett">
-      {% for binary in module.binaries %}
-      <li {% if binary.build.changesets|count == 0 %}class="no-info"{% endif %}>
-        {{ binary.build.number }}{{ ", " if not loop.last }}
-      </li>
-      {% endfor %}
-    </ul>
+    <p>
+      <a href="{{ url_for('views.module', name=module.name) }}">{{ module.name }}</a>
+      built <span class="badge {{ 'badge-info' if module.binaries }}">{{ module.binaries | count }}</span> times.
+    </p>
   </li>
 {% else %}
   <li> No Module in DB (yet)</li>
                            modules=items,
                            )
 
+@views.route('/module/<name>')
+def module(name):
+    query = request.dbsession.query(models.Module) \
+                             .filter_by(name=name)
+    try:
+        module = query.one()
+    except sqlalchemy.orm.exc.NoResultFound:
+        abort(404)
+    return render_template('module.html', module=module)
+
 def text_response(data, code=None):
     if code is None:
         rv = make_response(str(data))