changeset 32:9b0fb5ca7eff

Replace the (%d)s with badges
author Benoît Allard <benoit.allard@greenbone.net>
date Thu, 02 Oct 2014 15:40:38 +0200
parents 79b76911444e
children 752b8bfe0baf
files farol/templates/document/view.j2 farol/templates/macros.j2 farol/templates/vulnerability/view.j2
diffstat 3 files changed, 19 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/farol/templates/document/view.j2	Thu Oct 02 15:39:39 2014 +0200
+++ b/farol/templates/document/view.j2	Thu Oct 02 15:40:38 2014 +0200
@@ -102,7 +102,7 @@
 {% endcall %}
 <div class="clearfix">
   <div class="col-sm-4">
-    {% call panel(type="success", heading="Notes (%d)" % cvrf._notes | length , title=3) %}
+    {% call panel(type="success", heading="Notes", badge=cvrf._notes | length , title=3) %}
     <ul>
     {% for note in cvrf._notes %}
       <li><a href="{{ url_for('.view_note', ordinal=note._ordinal) }}">{{ note.getTitle() }}</a></li>
@@ -112,7 +112,7 @@
     {% endcall %}
   </div>
   <div class="col-sm-4">
-    {% call panel(type="warning", heading="References (%d)" % cvrf._references | length, title=3) %}
+    {% call panel(type="warning", heading="References", badge=cvrf._references | length, title=3) %}
     <ul>
     {% for reference in cvrf._references %}
       <li><a href="{{ reference._url }}" target="_blank">{{ reference._description }}{% if reference._type %} ({{ reference._type }}){% endif %}</a> (<a href="{{ url_for('.edit_reference', index=loop.index0) }}">edit</a>)</li>
@@ -122,7 +122,7 @@
     {% endcall %}
   </div>
   <div class="col-sm-4">
-    {% call panel(type="info", heading="Acknowledgments (%d)" % cvrf._acknowledgments | length, title=3) %}
+    {% call panel(type="info", heading="Acknowledgments", badge=cvrf._acknowledgments | length, title=3) %}
     <ul>
     {% for ack in cvrf._acknowledgments %}
       <li><a href="{{ url_for('.view_acknowledgment', index=loop.index0) }}">{{ ack.getTitle() }}</a></li>
@@ -138,7 +138,7 @@
   <div class="col-md-6">
     {% call panel(type="danger", heading="Product Tree", title=3) %}
       {% if cvrf._producttree %}
-        {% call panel(heading="Branches (%d)" % cvrf._producttree._branches | length, title=4, extended=True) %}
+        {% call panel(heading="Branches", badge=cvrf._producttree._branches | length, title=4, extended=True) %}
           {% for branch in cvrf._producttree._branches recursive %}
             {% call panel() %}
               <p>{{ branch._type}}: <em>{{ branch._name }}</em> (<a href="{{ url_for('producttree.edit_branch', path=branch.getPath() | join('/')) }}">edit</a>)</p>
@@ -154,13 +154,13 @@
           {% endfor %}
           <a href="{{ url_for('producttree.add_branch') }}" class="pull-right">add branch</a>
         {% endcall %}
-        {% call panel(heading="Products (%d)" % cvrf._producttree.nbProducts(), title=4) %}
+        {% call panel(heading="Products", badge=cvrf._producttree.nbProducts(), title=4) %}
           {% for product in cvrf._producttree._products if product._parent is sameas cvrf._producttree %}
             <p><strong><a href="{{ url_for('producttree.view_product', productid=product._productid) }}">{{ product._name }}</a></strong> (<a href="{{ url_for('producttree.edit_product', productid=product._productid) }}">edit</a>)</p>
           {% endfor %}
           <a href="{{ url_for('producttree.add_product') }}" class="pull-right">add product</a>
         {% endcall %}
-        {% call panel(heading="Relationships (%d)" % cvrf._producttree._relationships | length, title=4) %}
+        {% call panel(heading="Relationships", badge=cvrf._producttree._relationships | length, title=4) %}
           {% for relationship in cvrf._producttree._relationships %}
             {% call panel() %}
               <p><em>{{ cvrf.getProductForID(relationship._productreference)._name }}</em> as {{ relationship._relationtype | lower }} <em>{{ cvrf.getProductForID(relationship._relatestoproductreference)._name }}</em> (<a href="{{ url_for('producttree.edit_relationship', index=loop.index0) }}">edit</a>)</p>
@@ -172,7 +172,7 @@
           {% endfor %}
           <a href="{{ url_for('producttree.add_relationship') }}" class="pull-right">add</a>
         {% endcall %}
-        {% call panel(heading="Groups (%d)" % cvrf._producttree._groups | length, title=4) %}
+        {% call panel(heading="Groups", badge=cvrf._producttree._groups | length, title=4) %}
           {% for group in cvrf._producttree._groups %}
             {% call panel() %}
               <a href="{{ url_for('producttree.edit_group', groupid=group._groupid) }}" class="pull-right">edit</a>
@@ -198,7 +198,7 @@
   </div>
 
   <div class="col-md-6">
-    {% call panel(type="primary", heading="Vulnerabilities (%d)" % cvrf._vulnerabilities | length, title=3) %}
+    {% call panel(type="primary", heading="Vulnerabilities", badge=cvrf._vulnerabilities | length, title=3) %}
     <ul>
       {% for vulnerability in cvrf._vulnerabilities %}
         <li><a href="{{ url_for('vulnerability.view', ordinal=vulnerability._ordinal) }}">{{ vulnerability.getTitle() }}</a></li>
--- a/farol/templates/macros.j2	Thu Oct 02 15:39:39 2014 +0200
+++ b/farol/templates/macros.j2	Thu Oct 02 15:40:38 2014 +0200
@@ -76,7 +76,7 @@
 </div>
 {% endmacro %}
 
-{% macro panel(type="default", heading=None, title=0, collapsible=True, extended=False) %}
+{% macro panel(type="default", heading=None, badge=None, title=0, collapsible=True, extended=False) %}
 {% if not heading %}
   {% set collapsible = False %}
 {% endif %}
@@ -85,7 +85,7 @@
   <div class="panel-heading">
     {%- if title %}<h{{ title }} class="panel-title">{% endif -%}
     {%- if collapsible %}<a data-toggle="collapse" href="#{{ heading | secure_filename }}">{% endif -%}
-    {{ heading }}
+    {{ heading }}{% if badge is not none %}<span class="pull-right badge">{{ badge }}</span>{% endif %}
     {%- if collapsible %}</a>{% endif -%}
     {%- if title %}</h{{ title }}>{% endif -%}
   </div>
--- a/farol/templates/vulnerability/view.j2	Thu Oct 02 15:39:39 2014 +0200
+++ b/farol/templates/vulnerability/view.j2	Thu Oct 02 15:40:38 2014 +0200
@@ -42,7 +42,7 @@
     </div>
   {% endcall %}
 {% endif %}
-{% call panel(heading="Notes (%d)" % vulnerability._notes | length, title=3) %}
+{% call panel(heading="Notes", badge=vulnerability._notes | length, title=3) %}
   <ul>
     {% for note in vulnerability._notes %}
       <li><a href="{{ url_for('.view_note', ordinal=vulnerability._ordinal, note_ordinal=note._ordinal)}}">{{ note.getTitle() }}</a></li>
@@ -54,7 +54,7 @@
   {% if vulnerability._discoverydate %}{{ label_value("Discovery Date", vulnerability._discoverydate) }}{% endif %}
   {% if vulnerability._releasedate %}{{ label_value("Release Date", vulnerability._releasedate) }}{% endif %}
 </div>
-{% call panel(heading="Involvements (%d)" % vulnerability._involvements | length, title=3) %}
+{% call panel(heading="Involvements",  badge=vulnerability._involvements | length, title=3) %}
   <ul>
     {% for involvement in vulnerability._involvements %}
       <li><a href="{{ url_for('.view_involvement', ordinal=vulnerability._ordinal, index=loop.index0) }}">{{ involvement.getTitle() }}</a></li>
@@ -67,14 +67,14 @@
   {{ label_value("CVE", vulnerability._cve) }}
 </div>
 {% endif %}
-{% call panel(heading="CWE (%d)" % vulnerability._cwes | length, title=3) %}
+{% call panel(heading="CWE", badge=vulnerability._cwes | length, title=3) %}
   <ul>
   {% for cwe in vulnerability._cwes %}
     <li>{{ cwe._id }} - {{ cwe._value}} (<a href="{{ url_for('.edit_cwe', ordinal=vulnerability._ordinal, index=loop.index0)  }}">edit</a>)</li>
   {% endfor %}
   <a href="{{ url_for('.add_cwe', ordinal=vulnerability._ordinal) }}" class="pull-right">add</a>
 {% endcall %}
-{% call panel(heading="Product Statuses (%d)" % vulnerability._productstatuses | length, title=3) %}
+{% call panel(heading="Product Statuses", badge=vulnerability._productstatuses | length, title=3) %}
   <ul>
     {% for status in vulnerability._productstatuses %}
       <li><a href="{{ url_for('.view_status', ordinal=vulnerability._ordinal, index=loop.index0) }}">{{ status.getTitle() }}</a></li>
@@ -82,7 +82,7 @@
   </ul>
   <a href="{{ url_for('.add_status', ordinal=vulnerability._ordinal) }}" class="pull-right">add</a>
 {% endcall %}
-{% call panel(heading="Threats (%d)" % vulnerability._threats | length, title=3) %}
+{% call panel(heading="Threats", badge=vulnerability._threats | length, title=3) %}
   <ul>
     {% for threat in vulnerability._threats %}
       <li><a href="{{ url_for('.view_threat', ordinal=vulnerability._ordinal, index=loop.index0) }}">{{ threat.getTitle() }}</a></li>
@@ -90,7 +90,7 @@
   </ul>
   <a href="{{ url_for('.add_threat', ordinal=vulnerability._ordinal) }}" class="pull-right">add</a>
 {% endcall %}
-{% call panel(heading="CVSS Score Sets (%d)" % vulnerability._cvsss | length, title=3) %}
+{% call panel(heading="CVSS Score Sets", badge=vulnerability._cvsss | length, title=3) %}
   <ul>
     {% for cvss in vulnerability._cvsss %}
       <li><a href="{{ url_for('.view_cvss', ordinal=vulnerability._ordinal, index=loop.index0) }}">{{ cvss._vector }} ({{ cvss._basescore }})</a></li>
@@ -98,7 +98,7 @@
   </ul>
   <a href="{{ url_for('.add_cvss', ordinal=vulnerability._ordinal) }}" class="pull-right">add</a>
 {% endcall %}
-{% call panel(heading="Remediations (%d)" % vulnerability._remediations | length, title=3) %}
+{% call panel(heading="Remediations", badge=vulnerability._remediations | length, title=3) %}
   <ul>
     {% for remediation in vulnerability._remediations %}
       <li><a href="{{ url_for('.view_remediation', ordinal=vulnerability._ordinal, index=loop.index0) }}">{{ remediation.getTitle() }}</a></li>
@@ -106,7 +106,7 @@
   </ul>
   <a href="{{ url_for('.add_remediation', ordinal=vulnerability._ordinal) }}" class="pull-right">add</a>
 {% endcall %}
-{% call panel(heading="References (%d)" % vulnerability._references | length , title=3) %}
+{% call panel(heading="References", badge=vulnerability._references | length , title=3) %}
   <ul>
     {% for reference in vulnerability._references %}
       <li><a href="{{ reference._url }}" target="_blank">{{ reference._description }}{% if reference._type %} ({{ reference._type }}){% endif %}</a> (<a href="{{ url_for('.edit_reference', ordinal=vulnerability._ordinal, index=loop.index0) }}">edit</a>)</li>
@@ -114,7 +114,7 @@
   </ul>
   <a class="pull-right" href="{{ url_for('.add_reference', ordinal=vulnerability._ordinal) }}">add</a>
 {% endcall %}
-{% call panel(heading="Acknowledgments (%d)" % vulnerability._acknowledgments | length, title=3) %}
+{% call panel(heading="Acknowledgments", badge=vulnerability._acknowledgments | length, title=3) %}
   <ul>
     {% for ack in vulnerability._acknowledgments %}
       <li><a href="{{ url_for('.view_acknowledgment', ordinal=vulnerability._ordinal, index=loop.index0)}}">{{ ack.getTitle() }}</a></li>

http://farol.wald.intevation.org