changeset 56:e6da0705a47c

Unify the edit_reference pages
author Benoît Allard <benoit.allard@greenbone.net>
date Wed, 08 Oct 2014 10:08:05 +0200
parents 76cba17794ab
children 4ac1dd522998
files farol/templates/common_edits.j2 farol/templates/document/edit_reference.j2 farol/templates/vulnerability/edit_reference.j2
diffstat 3 files changed, 26 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/farol/templates/common_edits.j2	Wed Oct 08 09:57:13 2014 +0200
+++ b/farol/templates/common_edits.j2	Wed Oct 08 10:08:05 2014 +0200
@@ -75,3 +75,23 @@
 <p>The note should contain a compartmentalized textual discussion constrained by its <em>Type</em> attribute.</p>
 {% endcall %}
 {% endmacro %}
+
+{% macro edit_reference(types, _type, url, description) %}
+<p>The <strong>Reference</strong> container should include references to any conferences, papers, advisories, and other resources that are related and considered to be of value to the document consumer.</p>
+<p>The <strong>Reference</strong> element contains a description of a related document. This may include a plaintext or HTML version of the advisory or other related documentation, such as white papers or mitigation documentation.</p>
+{% call selectinput("type", "Type", types, _type) %}
+<p>The <em>Type</em> attribute denotes the type of the document reference relative to the given document. The following types are available:</p>
+<dl class="dl-horizontal">
+  <dt>External:</dt>
+  <dd>The default value indicates the reference is external to the document.</dd>
+  <dt>Self:</dt>
+  <dd>This indicates the related document is actually a direct reference to itself.</dd>
+</dl>
+{% endcall %}
+{% call textinput("url", "URL", "http://...", url, type="url", required=True) %}
+<p><strong>URL</strong> is the fixed URL or location of the reference.</p>
+{% endcall %}
+{% call  textinput("description", "Description", "", description, required=True) %}
+<p><strong>Description</strong> is a descriptive title or the name of the reference.</p>
+{% endcall %}
+{% endmacro %}
--- a/farol/templates/document/edit_reference.j2	Wed Oct 08 09:57:13 2014 +0200
+++ b/farol/templates/document/edit_reference.j2	Wed Oct 08 10:08:05 2014 +0200
@@ -25,26 +25,13 @@
 
 {% extends "base.j2" %}
 {% from "macros.j2" import textinput, selectinput %}
-{% block title %}Edit the title{% endblock %}
+{% from "common_edits.j2" import edit_reference %}
+{% block title %}Edit a Reference{% endblock %}
 
 {% block content %}
 <form role="form" method="POST">
 
-{% call selectinput("type", "Type", types, _type) %}
-<p>The <em>Type</em> attribute denotes the type of the document reference relative to the given document. The following types are available:</p>
-<dl class="dl-horizontal">
-  <dt>External:</dt>
-  <dd>The default value indicates the reference is external to the document.</dd>
-  <dt>Self:</dt>
-  <dd>This indicates the related document is actually a direct reference to itself.</dd>
-</dl>
-{% endcall %}
-{% call textinput("url", "URL", "http://...", url, type="url", required=True) %}
-<p><strong>URL</strong> is the fixed URL or location of the reference.</p>
-{% endcall %}
-{% call  textinput("description", "Description", "", description, required=True) %}
-<p><strong>Description</strong> is a descriptive title or the name of the reference.</p>
-{% endcall %}
+  {{ edit_reference(types, _type, url, description) }}
 
 <button class="btn btn-primary" type="submit">{{ action or 'Update' }}</button>
 <a class="btn btn-danger" href="{{ url_for('.view') }}">Cancel</a>
--- a/farol/templates/vulnerability/edit_reference.j2	Wed Oct 08 09:57:13 2014 +0200
+++ b/farol/templates/vulnerability/edit_reference.j2	Wed Oct 08 10:08:05 2014 +0200
@@ -24,17 +24,14 @@
 -#}
 
 {% extends "base.j2" %}
-{% from "macros.j2" import textinput, selectinput %}
-{% block title %}Edit the title{% endblock %}
-
+{% block title %}Edit a Reference{% endblock %}
+{% from "common_edits.j2" import edit_reference %}
 {% set active = 'vulnerability' %}
 
 {% block content %}
 <form role="form" method="POST">
 
-{{ selectinput("type", "Type", types, _type) }}
-{{ textinput("url", "URL", "http://...", url, type="url") }}
-{{ textinput("description", "Description", "", description) }}
+  {{ edit_reference(types, _type, url, description) }}
 
 <button class="btn btn-primary" type="submit">{{ action or 'Update' }}</button>
 <a class="btn btn-danger" href="{{ url_for('.view', ordinal=ordinal) }}">Cancel</a>

http://farol.wald.intevation.org