From fb11aa44074f730236530ebfe19b62fced3c5605 Mon Sep 17 00:00:00 2001 From: Tobias Kunze Date: Mon, 24 Mar 2025 10:50:48 +0100 Subject: [PATCH] Improve service detail template --- .../organizations/service_detail.html | 125 +++++------------- .../frontend/organizations/services.html | 43 +++--- .../frontend/templates/frontend/profile.html | 4 +- src/servala/frontend/views/service.py | 8 +- 4 files changed, 62 insertions(+), 118 deletions(-) diff --git a/src/servala/frontend/templates/frontend/organizations/service_detail.html b/src/servala/frontend/templates/frontend/organizations/service_detail.html index bdff6b9..674a714 100644 --- a/src/servala/frontend/templates/frontend/organizations/service_detail.html +++ b/src/servala/frontend/templates/frontend/organizations/service_detail.html @@ -18,7 +18,7 @@ max-height: 48px"> {% endif %}
-

{{ service.name }}

+

{{ service.name }}

{{ service.category }}
@@ -28,99 +28,38 @@ -
-
-

{% trans "Available Offerings" %}

-
-
- {% for offering in service.offerings.all %} -
-
-
- {% if offering.provider.logo %} - {{ offering.provider.name }} - {% endif %} -
{{ service.name }} on {{ offering.provider.name }}
-
-
-
-
-
-

{{ offering.description|default:"No description available." }}

-
-
-
{% trans "Control Planes" %}
-
    - {% for control_plane in offering.control_planes.all %} -
  • {{ control_plane.name }}
  • - {% empty %} -
  • {% trans "No control planes available" %}
  • - {% endfor %} -
-
-
-
{% trans "Available Plans" %}
-
- - - - - - - - - - - - {% for plan in plans %} - - - - - - - - {% empty %} - - - - {% endfor %} - -
{% trans "Plan" %}{% trans "Term" %}{% trans "Features" %}{% trans "Pricing" %}{% trans "Actions" %}
- {{ plan.name }} - {% if plan.description %} -
- {{ plan.description }} - {% endif %} -
{{ plan.term }} {% trans "months" %} - {% if plan.features %} -
    - {% for feature, value in plan.features.items %}
  • {{ feature }}: {{ value }}
  • {% endfor %} -
- {% else %} - {% trans "No features specified" %} - {% endif %} -
- {% if plan.pricing %} -
    - {% for price_type, price in plan.pricing.items %}
  • {{ price_type }}: {{ price }}
  • {% endfor %} -
- {% else %} - {% trans "No pricing specified" %} - {% endif %} -
- -
{% trans "No plans available for this offering" %}
-
-
+ {% for offering in service.offerings.all %} +
+
+ {% if offering.provider.logo %} + {{ offering.provider.name }} + {% endif %} +
+

{{ offering.provider.name }}

- {% empty %} -
{% trans "No offerings available for this service yet." %}
- {% endfor %} +
+
+ {% if offering.description %} +

{{ offering.description }}

+ {% elif offering.provider.description %} +

{{ offering.provider.description }}

+ {% endif %} +
+
-
+ {% empty %} +
+
+

{% translate "No offerings found." %}

+
+
+ {% endfor %} {% endblock content %} diff --git a/src/servala/frontend/templates/frontend/organizations/services.html b/src/servala/frontend/templates/frontend/organizations/services.html index 0e8fd16..56ddab0 100644 --- a/src/servala/frontend/templates/frontend/organizations/services.html +++ b/src/servala/frontend/templates/frontend/organizations/services.html @@ -18,30 +18,33 @@
{% for service in services %}
-
-
- {% if service.logo %} - {{ service.name }} - {% endif %} -
-

{{ service.name }}

- {{ service.category }} -
-
-
- {% if service.description %}

{{ service.description }}

{% endif %} -
- {% empty %} -

{% translate "No services found." %}

+
+
+

{% translate "No services found." %}

+
+
{% endfor %} diff --git a/src/servala/frontend/templates/frontend/profile.html b/src/servala/frontend/templates/frontend/profile.html index 2d6433a..db6eda4 100644 --- a/src/servala/frontend/templates/frontend/profile.html +++ b/src/servala/frontend/templates/frontend/profile.html @@ -73,7 +73,7 @@
-

{% translate "Profile" %}

+

{% translate "Profile" %}

@@ -106,7 +106,7 @@
-

{% translate "Account" %}

+

{% translate "Account" %}

diff --git a/src/servala/frontend/views/service.py b/src/servala/frontend/views/service.py index f407250..5eac7e2 100644 --- a/src/servala/frontend/views/service.py +++ b/src/servala/frontend/views/service.py @@ -1,7 +1,7 @@ from django.utils.functional import cached_property from django.views.generic import DetailView, ListView -from servala.core.models import Plan, Service, ServiceOffering +from servala.core.models import Service from servala.frontend.forms.service import ServiceFilterForm from servala.frontend.views.mixins import OrganizationViewMixin @@ -43,6 +43,8 @@ class ServiceDetailView(OrganizationViewMixin, DetailView): return Service.objects.select_related("category").prefetch_related( "offerings", "offerings__provider", - "offerings__control_planes", - "offerings__plans", ) + + +class ServiceOfferingDetailView: + pass