Add allowed channels section to campaign detail view
This commit is contained in:
parent
c8cc6d83df
commit
162d752a22
2 changed files with 22 additions and 1 deletions
|
|
@ -77,6 +77,26 @@
|
||||||
target="_blank">Connect Account</a>
|
target="_blank">Connect Account</a>
|
||||||
</p>
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<!-- Allowed Channels -->
|
||||||
|
{% if allowed_channels %}
|
||||||
|
<h5>Allowed Channels</h5>
|
||||||
|
<div id="allowed-channels" style="margin-bottom: 20px;">
|
||||||
|
{% for channel in allowed_channels %}
|
||||||
|
<a href="{% url 'twitch:channel_detail' channel.id %}"
|
||||||
|
style="display: inline-block;
|
||||||
|
margin: 2px 5px 2px 0;
|
||||||
|
padding: 3px 8px;
|
||||||
|
background-color: #9146ff;
|
||||||
|
color: white;
|
||||||
|
text-decoration: none;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-size: 0.9em">{{ channel.display_name }}</a>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
|
<h5>Allowed Channels</h5>
|
||||||
|
<p style="color: #666; font-style: italic;">All channels allowed or no channel restrictions specified.</p>
|
||||||
|
{% endif %}
|
||||||
<h5>Campaign Info</h5>
|
<h5>Campaign Info</h5>
|
||||||
{% if drops %}
|
{% if drops %}
|
||||||
<table id="drops-table" style="border-collapse: collapse; width: 100%;">
|
<table id="drops-table" style="border-collapse: collapse; width: 100%;">
|
||||||
|
|
|
||||||
|
|
@ -232,7 +232,7 @@ class DropCampaignDetailView(DetailView):
|
||||||
if queryset is None:
|
if queryset is None:
|
||||||
queryset = self.get_queryset()
|
queryset = self.get_queryset()
|
||||||
|
|
||||||
queryset = queryset.select_related("game__owner")
|
queryset = queryset.select_related("game__owner").prefetch_related("allow_channels")
|
||||||
|
|
||||||
return super().get_object(queryset=queryset)
|
return super().get_object(queryset=queryset)
|
||||||
|
|
||||||
|
|
@ -337,6 +337,7 @@ class DropCampaignDetailView(DetailView):
|
||||||
context["drops"] = enhanced_drops
|
context["drops"] = enhanced_drops
|
||||||
context["campaign_data"] = format_and_color_json(campaign_data[0])
|
context["campaign_data"] = format_and_color_json(campaign_data[0])
|
||||||
context["owner"] = campaign.game.owner
|
context["owner"] = campaign.game.owner
|
||||||
|
context["allowed_channels"] = campaign.allow_channels.all().order_by("display_name")
|
||||||
|
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue