Skip to content

Commit ea639f9

Browse files
committed
* Add filename_with_link to create links only for active documents
* Display document status if it's not Active * Use revision_display in displayname() * Check for DocumentComment.created_by flag value of 999 - Legacy-Id: 317
1 parent e7a13bf commit ea639f9

3 files changed

Lines changed: 15 additions & 7 deletions

File tree

ietf/idtracker/models.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def save(self):
147147
self.id_document_key = self.title.upper()
148148
super(InternetDraft, self).save()
149149
def displayname(self):
150-
return "%s-%s.txt" % ( self.filename, self.revision )
150+
return "%s-%s.txt" % ( self.filename, self.revision_display() )
151151
def doclink(self):
152152
return "http://www.ietf.org/internet-drafts/%s" % ( self.displayname() )
153153
def group_acronym(self):
@@ -167,7 +167,11 @@ def revision_display(self):
167167
return "%02d" % r
168168
def doctype(self):
169169
return "Draft"
170-
170+
def filename_with_link(self):
171+
if self.status.status != 'Active':
172+
return self.filename
173+
else:
174+
return '<a href="%s">%s</a>' % ( self.doclink(), self.filename )
171175
class Meta:
172176
db_table = "internet_drafts"
173177
class Admin:
@@ -335,6 +339,8 @@ def doclink(self):
335339
return "http://www.ietf.org/rfc/%s" % ( self.displayname() )
336340
def doctype(self):
337341
return "RFC"
342+
def filename_with_link(self):
343+
return '<a href="%s">%s</a>' % ( self.doclink(), self.displayname() )
338344
class Meta:
339345
db_table = 'rfcs'
340346
verbose_name = 'RFC'
@@ -503,12 +509,12 @@ def get_absolute_url(self):
503509
else:
504510
return "/idtracker/%s/comment/%d/" % (self.document.draft.filename, self.id)
505511
def get_author(self):
506-
if self.created_by:
512+
if self.created_by_id and self.created_by_id != 999:
507513
return self.created_by.__str__()
508514
else:
509515
return "system"
510516
def get_username(self):
511-
if self.created_by:
517+
if self.created_by_id and self.created_by_id != 999:
512518
return self.created_by.login_name
513519
else:
514520
return "system"

ietf/templates/idtracker/idinternal_detail.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@
2929

3030
<td>
3131
<div class="largefont3">
32-
<a href="{{ object.document.doclink }}">
33-
{{ object.document.displayname }}</a>
32+
{{ object.document.filename_with_link }}
33+
{% ifnotequal object.document.status.status "Active" %}
34+
({{ object.document.status.status }})
35+
{% endifnotequal %}
3436
<font color="red">
3537
{% if object.via_rfc_editor %}
3638
(Independent submission via RFC Editor)

ietf/templates/idtracker/search_result_row.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
invalid HTML. -->
66
<form method="GET" action="{% url ietf.idtracker.views.view_id match.document.filename %}"><td><input type="submit" value="DETAIL"></td></form>
77
{# todo: conditionalize doclink properly #}
8-
<td>{% if match.primary_flag %}<li>{% else %}<dd>{% endif %}<a href="{{ match.document.doclink }}">{{ match.document.filename }}</a> ({{ match.document.intended_status }})</td>
8+
<td>{% if match.primary_flag %}<li>{% else %}<dd>{% endif %}{{ match.document.filename_with_link }} ({{ match.document.intended_status }})</td>
99
<td>{{ match.document.revision }}</td>
1010
<td>{{ match.job_owner }}</td>
1111
<td>{% firstof match.status_date "" %}</td>

0 commit comments

Comments
 (0)