ttvdrops/templates/twitch/search_results.html

87 lines
4.3 KiB
HTML

{% extends "base.html" %}
{% block title %}
Search Results for "{{ query }}"
{% endblock title %}
{% block content %}
<div class="container" id="search-results-container">
<h1 id="page-title">Search Results for "{{ query }}"</h1>
{% if not results.organizations and not results.games and not results.campaigns and not results.drops and not results.benefits and not results.reward_campaigns %}
<p id="no-results">No results found.</p>
{% else %}
{% if results.organizations %}
<h2 id="organizations-header">Organizations</h2>
<ul id="organizations-list">
{% for org in results.organizations %}
<li id="org-{{ org.twitch_id }}">
<a href="{% url 'twitch:organization_detail' org.twitch_id %}">{{ org.name }}</a>
</li>
{% endfor %}
</ul>
{% endif %}
{% if results.games %}
<h2 id="games-header">Games</h2>
<ul id="games-list">
{% for game in results.games %}
<li id="game-{{ game.twitch_id }}">
<a href="{% url 'twitch:game_detail' game.twitch_id %}">{{ game.display_name }}</a>
</li>
{% endfor %}
</ul>
{% endif %}
{% if results.campaigns %}
<h2 id="campaigns-header">Campaigns</h2>
<ul id="campaigns-list">
{% for campaign in results.campaigns %}
<li id="campaign-{{ campaign.twitch_id }}">
<a href="{% url 'twitch:campaign_detail' campaign.twitch_id %}">{{ campaign.name }}</a>
</li>
{% endfor %}
</ul>
{% endif %}
{% if results.drops %}
<h2 id="drops-header">Drops</h2>
<ul id="drops-list">
{% for drop in results.drops %}
<li id="drop-{{ drop.twitch_id }}">
{% if drop.campaign and drop.campaign.twitch_id %}
<a href="{% url 'twitch:campaign_detail' drop.campaign.twitch_id %}">{{ drop.name }}</a> (in {{ drop.campaign.name }})
{% else %}
{{ drop.name }}
{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
{% if results.benefits %}
<h2 id="benefits-header">Benefits</h2>
<ul id="benefits-list">
{% for benefit in results.benefits %}
<li id="benefit-{{ benefit.twitch_id }}">
{% with first_drop=benefit.drops.first %}
{% if first_drop and first_drop.campaign and first_drop.campaign.twitch_id %}
<a href="{% url 'twitch:campaign_detail' first_drop.campaign.twitch_id %}">{{ benefit.name }}</a>
{% else %}
{{ benefit.name }}
{% endif %}
{% endwith %}
</li>
{% endfor %}
</ul>
{% endif %}
{% if results.reward_campaigns %}
<h2 id="reward-campaigns-header">Reward Campaigns</h2>
<ul id="reward-campaigns-list">
{% for campaign in results.reward_campaigns %}
<li id="reward-campaign-{{ campaign.twitch_id }}">
{% if campaign.brand %}
<a href="{% url 'twitch:reward_campaign_detail' campaign.twitch_id %}">{{ campaign.brand }}: {{ campaign.name }}</a>
{% else %}
<a href="{% url 'twitch:reward_campaign_detail' campaign.twitch_id %}">{{ campaign.name }}</a>
{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
{% endif %}
</div>
{% endblock content %}