feat(base): add dynamic docs icon

specifying `context['model_docs_path']` with the path will add the docs icon

!21
This commit is contained in:
2024-06-12 05:06:22 +09:30
parent 4016d4c200
commit 87282ce41c
3 changed files with 11 additions and 1 deletions

View File

@ -24,7 +24,7 @@ SETTINGS_DIR = '/etc/itsm' # Primary Settings Directory
BUILD_REPO = os.getenv('CI_PROJECT_URL')
BUILD_SHA = os.getenv('CI_COMMIT_SHA')
BUILD_VERSION = os.getenv('CI_COMMIT_TAG')
DOCS_ROOT = 'https://django-app-nofusscomputing-infrastructure-config-97663cd48b4029.gitlab.io/projects/django-template/'
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/

View File

@ -72,6 +72,10 @@ section h2 span svg {
fill: #ff0000;
}
.icon-help svg {
fill: #177ee6;
}
</style>
<section>
@ -81,6 +85,11 @@ section h2 span svg {
{% include 'icons/delete.svg' %}
</span>
{% endif %}
{% if model_docs_path %}
<span title="Documentation" id="content_header_icon" class="icon-help" onclick="window.open('{% settings_value 'DOCS_ROOT' %}{{ model_docs_path }}', '_blank')">
{% include 'icons/help.svg' %}
</span>
{% endif %}
{% if model_name and model_pk %}
{% block content_header_icon %}
<span title="View History" id="content_header_icon" onclick="window.location='{% url '_history' model_name=model_name model_pk=model_pk %}';">

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" ><path d="M478-240q21 0 35.5-14.5T528-290q0-21-14.5-35.5T478-340q-21 0-35.5 14.5T428-290q0 21 14.5 35.5T478-240Zm-36-154h74q0-33 7.5-52t42.5-52q26-26 41-49.5t15-56.5q0-56-41-86t-97-30q-57 0-92.5 30T342-618l66 26q5-18 22.5-39t53.5-21q32 0 48 17.5t16 38.5q0 20-12 37.5T506-526q-44 39-54 59t-10 73Zm38 314q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z"/></svg>

After

Width:  |  Height:  |  Size: 654 B