Allow subscribe to orgs

This commit is contained in:
Joakim Hellsén 2025-08-02 05:45:20 +02:00
commit 4af2b02a01
10 changed files with 190 additions and 14 deletions

View file

@ -46,6 +46,7 @@
<a href="{% url 'twitch:dashboard' %}">Dashboard</a> |
<a href="{% url 'twitch:campaign_list' %}">Campaigns</a> |
<a href="{% url 'twitch:game_list' %}">Games</a> |
<a href="{% url 'twitch:org_list' %}">Organizations</a> |
{% if user.is_authenticated %}
{% if user.is_staff %}
<a href="{% url 'admin:index' %}">Admin</a> |
@ -60,7 +61,7 @@
{% for message in messages %}
<li>
{% if message.level == DEFAULT_MESSAGE_LEVELS.ERROR %}Important:{% endif %}
{{ message }}
{{ message|linebreaksbr }}
</li>
{% endfor %}
</ul>

View file

@ -9,7 +9,7 @@
</h1>
<p>
{# TODO: Link to organization #}
<a href="#">{{ campaign.owner.name }}</a>
<a href="{% url 'twitch:org_detail' campaign.owner.id %}">{{ campaign.owner.name }}</a>
</p>
{% if campaign.image_url %}
<img height="70"

View file

@ -1,9 +1,9 @@
{% extends "base.html" %}
{% block title %}
Games by Organization - Twitch Drops Tracker
Games
{% endblock title %}
{% block content %}
<h1>Games by Organization</h1>
<h1>Games</h1>
{% if games_by_org %}
{% for organization, games in games_by_org.items %}
<h2>{{ organization.name }}</h2>

View file

@ -0,0 +1,18 @@
{% extends "base.html" %}
{% block title %}
Games
{% endblock title %}
{% block content %}
<h1>Organizations</h1>
{% if orgs %}
<ul>
{% for organization in orgs %}
<li>
<a href="{% url 'twitch:org_detail' organization.id %}">{{ organization.name }}</a>
</li>
{% endfor %}
</ul>
{% else %}
No games found.
{% endif %}
{% endblock content %}

View file

@ -0,0 +1,37 @@
{% extends "base.html" %}
{% block title %}
{{ organization.name }}
{% endblock title %}
{% block content %}
<h1>{{ organization.name }}</h1>
{% if user.is_authenticated %}
<form method="post"
action="{% url 'twitch:subscribe_org_notifications' org_id=organization.id %}">
{% csrf_token %}
<div>
<input type="checkbox"
id="found"
name="notify_found"
{% if subscription and subscription.notify_found %}checked{% endif %} />
<label for="found">🔔 Notify me when a drop for {{ organization.name }} appears on Twitch.</label>
</div>
<div>
<input type="checkbox"
id="live"
name="notify_live"
{% if subscription and subscription.notify_live %}checked{% endif %} />
<label for="live">🎮 Notify me when the drop is live and ready to be farmed.</label>
</div>
<button type="submit">Save preferences</button>
</form>
{% else %}
Login to subscribe!
{% endif %}
<ul>
{% for game in games %}
<li>
<a href="{% url 'twitch:game_detail' pk=game.id %}">{{ game }}</a>
</li>
{% endfor %}
</ul>
{% endblock content %}