Mercurial > farol > farol
comparison 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 |
comparison
equal
deleted
inserted
replaced
104:0e0572780aff | 105:09915cbdf549 |
---|---|
22 # along with this program; if not, write to the Free Software | 22 # along with this program; if not, write to the Free Software |
23 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | 23 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
24 -#} | 24 -#} |
25 | 25 |
26 {% extends "base.j2" %} | 26 {% extends "base.j2" %} |
27 {% from "macros.j2" import panel, label_value, delete_button %} | 27 {% from "macros.j2" import panel, label_value, add_button, edit_button, delete_button %} |
28 {% block title %}Document{% endblock %} | 28 {% block title %}Document{% endblock %} |
29 | 29 |
30 {% set active='document' %} | 30 {% set active='document' %} |
31 | 31 |
32 {% block content %} | 32 {% block content %} |
33 <div class='clearfix page-header'> | 33 <div class='clearfix page-header'> |
34 <h1>{{ cvrf._title }} <small>({{ cvrf._type }})</small></h1> | 34 <h1>{{ cvrf._title }} <small>({{ cvrf._type }})</small></h1> |
35 <a class="pull-right" href="{{ url_for('.edit_title') }}">edit title</a> | 35 <div class="pull-right">{{ edit_button(url_for('.edit_title'), "edit title") }}</div> |
36 </div> | 36 </div> |
37 {% call panel(heading="Publisher", title=3, collapsible=False) %} | 37 {% call panel(heading="Publisher", title=3, collapsible=False) %} |
38 <a class="pull-right" href="{{ url_for('.edit_publisher') }}">edit</a> | 38 <div class="pull-right">{{ edit_button(url_for('.edit_publisher')) }}</div> |
39 <div class="form-horizontal"> | 39 <div class="form-horizontal"> |
40 {% for label, value in [("Type", cvrf._publisher._type), | 40 {% for label, value in [("Type", cvrf._publisher._type), |
41 ("VendorID", cvrf._publisher._vendorid or ''), | 41 ("VendorID", cvrf._publisher._vendorid or ''), |
42 ("Contact Details", (cvrf._publisher._contact or '') | replace('\n', '<br>')), | 42 ("Contact Details", (cvrf._publisher._contact or '') | replace('\n', '<br>')), |
43 ("Issuing Authority", (cvrf._publisher._authority or '') | replace('\n', '<br>'))] %} | 43 ("Issuing Authority", (cvrf._publisher._authority or '') | replace('\n', '<br>'))] %} |
44 {{ label_value(label, value, right=8) }} {# 8: so that we reserve place for the floating 'edit'#} | 44 {{ label_value(label, value, right=8) }} {# 8: so that we reserve place for the floating 'edit'#} |
45 {% endfor %} | 45 {% endfor %} |
46 </div> | 46 </div> |
47 {% endcall %} | 47 {% endcall %} |
48 {% call panel(heading="Document Tracking", title=3, collapsible=False) %} | 48 {% call panel(heading="Document Tracking", title=3, collapsible=False) %} |
49 <a class="pull-right" href="{{ url_for('.edit_tracking') }}">edit</a> | 49 <div class="pull-right">{{ edit_button(url_for('.edit_tracking')) }}</div> |
50 <div class="form-horizontal"> | 50 <div class="form-horizontal"> |
51 {% for label, value in [("Identification", cvrf._tracking._identification), | 51 {% for label, value in [("Identification", cvrf._tracking._identification), |
52 ("Status", cvrf._tracking._status), | 52 ("Status", cvrf._tracking._status), |
53 ("Version", cvrf._tracking._version | join('.'))] %} | 53 ("Version", cvrf._tracking._version | join('.'))] %} |
54 {{ label_value(label, value, right=8) }} | 54 {{ label_value(label, value, right=8) }} |
59 <div id="history" class="collapse"> | 59 <div id="history" class="collapse"> |
60 {% for revision in cvrf._tracking._history %} | 60 {% for revision in cvrf._tracking._history %} |
61 <li class="list-group-item"> | 61 <li class="list-group-item"> |
62 <div class="form-horizontal"> | 62 <div class="form-horizontal"> |
63 <div class="pull-right"> | 63 <div class="pull-right"> |
64 <a href="{{ url_for('.edit_revision', index=loop.index0) }}"><span class="label label-default">edit</span></a> | 64 {{ edit_button(url_for('.edit_revision', index=loop.index0)) }} |
65 {{ delete_button(url_for('.del_revision', index=loop.index0)) }} | 65 {{ delete_button(url_for('.del_revision', index=loop.index0)) }} |
66 </div> | 66 </div> |
67 {{ label_value('Number', revision._number | join('.'), right=8) }} | 67 {{ label_value('Number', revision._number | join('.'), right=8) }} |
68 {{ label_value('Date', revision._date) }} | 68 {{ label_value('Date', revision._date) }} |
69 {{ label_value('Description', revision._description) }} | 69 {{ label_value('Description', revision._description) }} |
70 </div> | 70 </div> |
71 </li> | 71 </li> |
72 {% endfor %} | 72 {% endfor %} |
73 <li class="list-group-item clearfix"> | 73 <li class="list-group-item clearfix"> |
74 <a class="pull-right" href="{{ url_for('.add_revision') }}">add revision</a> | 74 <div class="pull-right">{{ add_button(url_for('.add_revision'), "add revision") }}</div> |
75 </li> | 75 </li> |
76 </div> | 76 </div> |
77 </ul> | 77 </ul> |
78 <div class="form-horizontal"> | 78 <div class="form-horizontal"> |
79 {% for label, value in [("Initial Release Date", cvrf._tracking._initialDate), | 79 {% for label, value in [("Initial Release Date", cvrf._tracking._initialDate), |
89 </div> | 89 </div> |
90 {% endcall %} | 90 {% endcall %} |
91 {% endif %} | 91 {% endif %} |
92 {% endcall %} | 92 {% endcall %} |
93 {% call panel(heading="Distribution", title=3, collapsible=False) %} | 93 {% call panel(heading="Distribution", title=3, collapsible=False) %} |
94 <a class="pull-right" href="{{ url_for('.edit_distribution') }}">edit</a> | 94 <div class="pull-right">{{ edit_button(url_for('.edit_distribution')) }}</div> |
95 <p>{{ (cvrf._distribution or '') | replace('\n', '<br>') }}</p> | 95 <p>{{ (cvrf._distribution or '') | replace('\n', '<br>') }}</p> |
96 {% endcall %} | 96 {% endcall %} |
97 {% call panel(heading="Aggregate Severity", title=3, collapsible=False) %} | 97 {% call panel(heading="Aggregate Severity", title=3, collapsible=False) %} |
98 <div class="form-horizontal"> | 98 <div class="form-horizontal"> |
99 <a class="pull-right" href="{{ url_for('.edit_severity') }}">edit</a> | 99 <div class="pull-right">{{ edit_button(url_for('.edit_severity')) }}</div> |
100 {% if cvrf._aggregateseverity %} | 100 {% if cvrf._aggregateseverity %} |
101 {{ label_value('Namespace', (cvrf._aggregateseverity._namespace or '') | urlize, right=8) }} | 101 {{ label_value('Namespace', (cvrf._aggregateseverity._namespace or '') | urlize, right=8) }} |
102 {{ label_value('Severity', cvrf._aggregateseverity._severity) }} | 102 {{ label_value('Severity', cvrf._aggregateseverity._severity) }} |
103 {% endif %} | 103 {% endif %} |
104 </div> | 104 </div> |
109 <ul> | 109 <ul> |
110 {% for note in cvrf._notes %} | 110 {% for note in cvrf._notes %} |
111 <li><a href="{{ url_for('.view_note', ordinal=note._ordinal) }}">{{ note.getTitle() }}</a></li> | 111 <li><a href="{{ url_for('.view_note', ordinal=note._ordinal) }}">{{ note.getTitle() }}</a></li> |
112 {% endfor %} | 112 {% endfor %} |
113 </ul> | 113 </ul> |
114 <a class="pull-right" href="{{ url_for('.add_note') }}">add</a> | 114 <div class="pull-right">{{ add_button(url_for('.add_note')) }}</div> |
115 {% endcall %} | 115 {% endcall %} |
116 </div> | 116 </div> |
117 <div class="col-sm-4"> | 117 <div class="col-sm-4"> |
118 {% call panel(type="warning", heading="References", badge=cvrf._references | length, title=3) %} | 118 {% call panel(type="warning", heading="References", badge=cvrf._references | length, title=3) %} |
119 <ul> | 119 <ul> |
120 {% for reference in cvrf._references %} | 120 {% for reference in cvrf._references %} |
121 <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> | 121 <li> |
122 <a href="{{ reference._url }}" target="_blank"> | |
123 {{ reference._description }}{% if reference._type %} ({{ reference._type }}){% endif %} | |
124 </a> | |
125 {{ edit_button(url_for('.edit_reference', index=loop.index0)) }} | |
126 {{ delete_button(url_for('.del_reference', index=loop.index0)) }} | |
127 </li> | |
122 {% endfor %} | 128 {% endfor %} |
123 </ul> | 129 </ul> |
124 <a class="pull-right" href="{{ url_for('.add_reference') }}">add</a> | 130 <div class="pull-right">{{ add_button(url_for('.add_reference')) }}</div> |
125 {% endcall %} | 131 {% endcall %} |
126 </div> | 132 </div> |
127 <div class="col-sm-4"> | 133 <div class="col-sm-4"> |
128 {% call panel(type="info", heading="Acknowledgments", badge=cvrf._acknowledgments | length, title=3) %} | 134 {% call panel(type="info", heading="Acknowledgments", badge=cvrf._acknowledgments | length, title=3) %} |
129 <ul> | 135 <ul> |
130 {% for ack in cvrf._acknowledgments %} | 136 {% for ack in cvrf._acknowledgments %} |
131 <li><a href="{{ url_for('.view_acknowledgment', index=loop.index0) }}">{{ ack.getTitle() }}</a></li> | 137 <li><a href="{{ url_for('.view_acknowledgment', index=loop.index0) }}">{{ ack.getTitle() }}</a></li> |
132 {% endfor %} | 138 {% endfor %} |
133 </ul> | 139 </ul> |
134 <a class="pull-right" href="{{ url_for('.add_acknowledgment') }}">add</a> | 140 <div class="pull-right">{{ add_button(url_for('.add_acknowledgment')) }}</div> |
135 {% endcall %} | 141 {% endcall %} |
136 </div> | 142 </div> |
137 </div> | 143 </div> |
138 | 144 |
139 | 145 |
157 <ul> | 163 <ul> |
158 {% for vulnerability in cvrf._vulnerabilities %} | 164 {% for vulnerability in cvrf._vulnerabilities %} |
159 <li><a href="{{ url_for('vulnerability.view', ordinal=vulnerability._ordinal) }}">{{ vulnerability.getTitle() }}</a></li> | 165 <li><a href="{{ url_for('vulnerability.view', ordinal=vulnerability._ordinal) }}">{{ vulnerability.getTitle() }}</a></li> |
160 {% endfor %} | 166 {% endfor %} |
161 </ul> | 167 </ul> |
162 <a href="{{ url_for('vulnerability.add') }}" class="pull-right">add</a> | 168 <div class="pull-right">{{ add_button(url_for('vulnerability.add')) }}</div> |
163 {% endcall %} | 169 {% endcall %} |
164 </div> | 170 </div> |
165 </div> | 171 </div> |
166 {% endblock %} | 172 {% endblock %} |