Skip to content

Commit ec4b877

Browse files
committed
Refactored document list row templates (search results, agenda docs, iesg discusses, etc.)
- Legacy-Id: 2108
1 parent b957568 commit ec4b877

7 files changed

Lines changed: 116 additions & 48 deletions

File tree

ietf/idrfc/idrfc_wrapper.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ class IdWrapper:
8585
ietf_process = None
8686

8787
def __init__(self, draft):
88+
self.id = self
8889
if isinstance(draft, IDInternal):
8990
self._idinternal = draft
9091
self._draft = self._idinternal.draft
@@ -210,6 +211,11 @@ def ad_name(self):
210211
else:
211212
return None
212213

214+
def get_absolute_url(self):
215+
return "/doc/"+self.draft_name+"/"
216+
def displayname_with_link(self):
217+
return '<a href="%s">%s</a>' % (self.get_absolute_url(), self.draft_name_and_revision())
218+
213219
def to_json(self):
214220
result = jsonify_helper(self, ['draft_name', 'draft_status', 'latest_revision', 'rfc_number', 'title', 'tracker_id', 'publication_date','rfc_editor_state', 'replaced_by', 'replaces', 'in_ietf_process', 'file_types', 'group_acronym', 'stream_id','friendly_state', 'abstract', 'ad_name'])
215221
if self.in_ietf_process():
@@ -237,6 +243,7 @@ def __init__(self, rfcindex, rfc=None, idinternal=None):
237243
self._rfcindex = rfcindex
238244
self._rfc = rfc
239245
self._idinternal = idinternal
246+
self.rfc = self
240247

241248
if not self._idinternal:
242249
try:
@@ -310,6 +317,11 @@ def ad_name(self):
310317
# TODO: get AD name of the draft
311318
return None
312319

320+
def get_absolute_url(self):
321+
return "/doc/rfc%d/" % (self.rfc_number,)
322+
def displayname_with_link(self):
323+
return '<a href="%s">RFC %d</a>' % (self.get_absolute_url(), self.rfc_number)
324+
313325
def to_json(self):
314326
result = jsonify_helper(self, ['rfc_number', 'title', 'publication_date', 'maturity_level', 'obsoleted_by','obsoletes','updated_by','updates','has_errata','file_types','in_ietf_process', 'friendly_state'])
315327
if self.in_ietf_process():
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{% comment %}
2+
Copyright (C) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
3+
All rights reserved. Contact: Pasi Eronen <pasi.eronen@nokia.com>
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions
7+
are met:
8+
9+
* Redistributions of source code must retain the above copyright
10+
notice, this list of conditions and the following disclaimer.
11+
12+
* Redistributions in binary form must reproduce the above
13+
copyright notice, this list of conditions and the following
14+
disclaimer in the documentation and/or other materials provided
15+
with the distribution.
16+
17+
* Neither the name of the Nokia Corporation and/or its
18+
subsidiary(-ies) nor the names of its contributors may be used
19+
to endorse or promote products derived from this software
20+
without specific prior written permission.
21+
22+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33+
{% endcomment %}
34+
{% load ietf_filters %}<td class="date">{% if not doc.rfc %}{{ doc.publication_date }}{% else %}{{ doc.publication_date|date:"Y-m" }}{% endif %}
35+
{% if doc.publication_date|timesince_days|less_than:"14" %}<br/><span class="ietf-small ietf-highlight-y">{% if not doc.rfc%}<a href="http://tools.ietf.org/rfcdiff?url2={{doc.id.draft_name_and_revision}}">new</a>{%else%}new{%endif%}</span>{%endif%}
36+
{% if doc.id and doc.id.expected_expiration_date and doc.id.expected_expiration_date|timesince_days|greater_than:"-14" %}<br/><span class="ietf-small ietf-highlight-y">expires soon</span>{%endif%}
37+
</td>

ietf/templates/idrfc/search_result_row.html

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -36,27 +36,14 @@
3636
{% load ballot_icon %}
3737
<tr class="{% cycle oddrow,evenrow %}">
3838
<td class="doc">
39-
{% if doc.rfc %}<a href="/doc/rfc{{doc.rfc.rfc_number}}/">RFC {{doc.rfc.rfc_number}}</a>
40-
{% if doc.id %}<br />(<a href="/doc/{{doc.id.draft_name}}/">{{doc.id.draft_name}}</a>){%endif%}
41-
{% else %}<a href="/doc/{{doc.id.draft_name}}/">{{doc.id.draft_name_and_revision}}</a>{% endif %}</td>
42-
<td class="title">{{ doc.title|escape }}</td>
43-
<td class="date">{% if not doc.rfc %}{{ doc.publication_date }}{% else %}{{ doc.publication_date|date:"Y-m" }}{% endif %}
44-
{% if doc.publication_date|timesince_days|less_than:"14" %}<br/><span class="ietf-small ietf-highlight-y">{% if not doc.rfc%}<a href="http://tools.ietf.org/rfcdiff?url2={{doc.id.draft_name_and_revision}}">new</a>{%else%}new{%endif%}</span>{%endif%}
45-
{% if doc.id and doc.id.expected_expiration_date and doc.id.expected_expiration_date|timesince_days|greater_than:"-14" %}<br/><span class="ietf-small ietf-highlight-y">expires soon</span>{%endif%}
46-
</td>
47-
48-
<td class="status">{{ doc.friendly_state|safe }}
49-
{% if not doc.rfc %}{{ doc.id|state_age_colored|safe }}{% endif %}
50-
{% if doc.rfc %}
51-
{% if doc.rfc.obsoleted_by %}<br />Obsoleted by {{ doc.rfc.obsoleted_by|urlize_ietf_docs }}{%endif %}
52-
{% if doc.rfc.updated_by %}<br />Updated by {{ doc.rfc.updated_by|urlize_ietf_docs }}{%endif %}
53-
{% if doc.rfc.has_errata %}<br /><a href="http://www.rfc-editor.org/errata_search.php?rfc={{doc.rfc.rfc_number}}" rel="nofollow">Errata</a>{% endif %}
54-
{% else %}
55-
{% if doc.id.rfc_editor_state %}<br />RFC Editor State: <a href="http://www.rfc-editor.org/queue2.html#{{doc.id.draft_name}}">{{ doc.id.rfc_editor_state|escape }}</a>{% endif %}
39+
{% if doc.rfc %}{{ doc.rfc.displayname_with_link|safe }}
40+
{% if doc.id %}<br />(<a href="{{ doc.id.get_absolute_url }}">{{doc.id.draft_name}}</a>){%endif%}
41+
{% else %}{{ doc.id.displayname_with_link|safe }}</td>
5642
{% endif %}
57-
</td>
58-
<td class="ballot">
59-
{% if doc.rfc and doc.rfc.in_ietf_process and doc.rfc.ietf_process.has_active_iesg_ballot %}{% ballot_icon doc.rfc %}{% else %}{% if doc.id %}{% ballot_icon doc.id %}{%endif%}{%endif%}</td>
60-
<td class="ad">{% if doc.ad_name %}{{ doc.ad_name|escape }}{% else %}&nbsp;{% endif %}</td>
43+
<td class="title">{{ doc.title }}</td>
44+
{% include "idrfc/date_column.html" %}
45+
{% include "idrfc/status_columns.html" %}
46+
{# <td class="ad">{% if doc.ad_name %}{{ doc.ad_name }}{% else %}&nbsp;{% endif %}</td> #}
47+
<td class="ad">{{ doc.ad_name|default:"" }}</td>
6148

6249
</tr>
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{% comment %}
2+
Copyright (C) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
3+
All rights reserved. Contact: Pasi Eronen <pasi.eronen@nokia.com>
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions
7+
are met:
8+
9+
* Redistributions of source code must retain the above copyright
10+
notice, this list of conditions and the following disclaimer.
11+
12+
* Redistributions in binary form must reproduce the above
13+
copyright notice, this list of conditions and the following
14+
disclaimer in the documentation and/or other materials provided
15+
with the distribution.
16+
17+
* Neither the name of the Nokia Corporation and/or its
18+
subsidiary(-ies) nor the names of its contributors may be used
19+
to endorse or promote products derived from this software
20+
without specific prior written permission.
21+
22+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33+
{% endcomment %}
34+
{% load ietf_filters %}{% load ballot_icon %}
35+
<td class="status">
36+
{{ doc.friendly_state|safe }} {% if not doc.rfc %}{{ doc.id|state_age_colored|safe }}{% endif %}
37+
{% block extra_status %}{% endblock %}
38+
{% if doc.rfc %}
39+
{% if doc.rfc.obsoleted_by %}<br />Obsoleted by {{ doc.rfc.obsoleted_by|urlize_ietf_docs }}{%endif %}
40+
{% if doc.rfc.updated_by %}<br />Updated by {{ doc.rfc.updated_by|urlize_ietf_docs }}{%endif %}
41+
{% if doc.rfc.has_errata %}<br /><a href="http://www.rfc-editor.org/errata_search.php?rfc={{doc.rfc.rfc_number}}" rel="nofollow">Errata</a>{% endif %}
42+
{% else %}{# not rfc #}
43+
{% if doc.id.rfc_editor_state %}<br />RFC Editor State: <a href="http://www.rfc-editor.org/queue2.html#{{doc.id.draft_name}}">{{ doc.id.rfc_editor_state|escape }}</a>{% endif %}
44+
{% endif %}
45+
</td>
46+
<td class="ballot">
47+
{% if doc.rfc and doc.rfc.in_ietf_process and doc.rfc.ietf_process.has_active_iesg_ballot %}{% ballot_icon doc.rfc %}{% else %}{% if doc.id %}{% ballot_icon doc.id %}{%endif%}{%endif%}
48+
</td>

ietf/templates/iesg/agenda_documents_row.html

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -43,25 +43,12 @@
4343
{% endif %}
4444
>
4545
<td class="doc">
46-
{% if doc.is_rfc_wrapper %}<a href="/doc/rfc{{doc.rfc_number}}/">RFC {{doc.rfc_number}}</a>
47-
{% else %}<a href="/doc/{{doc.draft_name}}/">{{doc.draft_name_and_revision}}</a>{% endif %}
46+
{{ doc.displayname_with_link|safe }}
4847
{% if doc.ietf_process.iesg_ballot.was_deferred %}
4948
<br/><b title="deferred by {{ doc.ietf_process.iesg_ballot.deferred_by}}">(deferred on {{doc.ietf_process.iesg_ballot.deferred_date }})</b>
5049
{% endif %}
5150
</td>
52-
53-
<td class="title">{{ doc.title|escape }}</td>
54-
55-
<td class="status">{{ doc.friendly_state|safe }}
56-
<br/>Intended status: {{doc.ietf_process.intended_maturity_level}}
57-
{% if doc.is_rfc_wrapper %}
58-
{% if doc.has_errata %}<br /><a href="http://www.rfc-editor.org/errata_search.php?rfc={{doc.rfc_number}}" rel="nofollow">Errata</a>{% endif %}
59-
{% else %}
60-
{% if doc.rfc_editor_state %}<br />RFC Editor State: <a href="http://www.rfc-editor.org/queue2.html#{{ doc.draft_name}}">{{ doc.rfc_editor_state|escape }}</a>{% endif %}
61-
{% endif %}
62-
63-
</td>
64-
<td class="ballot">{% ballot_icon doc %}</td>
65-
<td class="ad">{% if doc.ad_name %}{{ doc.ad_name|escape }}{% else %}&nbsp;{% endif %}</td>
66-
51+
<td class="title">{{ doc.title }}</td>
52+
{% include "iesg/agenda_documents_row_status.html" %}
53+
<td class="ad">{{ doc.ad_name|default:"" }}</td>
6754
</tr>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{% extends "idrfc/status_columns.html" %}
2+
{% block extra_status %}
3+
<br/>Intended status: {{doc.ietf_process.intended_maturity_level}}
4+
{% endblock %}

ietf/templates/iesg/discusses.html

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,9 @@ <h1>IESG Discuss Positions</h1>
5757
<tr><th class="doc">Document</th><th class="status" colspan="2">Status</th><th class="ad">Area Director</th><th>Discusses</th></tr>
5858
{% for doc in docs %}
5959
<tr class="discuss_row {% cycle oddrow,evenrow %} {% if user|in_group:"Area_Director" %}{% if doc|my_position:user|equal:"Discuss" %}discuss_byme{% else %}discuss_notbyme{% endif %} {% ifequal user.get_profile.person|lower doc.ad_name|lower %}discuss_forme{%else%}discuss_notforme{%endifequal%}{% endif %}">
60-
<td class="doc">
61-
{% if doc.is_rfc_wrapper %}
62-
<a href="/doc/rfc{{doc.rfc_number}}/">RFC {{doc.rfc_number}}</a>
63-
{% else %}
64-
<a href="/doc/{{doc.draft_name}}/">{{doc.draft_name_and_revision}}</a>
65-
{% endif %}
66-
</td>
67-
<td class="status">{{ doc.friendly_state|safe }}</td>
68-
<td class="ballot">{% ballot_icon doc %}</td>
69-
<td class="ad">{% if doc.ad_name %}{{ doc.ad_name|escape }}{% else %}&nbsp;{% endif %}</td>
60+
<td class="doc">{{ doc.displayname_with_link|safe }}</td>
61+
{% include "idrfc/status_columns.html" %}
62+
<td class="ad">{{ doc.ad_name|default:"" }}</td>
7063
<td>
7164
{% for po in doc.ietf_process.iesg_ballot.get_discuss %}
7265
{{po.ad_name}} ({% if po.discuss_date %}{{po.discuss_date|timesince_days}}{%endif%} days ago{% if doc.is_id_wrapper %}{% ifnotequal po.discuss_revision doc.latest_revision %} for -{{po.discuss_revision}}{% endifnotequal %}{% endif %})<br/>

0 commit comments

Comments
 (0)