mirror of
https://github.com/daniviga/django-ram.git
synced 2025-08-04 13:17:50 +02:00
Simplify cards, use icons for DCC
This commit is contained in:
@@ -73,33 +73,12 @@
|
|||||||
<th scope="row">Item number</th>
|
<th scope="row">Item number</th>
|
||||||
<td>{{ d.item.item_number }}{%if d.item.set %} | <a class="badge text-bg-primary" href="{% url 'manufacturer' manufacturer=d.item.manufacturer.slug search=d.item.item_number_slug %}">SET</a>{% endif %}</td>
|
<td>{{ d.item.item_number }}{%if d.item.set %} | <a class="badge text-bg-primary" href="{% url 'manufacturer' manufacturer=d.item.manufacturer.slug search=d.item.item_number_slug %}">SET</a>{% endif %}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">DCC</th>
|
||||||
|
<td>{{ d.item.dcc|safe }}</td>
|
||||||
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
{% if d.item.decoder or d.item.decoder_interface %}
|
|
||||||
<table class="table table-striped">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th colspan="2" scope="row">DCC data</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody class="table-group-divider">
|
|
||||||
<tr>
|
|
||||||
<th class="w-33" scope="row">Interface</th>
|
|
||||||
<td>{{ d.item.get_decoder_interface }}</td>
|
|
||||||
</tr>
|
|
||||||
{% if d.item.decoder %}
|
|
||||||
<tr>
|
|
||||||
<th scope="row">Decoder</th>
|
|
||||||
<td>{{ d.item.decoder }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="row">Address</th>
|
|
||||||
<td>{{ d.item.address }}</td>
|
|
||||||
</tr>
|
|
||||||
{% endif %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
{% endif %}
|
|
||||||
<div class="d-grid gap-2 mb-1 d-md-block">
|
<div class="d-grid gap-2 mb-1 d-md-block">
|
||||||
<a class="btn btn-sm btn-outline-primary" href="{{d.item.get_absolute_url}}">Show all data</a>
|
<a class="btn btn-sm btn-outline-primary" href="{{d.item.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' d.item.pk %}">Edit</a>{% endif %}
|
{% if request.user.is_staff %}<a class="btn btn-sm btn-outline-danger" href="{% url 'admin:roster_rollingstock_change' d.item.pk %}">Edit</a>{% endif %}
|
||||||
|
@@ -153,7 +153,13 @@
|
|||||||
{% if rolling_stock.decoder %}
|
{% if rolling_stock.decoder %}
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Decoder</th>
|
<th scope="row">Decoder</th>
|
||||||
<td>{{ rolling_stock.decoder }}</td>
|
<td>{{ rolling_stock.decoder }}
|
||||||
|
{% if rolling_stock.decoder.sound %}
|
||||||
|
| <span class="badge text-bg-secondary">
|
||||||
|
<abbr title="Sound decoder"<i class="bi bi-volume-up-fill"></i></abbr>
|
||||||
|
</span>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Address</th>
|
<th scope="row">Address</th>
|
||||||
@@ -348,24 +354,26 @@
|
|||||||
<td>{{ rolling_stock.get_decoder_interface }}</td>
|
<td>{{ rolling_stock.get_decoder_interface }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="w-33" scope="row">Address</th>
|
<th scope="row">Manufacturer</th>
|
||||||
<td>{{ rolling_stock.address }}</td>
|
<td>{{ rolling_stock.decoder.manufacturer | default:"-" }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Name</th>
|
<th scope="row">Name</th>
|
||||||
<td>{{ rolling_stock.decoder.name }}</td>
|
<td>{{ rolling_stock.decoder.name }}
|
||||||
</tr>
|
{% if rolling_stock.decoder.sound %}
|
||||||
<tr>
|
| <span class="badge text-bg-secondary">
|
||||||
<th scope="row">Manufacturer</th>
|
<abbr title="Sound decoder"<i class="bi bi-volume-up-fill"></i></abbr>
|
||||||
<td>{{ rolling_stock.decoder.manufacturer | default:"-" }}</td>
|
</span>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Version</th>
|
<th scope="row">Version</th>
|
||||||
<td>{{ rolling_stock.decoder.version | default:"-"}}</td>
|
<td>{{ rolling_stock.decoder.version | default:"-"}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Sound</th>
|
<th class="w-33" scope="row">Address</th>
|
||||||
<td>{{ rolling_stock.decoder.sound | yesno:"Yes,No" }}</td>
|
<td>{{ rolling_stock.address }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
from ram.utils import git_suffix
|
from ram.utils import git_suffix
|
||||||
|
|
||||||
__version__ = "0.17.10"
|
__version__ = "0.17.11"
|
||||||
__version__ += git_suffix(__file__)
|
__version__ += git_suffix(__file__)
|
||||||
|
@@ -135,9 +135,23 @@ class RollingStock(BaseModel):
|
|||||||
def get_decoder_interface(self):
|
def get_decoder_interface(self):
|
||||||
return str(
|
return str(
|
||||||
dict(settings.DECODER_INTERFACES).get(self.decoder_interface)
|
dict(settings.DECODER_INTERFACES).get(self.decoder_interface)
|
||||||
or "-"
|
or "No interface"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def dcc(self):
|
||||||
|
if self.decoder:
|
||||||
|
dcc = (
|
||||||
|
'<i class="bi bi-volume-up-fill"></i>'
|
||||||
|
if self.decoder.sound
|
||||||
|
else '<i class="bi bi-cpu-fill"></i>'
|
||||||
|
)
|
||||||
|
dcc = f'<abbr title="{self.decoder} ({self.get_decoder_interface()})">{dcc}</abbr>' # noqa: E501
|
||||||
|
elif self.decoder_interface:
|
||||||
|
dcc = f'<abbr title="{self.get_decoder_interface()}"><i class="bi bi-cpu"></i></abbr>' # noqa: E501
|
||||||
|
else:
|
||||||
|
dcc = f'<abbr title="{self.get_decoder_interface()}"><i class="bi bi-ban"></i></abbr>' # noqa: E501
|
||||||
|
return dcc
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def country(self):
|
def country(self):
|
||||||
return self.rolling_class.company.country
|
return self.rolling_class.company.country
|
||||||
|
Reference in New Issue
Block a user