Remove debug JSON from templates and views

This commit is contained in:
Joakim Hellsén 2026-03-17 05:01:49 +01:00
commit 92ca0404a6
Signed by: Joakim Hellsén
SSH key fingerprint: SHA256:/9h/CsExpFp+PRhsfA0xznFx2CGfTT5R/kpuFfUgEQk
13 changed files with 4 additions and 329 deletions

View file

@ -7,13 +7,11 @@
<h1>{{ badge_sets.count }} Twitch Chat Badges</h1>
{% if badge_sets %}
{% for data in badge_data %}
<!-- {{ data.set.set_id }} - {{ data.badges|length }} version{% if data.badges|length > 1 %}s{% endif %} -->
<h2>
<a href="{% url 'twitch:badge_set_detail' set_id=data.set.set_id %}">{{ data.set.set_id }}</a>
</h2>
<table>
{% for badge in data.badges %}
<!-- {{ badge.title }} {% if badge.description != badge.title %}- {{ badge.description }}{% else %}{% endif %} -->
<tr>
<td style="width: 40px;">
<a href="{% url 'twitch:badge_set_detail' set_id=data.set.set_id %}">

View file

@ -9,7 +9,6 @@
<table>
<tbody>
{% for badge in badges %}
<!-- {{ badge.title }} {% if badge.description != badge.title %}- {{ badge.description }}{% else %}{% endif %} -->
<tr>
<td>
<code>{{ badge.badge_id }}</code>
@ -48,5 +47,4 @@
{% else %}
<p>No badges found in this set.</p>
{% endif %}
{{ set_data|safe }}
{% endblock content %}

View file

@ -114,7 +114,6 @@
<table style="border-collapse: collapse; width: 100%;">
<tbody>
{% for drop in drops %}
<!-- {{ drop.drop.name }} - {{ drop.drop.benefits.all|join:", " }} -->
<tr>
<td>
{% for benefit in drop.drop.benefits.all %}
@ -177,7 +176,6 @@
<h5>Allowed Channels</h5>
<div>
{% for channel in allowed_channels %}
<!-- {{ channel.display_name }} https://www.twitch.tv/{{ channel.display_name }} -->
<a href="{% url 'twitch:channel_detail' channel.twitch_id %}">{{ channel.display_name }}</a>
{% endfor %}
</div>
@ -189,6 +187,4 @@
Go to a participating live channel
</a>
{% endif %}
<!-- Campaign JSON -->
{{ campaign_data|safe }}
{% endblock content %}

View file

@ -1,7 +1,6 @@
{% extends "base.html" %}
{% load static %}
{% load image_tags %}
{% load image_tags %}
{% block title %}
Drop Campaigns
{% endblock title %}
@ -47,7 +46,6 @@
<select name="game">
<option value="">All Games</option>
{% for game in games %}
<!-- Game option with Twitch ID {{ game.twitch_id }} and display name "{{ game.display_name }}" -->
<option value="{{ game.twitch_id }}"
{% if selected_game == game.twitch_id %}selected{% endif %}>
{{ game.display_name|default:game.name|default:game.slug|default:game.twitch_id }}
@ -58,7 +56,6 @@
<select id="status" name="status">
<option value="">All Statuses</option>
{% for status in status_options %}
<!-- Status option "{{ status }}" -->
<option value="{{ status }}"
{% if selected_status == status %}selected{% endif %}>{{ status|title }}</option>
{% endfor %}
@ -71,7 +68,6 @@
{% if campaigns %}
{% regroup campaigns by game as campaigns_by_game %}
{% for game_group in campaigns_by_game %}
<!-- Game group for game "{{ game_group.grouper.display_name }}" with {{ game_group.list|length }} campaigns -->
<section>
<div style="display: flex; gap: 1rem;">
<div>
@ -108,9 +104,6 @@
<div style="overflow-x: auto;">
<div style="display: flex; gap: 1rem; min-width: max-content;">
{% for campaign in game_group.list %}
<!-- Campaign "{{ campaign.clean_name }}" with Twitch ID {{ campaign.twitch_id }} -->
<!-- https://ttvdrops.lovinator.space{% url 'twitch:campaign_detail' campaign.twitch_id %} -->
<!-- https://ttvdrops.lovinator.space{{ campaign.image_best_url }} -->
<article style="display: flex;
flex-direction: column;
align-items: flex-start;
@ -165,7 +158,6 @@
{% endif %}
<!-- Pagination -->
{% if is_paginated %}
<!-- {{ page_obj.paginator.count }} total campaigns, showing {{ page_obj.start_index }} to {{ page_obj.end_index }} on page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }} -->
<nav style="text-align: center;">
<div>
{% if page_obj.has_previous %}

View file

@ -33,17 +33,13 @@
<table>
<tbody>
{% for campaign in active_campaigns %}
<!-- Campaign {{ campaign.name }} ({{ campaign.twitch_id }}) -->
<tr>
<td>
<a href="{% url 'twitch:campaign_detail' campaign.twitch_id %}">{{ campaign.clean_name }}</a>
{% if campaign.time_based_drops.all %}
<!-- If the campaign has time-based drops, show the benefits in a nested div -->
<div>
<!-- swag swag swag {{campaign.sorted_benefits}} -->
{% for benefit in campaign.sorted_benefits %}
<!-- Benefit {{ benefit.name }} ({{ benefit.twitch_id }}) -->
<!-- {{ benefit.image_best_url }} -->
<span title="{{ benefit.name }}">
{% if benefit.image_best_url or benefit.image_asset_url %}
<!-- Show the benefit image if available -->
@ -85,7 +81,6 @@
<table>
<tbody>
{% for campaign in upcoming_campaigns %}
<!-- Campaign {{ campaign.name }} ({{ campaign.twitch_id }}) -->
<tr>
<td>
<a href="{% url 'twitch:campaign_detail' campaign.twitch_id %}">{{ campaign.clean_name }}</a>
@ -93,7 +88,6 @@
<!-- If the campaign has time-based drops, show the benefits in a nested div -->
<div>
{% for benefit in campaign.sorted_benefits %}
<!-- Benefit {{ benefit.name }} ({{ benefit.twitch_id }}) -->
<span title="{{ benefit.name }}">
{% if benefit.image_best_url or benefit.image_asset_url %}
<!-- Show the benefit image if available -->
@ -135,7 +129,6 @@
<table>
<tbody>
{% for campaign in expired_campaigns %}
<!-- Campaign {{ campaign.name }} ({{ campaign.twitch_id }}) -->
<tr>
<td>
<a href="{% url 'twitch:campaign_detail' campaign.twitch_id %}">{{ campaign.clean_name }}</a>
@ -143,7 +136,6 @@
<!-- If the campaign has time-based drops, show the benefits in a nested div -->
<div>
{% for benefit in campaign.sorted_benefits %}
<!-- Benefit {{ benefit.name }} ({{ benefit.twitch_id }}) -->
<span title="{{ benefit.name }}">
{% if benefit.image_best_url or benefit.image_asset_url %}
<img src="{{ benefit.image_best_url|default:benefit.image_asset_url }}"
@ -181,5 +173,4 @@
{% if not active_campaigns and not upcoming_campaigns and not expired_campaigns %}
<p>No campaigns found for this channel.</p>
{% endif %}
{{ channel_data|safe }}
{% endblock content %}

View file

@ -63,7 +63,6 @@
<div style="flex: 1; overflow-x: auto;">
<div style="display: flex; gap: 1rem; min-width: max-content;">
{% for campaign_data in game_data.campaigns %}
<!-- {{ campaign_data.campaign.name }} -->
<article style="display: flex;
flex-direction: column;
align-items: center;
@ -106,7 +105,6 @@
{% if campaign_data.campaign.allow_is_enabled %}
{% if campaign_data.allowed_channels %}
{% for channel in campaign_data.allowed_channels|slice:":5" %}
<!-- {{ channel.name }} -->
<li style="margin-bottom: 0.1rem;">
<a href="https://twitch.tv/{{ channel.name }}"
rel="nofollow ugc"
@ -132,14 +130,12 @@
{% endif %}
{% endif %}
{% if campaign_data.allowed_channels|length > 5 %}
<!-- {{ campaign_data.allowed_channels|length }} allowed channels -->
<li style="margin-bottom: 0.1rem; color: #666; font-style: italic;">
... and {{ campaign_data.allowed_channels|length|add:"-5" }} more
</li>
{% endif %}
{% else %}
{% if campaign_data.campaign.game.twitch_directory_url %}
<!--{{ campaign_data.campaign.game.display_name }} Twitch directory URL: {{ campaign_data.campaign.game.twitch_directory_url }} -->
<li>
<a href="{{ campaign_data.campaign.game.twitch_directory_url }}"
rel="nofollow ugc"
@ -148,7 +144,6 @@
</a>
</li>
{% else %}
<!-- {{ campaign_data.campaign.game.display_name }} Twitch directory URL not available -->
<li>Failed to get Twitch directory URL :(</li>
{% endif %}
{% endif %}

View file

@ -6,8 +6,6 @@
{% block content %}
<h1>Emotes</h1>
{% for emote in emotes %}
<!-- Emote from campaign {{ emote.campaign.name }} -->
<!-- https://ttvdrops.lovinator.space{{ emote.image_url }} -->
<a href="{% url 'twitch:campaign_detail' emote.campaign.twitch_id %}"
title="{{ emote.campaign.name }}"
style="display: inline-block">

View file

@ -158,5 +158,4 @@
{% if not active_campaigns and not upcoming_campaigns and not expired_campaigns %}
<p id="no-campaigns-message">No campaigns found for this game.</p>
{% endif %}
{{ game_data|safe }}
{% endblock content %}

View file

@ -27,5 +27,4 @@
{% else %}
<p>No organizations found.</p>
{% endif %}
{{ orgs_data|safe }}
{% endblock content %}

View file

@ -44,6 +44,4 @@
{% endfor %}
</tbody>
</table>
<hr />
{{ org_data|safe }}
{% endblock content %}

View file

@ -164,6 +164,4 @@
</tr>
</tbody>
</table>
<hr />
{{ campaign_data|safe }}
{% endblock content %}