feat(admin-docs): add base structure and templates for admin documentation
Introduce templates for admin documentation, including model details, views, template tags, filters, and bookmarklets. This enhances the admin interface by providing detailed documentation directly within the application.
This commit is contained in:
parent
c728204cb1
commit
f8f051f4e9
11 changed files with 575 additions and 0 deletions
34
engine/core/templates/admin_doc/bookmarklets.html
Normal file
34
engine/core/templates/admin_doc/bookmarklets.html
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
{% extends "admin/base_site.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block title %}{% translate "Documentation bookmarklets" %}{% endblock %}
|
||||
|
||||
{% block breadcrumbs %}
|
||||
<div class="flex gap-2 items-center px-4 py-3 text-sm text-base-400 dark:text-base-500">
|
||||
<a href="{% url 'admin:index' %}" class="hover:text-primary-600 dark:hover:text-primary-500">{% translate 'Home' %}</a>
|
||||
<span class="material-symbols-outlined md-18">chevron_right</span>
|
||||
<a href="{% url 'django-admindocs-docroot' %}" class="hover:text-primary-600 dark:hover:text-primary-500">{% translate 'Documentation' %}</a>
|
||||
<span class="material-symbols-outlined md-18">chevron_right</span>
|
||||
<span class="text-base-700 dark:text-base-300">{% translate 'Bookmarklets' %}</span>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1 class="font-semibold mb-4 text-xl text-base-900 dark:text-base-100">{% translate "Documentation bookmarklets" %}</h1>
|
||||
|
||||
<p class="text-sm text-base-500 dark:text-base-400 mb-6">{% blocktranslate trimmed %}
|
||||
To install bookmarklets, drag the link to your bookmarks toolbar, or right-click
|
||||
the link and add it to your bookmarks. Now you can select the bookmarklet
|
||||
from any page in the site.
|
||||
{% endblocktranslate %}</p>
|
||||
|
||||
<div class="border border-base-200 rounded-default bg-white shadow-xs dark:bg-base-900 dark:border-base-800">
|
||||
<div class="px-4 py-4">
|
||||
<div class="flex items-center gap-3 mb-2">
|
||||
<span class="material-symbols-outlined text-primary-600 dark:text-primary-500">bookmark</span>
|
||||
<a href="javascript:(function(){if(typeof XMLHttpRequest!='undefined'){x=new XMLHttpRequest()}else{return;}x.open('HEAD',location.href,false);x.send(null);try{view=x.getResponseHeader('x-view');}catch(e){alert('No view found for this page');return;}if(view=='undefined'){alert('No view found for this page');}document.location='{% url 'django-admindocs-views-index' %}'+view+'/';})()" class="font-semibold text-primary-600 dark:text-primary-500 hover:underline">{% translate "Documentation for this page" %}</a>
|
||||
</div>
|
||||
<p class="text-sm text-base-500 dark:text-base-400 ml-9">{% translate "Jumps you from any page to the documentation for the view that generates that page." %}</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
58
engine/core/templates/admin_doc/index.html
Normal file
58
engine/core/templates/admin_doc/index.html
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
{% extends "admin/base_site.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block title %}{% translate 'Documentation' %}{% endblock %}
|
||||
|
||||
{% block breadcrumbs %}
|
||||
<div class="flex gap-2 items-center px-4 py-3 text-sm text-base-400 dark:text-base-500">
|
||||
<a href="{% url 'admin:index' %}" class="hover:text-primary-600 dark:hover:text-primary-500">{% translate 'Home' %}</a>
|
||||
<span class="material-symbols-outlined md-18">chevron_right</span>
|
||||
<span class="text-base-700 dark:text-base-300">{% translate 'Documentation' %}</span>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1 class="font-semibold mb-6 text-xl text-base-900 dark:text-base-100">{% translate 'Documentation' %}</h1>
|
||||
|
||||
<div class="grid gap-4 sm:grid-cols-2 lg:grid-cols-3">
|
||||
<a href="models/" class="group border border-base-200 rounded-default bg-white p-5 shadow-xs hover:border-primary-300 hover:shadow-md transition dark:bg-base-900 dark:border-base-800 dark:hover:border-primary-700">
|
||||
<div class="flex items-center gap-3 mb-2">
|
||||
<span class="material-symbols-outlined text-primary-600 dark:text-primary-500">database</span>
|
||||
<h2 class="font-semibold text-base text-base-900 dark:text-base-100">{% translate 'Models' %}</h2>
|
||||
</div>
|
||||
<p class="text-sm text-base-500 dark:text-base-400">{% translate 'Models are descriptions of all the objects in the system and their associated fields. Each model has a list of fields which can be accessed as template variables' %}.</p>
|
||||
</a>
|
||||
|
||||
<a href="views/" class="group border border-base-200 rounded-default bg-white p-5 shadow-xs hover:border-primary-300 hover:shadow-md transition dark:bg-base-900 dark:border-base-800 dark:hover:border-primary-700">
|
||||
<div class="flex items-center gap-3 mb-2">
|
||||
<span class="material-symbols-outlined text-primary-600 dark:text-primary-500">visibility</span>
|
||||
<h2 class="font-semibold text-base text-base-900 dark:text-base-100">{% translate 'Views' %}</h2>
|
||||
</div>
|
||||
<p class="text-sm text-base-500 dark:text-base-400">{% translate 'Each page on the public site is generated by a view. The view defines which template is used to generate the page and which objects are available to that template.' %}</p>
|
||||
</a>
|
||||
|
||||
<a href="tags/" class="group border border-base-200 rounded-default bg-white p-5 shadow-xs hover:border-primary-300 hover:shadow-md transition dark:bg-base-900 dark:border-base-800 dark:hover:border-primary-700">
|
||||
<div class="flex items-center gap-3 mb-2">
|
||||
<span class="material-symbols-outlined text-primary-600 dark:text-primary-500">code</span>
|
||||
<h2 class="font-semibold text-base text-base-900 dark:text-base-100">{% translate 'Tags' %}</h2>
|
||||
</div>
|
||||
<p class="text-sm text-base-500 dark:text-base-400">{% translate 'List of all the template tags and their functions.' %}</p>
|
||||
</a>
|
||||
|
||||
<a href="filters/" class="group border border-base-200 rounded-default bg-white p-5 shadow-xs hover:border-primary-300 hover:shadow-md transition dark:bg-base-900 dark:border-base-800 dark:hover:border-primary-700">
|
||||
<div class="flex items-center gap-3 mb-2">
|
||||
<span class="material-symbols-outlined text-primary-600 dark:text-primary-500">filter_alt</span>
|
||||
<h2 class="font-semibold text-base text-base-900 dark:text-base-100">{% translate 'Filters' %}</h2>
|
||||
</div>
|
||||
<p class="text-sm text-base-500 dark:text-base-400">{% translate 'Filters are actions which can be applied to variables in a template to alter the output.' %}</p>
|
||||
</a>
|
||||
|
||||
<a href="bookmarklets/" class="group border border-base-200 rounded-default bg-white p-5 shadow-xs hover:border-primary-300 hover:shadow-md transition dark:bg-base-900 dark:border-base-800 dark:hover:border-primary-700">
|
||||
<div class="flex items-center gap-3 mb-2">
|
||||
<span class="material-symbols-outlined text-primary-600 dark:text-primary-500">bookmark</span>
|
||||
<h2 class="font-semibold text-base text-base-900 dark:text-base-100">{% translate 'Bookmarklets' %}</h2>
|
||||
</div>
|
||||
<p class="text-sm text-base-500 dark:text-base-400">{% translate 'Tools for your browser to quickly access admin functionality.' %}</p>
|
||||
</a>
|
||||
</div>
|
||||
{% endblock %}
|
||||
25
engine/core/templates/admin_doc/missing_docutils.html
Normal file
25
engine/core/templates/admin_doc/missing_docutils.html
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
{% extends "admin/base_site.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block title %}{% translate 'Please install docutils' %}{% endblock %}
|
||||
|
||||
{% block breadcrumbs %}
|
||||
<div class="flex gap-2 items-center px-4 py-3 text-sm text-base-400 dark:text-base-500">
|
||||
<a href="{% url 'admin:index' %}" class="hover:text-primary-600 dark:hover:text-primary-500">{% translate 'Home' %}</a>
|
||||
<span class="material-symbols-outlined md-18">chevron_right</span>
|
||||
<span class="text-base-700 dark:text-base-300">{% translate 'Documentation' %}</span>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="border border-amber-200 rounded-default bg-amber-50 shadow-xs p-6 dark:bg-amber-900/20 dark:border-amber-800">
|
||||
<div class="flex items-start gap-3">
|
||||
<span class="material-symbols-outlined text-amber-600 dark:text-amber-400 mt-0.5">warning</span>
|
||||
<div>
|
||||
<h1 class="font-semibold text-lg text-amber-800 dark:text-amber-200 mb-2">{% translate 'Documentation' %}</h1>
|
||||
<p class="text-sm text-amber-700 dark:text-amber-300 mb-2">{% blocktranslate with "https://docutils.sourceforge.io/" as link %}The admin documentation system requires Python's <a href="{{ link }}" class="underline font-medium">docutils</a> library.{% endblocktranslate %}</p>
|
||||
<p class="text-sm text-amber-700 dark:text-amber-300">{% blocktranslate with "https://pypi.org/project/docutils/" as link %}Please ask your administrators to install <a href="{{ link }}" class="underline font-medium">docutils</a>.{% endblocktranslate %}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
91
engine/core/templates/admin_doc/model_detail.html
Normal file
91
engine/core/templates/admin_doc/model_detail.html
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
{% extends "admin/base_site.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block title %}{% blocktranslate %}Model: {{ name }}{% endblocktranslate %}{% endblock %}
|
||||
|
||||
{% block breadcrumbs %}
|
||||
<div class="flex gap-2 items-center px-4 py-3 text-sm text-base-400 dark:text-base-500">
|
||||
<a href="{% url 'admin:index' %}" class="hover:text-primary-600 dark:hover:text-primary-500">{% translate 'Home' %}</a>
|
||||
<span class="material-symbols-outlined md-18">chevron_right</span>
|
||||
<a href="{% url 'django-admindocs-docroot' %}" class="hover:text-primary-600 dark:hover:text-primary-500">{% translate 'Documentation' %}</a>
|
||||
<span class="material-symbols-outlined md-18">chevron_right</span>
|
||||
<a href="{% url 'django-admindocs-models-index' %}" class="hover:text-primary-600 dark:hover:text-primary-500">{% translate 'Models' %}</a>
|
||||
<span class="material-symbols-outlined md-18">chevron_right</span>
|
||||
<span class="text-base-700 dark:text-base-300">{{ name }}</span>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="mb-6">
|
||||
<h1 class="font-semibold text-xl text-base-900 dark:text-base-100">{{ name }}</h1>
|
||||
{% if summary %}<p class="mt-1 text-sm text-base-500 dark:text-base-400">{{ summary }}</p>{% endif %}
|
||||
{% if description %}<div class="mt-2 text-sm text-base-600 dark:text-base-400 prose dark:prose-invert max-w-none">{{ description }}</div>{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="border border-base-200 rounded-default bg-white shadow-xs mb-6 dark:bg-base-900 dark:border-base-800">
|
||||
<div class="border-b border-base-200 dark:border-base-800 px-4 py-3">
|
||||
<h3 class="font-semibold text-base text-base-900 dark:text-base-100 flex items-center gap-2">
|
||||
<span class="material-symbols-outlined md-18 text-primary-600 dark:text-primary-500">list</span>
|
||||
{% translate 'Fields' %}
|
||||
</h3>
|
||||
</div>
|
||||
<div class="overflow-x-auto">
|
||||
<table class="w-full text-sm">
|
||||
<thead>
|
||||
<tr class="border-b border-base-200 dark:border-base-800 bg-base-50 dark:bg-base-800/50">
|
||||
<th class="px-4 py-2.5 text-left font-semibold text-base-700 dark:text-base-300">{% translate 'Field' %}</th>
|
||||
<th class="px-4 py-2.5 text-left font-semibold text-base-700 dark:text-base-300">{% translate 'Type' %}</th>
|
||||
<th class="px-4 py-2.5 text-left font-semibold text-base-700 dark:text-base-300">{% translate 'Description' %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-base-200 dark:divide-base-800">
|
||||
{% for field in fields|dictsort:"name" %}
|
||||
<tr class="hover:bg-base-50 dark:hover:bg-base-800/30 transition">
|
||||
<td class="px-4 py-2.5 font-mono text-sm text-base-900 dark:text-base-100 whitespace-nowrap">{{ field.name }}</td>
|
||||
<td class="px-4 py-2.5 text-base-500 dark:text-base-400 whitespace-nowrap">
|
||||
<span class="bg-base-100 dark:bg-base-800 px-2 py-0.5 rounded text-xs font-medium">{{ field.data_type }}</span>
|
||||
</td>
|
||||
<td class="px-4 py-2.5 text-base-600 dark:text-base-400">{{ field.verbose }}{% if field.help_text %} — {{ field.help_text|safe }}{% endif %}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if methods %}
|
||||
<div class="border border-base-200 rounded-default bg-white shadow-xs mb-6 dark:bg-base-900 dark:border-base-800">
|
||||
<div class="border-b border-base-200 dark:border-base-800 px-4 py-3">
|
||||
<h3 class="font-semibold text-base text-base-900 dark:text-base-100 flex items-center gap-2">
|
||||
<span class="material-symbols-outlined md-18 text-primary-600 dark:text-primary-500">function</span>
|
||||
{% translate 'Methods with arguments' %}
|
||||
</h3>
|
||||
</div>
|
||||
<div class="overflow-x-auto">
|
||||
<table class="w-full text-sm">
|
||||
<thead>
|
||||
<tr class="border-b border-base-200 dark:border-base-800 bg-base-50 dark:bg-base-800/50">
|
||||
<th class="px-4 py-2.5 text-left font-semibold text-base-700 dark:text-base-300">{% translate 'Method' %}</th>
|
||||
<th class="px-4 py-2.5 text-left font-semibold text-base-700 dark:text-base-300">{% translate 'Arguments' %}</th>
|
||||
<th class="px-4 py-2.5 text-left font-semibold text-base-700 dark:text-base-300">{% translate 'Description' %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-base-200 dark:divide-base-800">
|
||||
{% for method in methods|dictsort:"name" %}
|
||||
<tr class="hover:bg-base-50 dark:hover:bg-base-800/30 transition">
|
||||
<td class="px-4 py-2.5 font-mono text-sm text-base-900 dark:text-base-100 whitespace-nowrap">{{ method.name }}</td>
|
||||
<td class="px-4 py-2.5 font-mono text-xs text-base-500 dark:text-base-400">{{ method.arguments }}</td>
|
||||
<td class="px-4 py-2.5 text-base-600 dark:text-base-400">{{ method.verbose }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<a href="{% url 'django-admindocs-models-index' %}" class="inline-flex items-center gap-1 text-sm text-primary-600 dark:text-primary-500 hover:underline">
|
||||
<span class="material-symbols-outlined md-18">arrow_back</span>
|
||||
{% translate 'Back to Model documentation' %}
|
||||
</a>
|
||||
{% endblock %}
|
||||
55
engine/core/templates/admin_doc/model_index.html
Normal file
55
engine/core/templates/admin_doc/model_index.html
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
{% extends "admin/base_site.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block title %}{% translate 'Models' %}{% endblock %}
|
||||
|
||||
{% block breadcrumbs %}
|
||||
<div class="flex gap-2 items-center px-4 py-3 text-sm text-base-400 dark:text-base-500">
|
||||
<a href="{% url 'admin:index' %}" class="hover:text-primary-600 dark:hover:text-primary-500">{% translate 'Home' %}</a>
|
||||
<span class="material-symbols-outlined md-18">chevron_right</span>
|
||||
<a href="{% url 'django-admindocs-docroot' %}" class="hover:text-primary-600 dark:hover:text-primary-500">{% translate 'Documentation' %}</a>
|
||||
<span class="material-symbols-outlined md-18">chevron_right</span>
|
||||
<span class="text-base-700 dark:text-base-300">{% translate 'Models' %}</span>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1 class="font-semibold mb-6 text-xl text-base-900 dark:text-base-100">{% translate 'Model documentation' %}</h1>
|
||||
|
||||
{% regroup models by app_config as grouped_models %}
|
||||
|
||||
<div class="flex flex-col gap-4 lg:flex-row lg:gap-6">
|
||||
<div class="grow flex flex-col gap-4">
|
||||
{% for group in grouped_models %}
|
||||
<div id="app-{{ group.grouper.label }}" class="border border-base-200 rounded-default bg-white shadow-xs dark:bg-base-900 dark:border-base-800">
|
||||
<div class="border-b border-base-200 dark:border-base-800 px-4 py-3">
|
||||
<h2 class="font-semibold text-base text-base-900 dark:text-base-100">{{ group.grouper.verbose_name }}</h2>
|
||||
<span class="text-xs text-base-400 dark:text-base-500">{{ group.grouper.name }}</span>
|
||||
</div>
|
||||
<div class="divide-y divide-base-200 dark:divide-base-800">
|
||||
{% for model in group.list %}
|
||||
<a href="{% url 'django-admindocs-models-detail' app_label=model.app_label model_name=model.model_name %}" class="flex items-center gap-2 px-4 py-2.5 text-sm hover:bg-base-50 dark:hover:bg-base-800 transition">
|
||||
<span class="material-symbols-outlined md-18 text-base-400 dark:text-base-500">table_chart</span>
|
||||
<span class="text-primary-600 dark:text-primary-500 font-medium">{{ model.object_name }}</span>
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<div class="shrink-0 lg:w-56">
|
||||
<div class="border border-base-200 rounded-default bg-white shadow-xs sticky top-4 dark:bg-base-900 dark:border-base-800">
|
||||
<div class="border-b border-base-200 dark:border-base-800 px-4 py-3">
|
||||
<h2 class="font-semibold text-sm text-base-900 dark:text-base-100">{% translate 'Model groups' %}</h2>
|
||||
</div>
|
||||
<nav class="p-2">
|
||||
{% regroup models by app_config as grouped_models %}
|
||||
{% for group in grouped_models %}
|
||||
<a href="#app-{{ group.grouper.label }}" class="block px-3 py-1.5 rounded-default text-sm text-base-600 hover:bg-base-50 hover:text-primary-600 dark:text-base-400 dark:hover:bg-base-800 dark:hover:text-primary-500">{{ group.grouper.verbose_name }}</a>
|
||||
{% endfor %}
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
42
engine/core/templates/admin_doc/template_detail.html
Normal file
42
engine/core/templates/admin_doc/template_detail.html
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
{% extends "admin/base_site.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block title %}{% blocktranslate %}Template: {{ name }}{% endblocktranslate %}{% endblock %}
|
||||
|
||||
{% block breadcrumbs %}
|
||||
<div class="flex gap-2 items-center px-4 py-3 text-sm text-base-400 dark:text-base-500">
|
||||
<a href="{% url 'admin:index' %}" class="hover:text-primary-600 dark:hover:text-primary-500">{% translate 'Home' %}</a>
|
||||
<span class="material-symbols-outlined md-18">chevron_right</span>
|
||||
<a href="{% url 'django-admindocs-docroot' %}" class="hover:text-primary-600 dark:hover:text-primary-500">{% translate 'Documentation' %}</a>
|
||||
<span class="material-symbols-outlined md-18">chevron_right</span>
|
||||
<span class="text-base-700 dark:text-base-300">{% translate 'Templates' %}</span>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1 class="font-semibold mb-2 text-xl text-base-900 dark:text-base-100">{% blocktranslate %}Template: <code class="font-mono text-primary-600 dark:text-primary-500">{{ name }}</code>{% endblocktranslate %}</h1>
|
||||
|
||||
<div class="border border-base-200 rounded-default bg-white shadow-xs mb-6 dark:bg-base-900 dark:border-base-800">
|
||||
<div class="border-b border-base-200 dark:border-base-800 px-4 py-3">
|
||||
<h2 class="font-semibold text-base text-base-900 dark:text-base-100">{% blocktranslate %}Search path for template <code class="font-mono">{{ name }}</code>:{% endblocktranslate %}</h2>
|
||||
</div>
|
||||
<div class="divide-y divide-base-200 dark:divide-base-800">
|
||||
{% for template in templates|dictsort:"order" %}
|
||||
<div class="flex items-center gap-2 px-4 py-2.5 text-sm">
|
||||
<span class="text-base-400 dark:text-base-500 font-mono text-xs w-6 text-right shrink-0">{{ template.order }}</span>
|
||||
<code class="font-mono text-sm {% if template.exists %}text-base-900 dark:text-base-100{% else %}text-base-400 dark:text-base-600{% endif %}">{{ template.file }}</code>
|
||||
{% if not template.exists %}
|
||||
<span class="bg-base-100 dark:bg-base-800 px-2 py-0.5 rounded text-xs text-base-400 dark:text-base-500">{% translate '(does not exist)' %}</span>
|
||||
{% else %}
|
||||
<span class="material-symbols-outlined md-18 text-green-500">check_circle</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a href="{% url 'django-admindocs-docroot' %}" class="inline-flex items-center gap-1 text-sm text-primary-600 dark:text-primary-500 hover:underline">
|
||||
<span class="material-symbols-outlined md-18">arrow_back</span>
|
||||
{% translate 'Back to Documentation' %}
|
||||
</a>
|
||||
{% endblock %}
|
||||
63
engine/core/templates/admin_doc/template_filter_index.html
Normal file
63
engine/core/templates/admin_doc/template_filter_index.html
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
{% extends "admin/base_site.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block title %}{% translate 'Template filters' %}{% endblock %}
|
||||
|
||||
{% block breadcrumbs %}
|
||||
<div class="flex gap-2 items-center px-4 py-3 text-sm text-base-400 dark:text-base-500">
|
||||
<a href="{% url 'admin:index' %}" class="hover:text-primary-600 dark:hover:text-primary-500">{% translate 'Home' %}</a>
|
||||
<span class="material-symbols-outlined md-18">chevron_right</span>
|
||||
<a href="{% url 'django-admindocs-docroot' %}" class="hover:text-primary-600 dark:hover:text-primary-500">{% translate 'Documentation' %}</a>
|
||||
<span class="material-symbols-outlined md-18">chevron_right</span>
|
||||
<span class="text-base-700 dark:text-base-300">{% translate 'Filters' %}</span>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1 class="font-semibold mb-6 text-xl text-base-900 dark:text-base-100">{% translate 'Template filter documentation' %}</h1>
|
||||
|
||||
{% regroup filters|dictsort:"library" by library as filter_libraries %}
|
||||
|
||||
<div class="flex flex-col gap-4 lg:flex-row lg:gap-6">
|
||||
<div class="grow flex flex-col gap-4">
|
||||
{% for library in filter_libraries %}
|
||||
<div class="border border-base-200 rounded-default bg-white shadow-xs dark:bg-base-900 dark:border-base-800">
|
||||
<div class="border-b border-base-200 dark:border-base-800 px-4 py-3">
|
||||
<h2 class="font-semibold text-base text-base-900 dark:text-base-100">{% firstof library.grouper _("Built-in filters") %}</h2>
|
||||
{% if library.grouper %}
|
||||
<p class="mt-1 text-xs text-base-400 dark:text-base-500">
|
||||
{% blocktranslate with code="{"|add:"% load "|add:library.grouper|add:" %"|add:"}" %}To use these filters, put <code class="font-mono bg-base-100 dark:bg-base-800 px-1 py-0.5 rounded">{{ code }}</code> in your template before using the filter.{% endblocktranslate %}
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="divide-y divide-base-200 dark:divide-base-800">
|
||||
{% for filter in library.list|dictsort:"name" %}
|
||||
<div id="{{ library.grouper|default:"built_in" }}-{{ filter.name }}" class="px-4 py-3">
|
||||
<h3 class="font-mono font-semibold text-sm text-base-900 dark:text-base-100">{{ filter.name }}</h3>
|
||||
<div class="mt-1 text-sm text-base-600 dark:text-base-400 prose dark:prose-invert max-w-none prose-sm">
|
||||
{{ filter.title }}
|
||||
{{ filter.body }}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<div class="shrink-0 lg:w-56">
|
||||
{% for library in filter_libraries %}
|
||||
<div class="border border-base-200 rounded-default bg-white shadow-xs sticky top-4 mb-4 dark:bg-base-900 dark:border-base-800">
|
||||
<div class="border-b border-base-200 dark:border-base-800 px-4 py-3">
|
||||
<h2 class="font-semibold text-sm text-base-900 dark:text-base-100">{% firstof library.grouper _("Built-in filters") %}</h2>
|
||||
</div>
|
||||
<nav class="p-2 max-h-96 overflow-y-auto">
|
||||
{% for filter in library.list|dictsort:"name" %}
|
||||
<a href="#{{ library.grouper|default:"built_in" }}-{{ filter.name }}" class="block px-3 py-1 rounded-default text-xs font-mono text-base-600 hover:bg-base-50 hover:text-primary-600 dark:text-base-400 dark:hover:bg-base-800 dark:hover:text-primary-500">{{ filter.name }}</a>
|
||||
{% endfor %}
|
||||
</nav>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
63
engine/core/templates/admin_doc/template_tag_index.html
Normal file
63
engine/core/templates/admin_doc/template_tag_index.html
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
{% extends "admin/base_site.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block title %}{% translate 'Template tags' %}{% endblock %}
|
||||
|
||||
{% block breadcrumbs %}
|
||||
<div class="flex gap-2 items-center px-4 py-3 text-sm text-base-400 dark:text-base-500">
|
||||
<a href="{% url 'admin:index' %}" class="hover:text-primary-600 dark:hover:text-primary-500">{% translate 'Home' %}</a>
|
||||
<span class="material-symbols-outlined md-18">chevron_right</span>
|
||||
<a href="{% url 'django-admindocs-docroot' %}" class="hover:text-primary-600 dark:hover:text-primary-500">{% translate 'Documentation' %}</a>
|
||||
<span class="material-symbols-outlined md-18">chevron_right</span>
|
||||
<span class="text-base-700 dark:text-base-300">{% translate 'Tags' %}</span>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1 class="font-semibold mb-6 text-xl text-base-900 dark:text-base-100">{% translate 'Template tag documentation' %}</h1>
|
||||
|
||||
{% regroup tags|dictsort:"library" by library as tag_libraries %}
|
||||
|
||||
<div class="flex flex-col gap-4 lg:flex-row lg:gap-6">
|
||||
<div class="grow flex flex-col gap-4">
|
||||
{% for library in tag_libraries %}
|
||||
<div class="border border-base-200 rounded-default bg-white shadow-xs dark:bg-base-900 dark:border-base-800">
|
||||
<div class="border-b border-base-200 dark:border-base-800 px-4 py-3">
|
||||
<h2 class="font-semibold text-base text-base-900 dark:text-base-100">{% firstof library.grouper _("Built-in tags") %}</h2>
|
||||
{% if library.grouper %}
|
||||
<p class="mt-1 text-xs text-base-400 dark:text-base-500">
|
||||
{% blocktranslate with code="{"|add:"% load "|add:library.grouper|add:" %"|add:"}" %}To use these tags, put <code class="font-mono bg-base-100 dark:bg-base-800 px-1 py-0.5 rounded">{{ code }}</code> in your template before using the tag.{% endblocktranslate %}
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="divide-y divide-base-200 dark:divide-base-800">
|
||||
{% for tag in library.list|dictsort:"name" %}
|
||||
<div id="{{ library.grouper|default:"built_in" }}-{{ tag.name }}" class="px-4 py-3">
|
||||
<h3 class="font-mono font-semibold text-sm text-base-900 dark:text-base-100">{{ tag.name }}</h3>
|
||||
<div class="mt-1 text-sm text-base-600 dark:text-base-400 prose dark:prose-invert max-w-none prose-sm">
|
||||
<p class="font-medium">{{ tag.title|striptags }}</p>
|
||||
{{ tag.body }}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<div class="shrink-0 lg:w-56">
|
||||
{% for library in tag_libraries %}
|
||||
<div class="border border-base-200 rounded-default bg-white shadow-xs sticky top-4 mb-4 dark:bg-base-900 dark:border-base-800">
|
||||
<div class="border-b border-base-200 dark:border-base-800 px-4 py-3">
|
||||
<h2 class="font-semibold text-sm text-base-900 dark:text-base-100">{% firstof library.grouper _("Built-in tags") %}</h2>
|
||||
</div>
|
||||
<nav class="p-2 max-h-96 overflow-y-auto">
|
||||
{% for tag in library.list|dictsort:"name" %}
|
||||
<a href="#{{ library.grouper|default:"built_in" }}-{{ tag.name }}" class="block px-3 py-1 rounded-default text-xs font-mono text-base-600 hover:bg-base-50 hover:text-primary-600 dark:text-base-400 dark:hover:bg-base-800 dark:hover:text-primary-500">{{ tag.name }}</a>
|
||||
{% endfor %}
|
||||
</nav>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
43
engine/core/templates/admin_doc/view_detail.html
Normal file
43
engine/core/templates/admin_doc/view_detail.html
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
{% extends "admin/base_site.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block title %}{% blocktranslate %}View: {{ name }}{% endblocktranslate %}{% endblock %}
|
||||
|
||||
{% block breadcrumbs %}
|
||||
<div class="flex gap-2 items-center px-4 py-3 text-sm text-base-400 dark:text-base-500">
|
||||
<a href="{% url 'admin:index' %}" class="hover:text-primary-600 dark:hover:text-primary-500">{% translate 'Home' %}</a>
|
||||
<span class="material-symbols-outlined md-18">chevron_right</span>
|
||||
<a href="{% url 'django-admindocs-docroot' %}" class="hover:text-primary-600 dark:hover:text-primary-500">{% translate 'Documentation' %}</a>
|
||||
<span class="material-symbols-outlined md-18">chevron_right</span>
|
||||
<a href="{% url 'django-admindocs-views-index' %}" class="hover:text-primary-600 dark:hover:text-primary-500">{% translate 'Views' %}</a>
|
||||
<span class="material-symbols-outlined md-18">chevron_right</span>
|
||||
<span class="text-base-700 dark:text-base-300">{{ name }}</span>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="border border-base-200 rounded-default bg-white shadow-xs mb-6 dark:bg-base-900 dark:border-base-800">
|
||||
<div class="border-b border-base-200 dark:border-base-800 px-4 py-3">
|
||||
<h1 class="font-semibold text-lg text-base-900 dark:text-base-100">{{ name }}</h1>
|
||||
{% if summary %}<p class="mt-1 text-sm text-base-500 dark:text-base-400">{{ summary }}</p>{% endif %}
|
||||
</div>
|
||||
<div class="px-4 py-4 text-sm text-base-600 dark:text-base-400 prose dark:prose-invert max-w-none">
|
||||
{{ body }}
|
||||
|
||||
{% if meta.Context %}
|
||||
<h3 class="font-semibold text-base-900 dark:text-base-100 mt-4 mb-1">{% translate 'Context:' %}</h3>
|
||||
<p>{{ meta.Context }}</p>
|
||||
{% endif %}
|
||||
|
||||
{% if meta.Templates %}
|
||||
<h3 class="font-semibold text-base-900 dark:text-base-100 mt-4 mb-1">{% translate 'Templates:' %}</h3>
|
||||
<p>{{ meta.Templates }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a href="{% url 'django-admindocs-views-index' %}" class="inline-flex items-center gap-1 text-sm text-primary-600 dark:text-primary-500 hover:underline">
|
||||
<span class="material-symbols-outlined md-18">arrow_back</span>
|
||||
{% translate 'Back to View documentation' %}
|
||||
</a>
|
||||
{% endblock %}
|
||||
66
engine/core/templates/admin_doc/view_index.html
Normal file
66
engine/core/templates/admin_doc/view_index.html
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
{% extends "admin/base_site.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block title %}{% translate 'Views' %}{% endblock %}
|
||||
|
||||
{% block breadcrumbs %}
|
||||
<div class="flex gap-2 items-center px-4 py-3 text-sm text-base-400 dark:text-base-500">
|
||||
<a href="{% url 'admin:index' %}" class="hover:text-primary-600 dark:hover:text-primary-500">{% translate 'Home' %}</a>
|
||||
<span class="material-symbols-outlined md-18">chevron_right</span>
|
||||
<a href="{% url 'django-admindocs-docroot' %}" class="hover:text-primary-600 dark:hover:text-primary-500">{% translate 'Documentation' %}</a>
|
||||
<span class="material-symbols-outlined md-18">chevron_right</span>
|
||||
<span class="text-base-700 dark:text-base-300">{% translate 'Views' %}</span>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1 class="font-semibold mb-6 text-xl text-base-900 dark:text-base-100">{% translate 'View documentation' %}</h1>
|
||||
|
||||
{% regroup views|dictsort:'namespace' by namespace as views_by_ns %}
|
||||
|
||||
<div class="flex flex-col gap-4 lg:flex-row lg:gap-6">
|
||||
<div class="grow flex flex-col gap-4">
|
||||
{% for ns_views in views_by_ns %}
|
||||
<div id="ns-{{ ns_views.grouper|default:'empty' }}" class="border border-base-200 rounded-default bg-white shadow-xs dark:bg-base-900 dark:border-base-800">
|
||||
<div class="border-b border-base-200 dark:border-base-800 px-4 py-3">
|
||||
<h2 class="font-semibold text-base text-base-900 dark:text-base-100">
|
||||
{% if ns_views.grouper %}
|
||||
{% blocktranslate with ns_views.grouper as name %}Views by namespace {{ name }}{% endblocktranslate %}
|
||||
{% else %}
|
||||
{% blocktranslate %}Views by empty namespace{% endblocktranslate %}
|
||||
{% endif %}
|
||||
</h2>
|
||||
</div>
|
||||
<div class="divide-y divide-base-200 dark:divide-base-800">
|
||||
{% for view in ns_views.list|dictsort:"url" %}
|
||||
{% ifchanged %}
|
||||
<div class="px-4 py-3 hover:bg-base-50 dark:hover:bg-base-800/30 transition">
|
||||
<a href="{% url 'django-admindocs-views-detail' view=view.full_name %}" class="font-mono text-sm text-primary-600 dark:text-primary-500 hover:underline">{{ view.url }}</a>
|
||||
<p class="mt-1 text-xs text-base-400 dark:text-base-500">
|
||||
{% blocktranslate with view.full_name as full_name and view.url_name as url_name %}View function: <code>{{ full_name }}</code>. Name: <code>{{ url_name }}</code>.{% endblocktranslate %}
|
||||
</p>
|
||||
{% if view.title %}<p class="mt-1 text-sm text-base-600 dark:text-base-400">{{ view.title }}</p>{% endif %}
|
||||
</div>
|
||||
{% endifchanged %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<div class="shrink-0 lg:w-56">
|
||||
<div class="border border-base-200 rounded-default bg-white shadow-xs sticky top-4 dark:bg-base-900 dark:border-base-800">
|
||||
<div class="border-b border-base-200 dark:border-base-800 px-4 py-3">
|
||||
<h2 class="font-semibold text-sm text-base-900 dark:text-base-100">{% translate 'Jump to namespace' %}</h2>
|
||||
</div>
|
||||
<nav class="p-2">
|
||||
{% for ns_views in views_by_ns %}
|
||||
<a href="#ns-{{ ns_views.grouper|default:'empty' }}" class="block px-3 py-1.5 rounded-default text-sm text-base-600 hover:bg-base-50 hover:text-primary-600 dark:text-base-400 dark:hover:bg-base-800 dark:hover:text-primary-500">
|
||||
{% if ns_views.grouper %}{{ ns_views.grouper }}{% else %}{% translate "Empty namespace" %}{% endif %}
|
||||
</a>
|
||||
{% endfor %}
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
35
engine/core/templates/unfold/helpers/fieldsets_tabs.html
Normal file
35
engine/core/templates/unfold/helpers/fieldsets_tabs.html
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
{% load unfold %}
|
||||
{% load filters %}
|
||||
|
||||
{% with tabs=adminform|tabs %}
|
||||
{% if tabs %}
|
||||
{% with active_tab=tabs|tabs_active_unicode %}
|
||||
<div class="{% fieldset_rows_classes %}" x-data="{ activeFieldsetTab: '{{ active_tab }}'}" x-show="activeTab == 'general'">
|
||||
<div class="{% if adminform.model_admin.compressed_fields %}border-b border-base-200 border-dashed dark:border-base-800{% endif %}">
|
||||
<nav class="bg-base-100 cursor-pointer flex flex-col font-medium gap-1 m-2 p-1 rounded-default text-important dark:border-base-700 md:inline-flex md:flex-row md:w-auto dark:bg-white/[.06] *:flex *:flex-row *:gap-1 *:items-center *:px-2.5 *:py-[5px] *:rounded-default *:hover:bg-base-700/[.06] *:dark:hover:bg-white/[.06] [&>.active]:bg-white [&>.active]:shadow-xs [&>.active]:dark:bg-base-700 [&>.active]:hover:bg-white [&>.active]:dark:hover:bg-base-700">
|
||||
{% for fieldset in tabs %}
|
||||
<a x-on:click="activeFieldsetTab = '{{ fieldset.name|unicode_slugify }}'" x-bind:class="activeFieldsetTab == '{{ fieldset.name|unicode_slugify }}' && 'active'">
|
||||
{{ fieldset.name }}
|
||||
|
||||
{% with error_count=fieldset|tabs_errors_count %}
|
||||
{% if error_count > 0 %}
|
||||
<span data-testid="error-count" class="bg-red-500 inline-flex font-semibold items-center justify-center leading-none rounded-full w-4 h-4 text-white relative text-center text-[11px] whitespace-nowrap uppercase">
|
||||
{{ error_count }}
|
||||
</span>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
</a>
|
||||
{% endfor %}
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
{% for fieldset in tabs %}
|
||||
<div class="tab-wrapper{% if fieldset.name %} fieldset-{{ fieldset.name|unicode_slugify }}{% endif %}"
|
||||
x-show="activeFieldsetTab == '{{ fieldset.name|unicode_slugify }}'">
|
||||
{% include 'admin/includes/fieldset.html' with stacked=1 %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
Loading…
Reference in a new issue