mirror of
https://github.com/daniviga/django-ram.git
synced 2025-08-07 14:47:49 +02:00
Compare commits
16 Commits
Author | SHA1 | Date | |
---|---|---|---|
9b8ec6ba6b
|
|||
c0b1b0b37b
|
|||
169763e237 | |||
bbe0758c6b
|
|||
c73305fd85
|
|||
4a3fbda3dc
|
|||
295965710f | |||
c152f43aa6
|
|||
8ed92dc5f0
|
|||
b70aa27a13
|
|||
3860ed70fd
|
|||
68a18fcf58 | |||
e45d11d4b1
|
|||
32b5522a1e | |||
89b666dab2 | |||
ffad964373
|
2
.github/workflows/django.yml
vendored
2
.github/workflows/django.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
max-parallel: 2
|
max-parallel: 2
|
||||||
matrix:
|
matrix:
|
||||||
python-version: ['3.9', '3.10']
|
python-version: ['3.9', '3.10', '3.11']
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
@@ -21,7 +21,7 @@ it has been developed with a commitment of few minutes a day;
|
|||||||
it lacks any kind of documentation, code review, architectural review,
|
it lacks any kind of documentation, code review, architectural review,
|
||||||
security assesment, pentest, ISO certification, etc.
|
security assesment, pentest, ISO certification, etc.
|
||||||
|
|
||||||
This project probably doesn't match you needs nor expectations. Be aware.
|
This project probably doesn't match your needs nor expectations. Be aware.
|
||||||
|
|
||||||
Your model train may also catch fire while using this software.
|
Your model train may also catch fire while using this software.
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ It has been developed with:
|
|||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
- Python 3.8+
|
- Python 3.9+
|
||||||
- A USB port when running Arduino hardware (and adaptors if you have a Mac)
|
- A USB port when running Arduino hardware (and adaptors if you have a Mac)
|
||||||
|
|
||||||
## Web portal installation
|
## Web portal installation
|
||||||
|
17
ram/consist/migrations/0008_alter_consist_options.py
Normal file
17
ram/consist/migrations/0008_alter_consist_options.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# Generated by Django 4.1.3 on 2023-01-02 15:03
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("consist", "0007_alter_consist_image"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name="consist",
|
||||||
|
options={"ordering": ["company", "-creation_time"]},
|
||||||
|
),
|
||||||
|
]
|
@@ -32,7 +32,7 @@ class Consist(models.Model):
|
|||||||
return reverse("consist", kwargs={"uuid": self.uuid})
|
return reverse("consist", kwargs={"uuid": self.uuid})
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ["creation_time"]
|
ordering = ["company", "-creation_time"]
|
||||||
|
|
||||||
|
|
||||||
class ConsistItem(models.Model):
|
class ConsistItem(models.Model):
|
||||||
|
@@ -3,7 +3,35 @@ from solo.admin import SingletonModelAdmin
|
|||||||
|
|
||||||
from portal.models import SiteConfiguration, Flatpage
|
from portal.models import SiteConfiguration, Flatpage
|
||||||
|
|
||||||
admin.site.register(SiteConfiguration, SingletonModelAdmin)
|
@admin.register(SiteConfiguration)
|
||||||
|
class SiteConfigurationAdmin(SingletonModelAdmin):
|
||||||
|
fieldsets = (
|
||||||
|
(
|
||||||
|
None,
|
||||||
|
{
|
||||||
|
"fields": (
|
||||||
|
"site_name",
|
||||||
|
"site_author",
|
||||||
|
"about",
|
||||||
|
"items_per_page",
|
||||||
|
"items_ordering",
|
||||||
|
"footer",
|
||||||
|
"footer_extended",
|
||||||
|
)
|
||||||
|
},
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"Advanced",
|
||||||
|
{
|
||||||
|
"classes": ("collapse",),
|
||||||
|
"fields": (
|
||||||
|
"show_version",
|
||||||
|
"use_cdn",
|
||||||
|
"extra_head",
|
||||||
|
),
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@admin.register(Flatpage)
|
@admin.register(Flatpage)
|
||||||
|
18
ram/portal/migrations/0014_siteconfiguration_extra_head.py
Normal file
18
ram/portal/migrations/0014_siteconfiguration_extra_head.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 4.1.3 on 2022-12-28 22:43
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("portal", "0013_remove_flatpage_draft_flatpage_published"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="siteconfiguration",
|
||||||
|
name="extra_head",
|
||||||
|
field=models.TextField(blank=True),
|
||||||
|
),
|
||||||
|
]
|
18
ram/portal/migrations/0015_siteconfiguration_use_cdn.py
Normal file
18
ram/portal/migrations/0015_siteconfiguration_use_cdn.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 4.1.5 on 2023-01-03 15:01
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("portal", "0014_siteconfiguration_extra_head"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="siteconfiguration",
|
||||||
|
name="use_cdn",
|
||||||
|
field=models.BooleanField(default=True),
|
||||||
|
),
|
||||||
|
]
|
@@ -35,6 +35,8 @@ class SiteConfiguration(SingletonModel):
|
|||||||
footer = RichTextField(blank=True)
|
footer = RichTextField(blank=True)
|
||||||
footer_extended = RichTextField(blank=True)
|
footer_extended = RichTextField(blank=True)
|
||||||
show_version = models.BooleanField(default=True)
|
show_version = models.BooleanField(default=True)
|
||||||
|
use_cdn = models.BooleanField(default=True)
|
||||||
|
extra_head = models.TextField(blank=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = "Site Configuration"
|
verbose_name = "Site Configuration"
|
||||||
|
2018
ram/portal/static/bootstrap-icons@1.10.3/font/bootstrap-icons.css
vendored
Normal file
2018
ram/portal/static/bootstrap-icons@1.10.3/font/bootstrap-icons.css
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -1,3 +1,8 @@
|
|||||||
|
/* Switch SVG logo to white on dark mode */
|
||||||
|
html.dark .navbar-light svg {
|
||||||
|
fill: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
.card > a > img {
|
.card > a > img {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
@@ -11,10 +16,6 @@ a.badge, a.badge:hover {
|
|||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab-pane {
|
|
||||||
min-height: 300px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.img-thumbnail {
|
.img-thumbnail {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
BIN
ram/portal/static/favicon.png
Normal file
BIN
ram/portal/static/favicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
9
ram/portal/static/favicon.svg
Normal file
9
ram/portal/static/favicon.svg
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<svg width="26" height="16" enable-background="new 0 0 26 26" version="1" viewBox="0 0 26 16" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="m2.8125 0.0010991a1.0001 1.0001 0 0 0-0.8125 1c0 0.55455-0.44545 1-1 1a1.0001 1.0001 0 0 0-1 1v10a1.0001 1.0001 0 0 0 1 1c0.55455 0 1 0.44546 1 1a1.0001 1.0001 0 0 0 1 1h20a1.0001 1.0001 0 0 0 1-1c0-0.55454 0.44546-1 1-1a1.0001 1.0001 0 0 0 1-1v-10a1.0001 1.0001 0 0 0-1-1c-0.55454 0-1-0.44545-1-1a1.0001 1.0001 0 0 0-1-1h-20a1.0001 1.0001 0 0 0-0.09375 0 1.0001 1.0001 0 0 0-0.09375 0zm0.78125 2h14.406v1h2v-1h2.4062c0.30628 0.76906 0.82469 1.2875 1.5938 1.5938v8.8125c-0.76906 0.30628-1.2875 0.82469-1.5938 1.5938h-2.4062v-1h-2v1h-14.406c-0.30628-0.76906-0.82469-1.2875-1.5938-1.5938v-8.8125c0.76906-0.30628 1.2875-0.82469 1.5938-1.5938zm14.406 2v2h2v-2zm0 3v2h2v-2zm0 3v2h2v-2z" enable-background="accumulate" overflow="visible" stroke-width="2" />
|
||||||
|
<style>
|
||||||
|
path {
|
||||||
|
text-indent:0;
|
||||||
|
text-transform:none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.1 KiB |
@@ -13,9 +13,16 @@
|
|||||||
<meta name="author" content="{{ site_conf.site_author }}">
|
<meta name="author" content="{{ site_conf.site_author }}">
|
||||||
<meta name="generator" content="Django Framework">
|
<meta name="generator" content="Django Framework">
|
||||||
<title>{% block title %}{{ title }}{% endblock %} - {{ site_conf.site_name }}</title>
|
<title>{% block title %}{{ title }}{% endblock %} - {{ site_conf.site_name }}</title>
|
||||||
|
<link rel="icon" href="{% static "favicon.png" %}" sizes="any">
|
||||||
|
<link rel="icon" href="{% static "favicon.svg" %}" type="image/svg+xml">
|
||||||
|
{% if site_conf.use_cdn %}
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-dark-5@1.1.3/dist/css/bootstrap-nightshade.min.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap-dark-5@1.1.3/dist/css/bootstrap-nightshade.min.css" rel="stylesheet">
|
||||||
<link href="{% static "css/main.css" %}" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.3/font/bootstrap-icons.css" rel="stylesheet">
|
||||||
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
|
{% else %}
|
||||||
|
<link href="{% static "bootstrap-dark-5@1.1.3/dist/css/bootstrap-nightshade.min.css" %}" rel="stylesheet">
|
||||||
|
<link href="{% static "bootstrap-icons@1.10.3/font/bootstrap-icons.css" %}" rel="stylesheet">
|
||||||
|
{% endif %}
|
||||||
|
<link href="{% static "css/main.css" %}?v={{ site_conf.version }}" rel="stylesheet">
|
||||||
<style>
|
<style>
|
||||||
.bd-placeholder-img {
|
.bd-placeholder-img {
|
||||||
font-size: 1.125rem;
|
font-size: 1.125rem;
|
||||||
@@ -34,6 +41,10 @@
|
|||||||
html.dark .d-light-inline { display: none !important; }
|
html.dark .d-light-inline { display: none !important; }
|
||||||
html.dark .d-dark-inline { display: inline !important; }
|
html.dark .d-dark-inline { display: inline !important; }
|
||||||
</style>
|
</style>
|
||||||
|
{% block extra_head %}
|
||||||
|
{{ site_conf.extra_head | safe }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
@@ -41,13 +52,19 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<a href="{% url 'index' %}" class="navbar-brand d-flex align-items-center">
|
<a href="{% url 'index' %}" class="navbar-brand d-flex align-items-center">
|
||||||
<svg class="me-2" width="26" height="16" enable-background="new 0 0 26 26" version="1" viewBox="0 0 26 16" xmlns="http://www.w3.org/2000/svg">
|
<svg class="me-2" width="26" height="16" enable-background="new 0 0 26 26" version="1" viewBox="0 0 26 16" xmlns="http://www.w3.org/2000/svg">
|
||||||
<path d="m2.8125 0.0010991a1.0001 1.0001 0 0 0-0.8125 1c0 0.55455-0.44545 1-1 1a1.0001 1.0001 0 0 0-1 1v10a1.0001 1.0001 0 0 0 1 1c0.55455 0 1 0.44546 1 1a1.0001 1.0001 0 0 0 1 1h20a1.0001 1.0001 0 0 0 1-1c0-0.55454 0.44546-1 1-1a1.0001 1.0001 0 0 0 1-1v-10a1.0001 1.0001 0 0 0-1-1c-0.55454 0-1-0.44545-1-1a1.0001 1.0001 0 0 0-1-1h-20a1.0001 1.0001 0 0 0-0.09375 0 1.0001 1.0001 0 0 0-0.09375 0zm0.78125 2h14.406v1h2v-1h2.4062c0.30628 0.76906 0.82469 1.2875 1.5938 1.5938v8.8125c-0.76906 0.30628-1.2875 0.82469-1.5938 1.5938h-2.4062v-1h-2v1h-14.406c-0.30628-0.76906-0.82469-1.2875-1.5938-1.5938v-8.8125c0.76906-0.30628 1.2875-0.82469 1.5938-1.5938zm14.406 2v2h2v-2zm0 3v2h2v-2zm0 3v2h2v-2z" enable-background="accumulate" fill="#000" overflow="visible" stroke-width="2" style="text-indent:0;text-transform:none"/>
|
<path d="m2.8125 0.0010991a1.0001 1.0001 0 0 0-0.8125 1c0 0.55455-0.44545 1-1 1a1.0001 1.0001 0 0 0-1 1v10a1.0001 1.0001 0 0 0 1 1c0.55455 0 1 0.44546 1 1a1.0001 1.0001 0 0 0 1 1h20a1.0001 1.0001 0 0 0 1-1c0-0.55454 0.44546-1 1-1a1.0001 1.0001 0 0 0 1-1v-10a1.0001 1.0001 0 0 0-1-1c-0.55454 0-1-0.44545-1-1a1.0001 1.0001 0 0 0-1-1h-20a1.0001 1.0001 0 0 0-0.09375 0 1.0001 1.0001 0 0 0-0.09375 0zm0.78125 2h14.406v1h2v-1h2.4062c0.30628 0.76906 0.82469 1.2875 1.5938 1.5938v8.8125c-0.76906 0.30628-1.2875 0.82469-1.5938 1.5938h-2.4062v-1h-2v1h-14.406c-0.30628-0.76906-0.82469-1.2875-1.5938-1.5938v-8.8125c0.76906-0.30628 1.2875-0.82469 1.5938-1.5938zm14.406 2v2h2v-2zm0 3v2h2v-2zm0 3v2h2v-2z" enable-background="accumulate" overflow="visible" stroke-width="2" />
|
||||||
|
<style>
|
||||||
|
path {
|
||||||
|
text-indent:0;
|
||||||
|
text-transform:none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
</svg>
|
</svg>
|
||||||
<strong>{{ site_conf.site_name }}</strong>
|
<strong>{{ site_conf.site_name }}</strong>
|
||||||
</a>
|
</a>
|
||||||
<div class="btn-group" role="group" aria-label="Basic example">
|
<div class="btn-group" role="group" aria-label="Login menu">
|
||||||
{% include 'includes/login.html' %}
|
{% include 'includes/login.html' %}
|
||||||
<a id="darkmode-button" class="btn btn-sm btn-outline-dark"><i class="fa fa-moon-o fa-fw d-none d-light-inline" title="Switch to dark mode"></i><i class="fa fa-sun-o fa-fw d-none d-dark-inline" title="Switch to light mode"></i></a>
|
<a id="darkmode-button" class="btn btn-sm btn-outline-dark"><i class="bi bi-moon d-none d-light-inline" title="Switch to dark mode"></i><i class="bi bi-sun d-none d-dark-inline" title="Switch to light mode"></i></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -89,105 +106,24 @@
|
|||||||
</section>
|
</section>
|
||||||
<div class="album py-4 bg-light">
|
<div class="album py-4 bg-light">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
{% block carousel %}
|
||||||
|
{% endblock %}
|
||||||
<a id="rolling-stock"></a>
|
<a id="rolling-stock"></a>
|
||||||
<div class="row row-cols-1 row-cols-sm-2 row-cols-md-3 g-3">
|
{% block cards_layout %}
|
||||||
{% block cards %}
|
{% endblock %}
|
||||||
{% for r in rolling_stock %}
|
|
||||||
<div class="col">
|
|
||||||
<div class="card shadow-sm">
|
|
||||||
{% for i in r.image.all %}
|
|
||||||
{% if i.is_thumbnail %}<a href="{{r.get_absolute_url}}"><img src="{{ i.image.url }}" alt="Card image cap"></a>{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
<div class="card-body">
|
|
||||||
<p class="card-text" style="position: relative;">
|
|
||||||
<strong>{{ r }}</strong>
|
|
||||||
<a class="stretched-link" href="{{ r.get_absolute_url }}"></a>
|
|
||||||
</p>
|
|
||||||
{% if r.tags.all %}
|
|
||||||
<p class="card-text"><small>Tags:</small>
|
|
||||||
{% for t in r.tags.all %}<a href="{% url 'filtered' _filter="tag" search=t.slug %}" class="badge rounded-pill bg-primary">
|
|
||||||
{{ t.name }}</a>{# new line is required #}
|
|
||||||
{% endfor %}
|
|
||||||
</p>
|
|
||||||
{% endif %}
|
|
||||||
<table class="table table-striped">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th colspan="2" scope="row">Data</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<th width="35%" scope="row">Type</th>
|
|
||||||
<td>{{ r.rolling_class.type }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="row">Company</th>
|
|
||||||
<td><abbr title="{{ r.rolling_class.company.extended_name }}">{{ r.rolling_class.company }}</abbr></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="row">Class</th>
|
|
||||||
<td>{{ r.rolling_class.identifier }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="row">Road number</th>
|
|
||||||
<td>{{ r.road_number }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="row">Era</th>
|
|
||||||
<td>{{ r.era }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th width="35%" scope="row">Manufacturer</th>
|
|
||||||
<td>{% if r.manufacturer.website %}<a href="{{ r.manufacturer.website }}">{% endif %}{{ r.manufacturer }}{% if r.manufacturer.website %}</a>{% endif %}</th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="row">Scale</th>
|
|
||||||
<td><a href="{% url 'filtered' _filter="scale" search=r.scale %}"><abbr title="{{ r.scale.ratio }} - {{ r.scale.tracks }}">{{ r.scale }}</abbr></a></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="row">SKU</th>
|
|
||||||
<td>{{ r.sku }}</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
{% if r.decoder %}
|
|
||||||
<table class="table table-striped">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th colspan="2" scope="row">DCC data</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<th width="35%" scope="row">Decoder</th>
|
|
||||||
<td>{{ r.decoder }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="row">Address</th>
|
|
||||||
<td>{{ r.address }}</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
{% endif %}
|
|
||||||
<div class="d-grid gap-2 mb-1 d-md-block">
|
|
||||||
<a class="btn btn-sm btn-outline-primary" href="{{r.get_absolute_url}}">Show all data</a>
|
|
||||||
{% if request.user.is_staff %}<a class="btn btn-sm btn-outline-danger" href="{% url 'admin:roster_rollingstock_change' r.pk %}">Edit</a>{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
|
||||||
{% endblock %}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="container">{% block pagination %}{% endblock %}</div>
|
<div class="container">{% block pagination %}{% endblock %}</div>
|
||||||
</div>
|
</div>
|
||||||
{% block extra_content %}{% endblock %}
|
{% block extra_content %}{% endblock %}
|
||||||
</main>
|
</main>
|
||||||
{% include 'includes/footer.html' %}
|
{% include 'includes/footer.html' %}
|
||||||
|
{% if site_conf.use_cdn %}
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap-dark-5@1.1.3/dist/js/darkmode.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap-dark-5@1.1.3/dist/js/darkmode.min.js"></script>
|
||||||
|
{% else %}
|
||||||
|
<script src="{% static "bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" %}"></script>
|
||||||
|
<script src="{% static "bootstrap-dark-5@1.1.3/dist/js/darkmode.min.js" %}"></script>
|
||||||
|
{% endif %}
|
||||||
<!-- script src="https://cdn.jsdelivr.net/npm/masonry-layout@4.2.2/dist/masonry.pkgd.min.js" integrity="sha384-GNFwBvfVxBkLMJpYMOABq3c+d3KnQxudP/mGPkzpZSTYykLBNsZEnG2D9G/X/+7D" crossorigin="anonymous" async></script -->
|
<!-- script src="https://cdn.jsdelivr.net/npm/masonry-layout@4.2.2/dist/masonry.pkgd.min.js" integrity="sha384-GNFwBvfVxBkLMJpYMOABq3c+d3KnQxudP/mGPkzpZSTYykLBNsZEnG2D9G/X/+7D" crossorigin="anonymous" async></script -->
|
||||||
<script>
|
<script>
|
||||||
document.querySelector("#darkmode-button").onclick = function(e){
|
document.querySelector("#darkmode-button").onclick = function(e){
|
||||||
|
96
ram/portal/templates/cards.html
Normal file
96
ram/portal/templates/cards.html
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block cards_layout %}
|
||||||
|
<div class="row row-cols-1 row-cols-sm-2 row-cols-md-3 g-3">
|
||||||
|
{% block cards %}
|
||||||
|
{% for r in rolling_stock %}
|
||||||
|
<div class="col">
|
||||||
|
<div class="card shadow-sm">
|
||||||
|
{% for i in r.image.all %}
|
||||||
|
{% if forloop.first %}<a href="{{r.get_absolute_url}}"><img src="{{ i.image.url }}" alt="Card image cap"></a>{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
<div class="card-body">
|
||||||
|
<p class="card-text" style="position: relative;">
|
||||||
|
<strong>{{ r }}</strong>
|
||||||
|
<a class="stretched-link" href="{{ r.get_absolute_url }}"></a>
|
||||||
|
</p>
|
||||||
|
{% if r.tags.all %}
|
||||||
|
<p class="card-text"><small>Tags:</small>
|
||||||
|
{% for t in r.tags.all %}<a href="{% url 'filtered' _filter="tag" search=t.slug %}" class="badge rounded-pill bg-primary">
|
||||||
|
{{ t.name }}</a>{# new line is required #}
|
||||||
|
{% endfor %}
|
||||||
|
</p>
|
||||||
|
{% endif %}
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th colspan="2" scope="row">Data</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th width="35%" scope="row">Type</th>
|
||||||
|
<td>{{ r.rolling_class.type }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">Company</th>
|
||||||
|
<td>
|
||||||
|
<a href="{% url 'filtered' _filter="company" search=r.rolling_class.company %}"><abbr title="{{ r.rolling_class.company.extended_name }}">{{ r.rolling_class.company }}</abbr></a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">Class</th>
|
||||||
|
<td>{{ r.rolling_class.identifier }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">Road number</th>
|
||||||
|
<td>{{ r.road_number }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">Era</th>
|
||||||
|
<td>{{ r.era }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th width="35%" scope="row">Manufacturer</th>
|
||||||
|
<td>{{ r.manufacturer|default_if_none:"" }}{% if r.manufacturer.website %} <a href="{{ r.manufacturer.website }}" target="_blank"><i class="bi bi-box-arrow-up-right"></i></a>{% endif %}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">Scale</th>
|
||||||
|
<td><a href="{% url 'filtered' _filter="scale" search=r.scale %}"><abbr title="{{ r.scale.ratio }} - {{ r.scale.tracks }}">{{ r.scale }}</abbr></a></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">SKU</th>
|
||||||
|
<td>{{ r.sku }}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{% if r.decoder %}
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th colspan="2" scope="row">DCC data</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th width="35%" scope="row">Decoder</th>
|
||||||
|
<td>{{ r.decoder }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">Address</th>
|
||||||
|
<td>{{ r.address }}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{% endif %}
|
||||||
|
<div class="d-grid gap-2 mb-1 d-md-block">
|
||||||
|
<a class="btn btn-sm btn-outline-primary" href="{{r.get_absolute_url}}">Show all data</a>
|
||||||
|
{% if request.user.is_staff %}<a class="btn btn-sm btn-outline-danger" href="{% url 'admin:roster_rollingstock_change' r.pk %}">Edit</a>{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
{% endblock %}
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
@@ -1,4 +1,4 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "cards.html" %}
|
||||||
|
|
||||||
{% block cards %}
|
{% block cards %}
|
||||||
{% for c in company %}
|
{% for c in company %}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "cards.html" %}
|
||||||
|
|
||||||
{% block header %}
|
{% block header %}
|
||||||
{% if consist.tags.all %}
|
{% if consist.tags.all %}
|
||||||
@@ -10,12 +10,25 @@
|
|||||||
<small class="text-muted">Updated {{ consist.updated_time | date:"M d, Y H:i" }}</small>
|
<small class="text-muted">Updated {{ consist.updated_time | date:"M d, Y H:i" }}</small>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
{% block carousel %}
|
||||||
|
{% if consist.image %}
|
||||||
|
<div class="row pb-4">
|
||||||
|
<div id="carouselControls" class="carousel carousel-dark slide" data-bs-ride="carousel">
|
||||||
|
<div class="carousel-inner">
|
||||||
|
<div class="carousel-item active">
|
||||||
|
<img src="{{ consist.image.url }}" class="d-block w-100 rounded img-thumbnail" alt="...">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
{% block cards %}
|
{% block cards %}
|
||||||
{% for r in rolling_stock %}
|
{% for r in rolling_stock %}
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<div class="card shadow-sm">
|
<div class="card shadow-sm">
|
||||||
{% for i in r.rolling_stock.image.all %}
|
{% for i in r.rolling_stock.image.all %}
|
||||||
{% if i.is_thumbnail %}<a href="{{r.rolling_stock.get_absolute_url}}"><img src="{{ i.image.url }}" alt="Card image cap"></a>{% endif %}
|
{% if forloop.first %}<a href="{{r.rolling_stock.get_absolute_url}}"><img src="{{ i.image.url }}" alt="Card image cap"></a>{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<p class="card-text" style="position: relative;">
|
<p class="card-text" style="position: relative;">
|
||||||
@@ -42,7 +55,9 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Company</th>
|
<th scope="row">Company</th>
|
||||||
<td><abbr title="{{ r.rolling_stock.rolling_class.company.extended_name }}">{{ r.rolling_stock.rolling_class.company }}</abbr></td>
|
<td>
|
||||||
|
<a href="{% url 'filtered' _filter="company" search=r.rolling_stock.rolling_class.company %}"><abbr title="{{ r.rolling_stock.rolling_class.company.extended_name }}">{{ r.rolling_stock.rolling_class.company }}</abbr></a>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Class</th>
|
<th scope="row">Class</th>
|
||||||
@@ -58,7 +73,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th width="35%" scope="row">Manufacturer</th>
|
<th width="35%" scope="row">Manufacturer</th>
|
||||||
<td>{% if r.rolling_stock.manufacturer.website %}<a href="{{ r.rolling_stock.manufacturer.website }}">{% endif %}{{ r.rolling_stock.manufacturer }}{% if r.rolling_stock.manufacturer.website %}</a>{% endif %}</th>
|
<td>{{ r.rolling_stock.manufacturer|default_if_none:"" }}{% if r.rolling_stock.manufacturer.website %} <a href="{{ r.rolling_stock.manufacturer.website }}" target="_blank"><i class="bi bi-box-arrow-up-right"></i></a>{% endif %}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Scale</th>
|
<th scope="row">Scale</th>
|
||||||
@@ -141,6 +156,51 @@
|
|||||||
<section class="py-4 text-start container">
|
<section class="py-4 text-start container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="mx-auto">
|
<div class="mx-auto">
|
||||||
|
<nav>
|
||||||
|
<div class="nav nav-tabs" id="nav-tab" role="tablist">
|
||||||
|
<button class="nav-link active" id="nav-summary-tab" data-bs-toggle="tab" data-bs-target="#nav-summary" type="button" role="tab" aria-controls="nav-summary" aria-selected="true">Summary</button>
|
||||||
|
{% if consist.notes %}<button class="nav-link" id="nav-notes-tab" data-bs-toggle="tab" data-bs-target="#nav-notes" type="button" role="tab" aria-controls="nav-notes" aria-selected="false">Notes</button>{% endif %}
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
<div class="tab-content" id="nav-tabContent">
|
||||||
|
<div class="tab-pane fade show active" id="nav-summary" role="tabpanel" aria-labelledby="nav-summary-tab">
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th colspan="2" scope="row">Data</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th width="35%" scope="row">Company</th>
|
||||||
|
<td><abbr title="{{ consist.company.extended_name }}">{{ consist.company }}</abbr></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">Era</th>
|
||||||
|
<td>{{ consist.era }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">Length</th>
|
||||||
|
<td>{{ rolling_stock | length }}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="tab-pane fade" id="nav-notes" role="tabpanel" aria-labelledby="nav-notes-tab">
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">Notes</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>{{ consist.notes | safe }}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="d-grid gap-2 d-md-flex justify-content-md-end">
|
<div class="d-grid gap-2 d-md-flex justify-content-md-end">
|
||||||
{% if request.user.is_staff %}<a class="btn btn-sm btn-outline-danger" href="{% url 'admin:consist_consist_change' consist.pk %}">Edit</a>{% endif %}
|
{% if request.user.is_staff %}<a class="btn btn-sm btn-outline-danger" href="{% url 'admin:consist_consist_change' consist.pk %}">Edit</a>{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "cards.html" %}
|
||||||
|
|
||||||
{% block cards %}
|
{% block cards %}
|
||||||
{% for c in consist %}
|
{% for c in consist %}
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
{% else %}
|
{% else %}
|
||||||
{% with c.consist_item.first.rolling_stock as r %}
|
{% with c.consist_item.first.rolling_stock as r %}
|
||||||
{% for i in r.image.all %}
|
{% for i in r.image.all %}
|
||||||
{% if i.is_thumbnail %}<img src="{{ i.image.url }}" alt="Card image cap">{% endif %}
|
{% if forloop.first %}<img src="{{ i.image.url }}" alt="Card image cap">{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "cards.html" %}
|
||||||
|
|
||||||
{% block header %}
|
{% block header %}
|
||||||
<p class="lead text-muted">{{ site_conf.about | safe }}</p>
|
<p class="lead text-muted">{{ site_conf.about | safe }}</p>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block pagination %}
|
{% block pagination %}
|
||||||
{% if rolling_stock.has_other_pages %}
|
{% if rolling_stock.has_other_pages %}
|
||||||
<nav aria-label="Page navigation example">
|
<nav aria-label="Page navigation example">
|
||||||
|
@@ -1,21 +1,19 @@
|
|||||||
{% if request.user.is_staff %}
|
{% if request.user.is_staff %}
|
||||||
<div class="dropdown">
|
<button class="btn btn-sm btn-outline-dark dropdown-toggle" type="button" id="dropdownMenu2" data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
<button class="btn btn-sm btn-outline-dark dropdown-toggle" type="button" id="dropdownMenu2" data-bs-toggle="dropdown" aria-expanded="false">
|
Welcome back, <strong>{{ request.user }}</strong>
|
||||||
Welcome back, <strong>{{ request.user }}</strong>
|
</button>
|
||||||
</button>
|
<ul class="dropdown-menu" aria-labelledby="dropdownMenu2">
|
||||||
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="dropdownMenu2">
|
<li><a class="dropdown-item" href="{% url 'admin:roster_rollingstock_changelist' %}">Rolling stock</a></li>
|
||||||
<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:consist_consist_changelist' %}">Consists</a></li>
|
<li><a class="dropdown-item" href="{% url 'admin:app_list' 'metadata' %}">Metadata</a></li>
|
||||||
<li><a class="dropdown-item" href="{% url 'admin:app_list' 'metadata' %}">Metadata</a></li>
|
<li><a class="dropdown-item" href="{% url 'admin:portal_flatpage_changelist' %}">Pages</a></li>
|
||||||
<li><a class="dropdown-item" href="{% url 'admin:portal_flatpage_changelist' %}">Pages</a></li>
|
<li><hr class="dropdown-divider"></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:index' %}">Admin</a></li>
|
<li><a class="dropdown-item" href="{% url 'admin:portal_siteconfiguration_changelist' %}">Site configuration</a></li>
|
||||||
<li><a class="dropdown-item" href="{% url 'admin:portal_siteconfiguration_changelist' %}">Site configuration</a></li>
|
<li><a class="dropdown-item" href="{% url 'admin:driver_driverconfiguration_changelist' %}">DCC configuration</a></li>
|
||||||
<li><a class="dropdown-item" href="{% url 'admin:driver_driverconfiguration_changelist' %}">DCC configuration</a></li>
|
<li><hr class="dropdown-divider"></li>
|
||||||
<li><hr class="dropdown-divider"></li>
|
<li><a class="dropdown-item text-danger" href="{% url 'admin:logout' %}?next={{ request.path }}">Logout</a></li>
|
||||||
<li><a class="dropdown-item text-danger" href="{% url 'admin:logout' %}?next={{ request.path }}">Logout</a></li>
|
</ul>
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
{% else %}
|
{% else %}
|
||||||
<a class="btn btn-sm btn-outline-dark" href="{% url 'admin:login' %}?next={{ request.path }}">Log in</a>
|
<a class="btn btn-sm btn-outline-dark" href="{% url 'admin:login' %}?next={{ request.path }}">Log in</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@@ -10,29 +10,34 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
<small class="text-muted">Updated {{ rolling_stock.updated_time | date:"M d, Y H:i" }}</small>
|
<small class="text-muted">Updated {{ rolling_stock.updated_time | date:"M d, Y H:i" }}</small>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block cards %}
|
{% block carousel %}
|
||||||
{% for t in rolling_stock.image.all %}
|
<div class="row">
|
||||||
<div class="col">
|
<div id="carouselControls" class="carousel carousel-dark slide" data-bs-ride="carousel" data-bs-interval="10000">
|
||||||
<a href="" data-bs-toggle="modal" data-bs-target="#pictureModal{{ forloop.counter }}"><img class="img-thumbnail" src="{{ t.image.url }}" alt="Rolling stock image"></a>
|
<div class="carousel-inner">
|
||||||
</div>
|
{% for t in rolling_stock.image.all %}
|
||||||
<!-- Modal -->
|
{% if forloop.first %}
|
||||||
<div class="modal fade" id="pictureModal{{ forloop.counter }}" tabindex="-1" aria-labelledby="pictureModalLabel{{ forloop.counter }}" aria-hidden="true">
|
<div class="carousel-item active">
|
||||||
<div class="modal-dialog modal-lg">
|
{% else %}
|
||||||
<div class="modal-content">
|
<div class="carousel-item">
|
||||||
<div class="modal-header">
|
{% endif %}
|
||||||
<h5 class="modal-title" id="pictureModalLabel{{ forloop.counter }}">{{ rolling_stock }}</h5>
|
<img src="{{ t.image.url }}" class="d-block w-100 rounded img-thumbnail" alt="...">
|
||||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body text-center">
|
|
||||||
<img class="rounded img-fluid" src="{{ t.image.url }}" alt="Rolling stock image">
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
|
||||||
</div>
|
</div>
|
||||||
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
{% if rolling_stock.image.count > 1 %}
|
||||||
|
<button class="carousel-control-prev" type="button" data-bs-target="#carouselControls" data-bs-slide="prev">
|
||||||
|
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
|
||||||
|
<span class="visually-hidden">Previous</span>
|
||||||
|
</button>
|
||||||
|
<button class="carousel-control-next" type="button" data-bs-target="#carouselControls" data-bs-slide="next">
|
||||||
|
<span class="carousel-control-next-icon" aria-hidden="true"></span>
|
||||||
|
<span class="visually-hidden">Next</span>
|
||||||
|
</button>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endblock %}
|
||||||
|
{% block cards %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block extra_content %}
|
{% block extra_content %}
|
||||||
<section class="py-4 text-start container">
|
<section class="py-4 text-start container">
|
||||||
@@ -64,7 +69,9 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Company</th>
|
<th scope="row">Company</th>
|
||||||
<td><abbr title="{{ rolling_stock.rolling_class.company.extended_name }}">{{ rolling_stock.rolling_class.company }}</abbr></td>
|
<td>
|
||||||
|
<a href="{% url 'filtered' _filter="company" search=rolling_stock.rolling_class.company %}"><abbr title="{{ rolling_stock.rolling_class.company.extended_name }}">{{ rolling_stock.rolling_class.company }}</abbr></a>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Class</th>
|
<th scope="row">Class</th>
|
||||||
@@ -89,7 +96,7 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<th width="35%" scope="row">Manufacturer</th>
|
<th width="35%" scope="row">Manufacturer</th>
|
||||||
<td>{% if rolling_stock.manufacturer.website %}<a href="{{ rolling_stock.manufacturer.website }}">{% endif %}{{ rolling_stock.manufacturer|default_if_none:"" }}{% if rolling_stock.manufacturer.website %}</a>{% endif %}</th>
|
<td>{{ rolling_stock.manufacturer|default_if_none:"" }}{% if rolling_stock.manufacturer.website %} <a href="{{ rolling_stock.manufacturer.website }}" target="_blank"><i class="bi bi-box-arrow-up-right"></i></a>{% endif %}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Scale</th>
|
<th scope="row">Scale</th>
|
||||||
@@ -137,7 +144,7 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<th width="35%" scope="row">Manufacturer</th>
|
<th width="35%" scope="row">Manufacturer</th>
|
||||||
<td>{% if rolling_stock.manufacturer.website %}<a href="{{ rolling_stock.manufacturer.website }}">{% endif %}{{ rolling_stock.manufacturer|default_if_none:"" }}{% if rolling_stock.manufacturer.website %}</a>{% endif %}</th>
|
<td>{{ rolling_stock.manufacturer|default_if_none:"" }}{% if rolling_stock.manufacturer.website %} <a href="{{ rolling_stock.manufacturer.website }}" target="_blank"><i class="bi bi-box-arrow-up-right"></i></a>{% endif %}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Scale</th>
|
<th scope="row">Scale</th>
|
||||||
@@ -263,7 +270,18 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-pane fade" id="nav-notes" role="tabpanel" aria-labelledby="nav-notes-tab">
|
<div class="tab-pane fade" id="nav-notes" role="tabpanel" aria-labelledby="nav-notes-tab">
|
||||||
{{ rolling_stock.notes | safe }}
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">Notes</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>{{ rolling_stock.notes | safe }}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-pane fade" id="nav-documents" role="tabpanel" aria-labelledby="nav-documents-tab">
|
<div class="tab-pane fade" id="nav-documents" role="tabpanel" aria-labelledby="nav-documents-tab">
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
@@ -276,7 +294,7 @@
|
|||||||
{% for d in rolling_stock.document.all %}
|
{% for d in rolling_stock.document.all %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ d.description }}</td>
|
<td>{{ d.description }}</td>
|
||||||
<td><a href="{{ d.file.url }}">{{ d.filename }}</a></td>
|
<td><a href="{{ d.file.url }}" target="_blank">{{ d.filename }}</a></td>
|
||||||
<td class="text-end">{{ d.file.size | filesizeformat }}</td>
|
<td class="text-end">{{ d.file.size | filesizeformat }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
@@ -1,4 +1,4 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "cards.html" %}
|
||||||
|
|
||||||
{% block cards %}
|
{% block cards %}
|
||||||
{% for s in scale %}
|
{% for s in scale %}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "cards.html" %}
|
||||||
|
|
||||||
{% block header %}
|
{% block header %}
|
||||||
<p class="lead text-muted">Results found: {{ matches }}</p>
|
<p class="lead text-muted">Results found: {{ matches }}</p>
|
||||||
|
@@ -170,7 +170,7 @@ class GetRollingStock(View):
|
|||||||
|
|
||||||
return render(
|
return render(
|
||||||
request,
|
request,
|
||||||
"page.html",
|
"rollingstock.html",
|
||||||
{
|
{
|
||||||
"title": rolling_stock,
|
"title": rolling_stock,
|
||||||
"rolling_stock": rolling_stock,
|
"rolling_stock": rolling_stock,
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
from ram.utils import git_suffix
|
from ram.utils import git_suffix
|
||||||
|
|
||||||
__version__ = "0.0.22"
|
__version__ = "0.0.29"
|
||||||
__version__ += git_suffix(__file__)
|
__version__ += git_suffix(__file__)
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
from adminsortable2.admin import SortableAdminBase, SortableInlineAdminMixin
|
||||||
|
|
||||||
from roster.models import (
|
from roster.models import (
|
||||||
RollingClass,
|
RollingClass,
|
||||||
RollingClassProperty,
|
RollingClassProperty,
|
||||||
@@ -35,7 +37,7 @@ class RollingStockDocInline(admin.TabularInline):
|
|||||||
classes = ["collapse"]
|
classes = ["collapse"]
|
||||||
|
|
||||||
|
|
||||||
class RollingStockImageInline(admin.TabularInline):
|
class RollingStockImageInline(SortableInlineAdminMixin, admin.TabularInline):
|
||||||
model = RollingStockImage
|
model = RollingStockImage
|
||||||
min_num = 0
|
min_num = 0
|
||||||
extra = 0
|
extra = 0
|
||||||
@@ -93,7 +95,7 @@ class RollingJournalDocumentAdmin(admin.ModelAdmin):
|
|||||||
|
|
||||||
|
|
||||||
@admin.register(RollingStock)
|
@admin.register(RollingStock)
|
||||||
class RollingStockAdmin(admin.ModelAdmin):
|
class RollingStockAdmin(SortableAdminBase, admin.ModelAdmin):
|
||||||
inlines = (
|
inlines = (
|
||||||
RollingStockPropertyInline,
|
RollingStockPropertyInline,
|
||||||
RollingStockImageInline,
|
RollingStockImageInline,
|
||||||
|
@@ -0,0 +1,22 @@
|
|||||||
|
# Generated by Django 4.1.3 on 2023-01-02 12:34
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("roster", "0015_alter_rollingstockimage_options"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name="rollingstockimage",
|
||||||
|
options={"ordering": ["order"]},
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="rollingstockimage",
|
||||||
|
name="order",
|
||||||
|
field=models.PositiveIntegerField(default=0),
|
||||||
|
),
|
||||||
|
]
|
@@ -0,0 +1,17 @@
|
|||||||
|
# Generated by Django 4.1.3 on 2023-01-02 15:02
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("roster", "0016_alter_rollingstockimage_options_and_more"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name="rollingstockimage",
|
||||||
|
name="is_thumbnail",
|
||||||
|
),
|
||||||
|
]
|
@@ -155,13 +155,13 @@ class RollingStockDocument(models.Model):
|
|||||||
|
|
||||||
|
|
||||||
class RollingStockImage(models.Model):
|
class RollingStockImage(models.Model):
|
||||||
|
order = models.PositiveIntegerField(default=0, blank=False, null=False)
|
||||||
rolling_stock = models.ForeignKey(
|
rolling_stock = models.ForeignKey(
|
||||||
RollingStock, on_delete=models.CASCADE, related_name="image"
|
RollingStock, on_delete=models.CASCADE, related_name="image"
|
||||||
)
|
)
|
||||||
image = models.ImageField(
|
image = models.ImageField(
|
||||||
upload_to="images/", storage=DeduplicatedStorage, null=True, blank=True
|
upload_to="images/", storage=DeduplicatedStorage, null=True, blank=True
|
||||||
)
|
)
|
||||||
is_thumbnail = models.BooleanField()
|
|
||||||
|
|
||||||
def image_thumbnail(self):
|
def image_thumbnail(self):
|
||||||
return get_image_preview(self.image.url)
|
return get_image_preview(self.image.url)
|
||||||
@@ -171,15 +171,8 @@ class RollingStockImage(models.Model):
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "{0}".format(os.path.basename(self.image.name))
|
return "{0}".format(os.path.basename(self.image.name))
|
||||||
|
|
||||||
def save(self, **kwargs):
|
|
||||||
if self.is_thumbnail:
|
|
||||||
RollingStockImage.objects.filter(
|
|
||||||
rolling_stock=self.rolling_stock
|
|
||||||
).update(is_thumbnail=False)
|
|
||||||
super().save(**kwargs)
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ["-is_thumbnail"]
|
ordering = ["order"]
|
||||||
|
|
||||||
|
|
||||||
class RollingStockProperty(models.Model):
|
class RollingStockProperty(models.Model):
|
||||||
|
Reference in New Issue
Block a user