fix: use type instead of state in templates

This commit is contained in:
Robert Sparks 2023-09-05 18:04:16 -05:00
parent e0f27b9d52
commit d0bac8913d
No known key found for this signature in database
GPG key ID: 6E2A6A5775F91318
10 changed files with 21 additions and 21 deletions

View file

@ -28,7 +28,7 @@
<td class="edit"></td>
<td>
<a href="{% url "ietf.doc.views_doc.document_main" name=conflictdoc.name %}">
{% if conflictdoc.get_state_slug == 'rfc' %}{{ conflictdoc.name|prettystdname }}{% else %}{{ conflictdoc.name }}-{{ conflictdoc.rev }}{% endif %}</a>
{% if conflictdoc.type_id == 'rfc' %}{{ conflictdoc.name|prettystdname }}{% else %}{{ conflictdoc.name }}-{{ conflictdoc.rev }}{% endif %}</a>
<span class="badge rounded-pill text-bg-info">{{ conflictdoc.stream }} stream</span>
{% if snapshot %}<span class="badge rounded-pill text-bg-warning">Snapshot</span>{% endif %}
</td>

View file

@ -13,11 +13,11 @@
title="Document changes"
href="/feed/document-changes/{{ name }}/">
<meta name="description"
content="{{ doc.title }} {% if doc.get_state_slug == 'rfc' and not snapshot %}(RFC {{ rfc_number }}{% if published %}, {{ doc.pub_date|date:'F Y' }}{% endif %}{% if obsoleted_by %}; obsoleted by {% for rel in obsoleted_by %}{{ rel.source.name|prettystdname}}{% if not forloop.last%}, {% endif %}{% endfor %}{% endif %}){% endif %}">
content="{{ doc.title }} {% if doc.type_id == 'rfc' and not snapshot %}(RFC {{ rfc_number }}{% if published %}, {{ doc.pub_date|date:'F Y' }}{% endif %}{% if obsoleted_by %}; obsoleted by {% for rel in obsoleted_by %}{{ rel.source.name|prettystdname}}{% if not forloop.last%}, {% endif %}{% endfor %}{% endif %}){% endif %}">
{% endblock %}
{% block morecss %}.inline { display: inline; }{% endblock %}
{% block title %}
{% if doc.get_state_slug == "rfc" and not snapshot %}
{% if doc.type_id == "rfc" and not snapshot %}
RFC {{ rfc_number }} - {{ doc.title }}
{% else %}
{{ name }}-{{ doc.rev }} - {{ doc.title }}
@ -31,7 +31,7 @@
{% if doc.rev != latest_rev %}
<div class="alert alert-warning my-3">The information below is for an old version of the document.</div>
{% else %}
{% if doc.get_state_slug == "rfc" and snapshot %}
{% if doc.type_id == "rfc" and snapshot %}
<div class="alert alert-warning my-3">
The information below is for an old version of the document that is already published as an RFC.
</div>
@ -764,10 +764,10 @@
{% endfor %}
{% endif %}
</div>
{% if doc.get_state_slug == "active" or doc.get_state_slug == "rfc" %}
{% if doc.get_state_slug == "active" or doc.type_id == "rfc" %}
<div class="card mt-5">
<div class="card-header">
{% if doc.get_state_slug == "rfc" and not snapshot %}
{% if doc.type_id == "rfc" and not snapshot %}
RFC {{ rfc_number }}
{% else %}
{{ name }}-{{ doc.rev }}

View file

@ -4,11 +4,11 @@
{% if label != skip_format %}
<a class="btn btn-primary btn-sm"
{% if label == 'pdf' or label == 'pdfized' %}
download="{% if not snapshot and doc.get_state_slug == 'rfc' %}rfc{{ doc.rfc_number }}{% else %}{{ doc.name }}-{{ doc.rev }}{% endif %}.pdf"
download="{% if not snapshot and doc.type_id == 'rfc' %}rfc{{ doc.rfc_number }}{% else %}{{ doc.name }}-{{ doc.rev }}{% endif %}.pdf"
{% comment %}
TODO: determine if we want bibtex to jiust download
{% elif label == 'bibtex' %}
download="{% if not snapshot and doc.get_state_slug == 'rfc' %}rfc{{ doc.rfc_number }}{% else %}{{ doc.name }}-{{ doc.rev }}{% endif %}.bib"
download="{% if not snapshot and doc.type_id == 'rfc' %}rfc{{ doc.rfc_number }}{% else %}{{ doc.name }}-{{ doc.rev }}{% endif %}.bib"
{% endcomment %}
{% endif %}
{% if label != 'htmlized' %}target="_blank"{% endif %}

View file

@ -60,7 +60,7 @@
{% for name, rev, time, url in diff_revisions %}
<option value="{{ url }}"
{% if document_html %}
{% if not snapshot and doc.get_state_slug == "rfc" and name == "rfc"|add:doc.rfc_number or snapshot and name == doc.name and rev == doc.rev %} selected{% endif %}
{% if not snapshot and doc.type_id == "rfc" and name == "rfc"|add:doc.rfc_number or snapshot and name == doc.name and rev == doc.rev %} selected{% endif %}
{% else %}
{% if forloop.counter == 1 %} selected{% endif %}
{% endif %}>

View file

@ -33,7 +33,7 @@
{% endif %}
<link rel="alternate" type="application/atom+xml" title="Document changes" href="/feed/document-changes/{{ doc.name }}/">
<meta name="description"
{% if not snapshot and doc.get_state_slug == 'rfc' %}
{% if not snapshot and doc.type_id == 'rfc' %}
content="{{ doc.title }} (RFC {{ doc.rfc_number }}{% if published %}, {{ published.time|date:'F Y' }}{% endif %}{% if obsoleted_by %}; obsoleted by {% for rel in obsoleted_by %}{{ rel.source.name|prettystdname}}{% if not forloop.last%}, {% endif %}{% endfor %}{% endif %})"
{% else %}
content="{{ doc.title }} (Internet-Draft, {{ doc.time|date:'Y' }})"
@ -98,7 +98,7 @@
<nav class="navbar bg-light-subtle px-1 fixed-top d-print-none d-md-none">
<a class="nav-link ps-1"
href="{% url 'ietf.doc.views_doc.document_main' name=doc.name %}">
{% if not snapshot and doc.get_state_slug == "rfc" %}
{% if not snapshot and doc.type_id == "rfc" %}
RFC {{ doc.rfc_number }}
{% else %}
{{ doc.name }}-{{ doc.rev }}
@ -175,7 +175,7 @@
<div class="pt-2 pt-lg-3 px-md-2 px-lg-3">
<a class="btn btn-primary btn-sm" href="{% url 'ietf.doc.views_doc.document_main' name=doc.name %}">Datatracker</a>
<p class="fw-bold pt-2">
{% if not snapshot and doc.get_state_slug == "rfc" %}
{% if not snapshot and doc.type_id == "rfc" %}
RFC {{ doc.rfc_number }}
{% else %}
{{ doc.name }}-{{ doc.rev }}

View file

@ -31,7 +31,7 @@
{% if document_html %}View errata{% else %}Errata{% endif %}
</a>
{% endif %}
{% if document_html and doc.get_state_slug == "rfc" and not snapshot %}
{% if document_html and doc.type_id == "rfc" and not snapshot %}
<a class="btn btn-sm btn-warning"
title="Click to report an error in the document."
href="https://www.rfc-editor.org/errata.php#reportnew"
@ -60,7 +60,7 @@
</div>
{% endif %}
{% else %}
{% if snapshot and doc.doc.get_state_slug == 'rfc' %}
{% if snapshot and doc.doc.type_id == 'rfc' %}
<div{% if document_html %} class="alert alert-warning small"{% endif %}>This is an older version of an Internet-Draft that was ultimately published as <a href="{% url 'ietf.doc.views_doc.document_html' name=doc.doc.name %}">{{doc.doc.name|prettystdname}}</a>.</div>
{% elif snapshot and doc.rev != latest_rev %}
<div{% if document_html %} class="alert alert-warning small"{% endif %}>This is an older version of an Internet-Draft whose latest revision state is "{{ doc.doc.get_state }}".</div>

View file

@ -13,7 +13,7 @@
title="Document changes"
href="/feed/document-changes/{{ name }}/">
<meta name="description"
content="{{ doc.title }} {% if doc.get_state_slug == 'rfc' and not snapshot %}(RFC {{ rfc_number }}{% if published %}, {{ doc.pub_date|date:'F Y' }}{% endif %}{% if obsoleted_by %}; obsoleted by {% for rel in obsoleted_by %}{{ rel.source.name|prettystdname}}{% if not forloop.last%}, {% endif %}{% endfor %}{% endif %}){% endif %}">
content="{{ doc.title }} {% if doc.type_id == 'rfc' and not snapshot %}(RFC {{ rfc_number }}{% if published %}, {{ doc.pub_date|date:'F Y' }}{% endif %}{% if obsoleted_by %}; obsoleted by {% for rel in obsoleted_by %}{{ rel.source.name|prettystdname}}{% if not forloop.last%}, {% endif %}{% endfor %}{% endif %}){% endif %}">
{% endblock %}
{% block morecss %}.inline { display: inline; }{% endblock %}
{% block title %}
@ -280,10 +280,10 @@
{% endfor %}
{% endif %}
</div>
{% if doc.get_state_slug == "active" or doc.get_state_slug == "rfc" %}
{% if doc.get_state_slug == "active" or doc.type_id == "rfc" %}
<div class="card mt-5">
<div class="card-header">
{% if doc.get_state_slug == "rfc" and not snapshot %}
{% if doc.type_id == "rfc" and not snapshot %}
RFC {{ rfc_number }}
{% else %}
{{ name }}-{{ doc.rev }}

View file

@ -3,7 +3,7 @@
{% load static %}
{% load ietf_filters %}
{% origin %}
<meta property="og:title" content="{% if doc.get_state_slug == 'rfc' and not snapshot %}RFC {{ rfc_number }}: {% endif %}{{ doc.title }}">
<meta property="og:title" content="{% if doc.type_id == 'rfc' and not snapshot %}RFC {{ rfc_number }}: {% endif %}{{ doc.title }}">
<meta property="og:url" content="{{ settings.IDTRACKER_BASE_URL }}{{ request.path }}">
<link rel="canonical" href="{{ settings.IDTRACKER_BASE_URL }}{{ request.path }}">
<meta property="og:site_name" content="IETF Datatracker">

View file

@ -17,14 +17,14 @@
</li>
{% endif %}
{% endfor %}
{% if doc.get_state_slug == 'rfc' %}
{% if doc.type_id == 'rfc' %}
<li class="page-item rfc{% if not snapshot %} active{% endif %}">
<a class="page-link"
href="{% if doc.doc %}{% if document_html %}{% url 'ietf.doc.views_doc.document_html' name=doc.doc.name %}{% else %}{% url 'ietf.doc.views_doc.document_main' name=doc.doc.name %}{% endif %}{% else %}{% if document_html %}{% url 'ietf.doc.views_doc.document_html' name=doc.name %}{% else %}{% url 'ietf.doc.views_doc.document_main' name=doc.name %}{% endif %}{% endif %}">
RFC {{ doc.rfc_number }}
</a>
</li>
{% elif doc.doc.get_state_slug == 'rfc' %}
{% elif doc.doc.type_id == 'rfc' %}
<li class="page-item rfc">
<a class="page-link"
href="{% if document_html %}{% url 'ietf.doc.views_doc.document_html' name=doc.doc.name %}{% else %}{% url 'ietf.doc.views_doc.document_main' name=doc.doc.name %}{% endif %}">

View file

@ -4,7 +4,7 @@
{% load ietf_filters ballot_icon person_filters %}
<td class="status bg-transparent">
<div class="float-end ms-1 mb-1" id="ballot-icon-{{ doc.name }}">{% ballot_icon doc %}</div>
{% if not doc.get_state_slug == "rfc" %}
{% if not doc.type_id == "rfc" %}
{% if '::' in doc.friendly_state %}
{{ doc.friendly_state|safe }}
{% else %}