diff --git a/core/models.py b/core/models.py index 5720e62..5535639 100644 --- a/core/models.py +++ b/core/models.py @@ -1,3 +1,4 @@ +from itertools import chain from django.db import models from django.db.models import Q from django.contrib.auth.models import User @@ -46,6 +47,16 @@ def __str__(self): def is_published(self): return self.published_at and self.published_at >= timezone.now() + @property + def url_providers(self): + documentation_items = self.documentationitem_set.all() + schema_refs = self.schemaref_set.all() + provider_names = { + reference_item.url_provider_info.provider_name + for reference_item in chain(documentation_items, schema_refs) + } + return provider_names + def _latest_documentation_item_of_type(self, role): return self.documentationitem_set.filter(role=role).order_by('-created_at').first() diff --git a/core/static/css/site.css b/core/static/css/site.css index 2f729bd..d0685fe 100644 --- a/core/static/css/site.css +++ b/core/static/css/site.css @@ -51,6 +51,12 @@ a:hover { color: var(--text-link-color-highlight); } +.text-with-icon { + display: flex; + align-items: center; + gap: 0.25rem; +} + input, select { border-radius: 8px; @@ -557,6 +563,15 @@ a.badge--w3c { color: #005a9c; } +.badge--github { + padding: 0; +} + +.badge--github svg { + width: 1.5rem; + height: 1.5rem; +} + .info-box { background: #172554; color: #bfdbfe; @@ -740,6 +755,11 @@ a.badge--w3c { color: var(--text-secondary); } +.schema-layout .schema-layout__extra .badges { + display: flex; + flex-wrap: wrap; +} + .schema-layout .schema-layout__extra .detail-list, .schema-layout .schema-layout__extra .detail-list li { display: flex; diff --git a/core/templates/core/icons/GitHub_Invertocat_Light.svg b/core/templates/core/icons/GitHub_Invertocat_Light.svg new file mode 100644 index 0000000..e0510c7 --- /dev/null +++ b/core/templates/core/icons/GitHub_Invertocat_Light.svg @@ -0,0 +1,15 @@ + + + + diff --git a/core/templates/core/index.html b/core/templates/core/index.html index ce7da75..1d3c528 100644 --- a/core/templates/core/index.html +++ b/core/templates/core/index.html @@ -56,22 +56,20 @@
{{ schema_ref.content|escape }}
{% endif %}
+ - View source + View source{{ schema_ref|branded_external_link_icon_for_reference_item }}
{% endblock %} diff --git a/core/templates/core/schemas/layout.html b/core/templates/core/schemas/layout.html index e8382bc..85c4b2a 100644 --- a/core/templates/core/schemas/layout.html +++ b/core/templates/core/schemas/layout.html @@ -50,9 +50,9 @@