diff farol/templates/document/view.j2 @ 105:09915cbdf549

Unify the add / edit / delete buttons
author Benoît Allard <benoit.allard@greenbone.net>
date Tue, 14 Oct 2014 14:36:31 +0200
parents 88adf067cae1
children 812e613cbbb4
line wrap: on
line diff
--- a/farol/templates/document/view.j2	Tue Oct 14 10:36:58 2014 +0200
+++ b/farol/templates/document/view.j2	Tue Oct 14 14:36:31 2014 +0200
@@ -24,7 +24,7 @@
 -#}
 
 {% extends "base.j2" %}
-{% from "macros.j2" import panel, label_value, delete_button %}
+{% from "macros.j2" import panel, label_value, add_button, edit_button, delete_button %}
 {% block title %}Document{% endblock %}
 
 {% set active='document' %}
@@ -32,10 +32,10 @@
 {% block content %}
 <div class='clearfix page-header'>
   <h1>{{ cvrf._title }} <small>({{ cvrf._type }})</small></h1>
-  <a class="pull-right" href="{{ url_for('.edit_title') }}">edit title</a>
+  <div class="pull-right">{{ edit_button(url_for('.edit_title'), "edit title") }}</div>
 </div>
 {% call panel(heading="Publisher", title=3, collapsible=False) %}
-  <a class="pull-right" href="{{ url_for('.edit_publisher') }}">edit</a>
+  <div class="pull-right">{{ edit_button(url_for('.edit_publisher')) }}</div>
   <div class="form-horizontal">
     {% for label, value in [("Type", cvrf._publisher._type),
                             ("VendorID", cvrf._publisher._vendorid or ''),
@@ -46,7 +46,7 @@
   </div>
 {% endcall %}
 {% call panel(heading="Document Tracking", title=3, collapsible=False) %}
-  <a class="pull-right" href="{{ url_for('.edit_tracking') }}">edit</a>
+  <div class="pull-right">{{ edit_button(url_for('.edit_tracking')) }}</div>
   <div class="form-horizontal">
     {% for label, value in [("Identification", cvrf._tracking._identification),
                             ("Status", cvrf._tracking._status),
@@ -61,7 +61,7 @@
       <li class="list-group-item">
         <div class="form-horizontal">
           <div class="pull-right">
-            <a  href="{{ url_for('.edit_revision', index=loop.index0) }}"><span class="label label-default">edit</span></a>
+            {{ edit_button(url_for('.edit_revision', index=loop.index0)) }}
             {{ delete_button(url_for('.del_revision', index=loop.index0)) }}
           </div>
           {{ label_value('Number', revision._number | join('.'), right=8) }}
@@ -71,7 +71,7 @@
       </li>
     {% endfor %}
     <li class="list-group-item clearfix">
-      <a class="pull-right" href="{{ url_for('.add_revision') }}">add revision</a>
+      <div class="pull-right">{{ add_button(url_for('.add_revision'), "add revision") }}</div>
     </li>
     </div>
   </ul>
@@ -91,12 +91,12 @@
   {% endif %}
 {% endcall %}
 {% call panel(heading="Distribution", title=3, collapsible=False) %}
-  <a class="pull-right" href="{{ url_for('.edit_distribution') }}">edit</a>
+  <div class="pull-right">{{ edit_button(url_for('.edit_distribution')) }}</div>
   <p>{{ (cvrf._distribution or '') | replace('\n', '<br>') }}</p>
 {% endcall %}
 {% call panel(heading="Aggregate Severity", title=3, collapsible=False) %}
   <div class="form-horizontal">
-  <a class="pull-right" href="{{ url_for('.edit_severity') }}">edit</a>
+  <div class="pull-right">{{ edit_button(url_for('.edit_severity')) }}</div>
   {% if cvrf._aggregateseverity %}
     {{ label_value('Namespace', (cvrf._aggregateseverity._namespace or '') | urlize, right=8) }}
     {{ label_value('Severity', cvrf._aggregateseverity._severity) }}
@@ -111,17 +111,23 @@
       <li><a href="{{ url_for('.view_note', ordinal=note._ordinal) }}">{{ note.getTitle() }}</a></li>
     {% endfor %}
     </ul>
-    <a class="pull-right" href="{{ url_for('.add_note') }}">add</a>
+    <div class="pull-right">{{ add_button(url_for('.add_note')) }}</div>
     {% endcall %}
   </div>
   <div class="col-sm-4">
     {% 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>){{ delete_button(url_for('.del_reference', index=loop.index0)) }}</li>
+      <li>
+        <a href="{{ reference._url }}" target="_blank">
+          {{ reference._description }}{% if reference._type %} ({{ reference._type }}){% endif %}
+        </a>
+        {{ edit_button(url_for('.edit_reference', index=loop.index0)) }}
+        {{ delete_button(url_for('.del_reference', index=loop.index0)) }}
+      </li>
     {% endfor %}
     </ul>
-    <a class="pull-right" href="{{ url_for('.add_reference') }}">add</a>
+    <div class="pull-right">{{ add_button(url_for('.add_reference')) }}</div>
     {% endcall %}
   </div>
   <div class="col-sm-4">
@@ -131,7 +137,7 @@
       <li><a href="{{ url_for('.view_acknowledgment', index=loop.index0) }}">{{ ack.getTitle() }}</a></li>
     {% endfor %}
     </ul>
-    <a class="pull-right" href="{{ url_for('.add_acknowledgment') }}">add</a>
+    <div class="pull-right">{{ add_button(url_for('.add_acknowledgment')) }}</div>
     {% endcall %}
   </div>
 </div>
@@ -159,7 +165,7 @@
         <li><a href="{{ url_for('vulnerability.view', ordinal=vulnerability._ordinal) }}">{{ vulnerability.getTitle() }}</a></li>
       {% endfor %}
     </ul>
-    <a href="{{ url_for('vulnerability.add') }}" class="pull-right">add</a>
+    <div class="pull-right">{{ add_button(url_for('vulnerability.add')) }}</div>
     {% endcall %}
   </div>
 </div>

http://farol.wald.intevation.org