diff --git a/src/servala/frontend/forms/service.py b/src/servala/frontend/forms/service.py index 04fe2df..189f9d5 100644 --- a/src/servala/frontend/forms/service.py +++ b/src/servala/frontend/forms/service.py @@ -1,4 +1,5 @@ from django import forms +from django.db.models import Q from django.utils.translation import gettext_lazy as _ from servala.core.models import ( @@ -18,13 +19,17 @@ class ServiceFilterForm(forms.Form): cloud_provider = forms.ModelChoiceField( queryset=CloudProvider.objects.all(), required=False ) - q = forms.CharField(required=False) + q = forms.CharField(label=_("Search"), required=False) def filter_queryset(self, queryset): if category := self.cleaned_data.get("category"): queryset = queryset.filter(category=category) if cloud_provider := self.cleaned_data.get("cloud_provider"): queryset = queryset.filter(offerings__provider=cloud_provider) + if search := self.cleaned_data.get("q"): + queryset = queryset.filter( + Q(name__icontains=search) | Q(category__name__icontains=search) + ) return queryset diff --git a/src/servala/frontend/templates/frontend/organizations/service_detail.html b/src/servala/frontend/templates/frontend/organizations/service_detail.html index c3962eb..a118539 100644 --- a/src/servala/frontend/templates/frontend/organizations/service_detail.html +++ b/src/servala/frontend/templates/frontend/organizations/service_detail.html @@ -28,38 +28,42 @@ - {% for offering in service.offerings.all %} -
-
- {% if offering.provider.logo %} - {{ offering.provider.name }} - {% endif %} -
-

{{ offering.provider.name }}

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

{{ offering.provider.name }}

+
+
+
+ {% if offering.description %} +

{{ offering.description }}

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

{{ offering.provider.description }}

+ {% endif %} +
+
-
- {% if offering.description %} -

{{ offering.description }}

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

{{ offering.provider.description }}

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

{% translate "No offerings found." %}

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

{% translate "No offerings found." %}

-
-
- {% endfor %} + {% endfor %} +
{% endblock content %} diff --git a/src/servala/frontend/templates/frontend/organizations/services.html b/src/servala/frontend/templates/frontend/organizations/services.html index 3286952..b3707e4 100644 --- a/src/servala/frontend/templates/frontend/organizations/services.html +++ b/src/servala/frontend/templates/frontend/organizations/services.html @@ -16,36 +16,40 @@
- {% for service in services %} -
-
- {% if service.logo %} - {{ service.name }} - {% endif %} -
-

{{ service.name }}

- {{ service.category }} +
+ {% for service in services %} +
+
+
+ {% if service.logo %} + {{ service.name }} + {% endif %} +
+

{{ service.name }}

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

{{ service.description }}

{% endif %} +
+
-
- {% if service.description %}

{{ service.description }}

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

{% translate "No services found." %}

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

{% translate "No services found." %}

-
-
- {% endfor %} + {% endfor %} +
{% endblock content %}