WIP: Services #25
|
@ -256,7 +256,7 @@ div.content-view>h2 {
|
||||||
|
|
||||||
div.services {
|
div.services {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: start;
|
||||||
gap: var(--double-space);
|
gap: var(--double-space);
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,13 +78,11 @@
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
{% comment %}
|
|
||||||
<li>
|
<li>
|
||||||
<a href="/services" class="{% active_path "services" "current" %}">
|
<a href="/services" class="{% active_path "services" "current" %}">
|
||||||
Services
|
Services
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% endcomment %}
|
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<a href="{% url "account_email" %}" class="{% active_path "account_email" "current" %}">
|
<a href="{% url "account_email" %}" class="{% active_path "account_email" "current" %}">
|
||||||
|
|
|
@ -2,61 +2,39 @@
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<div class="content-view">
|
|
||||||
Coming soon!
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% comment %}
|
|
||||||
<div class="content-view">
|
<div class="content-view">
|
||||||
<h2>Services you subscribe to</h2>
|
<h2>Services you subscribe to</h2>
|
||||||
<div class="services">
|
<div class="services">
|
||||||
|
{% for service in active_services %}
|
||||||
<div>
|
<div>
|
||||||
<div class="description">
|
<div class="description">
|
||||||
<h3>Passit</h3>
|
<h3>{{ service.name }}</h3>
|
||||||
<p>Passit is a service that blabla</p>
|
<p>...</p>
|
||||||
<a href="#">Read more …</a>
|
<a href="#">Read more …</a>
|
||||||
</div>
|
</div>
|
||||||
<a>Unsubscribe</a>
|
<a>Unsubscribe</a>
|
||||||
</div>
|
</div>
|
||||||
|
{% empty %}
|
||||||
|
<p>You are not subscribed to any service.</p>
|
||||||
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="content-view">
|
<div class="content-view">
|
||||||
<h2>Available services</h2>
|
<h2>Available services</h2>
|
||||||
<div class="services">
|
<div class="services">
|
||||||
|
{% for service in non_active_services %}
|
||||||
<div>
|
<div>
|
||||||
<div class="description">
|
<div class="description">
|
||||||
<h3>Forgejo</h3>
|
<h3>{{ service.name }}</h3>
|
||||||
<p>Forgejo is a service that blabla</p>
|
<p>{{ service.description }}</p>
|
||||||
<a href="#">Read more …</a>
|
<a href="{{ service.url }}" target="_blank">
|
||||||
</div>
|
Visit
|
||||||
<a>Subscribe</a>
|
</a>
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<div class="description">
|
|
||||||
<h3>Mastodon</h3>
|
|
||||||
<p>Mastodon is a service where you can write things to people around the world.</p>
|
|
||||||
<a href="#">Read more …</a>
|
|
||||||
</div>
|
|
||||||
<a>Subscribe</a>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<div class="description">
|
|
||||||
<h3>Matrix</h3>
|
|
||||||
<p>Matrix is a service that blabla</p>
|
|
||||||
<a href="#">Read more …</a>
|
|
||||||
</div>
|
|
||||||
<a>Subscribe</a>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<div class="description">
|
|
||||||
<h3>NextCloud</h3>
|
|
||||||
<p>NextCloud is a service that blabla</p>
|
|
||||||
<a href="#">Read more …</a>
|
|
||||||
</div>
|
</div>
|
||||||
<a>Subscribe</a>
|
<a>Subscribe</a>
|
||||||
</div>
|
</div>
|
||||||
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endcomment %}
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
"""Project views."""
|
"""Project views."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
from membership.models import ServiceAccess
|
||||||
|
from services.registry import ServiceRegistry
|
||||||
|
from utils.view_utils import render
|
||||||
|
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from django_view_decorator import view
|
from django_view_decorator import view
|
||||||
from utils.view_utils import render
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from django.http import HttpRequest
|
from django.http import HttpRequest
|
||||||
|
@ -29,4 +30,28 @@ def index(request: HttpRequest) -> HttpResponse:
|
||||||
)
|
)
|
||||||
def services_overview(request: HttpRequest) -> HttpResponse:
|
def services_overview(request: HttpRequest) -> HttpResponse:
|
||||||
"""View to show the services overview."""
|
"""View to show the services overview."""
|
||||||
return render(request, "services_overview.html")
|
active_services = [
|
||||||
|
access.service_implementation
|
||||||
|
for access in ServiceAccess.objects.filter(
|
||||||
|
user=request.user,
|
||||||
|
)
|
||||||
|
]
|
||||||
|
|
||||||
|
active_service_classes = [service.__class__ for service in active_services]
|
||||||
|
|
||||||
|
services = [
|
||||||
|
service
|
||||||
|
for _, service in ServiceRegistry.get_items()
|
||||||
|
if service not in active_service_classes
|
||||||
|
]
|
||||||
|
|
||||||
|
context = {
|
||||||
|
"non_active_services": services,
|
||||||
|
"active_services": active_services,
|
||||||
|
}
|
||||||
|
|
||||||
|
return render(
|
||||||
|
request=request,
|
||||||
|
template_name="services_overview.html",
|
||||||
|
context=context,
|
||||||
|
)
|
||||||
|
|
|
@ -13,6 +13,10 @@ class ServiceInterface(Interface):
|
||||||
|
|
||||||
registry = ServiceRegistry
|
registry = ServiceRegistry
|
||||||
|
|
||||||
|
name: str
|
||||||
|
description: str
|
||||||
|
url: str
|
||||||
|
|
||||||
public: bool = False
|
public: bool = False
|
||||||
|
|
||||||
# TODO: add a way to add a something which defines the required fields for a service
|
# TODO: add a way to add a something which defines the required fields for a service
|
||||||
|
|
|
@ -3,25 +3,43 @@ from .registry import ServiceInterface
|
||||||
|
|
||||||
class MailService(ServiceInterface):
|
class MailService(ServiceInterface):
|
||||||
slug = "mail"
|
slug = "mail"
|
||||||
|
name = "Mail"
|
||||||
|
url = "https://mail.data.coop"
|
||||||
|
description = "Mail service for data.coop"
|
||||||
|
|
||||||
|
|
||||||
class MatrixService(ServiceInterface):
|
class MatrixService(ServiceInterface):
|
||||||
slug = "matrix"
|
slug = "matrix"
|
||||||
|
name = "Matrix"
|
||||||
|
url = "https://matrix.data.coop"
|
||||||
|
description = "Matrix service for data.coop"
|
||||||
|
|
||||||
|
|
||||||
class MastodonService(ServiceInterface):
|
class MastodonService(ServiceInterface):
|
||||||
slug = "mastodon"
|
slug = "mastodon"
|
||||||
|
name = "Mastodon"
|
||||||
|
url = "https://social.data.coop"
|
||||||
|
description = "Mastodon service for data.coop"
|
||||||
|
|
||||||
|
|
||||||
class NextcloudService(ServiceInterface):
|
class NextcloudService(ServiceInterface):
|
||||||
slug = "nextcloud"
|
slug = "nextcloud"
|
||||||
|
name = "Nextcloud"
|
||||||
|
url = "https://cloud.data.coop"
|
||||||
|
description = "Nextcloud service for data.coop"
|
||||||
|
|
||||||
|
|
||||||
class HedgeDocService(ServiceInterface):
|
class HedgeDocService(ServiceInterface):
|
||||||
slug = "hedgedoc"
|
slug = "hedgedoc"
|
||||||
|
name = "HedgeDoc"
|
||||||
|
url = "https://pad.data.coop"
|
||||||
public = True
|
public = True
|
||||||
|
description = "HedgeDoc service for data.coop"
|
||||||
|
|
||||||
|
|
||||||
class RalllyService(ServiceInterface):
|
class RalllyService(ServiceInterface):
|
||||||
slug = "rallly"
|
slug = "rallly"
|
||||||
|
name = "Rallly"
|
||||||
|
url = "https://when.data.coop"
|
||||||
public = True
|
public = True
|
||||||
|
description = "Rallly service for data.coop"
|
||||||
|
|
Loading…
Reference in a new issue