From 68a18fcf58bd069093cbf8ed6066707d27f9624a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniele=20Vigan=C3=B2?= Date: Tue, 3 Jan 2023 01:32:16 +0100 Subject: [PATCH] Replace thumbnails with carousels in rolling stock pages (#15) * Replace thumbnails with carousels in rolling stock pages * Add consist data and notes in page --- ram/portal/templates/base.html | 96 ++---------------------- ram/portal/templates/cards.html | 94 +++++++++++++++++++++++ ram/portal/templates/companies.html | 2 +- ram/portal/templates/consist.html | 47 +++++++++++- ram/portal/templates/consists.html | 2 +- ram/portal/templates/home.html | 3 +- ram/portal/templates/includes/login.html | 32 ++++---- ram/portal/templates/page.html | 56 ++++++++------ ram/portal/templates/scales.html | 2 +- ram/portal/templates/search.html | 2 +- ram/ram/__init__.py | 2 +- 11 files changed, 201 insertions(+), 137 deletions(-) create mode 100644 ram/portal/templates/cards.html diff --git a/ram/portal/templates/base.html b/ram/portal/templates/base.html index c575a38..d5d37bc 100644 --- a/ram/portal/templates/base.html +++ b/ram/portal/templates/base.html @@ -49,7 +49,7 @@ {{ site_conf.site_name }} -
+
{% include 'includes/login.html' %}
@@ -94,96 +94,10 @@
-
- {% block cards %} - {% for r in rolling_stock %} -
-
- {% for i in r.image.all %} - {% if forloop.first %}Card image cap{% endif %} - {% endfor %} -
-

- {{ r }} - -

- {% if r.tags.all %} -

Tags: - {% for t in r.tags.all %} - {{ t.name }}{# new line is required #} - {% endfor %} -

- {% endif %} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Data
Type{{ r.rolling_class.type }}
Company{{ r.rolling_class.company }}
Class{{ r.rolling_class.identifier }}
Road number{{ r.road_number }}
Era{{ r.era }}
Manufacturer{% if r.manufacturer.website %}{% endif %}{{ r.manufacturer }}{% if r.manufacturer.website %}{% endif %} -
Scale{{ r.scale }}
SKU{{ r.sku }}
- {% if r.decoder %} - - - - - - - - - - - - - - - - -
DCC data
Decoder{{ r.decoder }}
Address{{ r.address }}
- {% endif %} -
- Show all data - {% if request.user.is_staff %}Edit{% endif %} -
-
-
-
- {% endfor %} - {% endblock %} -
+ {% block carousel %} + {% endblock %} + {% block cards_layout %} + {% endblock %}
{% block pagination %}{% endblock %}
diff --git a/ram/portal/templates/cards.html b/ram/portal/templates/cards.html new file mode 100644 index 0000000..4e96462 --- /dev/null +++ b/ram/portal/templates/cards.html @@ -0,0 +1,94 @@ +{% extends "base.html" %} + + {% block cards_layout %} +
+ {% block cards %} + {% for r in rolling_stock %} +
+
+ {% for i in r.image.all %} + {% if forloop.first %}Card image cap{% endif %} + {% endfor %} +
+

+ {{ r }} + +

+ {% if r.tags.all %} +

Tags: + {% for t in r.tags.all %} + {{ t.name }}{# new line is required #} + {% endfor %} +

+ {% endif %} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Data
Type{{ r.rolling_class.type }}
Company{{ r.rolling_class.company }}
Class{{ r.rolling_class.identifier }}
Road number{{ r.road_number }}
Era{{ r.era }}
Manufacturer{% if r.manufacturer.website %}{% endif %}{{ r.manufacturer }}{% if r.manufacturer.website %}{% endif %} +
Scale{{ r.scale }}
SKU{{ r.sku }}
+ {% if r.decoder %} + + + + + + + + + + + + + + + + +
DCC data
Decoder{{ r.decoder }}
Address{{ r.address }}
+ {% endif %} +
+ Show all data + {% if request.user.is_staff %}Edit{% endif %} +
+
+
+
+ {% endfor %} + {% endblock %} +
+ {% endblock %} diff --git a/ram/portal/templates/companies.html b/ram/portal/templates/companies.html index 3c82828..ed6ad2a 100644 --- a/ram/portal/templates/companies.html +++ b/ram/portal/templates/companies.html @@ -1,4 +1,4 @@ -{% extends "base.html" %} +{% extends "cards.html" %} {% block cards %} {% for c in company %} diff --git a/ram/portal/templates/consist.html b/ram/portal/templates/consist.html index 668d509..90a2fdb 100644 --- a/ram/portal/templates/consist.html +++ b/ram/portal/templates/consist.html @@ -1,4 +1,4 @@ -{% extends "base.html" %} +{% extends "cards.html" %} {% block header %} {% if consist.tags.all %} @@ -141,6 +141,51 @@
+ +
{% if request.user.is_staff %}Edit{% endif %}
diff --git a/ram/portal/templates/consists.html b/ram/portal/templates/consists.html index 6b1d49d..db30fc5 100644 --- a/ram/portal/templates/consists.html +++ b/ram/portal/templates/consists.html @@ -1,4 +1,4 @@ -{% extends "base.html" %} +{% extends "cards.html" %} {% block cards %} {% for c in consist %} diff --git a/ram/portal/templates/home.html b/ram/portal/templates/home.html index bc1746a..c923032 100644 --- a/ram/portal/templates/home.html +++ b/ram/portal/templates/home.html @@ -1,9 +1,8 @@ -{% extends "base.html" %} +{% extends "cards.html" %} {% block header %}

{{ site_conf.about | safe }}

{% endblock %} - {% block pagination %} {% if rolling_stock.has_other_pages %}