# HG changeset patch # User BenoƮt Allard # Date 1413290191 -7200 # Node ID 09915cbdf549e4ef928678f6c395ee970d8a4bbe # Parent 0e0572780aff402091d5dd57141344b2bbef8e5d Unify the add / edit / delete buttons diff -r 0e0572780aff -r 09915cbdf549 farol/templates/document/view.j2 --- 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 %} {% call panel(heading="Publisher", title=3, collapsible=False) %} - edit +
{{ edit_button(url_for('.edit_publisher')) }}
{% for label, value in [("Type", cvrf._publisher._type), ("VendorID", cvrf._publisher._vendorid or ''), @@ -46,7 +46,7 @@
{% endcall %} {% call panel(heading="Document Tracking", title=3, collapsible=False) %} - edit +
{{ edit_button(url_for('.edit_tracking')) }}
{% for label, value in [("Identification", cvrf._tracking._identification), ("Status", cvrf._tracking._status), @@ -61,7 +61,7 @@
  • - edit + {{ edit_button(url_for('.edit_revision', index=loop.index0)) }} {{ delete_button(url_for('.del_revision', index=loop.index0)) }}
    {{ label_value('Number', revision._number | join('.'), right=8) }} @@ -71,7 +71,7 @@
  • {% endfor %}
  • - add revision +
    {{ add_button(url_for('.add_revision'), "add revision") }}
  • @@ -91,12 +91,12 @@ {% endif %} {% endcall %} {% call panel(heading="Distribution", title=3, collapsible=False) %} - edit +
    {{ edit_button(url_for('.edit_distribution')) }}

    {{ (cvrf._distribution or '') | replace('\n', '
    ') }}

    {% endcall %} {% call panel(heading="Aggregate Severity", title=3, collapsible=False) %}
    - edit +
    {{ edit_button(url_for('.edit_severity')) }}
    {% if cvrf._aggregateseverity %} {{ label_value('Namespace', (cvrf._aggregateseverity._namespace or '') | urlize, right=8) }} {{ label_value('Severity', cvrf._aggregateseverity._severity) }} @@ -111,17 +111,23 @@
  • {{ note.getTitle() }}
  • {% endfor %} - add +
    {{ add_button(url_for('.add_note')) }}
    {% endcall %}
    {% call panel(type="warning", heading="References", badge=cvrf._references | length, title=3) %} - add +
    {{ add_button(url_for('.add_reference')) }}
    {% endcall %}
    @@ -131,7 +137,7 @@
  • {{ ack.getTitle() }}
  • {% endfor %} - add +
    {{ add_button(url_for('.add_acknowledgment')) }}
    {% endcall %}
    @@ -159,7 +165,7 @@
  • {{ vulnerability.getTitle() }}
  • {% endfor %} - add +
    {{ add_button(url_for('vulnerability.add')) }}
    {% endcall %} diff -r 0e0572780aff -r 09915cbdf549 farol/templates/document/view_acknowledgment.j2 --- a/farol/templates/document/view_acknowledgment.j2 Tue Oct 14 10:36:58 2014 +0200 +++ b/farol/templates/document/view_acknowledgment.j2 Tue Oct 14 14:36:31 2014 +0200 @@ -24,11 +24,11 @@ -#} {% extends "base.j2" %} -{% from "macros.j2" import label_value, delete_button %} +{% from "macros.j2" import label_value, edit_button, delete_button %} {% block title %}{{ acknowledgment.getTitle() }}{% endblock %} {% block content %} -edit +
    {{ edit_button(url_for('.edit_acknowledgment', index=index)) }}
    diff -r 0e0572780aff -r 09915cbdf549 farol/templates/document/view_note.j2 --- a/farol/templates/document/view_note.j2 Tue Oct 14 10:36:58 2014 +0200 +++ b/farol/templates/document/view_note.j2 Tue Oct 14 14:36:31 2014 +0200 @@ -24,11 +24,11 @@ -#} {% extends "base.j2" %} -{% from "macros.j2" import delete_button %} +{% from "macros.j2" import edit_button, delete_button %} {% block title %}{{ note._title }}{% endblock %} {% block content %} -edit +
    {{ edit_button(url_for('.edit_note', ordinal=note._ordinal)) }}
    diff -r 0e0572780aff -r 09915cbdf549 farol/templates/macros.j2 --- a/farol/templates/macros.j2 Tue Oct 14 10:36:58 2014 +0200 +++ b/farol/templates/macros.j2 Tue Oct 14 14:36:31 2014 +0200 @@ -185,6 +185,14 @@ {% endmacro %} -{% macro delete_button(url, hiddens={}, text="delete") %} +{% macro edit_button(url, text="edit") -%} + {{ text }} +{%- endmacro %} + +{% macro add_button(url, text="add") -%} + {{ text }} +{%- endmacro %} + +{% macro delete_button(url, hiddens={}, text="delete") -%} {{ POST_button(url, text, hiddens, style="btn-danger btn-xs") }} -{% endmacro %} +{%- endmacro %} diff -r 0e0572780aff -r 09915cbdf549 farol/templates/producttree/view.j2 --- a/farol/templates/producttree/view.j2 Tue Oct 14 10:36:58 2014 +0200 +++ b/farol/templates/producttree/view.j2 Tue Oct 14 14:36:31 2014 +0200 @@ -24,7 +24,7 @@ -#} {% extends "base.j2" %} -{% from "macros.j2" import panel, modal, delete_button %} +{% from "macros.j2" import panel, modal, add_button, edit_button, delete_button %} {% block title %}Product Tree{% endblock %} {% set active = 'product' %} @@ -50,7 +50,13 @@ {% call panel(heading="Branches", badge=producttree._branches | length, title=4, extended=True) %} {% for branch in producttree._branches recursive %} {% call panel() %} -
    {{ branch._type}}: {{ branch._name }} (edit){% if branch.isOrphaned() %}{{ delete_button(url_for('.del_branch', path=branch.getPath() | join('/'))) }}{% endif %}
    +
    + {{ branch._type}}: {{ branch._name }} + {{ edit_button(url_for('.edit_branch', path=branch.getPath() | join('/'))) }} + {% if branch.isOrphaned() %} + {{ delete_button(url_for('.del_branch', path=branch.getPath() | join('/'))) }} + {% endif %} +
    {% if branch._product %}

    {{ branch._product._name }}

    {% else %} @@ -61,31 +67,39 @@ {% endif %} {% endcall %} {% endfor %} - add branch +
    {{ add_button(url_for('.add_branch')) }}
    {% endcall %} {% call panel(heading="Products", badge=producttree.nbProducts(), title=4) %} {% for product in producttree._products if product._parent is sameas producttree %}

    {{ product._name }}

    {% endfor %} - add product +
    {{ add_button(url_for('.add_product')) }}
    {% endcall %} {% call panel(heading="Relationships", badge=producttree._relationships | length, title=4) %} {% for relationship in producttree._relationships %} {% call panel() %} -
    {{ cvrf.getProductForID(relationship._productreference)._name }} as {{ relationship._relationtype | lower }} {{ cvrf.getProductForID(relationship._relatestoproductreference)._name }} (edit){% if relationship.isOrphaned() %}{{ delete_button(url_for('.del_relationship', index=loop.index0)) }}{% endif %}
    - {% if relationship._product %}

    {{ relationship._product._name }}

    {% endif %} +
    + {{ cvrf.getProductForID(relationship._productreference)._name }} as {{ relationship._relationtype | lower }} {{ cvrf.getProductForID(relationship._relatestoproductreference)._name }} + {{ edit_button(url_for('.edit_relationship', index=loop.index0)) }} + {% if relationship.isOrphaned() %} + {{ delete_button(url_for('.del_relationship', index=loop.index0)) }} + {% endif %} +
    + {% if relationship._product %} +

    {{ relationship._product._name }}

    + {% endif %} {% if relationship.isOrphaned() %}

    This relationship is orphaned. A product should be created as child of this one.

    {% endif %} {% endcall %} {% endfor %} - add +
    {{ add_button(url_for('.add_relationship')) }}
    {% endcall %} {% call panel(heading="Groups", badge=producttree._groups | length, title=4) %} {% for group in producttree._groups %} {% call panel() %}
    - edit + {{ edit_button(url_for('.edit_group', groupid=group._groupid)) }} {{ delete_button(url_for('.del_group', groupid=group._groupid)) }}
    - add +
    {{ add_button(url_for('.add_note', ordinal=vulnerability._ordinal)) }}
    {% endcall %}
    {% if vulnerability._discoverydate %}{{ label_value("Discovery Date", vulnerability._discoverydate) }}{% endif %} @@ -60,7 +60,7 @@
  • {{ involvement.getTitle() }}
  • {% endfor %} - add +
    {{ add_button(url_for('.add_involvement', ordinal=vulnerability._ordinal)) }}
    {% endcall %} {% if vulnerability._cve %}
    @@ -70,9 +70,15 @@ {% call panel(heading="CWE", badge=vulnerability._cwes | length, title=3) %}
      {% for cwe in vulnerability._cwes %} -
    • {{ cwe._id }} - {{ cwe._value}} (edit){{ delete_button(url_for('.del_cwe', ordinal=vulnerability._ordinal, index=loop.index0)) }}
    • +
    • +
      + {{ cwe._id }} - {{ cwe._value}} + {{ edit_button(url_for('.edit_cwe', ordinal=vulnerability._ordinal, index=loop.index0)) }} + {{ delete_button(url_for('.del_cwe', ordinal=vulnerability._ordinal, index=loop.index0)) }} +
      +
    • {% endfor %} - add +
      {{ add_button(url_for('.add_cwe', ordinal=vulnerability._ordinal)) }}
      {% endcall %} {% call panel(heading="Product Statuses", badge=vulnerability._productstatuses | length, title=3) %} - add +
      {{ add_button(url_for('.add_status', ordinal=vulnerability._ordinal)) }}
      {% endcall %} {% call panel(heading="Threats", badge=vulnerability._threats | length, title=3) %} - add +
      {{ add_button(url_for('.add_threat', ordinal=vulnerability._ordinal)) }}
      {% endcall %} {% call panel(heading="CVSS Score Sets", badge=vulnerability._cvsss | length, title=3) %} - add +
      {{ add_button(url_for('.add_cvss', ordinal=vulnerability._ordinal)) }}
      {% endcall %} {% call panel(heading="Remediations", badge=vulnerability._remediations | length, title=3) %} - add +
      {{ add_button(url_for('.add_remediation', ordinal=vulnerability._ordinal)) }}
      {% endcall %} {% call panel(heading="References", badge=vulnerability._references | length , title=3) %} - add +
      {{ add_button(url_for('.add_reference', ordinal=vulnerability._ordinal)) }}
      {% endcall %} {% call panel(heading="Acknowledgments", badge=vulnerability._acknowledgments | length, title=3) %} - add +
      {{ add_button(url_for('.add_acknowledgment', ordinal=vulnerability._ordinal)) }}
      {% endcall %}
      {{ delete_button(url_for('.delete', ordinal=vulnerability._ordinal), text="delete vulnerability definition") }}
      {% endblock %} diff -r 0e0572780aff -r 09915cbdf549 farol/templates/vulnerability/view_acknowledgment.j2 --- a/farol/templates/vulnerability/view_acknowledgment.j2 Tue Oct 14 10:36:58 2014 +0200 +++ b/farol/templates/vulnerability/view_acknowledgment.j2 Tue Oct 14 14:36:31 2014 +0200 @@ -24,11 +24,11 @@ -#} {% extends "vulnerability/base.j2" %} -{% from "macros.j2" import label_value, delete_button %} +{% from "macros.j2" import label_value, edit_button, delete_button %} {% block title %}{{ acknowledgment.getTitle() }}{% endblock %} {% block i_content %} -edit +
      {{ edit_button(url_for('.edit_acknowledgment', ordinal=ordinal, index=index)) }}
      diff -r 0e0572780aff -r 09915cbdf549 farol/templates/vulnerability/view_cvss.j2 --- a/farol/templates/vulnerability/view_cvss.j2 Tue Oct 14 10:36:58 2014 +0200 +++ b/farol/templates/vulnerability/view_cvss.j2 Tue Oct 14 14:36:31 2014 +0200 @@ -24,11 +24,11 @@ -#} {% extends "vulnerability/base.j2" %} -{% from "macros.j2" import label_value, delete_button %} +{% from "macros.j2" import label_value, edit_button, delete_button %} {% block title %}CVSS: {{ cvss._basescore }}{% endblock %} {% block i_content %} -edit +
      {{ edit_button(url_for('.edit_cvss', ordinal=ordinal, index=index)) }}
      diff -r 0e0572780aff -r 09915cbdf549 farol/templates/vulnerability/view_involvement.j2 --- a/farol/templates/vulnerability/view_involvement.j2 Tue Oct 14 10:36:58 2014 +0200 +++ b/farol/templates/vulnerability/view_involvement.j2 Tue Oct 14 14:36:31 2014 +0200 @@ -24,11 +24,11 @@ -#} {% extends "vulnerability/base.j2" %} -{% from "macros.j2" import delete_button %} +{% from "macros.j2" import edit_button, delete_button %} {% block title %}{{ involvement.getTitle() }}{% endblock %} {% block i_content %} -edit +
      {{ edit_button(url_for('.edit_involvement', ordinal=ordinal, index=index)) }}
      diff -r 0e0572780aff -r 09915cbdf549 farol/templates/vulnerability/view_note.j2 --- a/farol/templates/vulnerability/view_note.j2 Tue Oct 14 10:36:58 2014 +0200 +++ b/farol/templates/vulnerability/view_note.j2 Tue Oct 14 14:36:31 2014 +0200 @@ -24,11 +24,11 @@ -#} {% extends "vulnerability/base.j2" %} -{% from "macros.j2" import delete_button %} +{% from "macros.j2" import edit_button, delete_button %} {% block title %}{{ note._title }}{% endblock %} {% block i_content %} -edit +
      {{ edit_button(url_for('.edit_note', ordinal=ordinal, note_ordinal=note._ordinal)) }}
      diff -r 0e0572780aff -r 09915cbdf549 farol/templates/vulnerability/view_productstatus.j2 --- a/farol/templates/vulnerability/view_productstatus.j2 Tue Oct 14 10:36:58 2014 +0200 +++ b/farol/templates/vulnerability/view_productstatus.j2 Tue Oct 14 14:36:31 2014 +0200 @@ -24,11 +24,11 @@ -#} {% extends "vulnerability/base.j2" %} -{% from "macros.j2" import delete_button %} +{% from "macros.j2" import edit_button, delete_button %} {% block title %}{{ status.getTitle() }}{% endblock %} {% block i_content %} -edit +
      {{ edit_button(url_for('.edit_status', ordinal=ordinal, index=index)) }}
      diff -r 0e0572780aff -r 09915cbdf549 farol/templates/vulnerability/view_remediation.j2 --- a/farol/templates/vulnerability/view_remediation.j2 Tue Oct 14 10:36:58 2014 +0200 +++ b/farol/templates/vulnerability/view_remediation.j2 Tue Oct 14 14:36:31 2014 +0200 @@ -24,11 +24,11 @@ -#} {% extends "vulnerability/base.j2" %} -{% from "macros.j2" import label_value, panel, delete_button %} +{% from "macros.j2" import label_value, panel, edit_button, delete_button %} {% block title %}{{ remediation.getTitle() }}{% endblock %} {% block i_content %} -edit +
      {{ edit_button(url_for('.edit_remediation', ordinal=ordinal, index=index)) }}
      @@ -39,7 +39,7 @@ {{ label_value('URL', remediation._url | urlize) }}
    {% if remediation._productids or remediation._groupids %} - {% call panel(heading="Products (%d)" % remediation._productids | length, title=2) %} + {% call panel(heading="Products", badge=remediation._productids | length, title=2) %}