add IrcOverView

This commit is contained in:
Thomas Steen Rasmussen 2021-07-19 22:02:35 +02:00
parent 949cb05ae1
commit 786e9d10bd
4 changed files with 74 additions and 0 deletions

View file

@ -147,6 +147,10 @@
<p class="list-group-item-text">No emails are currently held for release. Check back later!</p>
{% endif %}
</a>
<a href="{% url 'backoffice:irc_overview' camp_slug=camp.slug %}" class="list-group-item">
<h4 class="list-group-item-heading">IRC Overview</h4>
<p class="list-group-item-text">Use this view to see all IRC channels for this years teams</p>
</a>
{% endif %}
{% if perms.camps.economyteam_permission %}

View file

@ -0,0 +1,47 @@
{% extends 'base.html' %}
{% load commonmark %}
{% load static %}
{% load bornhack %}
{% block content %}
<div class="panel panel-default">
<div class="panel-heading">
<span class="h3">BackOffice - IRC Overview for {{ camp.title }} Teams</span>
</div>
<div class="panel-body">
<p class="lead">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.</p>
<table class="table table-hover">
<thead>
<tr>
<th>Team</th>
<th>Public IRC Channel</th>
<th class="text-center">Bot?</th>
<th class="text-center">Managed?</th>
<th class="text-center">Fix Needed?</th>
<th>Private IRC Channel</th>
<th class="text-center">Bot?</th>
<th class="text-center">Managed?</th>
<th class="text-center">Fix Needed?</th>
</tr>
</thead>
<tbody>
{% for team in team_list %}
<tr>
<td>{{ team.name }}</td>
<td>{{ team.public_irc_channel_name|default:"N/A" }}</td>
<td class="text-center">{{ team.public_irc_channel_bot|truefalseicon }}</td>
<td class="text-center">{{ team.public_irc_channel_managed|truefalseicon }}</td>
<td class="text-center">{{ team.public_irc_channel_fix_needed|truefalseicon }}</td>
<td>{{ team.private_irc_channel_name|default:"N/A" }}</td>
<td class="text-center">{{ team.private_irc_channel_bot|truefalseicon }}</td>
<td class="text-center">{{ team.private_irc_channel_managed|truefalseicon }}</td>
<td class="text-center">{{ team.private_irc_channel_fix_needed|truefalseicon }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<a class="btn btn-default" href="{% url 'backoffice:index' camp_slug=camp.slug %}"><i class="fas fa-undo"></i> Backoffice</a>
</p>
</div>
</div>
{% endblock content %}

View file

@ -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")]),
),
]

View file

@ -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,
)
)