ttvdrops/templates/twitch/campaign_detail.html

169 lines
7.9 KiB
HTML

{% extends "base.html" %}
{% load static %}
{% block title %}
{{ campaign.clean_name }}
{% endblock title %}
{% block content %}
<!-- Campaign Title -->
<h1>
{% if campaign.game %}
<a href="{% url 'twitch:game_detail' campaign.game.twitch_id %}">{{ campaign.game.get_game_name }}</a> - {{ campaign.clean_name }}
{% else %}
{{ campaign.clean_name }}
{% endif %}
</h1>
<!-- Campaign Owners -->
{% for org in owners %}
<p>
<a href="{% url 'twitch:organization_detail' org.twitch_id %}">{{ org.name }}</a>
</p>
{% endfor %}
<!-- Campaign image -->
{% if campaign.image_best_url %}
<img height="160"
width="160"
src="{{ campaign.image_best_url }}"
alt="{{ campaign.name }}" />
{% endif %}
<!-- Campaign description -->
<p>{{ campaign.description|linebreaksbr }}</p>
<!-- Campaign end times -->
<div>
{% if campaign.end_at < now %}
<time datetime="{{ campaign.end_at|date:'c' }}"
title="{{ campaign.end_at|date:'DATETIME_FORMAT' }}">
<strong>Ended</strong> {{ campaign.end_at|timesince }} ago
</time>
{% else %}
<time datetime="{{ campaign.end_at|date:'c' }}"
title="{{ campaign.end_at|date:'DATETIME_FORMAT' }}">
<strong>Ends in</strong> {{ campaign.end_at|timeuntil }}
</time>
{% endif %}
</div>
<!-- Campaign start times -->
<div>
{% if campaign.start_at > now %}
<time datetime="{{ campaign.start_at|date:'c' }}"
title="{{ campaign.start_at|date:'DATETIME_FORMAT' }}">
<strong>Starts in</strong> {{ campaign.start_at|timeuntil }}
</time>
{% else %}
<time datetime="{{ campaign.start_at|date:'c' }}"
title="{{ campaign.start_at|date:'DATETIME_FORMAT' }}">
<strong>Started</strong> {{ campaign.start_at|timesince }} ago
</time>
{% endif %}
</div>
<!-- Campaign duration -->
<div>
<time datetime="{{ campaign.duration_iso }}"
title="{{ campaign.start_at|date:'DATETIME_FORMAT' }} to {{ campaign.end_at|date:'DATETIME_FORMAT' }}">
<strong>Duration</strong> {{ campaign.end_at|timeuntil:campaign.start_at }}
</time>
</div>
<div>
<!-- Campaign Detail URL -->
{% if campaign.details_url %}<a href="{{ campaign.details_url }}" rel="nofollow ugc">[details]</a>{% endif %}
<!-- Campaign Account Link URL -->
{% if campaign.account_link_url %}
<a href="{{ campaign.account_link_url }}" rel="nofollow ugc">[connect]</a>
{% endif %}
<!-- RSS Feeds -->
{% if campaign.game %}
<a href="{% url 'twitch:game_campaign_feed' campaign.game.twitch_id %}"
title="RSS feed for {{ campaign.game.display_name }} campaigns">[rss]</a>
{% endif %}
</div>
{% if allowed_channels %}
<h5>Allowed Channels</h5>
<div>
{% for channel in allowed_channels %}
<a href="{% url 'twitch:channel_detail' channel.twitch_id %}">{{ channel.display_name }}</a>
{% endfor %}
</div>
{% else %}
<a href="{{ campaign.game.twitch_directory_url }}"
rel="nofollow ugc"
title="Find streamers playing {{ campaign.game.display_name }} with drops enabled">
Go to a participating live channel
</a>
{% endif %}
<h5>Campaign Info</h5>
{% if drops %}
<table id="drops-table" style="border-collapse: collapse; width: 100%;">
<thead>
<tr>
<th></th>
<th>Drop Name</th>
<th>Requirements</th>
<th>Period</th>
</tr>
</thead>
<tbody>
{% for drop in drops %}
<tr id="drop-{{ drop.drop.twitch_id }}">
<td>
{% for benefit in drop.drop.benefits.all %}
{% if benefit.image_asset_url %}
<img height="160"
width="160"
loading="lazy"
style="object-fit: cover;
margin-right: 3px"
src="{{ benefit.image_best_url|default:benefit.image_asset_url }}"
alt="{{ benefit.name }}" />
{% endif %}
{% if benefit.distribution_type == "BADGE" and drop.awarded_badge %}
<div style="margin-top: 6px; font-size: 0.9em;">
<strong>Awards Badge:</strong>
<a href="{% url 'twitch:badge_set_detail' set_id=drop.awarded_badge.badge_set.set_id %}">
<img src="{{ drop.awarded_badge.image_url_2x }}"
alt="{{ drop.awarded_badge.title }} badge"
height="24"
width="24"
style="vertical-align: middle;
margin-right: 4px" />
{{ drop.awarded_badge.title }}
</a>
{% if drop.awarded_badge.description %}
<div style="margin-top: 4px; color: #a9a9a9; font-size: 0.9em;">{{ drop.awarded_badge.description|linebreaksbr }}</div>
{% endif %}
</div>
{% endif %}
{% endfor %}
</td>
<td>
<div style="margin-bottom: 5px;">{{ drop.drop.name }}</div>
{% for benefit in drop.drop.benefits.all %}
{% if benefit.name != drop.drop.name %}
<div style="font-size: 0.9em; color: #a9a9a9; margin-bottom: 3px;">{{ benefit.name }}</div>
{% endif %}
{% endfor %}
</td>
<td>
{% if drop.drop.required_minutes_watched %}{{ drop.drop.required_minutes_watched }} minutes watched{% endif %}
{% if drop.drop.required_subs > 0 %}
{% if drop.drop.required_minutes_watched %}and{% endif %}
{{ drop.drop.required_subs }} subscriptions required
{% endif %}
</td>
<td>
<div>
{% if drop.local_start %}{{ drop.local_start|date:"M j, Y H:i" }}{% endif %}
{% if drop.local_start and drop.local_end %}-{% endif %}
{% if drop.local_end %}{{ drop.local_end|date:"M j, Y H:i" }}{% endif %}
<small style="color: #a9a9a9;">{{ drop.timezone_name }}</small>
</div>
<div style="font-size: 0.8em; color: #a9a9a9;">{{ drop.countdown_text }}</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>No drops available for this campaign.</p>
{% endif %}
<!-- Campaign JSON -->
{{ campaign_data|safe }}
{% endblock content %}