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 #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 3460f9242f
This commit is contained in:
commit
acaca62195
|
@ -524,6 +524,15 @@ class DocumentInfo(models.Model):
|
|||
cache.set(cache_key, html, settings.HTMLIZER_CACHE_TIME)
|
||||
return html
|
||||
|
||||
def references(self):
|
||||
return self.relations_that_doc(('refnorm','refinfo','refunk','refold'))
|
||||
|
||||
def referenced_by(self):
|
||||
return self.relations_that(('refnorm','refinfo','refunk','refold')).filter(source__states__type__slug='draft',source__states__slug__in=['rfc','active'])
|
||||
|
||||
def referenced_by_rfcs(self):
|
||||
return self.relations_that(('refnorm','refinfo','refunk','refold')).filter(source__states__type__slug='draft',source__states__slug='rfc')
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
|
@ -846,7 +855,6 @@ class Document(DocumentInfo):
|
|||
|
||||
return dh
|
||||
|
||||
|
||||
class DocumentURL(models.Model):
|
||||
doc = ForeignKey(Document)
|
||||
tag = ForeignKey(DocUrlTagName)
|
||||
|
|
|
@ -976,12 +976,12 @@ def document_shepherd_writeup(request, name):
|
|||
|
||||
def document_references(request, name):
|
||||
doc = get_object_or_404(Document,docalias__name=name)
|
||||
refs = doc.relations_that_doc(('refnorm','refinfo','refunk','refold'))
|
||||
refs = doc.references()
|
||||
return render(request, "doc/document_references.html",dict(doc=doc,refs=sorted(refs,key=lambda x:x.target.name),))
|
||||
|
||||
def document_referenced_by(request, name):
|
||||
doc = get_object_or_404(Document,docalias__name=name)
|
||||
refs = doc.relations_that(('refnorm','refinfo','refunk','refold')).filter(source__states__type__slug='draft',source__states__slug__in=['rfc','active'])
|
||||
refs = doc.referenced_by()
|
||||
full = ( request.GET.get('full') != None )
|
||||
numdocs = refs.count()
|
||||
if not full and numdocs>250:
|
||||
|
|
|
@ -51,8 +51,8 @@
|
|||
</td>
|
||||
<td>
|
||||
<b>{{ref.source.title}}</b><br>
|
||||
<a class="btn btn-default btn-xs" href="{% url 'ietf.doc.views_doc.document_references' name %}">Refs</a>
|
||||
<a class="btn btn-default btn-xs" href="{% url 'ietf.doc.views_doc.document_referenced_by' name %}">Ref'd by</a>
|
||||
<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>
|
||||
<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>
|
||||
</td>
|
||||
<td>
|
||||
{% ifequal ref.source.get_state.slug 'rfc' %}
|
||||
|
|
|
@ -38,8 +38,8 @@
|
|||
<td><a href="{% url 'ietf.doc.views_doc.document_main' name=name %}">{{ name|prettystdname }}</a></td>
|
||||
<td>
|
||||
<b>{{ref.target.document.title}}</b><br>
|
||||
<a class="btn btn-default btn-xs" href="{% url 'ietf.doc.views_doc.document_references' name %}">Refs</a>
|
||||
<a class="btn btn-default btn-xs" href="{% url 'ietf.doc.views_doc.document_referenced_by' name %}">Ref'd by</a>
|
||||
<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>
|
||||
<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>
|
||||
</td>
|
||||
<td>
|
||||
{% ifequal ref.target.document.get_state.slug 'rfc' %}
|
||||
|
|
|
@ -67,7 +67,13 @@
|
|||
<tr>
|
||||
<td><a href="{{ doc.get_absolute_url }}">{{ doc.canonical_name }}</a></td>
|
||||
<td>{{ doc.pub_date|date:"b Y"|title|nbsp }}</td>
|
||||
<td>{{ doc.title }}</td>
|
||||
<td>{{ doc.title }}<br>
|
||||
{% with doc.referenced_by_rfcs.count as refbycount %}
|
||||
{% if refbycount %}
|
||||
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>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
|
Loading…
Reference in a new issue