Skip to content

Commit acaca62

Browse files
committed
Merged in [17179] from housley@vigilsec.com:
Add references and referened-by buttons to each RFC listed on the peron profile page. In addition, changed the buttons on the document references and document referenced-by pages to match the buttons on the main document page (the buttons with the long arrows). Fixes ietf-tools#2854, although it does not include the number of references in the button. - Legacy-Id: 17191 Note: SVN reference [17179] has been migrated to Git commit 3460f92
2 parents fb3645f + 3460f92 commit acaca62

5 files changed

Lines changed: 22 additions & 8 deletions

File tree

ietf/doc/models.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,15 @@ def htmlized(self):
524524
cache.set(cache_key, html, settings.HTMLIZER_CACHE_TIME)
525525
return html
526526

527+
def references(self):
528+
return self.relations_that_doc(('refnorm','refinfo','refunk','refold'))
529+
530+
def referenced_by(self):
531+
return self.relations_that(('refnorm','refinfo','refunk','refold')).filter(source__states__type__slug='draft',source__states__slug__in=['rfc','active'])
532+
533+
def referenced_by_rfcs(self):
534+
return self.relations_that(('refnorm','refinfo','refunk','refold')).filter(source__states__type__slug='draft',source__states__slug='rfc')
535+
527536
class Meta:
528537
abstract = True
529538

@@ -846,7 +855,6 @@ def fake_history_obj(self, rev):
846855

847856
return dh
848857

849-
850858
class DocumentURL(models.Model):
851859
doc = ForeignKey(Document)
852860
tag = ForeignKey(DocUrlTagName)

ietf/doc/views_doc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -976,12 +976,12 @@ def document_shepherd_writeup(request, name):
976976

977977
def document_references(request, name):
978978
doc = get_object_or_404(Document,docalias__name=name)
979-
refs = doc.relations_that_doc(('refnorm','refinfo','refunk','refold'))
979+
refs = doc.references()
980980
return render(request, "doc/document_references.html",dict(doc=doc,refs=sorted(refs,key=lambda x:x.target.name),))
981981

982982
def document_referenced_by(request, name):
983983
doc = get_object_or_404(Document,docalias__name=name)
984-
refs = doc.relations_that(('refnorm','refinfo','refunk','refold')).filter(source__states__type__slug='draft',source__states__slug__in=['rfc','active'])
984+
refs = doc.referenced_by()
985985
full = ( request.GET.get('full') != None )
986986
numdocs = refs.count()
987987
if not full and numdocs>250:

ietf/templates/doc/document_referenced_by.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ <h1>References to {{alias_name}}</h1>
5151
</td>
5252
<td>
5353
<b>{{ref.source.title}}</b><br>
54-
<a class="btn btn-default btn-xs" href="{% url 'ietf.doc.views_doc.document_references' name %}">Refs</a>
55-
<a class="btn btn-default btn-xs" href="{% url 'ietf.doc.views_doc.document_referenced_by' name %}">Ref'd by</a>
54+
<a class="btn btn-default btn-xs" href="{% url 'ietf.doc.views_doc.document_references' name %}" rel="nofollow"><span class="fa fa-long-arrow-left"></span> References</a>
55+
<a class="btn btn-default btn-xs" href="{% url 'ietf.doc.views_doc.document_referenced_by' name %}" rel="nofollow"><span class="fa fa-long-arrow-right"></span> Referenced by</a>
5656
</td>
5757
<td>
5858
{% ifequal ref.source.get_state.slug 'rfc' %}

ietf/templates/doc/document_references.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ <h1>References from {{doc.canonical_name}}</h1>
3838
<td><a href="{% url 'ietf.doc.views_doc.document_main' name=name %}">{{ name|prettystdname }}</a></td>
3939
<td>
4040
<b>{{ref.target.document.title}}</b><br>
41-
<a class="btn btn-default btn-xs" href="{% url 'ietf.doc.views_doc.document_references' name %}">Refs</a>
42-
<a class="btn btn-default btn-xs" href="{% url 'ietf.doc.views_doc.document_referenced_by' name %}">Ref'd by</a>
41+
<a class="btn btn-default btn-xs" href="{% url 'ietf.doc.views_doc.document_references' name %}" rel="nofollow"><span class="fa fa-long-arrow-left"></span> References</a>
42+
<a class="btn btn-default btn-xs" href="{% url 'ietf.doc.views_doc.document_referenced_by' name %}" rel="nofollow"><span class="fa fa-long-arrow-right"></span> Referenced by</a>
4343
</td>
4444
<td>
4545
{% ifequal ref.target.document.get_state.slug 'rfc' %}

ietf/templates/person/profile.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,13 @@ <h2 id="rfcs">RFCs</h2>
6767
<tr>
6868
<td><a href="{{ doc.get_absolute_url }}">{{ doc.canonical_name }}</a></td>
6969
<td>{{ doc.pub_date|date:"b Y"|title|nbsp }}</td>
70-
<td>{{ doc.title }}</td>
70+
<td>{{ doc.title }}<br>
71+
{% with doc.referenced_by_rfcs.count as refbycount %}
72+
{% if refbycount %}
73+
Cited by <a style="text-decoration: underline" href="{% url 'ietf.doc.views_doc.document_referenced_by' doc.canonical_name %}" rel="nofollow">{{ refbycount }} RFC{{ refbycount|pluralize}}</a>
74+
{% endif %}
75+
{% endwith %}
76+
</td>
7177
</tr>
7278
{% endfor %}
7379
</table>

0 commit comments

Comments
 (0)