From 786e9d10bd8b47f9d165364a533d95f14d4fcd8e Mon Sep 17 00:00:00 2001 From: Thomas Steen Rasmussen Date: Mon, 19 Jul 2021 22:02:35 +0200 Subject: [PATCH] add IrcOverView --- src/backoffice/templates/index.html | 4 ++ src/backoffice/templates/irc_overview.html | 47 ++++++++++++++++++++++ src/backoffice/urls.py | 5 +++ src/backoffice/views/orga.py | 18 +++++++++ 4 files changed, 74 insertions(+) create mode 100644 src/backoffice/templates/irc_overview.html diff --git a/src/backoffice/templates/index.html b/src/backoffice/templates/index.html index d84c1e73..8203164d 100644 --- a/src/backoffice/templates/index.html +++ b/src/backoffice/templates/index.html @@ -147,6 +147,10 @@

No emails are currently held for release. Check back later!

{% endif %} + +

IRC Overview

+

Use this view to see all IRC channels for this years teams

+
{% endif %} {% if perms.camps.economyteam_permission %} diff --git a/src/backoffice/templates/irc_overview.html b/src/backoffice/templates/irc_overview.html new file mode 100644 index 00000000..0b54362e --- /dev/null +++ b/src/backoffice/templates/irc_overview.html @@ -0,0 +1,47 @@ +{% extends 'base.html' %} +{% load commonmark %} +{% load static %} +{% load bornhack %} + +{% block content %} +
+
+ BackOffice - IRC Overview for {{ camp.title }} Teams +
+
+

This view shows a list of all {{ camp.title }} teams with IRC channels registered in the system. Teams with neither a public IRC channel nor a private IRC channel are not listed here.

+ + + + + + + + + + + + + + + + {% for team in team_list %} + + + + + + + + + + + + {% endfor %} + +
TeamPublic IRC ChannelBot?Managed?Fix Needed?Private IRC ChannelBot?Managed?Fix Needed?
{{ team.name }}{{ team.public_irc_channel_name|default:"N/A" }}{{ team.public_irc_channel_bot|truefalseicon }}{{ team.public_irc_channel_managed|truefalseicon }}{{ team.public_irc_channel_fix_needed|truefalseicon }}{{ team.private_irc_channel_name|default:"N/A" }}{{ team.private_irc_channel_bot|truefalseicon }}{{ team.private_irc_channel_managed|truefalseicon }}{{ team.private_irc_channel_fix_needed|truefalseicon }}
+ Backoffice +

+
+
+{% endblock content %} diff --git a/src/backoffice/urls.py b/src/backoffice/urls.py index be0a0b36..1348998e 100644 --- a/src/backoffice/urls.py +++ b/src/backoffice/urls.py @@ -57,6 +57,7 @@ from .views import ( FacilityTypeListView, FacilityTypeUpdateView, FacilityUpdateView, + IrcOverView, MerchandiseOrdersView, MerchandiseToOrderView, OutgoingEmailMassUpdateView, @@ -803,4 +804,8 @@ urlpatterns = [ ] ), ), + path( + "irc/", + include([path("overview/", IrcOverView.as_view(), name="irc_overview")]), + ), ] diff --git a/src/backoffice/views/orga.py b/src/backoffice/views/orga.py index a6c2cf6c..0c73f239 100644 --- a/src/backoffice/views/orga.py +++ b/src/backoffice/views/orga.py @@ -11,6 +11,7 @@ from django.views.generic.edit import FormView from camps.mixins import CampViewMixin from profiles.models import Profile from shop.models import OrderProductRelation +from teams.models import Team from utils.models import OutgoingEmail from ..mixins import OrgaTeamPermissionMixin @@ -173,3 +174,20 @@ class OutgoingEmailMassUpdateView(CampViewMixin, OrgaTeamPermissionMixin, FormVi def get_success_url(self, *args, **kwargs): """Return to the backoffice index.""" return reverse("backoffice:index", kwargs={"camp_slug": self.camp.slug}) + + +###################### +# IRCBOT RELATED VIEWS +class IrcOverView(CampViewMixin, OrgaTeamPermissionMixin, ListView): + model = Team + template_name = "irc_overview.html" + + def get_queryset(self): + return ( + super() + .get_queryset() + .exclude( + public_irc_channel_name__isnull=True, + private_irc_channel_name__isnull=True, + ) + )