mirror of
https://github.com/daniviga/django-ram.git
synced 2026-02-04 01:50:39 +01:00
More templates modularization
This commit is contained in:
26
ram/portal/templates/_includes/documents.html
Normal file
26
ram/portal/templates/_includes/documents.html
Normal file
@@ -0,0 +1,26 @@
|
||||
{% if documents %}
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="3" scope="row">{{ header|default:"Documents" }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="table-group-divider">
|
||||
{% for d in documents.all %}
|
||||
<tr>
|
||||
<td class="w-33">{{ d.description }}</td>
|
||||
<td class="text-nowrap">
|
||||
{% if d.private %}
|
||||
<i class="bi bi-file-earmark-lock2"></i>
|
||||
{% else %}
|
||||
<i class="bi bi-file-earmark-text"></i>
|
||||
{% endif %}
|
||||
<a href="{{ d.file.url }}" target="_blank">{{ d.filename }}</a>
|
||||
</td>
|
||||
<td class="text-end">{{ d.file.size | filesizeformat }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endif %}
|
||||
|
||||
36
ram/portal/templates/_includes/footer.html
Normal file
36
ram/portal/templates/_includes/footer.html
Normal file
@@ -0,0 +1,36 @@
|
||||
<footer class="text-body-secondary py-4">
|
||||
<div class="container d-lg-flex justify-content-between">
|
||||
<div id="footer" class="mb-1">
|
||||
<p>© {% now "Y" %}</p> {{ site_conf.footer | safe }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="container">
|
||||
<div id="footer_extended">
|
||||
{{ site_conf.footer_extended | safe }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="container d-flex text-body-secondary">
|
||||
<p class="flex-fill small">Made with ❤️ for 🚂 and <i class="bi bi-github"></i> <a href="https://github.com/daniviga/django-ram">django-ram</a>
|
||||
{% if site_conf.show_version %}<br>Version {{ site_conf.version }}{% endif %}</p>
|
||||
<p class="text-end">
|
||||
{% if site_conf.disclaimer %}
|
||||
<a title="Disclaimer" href="" data-bs-toggle="modal" data-bs-target="#disclaimerModal"><i class="text-muted d-lg-none fs-5 bi bi-info-square-fill"></i><span class="d-none d-lg-inline small">Disclaimer</span></a><span class="d-none d-lg-inline small"> | </span>
|
||||
{% endif %}
|
||||
<a title="Back to top" href="#"><i class="text-muted d-lg-none fs-5 bi bi-arrow-up-left-square-fill"></i><span class="d-none d-lg-inline small">Back to top</span></a>
|
||||
</p>
|
||||
</div>
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="disclaimerModal" tabindex="-1" aria-labelledby="disclaimerLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-scrollable modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h1 class="modal-title fs-5" id="disclaimerLabel">Disclaimer</h1>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
{{ site_conf.disclaimer | safe }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
7
ram/portal/templates/_includes/header.html
Normal file
7
ram/portal/templates/_includes/header.html
Normal file
@@ -0,0 +1,7 @@
|
||||
<section class="py-4 text-center container">
|
||||
<div class="row">
|
||||
<div class="mx-auto">
|
||||
{% block header_content %}{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
56
ram/portal/templates/_includes/login.html
Normal file
56
ram/portal/templates/_includes/login.html
Normal file
@@ -0,0 +1,56 @@
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#loginNavbar" aria-controls="loginNavbar" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="bi bi-person-fill-gear"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse justify-content-end" id="loginNavbar">
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item dropdown">
|
||||
{% if request.user.is_staff %}
|
||||
<a class="nav-link dropdown-toggle" href="#" role="button" id="dropdownLogin" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
Welcome back, <strong>{{ request.user }}</strong>
|
||||
</a>
|
||||
<ul class="dropdown-menu" aria-labelledby="dropdownLogin">
|
||||
<li><a class="dropdown-item" href="{% url 'admin:roster_rollingstock_changelist' %}">Rolling stock</a></li>
|
||||
<li><a class="dropdown-item" href="{% url 'admin:consist_consist_changelist' %}">Consists</a></li>
|
||||
<li><a class="dropdown-item" href="{% url 'admin:app_list' 'bookshelf' %}">Bookshelf</a></li>
|
||||
<li><a class="dropdown-item" href="{% url 'admin:portal_flatpage_changelist' %}">Pages</a></li>
|
||||
<li><a class="dropdown-item" href="{% url 'admin:app_list' 'repository' %}">Repository</a></li>
|
||||
<li><a class="dropdown-item" href="{% url 'admin:app_list' 'metadata' %}">Metadata</a></li>
|
||||
<li><hr class="dropdown-divider"></li>
|
||||
<li><a class="dropdown-item" href="{% url 'admin:index' %}">Admin</a></li>
|
||||
<li><a class="dropdown-item" href="{% url 'admin:portal_siteconfiguration_changelist' %}">Site configuration</a></li>
|
||||
<li><hr class="dropdown-divider"></li>
|
||||
<li>
|
||||
<form id="logout-form" method="post" action="{% url 'admin:logout' %}?next={{ request.path }}">
|
||||
{% csrf_token %}
|
||||
<button class="btn btn-link dropdown-item text-danger" type="submit">Log out</button>
|
||||
</form>
|
||||
</li>
|
||||
</ul>
|
||||
{% else %}
|
||||
<a class="nav-link" href="{% url 'admin:login' %}?next={{ request.path }}">Log in</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
<li class="nav-item dropdown">
|
||||
<a class="theme-icon-active nav-link dropdown-toggle" href="#" role="button" id="bd-theme" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
<i class="bi bi-circle-half"></i>
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="bd-theme">
|
||||
<li>
|
||||
<button class="theme-icon dropdown-item" data-bs-theme-value="light" aria-pressed="false">
|
||||
<span class="me-2"><i class="bi bi-sun-fill"></i></span> Light
|
||||
</button>
|
||||
</li>
|
||||
<li>
|
||||
<button class="theme-icon dropdown-item" data-bs-theme-value="dark" aria-pressed="false">
|
||||
<span class="me-2"><i class="bi bi-moon-stars-fill"></i></span> Dark
|
||||
</button>
|
||||
</li>
|
||||
<li>
|
||||
<button class="theme-icon dropdown-item" data-bs-theme-value="auto" aria-pressed="false">
|
||||
<span class="me-2"><i class="bi bi-circle-half"></i></span> Auto
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
30
ram/portal/templates/_includes/search.html
Normal file
30
ram/portal/templates/_includes/search.html
Normal file
@@ -0,0 +1,30 @@
|
||||
<form class="d-flex needs-validation" action="{% url 'search' %}" method="post" novalidate>{% csrf_token %}
|
||||
<div class="input-group has-validation">
|
||||
<input class="form-control" type="search" list="datalistOptions" placeholder="Search" aria-label="Search" name="search" id="searchValidation" required>
|
||||
<datalist id="datalistOptions">
|
||||
<option value="company: ">
|
||||
<option value="manufacturer: ">
|
||||
<option value="scale: ">
|
||||
<option value="type: ">
|
||||
</datalist>
|
||||
<button class="btn btn-outline-primary" type="submit">Search</button>
|
||||
</div>
|
||||
</form>
|
||||
<script>
|
||||
(function () {
|
||||
'use strict'
|
||||
// Fetch all the forms we want to apply custom Bootstrap validation styles to
|
||||
var forms = document.querySelectorAll('.needs-validation')
|
||||
// Loop over them and prevent submission
|
||||
Array.prototype.slice.call(forms)
|
||||
.forEach(function (form) {
|
||||
form.addEventListener('submit', function (event) {
|
||||
if (!form.checkValidity()) {
|
||||
form.classList.add('was-validated')
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
}
|
||||
}, false)
|
||||
})
|
||||
})()
|
||||
</script>
|
||||
39
ram/portal/templates/_includes/symbols.html
Normal file
39
ram/portal/templates/_includes/symbols.html
Normal file
@@ -0,0 +1,39 @@
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="symbolsModal" tabindex="-1" aria-labelledby="symbolsLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-scrollable modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h1 class="modal-title fs-5" id="symbolsLabel">Symbols</h1>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2" scope="row">DCC symbols</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="table-group-divider">
|
||||
<tr>
|
||||
<th scope="row" class="text-center"><i class="bi bi-ban small"></i></th>
|
||||
<td>No socket</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row" class="text-center"><i class="bi bi-dice-6 small"></i></th>
|
||||
<td>Socket available</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row" class="text-center"><i class="bi bi-arrow-bar-left"></i><i class="bi bi-cpu-fill small"></i></th>
|
||||
<td>Decoder installed</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row" class="text-center"><i class="bi bi-arrow-bar-left"></i><i class="bi bi-volume-up-fill small"></i></th>
|
||||
<td>Sound decoder installed</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user