Mercurial > farol
changeset 49:5583ddcd6164
Unify the edit_note page
author | Benoît Allard <benoit.allard@greenbone.net> |
---|---|
date | Tue, 07 Oct 2014 16:15:43 +0200 |
parents | c6753fb93b3b |
children | 496ae1e8e90c |
files | farol/templates/common_edits.j2 farol/templates/document/edit_note.j2 farol/templates/vulnerability/edit_note.j2 |
diffstat | 3 files changed, 45 insertions(+), 41 deletions(-) [+] |
line wrap: on
line diff
--- a/farol/templates/common_edits.j2 Tue Oct 07 15:30:22 2014 +0200 +++ b/farol/templates/common_edits.j2 Tue Oct 07 16:15:43 2014 +0200 @@ -23,7 +23,7 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -#} -{% from "macros.j2" import textinput, examples %} +{% from "macros.j2" import textinput, textarea, selectinput, examples %} {% macro edit_title_type(doctitle, doctype) %} {% call textinput("title", "Document Title", "", doctitle, required=True) %} @@ -36,3 +36,42 @@ {{ examples(['Vulnerability Report', 'Security Bulletin', 'Security Notice']) }} {% endcall %} {% endmacro %} + +{% macro edit_note(types, note, ordinal) %} +<p><strong>Note</strong> is a place to put all manner of text blobs related to the document as a whole. It can be a concise summary of the overall document or a more compartmentalized and area-specific textual discussion. Depending on the need, there can be zero, one, or several <strong>Note</strong> elements in a given CVRF document. + +<p>The note should contain a compartmentalized textual discussion constrained by its <em>Type</em> attribute.</p> +{% call selectinput("type", "Type", types, note and note._type or '') %} +<p><em>Type</em> can be one of the following:</p> +<dl class="dl-horizontal"> + <dt>General:</dt> + <dd>A general, high-level note (<em>Title</em> may have more information).</dd> + <dt>Details:</dt> + <dd>A low-level detailed discussion (<em>Title</em> may have more information).</dd> + <dt>Description:</dt> + <dd>A description of something (<em>Title</em> may have more information).</dd> + <dt>Summary:</dt> + <dd>A summary of something (<em>Title</em> may have more information).</dd> + <dt>FAQ:</dt> + <dd>A list of frequently asked questions.</dd> + <dt>Legal Disclaimer:</dt> + <dd>Any possible legal discussion, including constraints, surrounding the document.</dd> + <dt>Other:</dt> + <dd>Something that doesn’t fit (<em>Title</em> should have more information).</dd> +</dl> +{% endcall %} +{% call textinput("ordinal", "Ordinal", "", ordinal or note._ordinal, type="number", required=True, extras={'min': '1'}) %} +<p><em>Ordinal</em> is a mandatory, locally significant value used to track notes inside a CVRF document at the root (document) level. It is provided to uniquely identify a <strong>Note</strong>.</p> +<p>There should be one of these values for every <strong>Note</strong> inside <strong>Document Notes</strong>, and it is recommended that <em>Ordinal</em> should be instantiated as a monotonically increasing counter, indexed from 1. Each <em>Ordinal</em> that tracks a <strong>Note</strong> inside <strong>Document Notes</strong> is completely independent from an <em>Ordinal</em> tracking a <strong>Note</strong> inside <strong>Vulnerability/Notes</strong>.</p> +{% endcall %} +{% call textinput("title", "Title", "", note and note._title or '') %} +<p><em>Title</em> should be a concise description of what is contained in the text.</p> +{% endcall %} +{% call textinput("audience", "Audience", "", note and note._audience or '') %} +<p><em>Audience</em> will indicate who is intended to read it.</p> +{% endcall %} +{% call textarea("note", "Note", "", note and note._note or '', 10, required=True) %} +<p><strong>Note</strong> is a place to put all manner of text blobs related to the document as a whole. It can be a concise summary of the overall document or a more compartmentalized and area-specific textual discussion.</p> +<p>The note should contain a compartmentalized textual discussion constrained by its <em>Type</em> attribute.</p> +{% endcall %} +{% endmacro %}
--- a/farol/templates/document/edit_note.j2 Tue Oct 07 15:30:22 2014 +0200 +++ b/farol/templates/document/edit_note.j2 Tue Oct 07 16:15:43 2014 +0200 @@ -24,45 +24,14 @@ -#} {% extends "base.j2" %} -{% from "macros.j2" import textinput, textarea, selectinput %} +{% from "common_edits.j2" import edit_note %} + {% block title %}Edit the type{% endblock %} {% block content %} <form role="form" method="POST"> -{% call selectinput("type", "Type", types, note and note._type or '') %} -<p><em>Type</em> can be one of the following:</p> -<dl class="dl-horizontal"> - <dt>General:</dt> - <dd>A general, high-level note (<em>Title</em> may have more information).</dd> - <dt>Details:</dt> - <dd>A low-level detailed discussion (<em>Title</em> may have more information).</dd> - <dt>Description:</dt> - <dd>A description of something (<em>Title</em> may have more information).</dd> - <dt>Summary:</dt> - <dd>A summary of something (<em>Title</em> may have more information).</dd> - <dt>FAQ:</dt> - <dd>A list of frequently asked questions.</dd> - <dt>Legal Disclaimer:</dt> - <dd>Any possible legal discussion, including constraints, surrounding the document.</dd> - <dt>Other:</dt> - <dd>Something that doesn’t fit (<em>Title</em> should have more information).</dd> -</dl> -{% endcall %} -{% call textinput("ordinal", "Ordinal", "", ordinal or note._ordinal, type="number", required=True, extras={'min': '1'}) %} -<p><em>Ordinal</em> is a mandatory, locally significant value used to track notes inside a CVRF document at the root (document) level. It is provided to uniquely identify a <strong>Note</strong>.</p> -<p>There should be one of these values for every <strong>Note</strong> inside <strong>Document Notes</strong>, and it is recommended that <em>Ordinal</em> should be instantiated as a monotonically increasing counter, indexed from 1. Each <em>Ordinal</em> that tracks a <strong>Note</strong> inside <strong>Document Notes</strong> is completely independent from an <em>Ordinal</em> tracking a <strong>Note</strong> inside <strong>Vulnerability/Notes</strong>.</p> -{% endcall %} -{% call textinput("title", "Title", "", note and note._title or '') %} -<p><em>Title</em> should be a concise description of what is contained in the text.</p> -{% endcall %} -{% call textinput("audience", "Audience", "", note and note._audience or '') %} -<p><em>Audience</em> will indicate who is intended to read it.</p> -{% endcall %} -{% call textarea("note", "Note", "", note and note._note or '', 10, required=True) %} -<p><strong>Note</strong> is a place to put all manner of text blobs related to the document as a whole. It can be a concise summary of the overall document or a more compartmentalized and area-specific textual discussion.</p> -<p>The note should contain a compartmentalized textual discussion constrained by its <em>Type</em> attribute.</p> -{% endcall %} + {{ edit_note(types, note, ordinal) }} <button class="btn btn-primary" type="submit">{{ action or 'Update' }}</button> <a class="btn btn-danger" href="{% if action=='Add' %}{{ url_for('.view') }}{% else %}{{ url_for('.view_note', ordinal=note._ordinal) }}{% endif %}">Cancel</a>
--- a/farol/templates/vulnerability/edit_note.j2 Tue Oct 07 15:30:22 2014 +0200 +++ b/farol/templates/vulnerability/edit_note.j2 Tue Oct 07 16:15:43 2014 +0200 @@ -24,7 +24,7 @@ -#} {% extends "base.j2" %} -{% from "macros.j2" import textinput, textarea, selectinput %} +{% from "common_edits.j2" import edit_note %} {% block title %}Edit the type{% endblock %} {% set active = 'vulnerability' %} @@ -32,11 +32,7 @@ {% block content %} <form role="form" method="POST"> -{{ selectinput("type", "Type", types, note and note._type or '') }} -{{ textinput("ordinal", "Ordinal", "", note_ordinal or note._ordinal, type="number", extras={'min': '1'}) }} -{{ textinput("title", "Title", "", note and note._title or '') }} -{{ textinput("audience", "Audience", "", note and note._audience or '') }} -{{ textarea("note", "Note", "", note and note._note or '', 10, required=True) }} + {{ edit_note(types, note, note_ordinal) }} <button class="btn btn-primary" type="submit">{{ action or 'Update' }}</button> <a class="btn btn-danger" href="{% if action=='Add' %}{{ url_for('.view', ordinal=ordinal) }}{% else %}{{ url_for('.view_note', ordinal=ordinal, note_ordinal=note._ordinal) }}{% endif %}">Cancel</a>