Don't use users
This commit is contained in:
@ -1,54 +0,0 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<h1 class="my-4">Add Discord Webhook</h1>
|
||||
<form method="post" class="needs-validation" novalidate>
|
||||
{% csrf_token %}
|
||||
{{ form.non_field_errors }}
|
||||
<div class="mb-3">
|
||||
{{ form.name.errors }}
|
||||
<label for="{{ form.name.id_for_label }}" class="form-label">{{ form.name.label }}</label>
|
||||
<input type="text"
|
||||
name="name"
|
||||
maxlength="255"
|
||||
required=""
|
||||
class="form-control"
|
||||
aria-describedby="id_name_helptext"
|
||||
id="id_name">
|
||||
<div class="form-text text-muted">{{ form.name.help_text }}</div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
{{ form.webhook_url.errors }}
|
||||
<label for="{{ form.webhook_url.id_for_label }}" class="form-label">{{ form.webhook_url.label }}</label>
|
||||
<input type="url"
|
||||
name="webhook_url"
|
||||
required=""
|
||||
class="form-control"
|
||||
aria-describedby="id_webhook_url_helptext"
|
||||
id="id_webhook_url">
|
||||
<div class="form-text text-muted">{{ form.webhook_url.help_text }}</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Add Webhook</button>
|
||||
</form>
|
||||
<h2 class="mt-5">Webhooks</h2>
|
||||
<ul class="list-group mt-3">
|
||||
{% for webhook in webhooks %}
|
||||
<li class="list-group-item d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<a href="{{ webhook.webhook_url }}" target="_blank">{{ webhook.name }}</a>
|
||||
<small class="text-muted">added on {{ webhook.created_at|date:"F j, Y, g:i a" }}</small>
|
||||
</div>
|
||||
<form method="post"
|
||||
action="{% url 'core:delete_discord_webhook' %}"
|
||||
class="mb-0">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="webhook_id" value="{{ webhook.id }}">
|
||||
<input type="hidden" name="webhook_name" value="{{ webhook.name }}">
|
||||
<input type="hidden" name="webhook_url" value="{{ webhook.webhook_url }}">
|
||||
<button type="submit" class="btn btn-sm btn-danger">Delete</button>
|
||||
</form>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endblock content %}
|
@ -1,98 +1,122 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<div class="container mt-4">
|
||||
<div class="row">
|
||||
<div class="col-lg-3">
|
||||
<div class="position-sticky d-none d-lg-block toc">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Games</h5>
|
||||
<ul class="list-unstyled">
|
||||
{% for game in games %}
|
||||
<li>
|
||||
<a href="#game-{{ game.game_id }}" class="text-decoration-none">{{ game.display_name }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-9">
|
||||
{% for game in games %}
|
||||
<div class="card mb-4 shadow-sm" id="game-{{ game.game_id }}">
|
||||
<div class="row g-0">
|
||||
<div class="col-md-2">
|
||||
<img src="{{ game.image_url }}"
|
||||
alt="{{ game.display_name }}"
|
||||
class="img-fluid rounded-start"
|
||||
height="283"
|
||||
width="212"
|
||||
loading="lazy">
|
||||
</div>
|
||||
<div class="col-md-10">
|
||||
<div class="card-body">
|
||||
<h2 class="card-title h5">
|
||||
<a href="{{ game.twitch_url }}" class="text-decoration-none">{{ game.display_name }}</a>
|
||||
</h2>
|
||||
<div class="mt-auto">
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" role="switch" id="new">
|
||||
<label class="form-check-label" for="new">
|
||||
Notify when new drop is found on <a href="https://www.twitch.tv/drops/campaigns">Twitch</a>
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" role="switch" id="live">
|
||||
<label class="form-check-label" for="live">Notify when a drop starts</label>
|
||||
</div>
|
||||
</div>
|
||||
{% for campaign in game.campaigns %}
|
||||
{% if not forloop.first %}<br>{% endif %}
|
||||
<div class="mt-3">
|
||||
<h3 class="h6">{{ campaign.name }}</h3>
|
||||
<p class="mb-2 text-muted">Ends in: {{ campaign.end_at|timeuntil }}</p>
|
||||
{% if campaign.description != campaign.name %}
|
||||
{% if campaign.description|length|get_digit:"-1" > 100 %}
|
||||
<p>
|
||||
<a class="btn btn-link p-0 text-muted"
|
||||
data-bs-toggle="collapse"
|
||||
href="#collapseDescription{{ campaign.drop_id }}"
|
||||
role="button"
|
||||
aria-expanded="false"
|
||||
aria-controls="collapseDescription{{ campaign.drop_id }}"
|
||||
aria-label="Show Description">Show
|
||||
Description</a>
|
||||
</p>
|
||||
<div class="collapse" id="collapseDescription{{ campaign.drop_id }}">
|
||||
<div class="card card-body">{{ campaign.description }}</div>
|
||||
<br>
|
||||
</div>
|
||||
{% else %}
|
||||
<p>{{ campaign.description }}</p>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<div class="row row-cols-1 row-cols-md-2 row-cols-lg-3 g-2">
|
||||
{% for drop in campaign.drops %}
|
||||
<div class="col d-flex align-items-center position-relative">
|
||||
<img src="{{ drop.image_url }}"
|
||||
alt="{{ drop.name }} drop image"
|
||||
class="img-fluid rounded me-3"
|
||||
height="50"
|
||||
width="50"
|
||||
loading="lazy">
|
||||
{{ drop.name }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
<body data-bs-spy="scroll"
|
||||
data-bs-target=".toc"
|
||||
data-bs-offset="-200"
|
||||
tabindex="0">
|
||||
<div class="container mt-4">
|
||||
<div class="row">
|
||||
<div class="col-lg-3">
|
||||
<div class="position-sticky d-none d-lg-block toc">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Games</h5>
|
||||
<div id="toc-list" class="list-group">
|
||||
{% for game in games %}
|
||||
<a class="list-group-item list-group-item-action plain-text-item"
|
||||
href="#game-{{ game.game_id }}">{{ game.display_name }}</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="col-lg-9">
|
||||
{% for game in games %}
|
||||
<div class="card mb-4 shadow-sm" id="game-{{ game.game_id }}">
|
||||
<div class="row g-0">
|
||||
<div class="col-md-2">
|
||||
<img src="{{ game.image_url }}"
|
||||
alt="{{ game.display_name }}"
|
||||
class="img-fluid rounded-start"
|
||||
height="283"
|
||||
width="212"
|
||||
loading="lazy">
|
||||
</div>
|
||||
<div class="col-md-10">
|
||||
<div class="card-body">
|
||||
<h2 class="card-title h5">
|
||||
<a href="{{ game.twitch_url }}" class="text-decoration-none">{{ game.display_name }}</a>
|
||||
</h2>
|
||||
<div class="mt-auto">
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input"
|
||||
type="checkbox"
|
||||
role="switch"
|
||||
id="new-{{ game.game_id }}">
|
||||
<label class="form-check-label" for="new-{{ game.game_id }}">
|
||||
Notify when new drop is found on <a href="https://www.twitch.tv/drops/campaigns">Twitch</a>
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input"
|
||||
type="checkbox"
|
||||
role="switch"
|
||||
id="live-{{ game.game_id }}">
|
||||
<label class="form-check-label" for="live-{{ game.game_id }}">Notify when a drop starts</label>
|
||||
</div>
|
||||
</div>
|
||||
{% for campaign in game.campaigns %}
|
||||
{% if not forloop.first %}<br>{% endif %}
|
||||
<div class="mt-3">
|
||||
<h3 class="h6">{{ campaign.name }}</h3>
|
||||
<p class="mb-2 text-muted">
|
||||
Ends in: <abbr title="{{ campaign.start_at|date:'l d F H:i' }} - {{ campaign.end_at|date:'l d F H:i e' }}">{{ campaign.end_at|timeuntil }}</abbr>
|
||||
</p>
|
||||
{% if campaign.description != campaign.name %}
|
||||
{% if campaign.description|length > 100 %}
|
||||
<p>
|
||||
<a class="btn btn-link p-0 text-muted"
|
||||
data-bs-toggle="collapse"
|
||||
href="#collapseDescription{{ campaign.drop_id }}"
|
||||
role="button"
|
||||
aria-expanded="false"
|
||||
aria-controls="collapseDescription{{ campaign.drop_id }}"
|
||||
aria-label="Show Description">Show
|
||||
Description</a>
|
||||
</p>
|
||||
<div class="collapse" id="collapseDescription{{ campaign.drop_id }}">
|
||||
<div class="card card-body">{{ campaign.description }}</div>
|
||||
<br>
|
||||
</div>
|
||||
{% else %}
|
||||
<p>{{ campaign.description }}</p>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<div class="row row-cols-1 row-cols-md-2 row-cols-lg-3 g-2">
|
||||
{% for drop in campaign.drops %}
|
||||
<div class="col d-flex align-items-center position-relative">
|
||||
<img src="{{ drop.image_url }}"
|
||||
alt="{{ drop.name }} drop image"
|
||||
class="img-fluid rounded me-3"
|
||||
height="50"
|
||||
width="50"
|
||||
loading="lazy">
|
||||
{{ drop.name }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="module">
|
||||
const scrollSpy = new bootstrap.ScrollSpy(document.body, {
|
||||
target: '.toc'
|
||||
})
|
||||
|
||||
document.body.addEventListener('activate.bs.scrollspy', function (event) {
|
||||
const activeItem = document.querySelector('.toc .active');
|
||||
if (activeItem) {
|
||||
activeItem.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'nearest' });
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
{% endblock content %}
|
||||
|
@ -1,4 +1,3 @@
|
||||
{% load socialaccount %}
|
||||
<header class="d-flex justify-content-between align-items-center py-3 border-bottom">
|
||||
<h1 class="h2">
|
||||
<a href='{% url "core:index" %}' class="text-decoration-none nav-title">Twitch drops</a>
|
||||
@ -15,17 +14,8 @@
|
||||
<a class="nav-link" href="https://github.com/sponsors/TheLovinator1">Donate</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="nav-link" href='{% url "core:add_discord_webhook" %}'>Webhooks</a>
|
||||
<a class="nav-link" href='{% url "core:webhooks" %}'>Webhooks</a>
|
||||
</li>
|
||||
{% if user.is_authenticated %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href='{% url "account_logout" %}'>Logout</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href='{% provider_login_url "twitch" %}'>Login</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</nav>
|
||||
</header>
|
||||
|
47
core/templates/webhooks.html
Normal file
47
core/templates/webhooks.html
Normal file
@ -0,0 +1,47 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<h1 class="my-4">Add Discord Webhook</h1>
|
||||
<form method="post"
|
||||
action="{% url 'core:add_webhook' %}"
|
||||
class="needs-validation"
|
||||
novalidate>
|
||||
{% csrf_token %}
|
||||
{{ form.non_field_errors }}
|
||||
<div class="mb-3">
|
||||
{{ form.webhook_url.errors }}
|
||||
<label for="{{ form.webhook_url.id_for_label }}" class="form-label">{{ form.webhook_url.label }}</label>
|
||||
<input type="url"
|
||||
name="webhook_url"
|
||||
required=""
|
||||
class="form-control"
|
||||
aria-describedby="id_webhook_url_helptext"
|
||||
id="id_webhook_url">
|
||||
<div class="form-text text-muted">{{ form.webhook_url.help_text }}</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Add Webhook</button>
|
||||
</form>
|
||||
<h2 class="mt-5">Webhooks</h2>
|
||||
{% if webhooks %}
|
||||
<ul class="list-group mt-3">
|
||||
{% for webhook in webhooks %}
|
||||
<li class="list-group-item d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<a href="{{ webhook.webhook_url }}" target="_blank">{{ webhook.name }}</a>
|
||||
<small class="text-muted">added on {{ webhook.created_at|date:"F j, Y, g:i a" }}</small>
|
||||
</div>
|
||||
<form method="post" action="" class="mb-0">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="webhook_id" value="{{ webhook.id }}">
|
||||
<input type="hidden" name="webhook_name" value="{{ webhook.name }}">
|
||||
<input type="hidden" name="webhook_url" value="{{ webhook.webhook_url }}">
|
||||
<button type="submit" class="btn btn-sm btn-danger">Delete</button>
|
||||
</form>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
<p class="text-muted">No webhooks added yet.</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock content %}
|
Reference in New Issue
Block a user