parent
b952b72a0d
commit
7ac58ffd73
@ -0,0 +1,90 @@ |
|||||||
|
{% extends 'tournaments/broadcast_base.html' %} |
||||||
|
|
||||||
|
{% block head_title %}Convocations{% endblock %} |
||||||
|
{% block first_title %}{{ tournament.name }}{% endblock %} |
||||||
|
{% block second_title %}Convocations{% endblock %} |
||||||
|
|
||||||
|
{% block content %} |
||||||
|
|
||||||
|
{% load static %} |
||||||
|
|
||||||
|
<div x-data="{ |
||||||
|
paginatedMatches: null, |
||||||
|
paginatedGroupStages: null, |
||||||
|
paginatedSummons: null, |
||||||
|
active: 1, |
||||||
|
retrieveData() { |
||||||
|
fetch('/tournament/{{ tournament.id }}/broadcast/json/') |
||||||
|
.then(res => res.json()) |
||||||
|
.then((data) => { |
||||||
|
this.paginatedMatches = this.paginate(data.matches, 8) |
||||||
|
this.paginatedGroupStages = this.paginate(data.group_stages, 4) |
||||||
|
this.paginatedSummons = this.paginateSummons(data.summons) |
||||||
|
}) |
||||||
|
}, |
||||||
|
paginateSummons(array) { |
||||||
|
let pageSize = 20 |
||||||
|
pages = this.paginate(array, pageSize) |
||||||
|
|
||||||
|
const splitGroups = [] |
||||||
|
pages.forEach(group => { |
||||||
|
const firstHalf = group.slice(0, pageSize / 2) |
||||||
|
const secondHalf = group.slice(pageSize / 2) |
||||||
|
if (secondHalf.length > 0) { |
||||||
|
splitGroups.push([firstHalf, secondHalf]) |
||||||
|
} else { |
||||||
|
splitGroups.push([firstHalf]) |
||||||
|
} |
||||||
|
}); |
||||||
|
return splitGroups |
||||||
|
}, |
||||||
|
paginate(array, pageSize) { |
||||||
|
let paginatedArray = []; |
||||||
|
for (let i = 0; i < array.length; i += pageSize) { |
||||||
|
paginatedArray.push(array.slice(i, i + pageSize)) |
||||||
|
} |
||||||
|
return paginatedArray; |
||||||
|
}, |
||||||
|
loop() { |
||||||
|
this.retrieveData() |
||||||
|
setInterval(() => { |
||||||
|
this.retrieveData() |
||||||
|
this.active = this.active === this.pageCount() ? 1 : this.active+1 |
||||||
|
}, 15000) |
||||||
|
}, |
||||||
|
pageCount() { |
||||||
|
return this.paginatedMatches.length + this.paginatedGroupStages.length + this.paginatedSummons.length |
||||||
|
} |
||||||
|
|
||||||
|
}" x-init="loop()"> |
||||||
|
|
||||||
|
<div class="grid-x"> |
||||||
|
|
||||||
|
<template x-for="i in paginatedSummons.length"> |
||||||
|
<template x-for="column in paginatedSummons[i-1]"> |
||||||
|
<div class="cell medium-6 large-6 topblock my-block" x-show="active === i"> |
||||||
|
{% include 'tournaments/broadcasted_summon.html' %} |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
</template> |
||||||
|
|
||||||
|
<template x-for="i in paginatedMatches.length" > |
||||||
|
<template x-for="match in paginatedMatches[i-1]" > |
||||||
|
<div class="cell medium-6 large-3 my-block" x-show="active === i + paginatedSummons.length"> |
||||||
|
{% include 'tournaments/broadcasted_match.html' %} |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
</template> |
||||||
|
|
||||||
|
<template x-for="i in paginatedGroupStages.length"> |
||||||
|
<template x-for="group_stage in paginatedGroupStages[i-1]"> |
||||||
|
<div class="cell medium-6 large-3 my-block" x-show="active === i + paginatedSummons.length + paginatedMatches.length"> |
||||||
|
{% include 'tournaments/broadcasted_group_stage.html' %} |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
</template> |
||||||
|
|
||||||
|
</div> |
||||||
|
</div> |
||||||
|
|
||||||
|
{% endblock %} |
||||||
@ -0,0 +1,48 @@ |
|||||||
|
<div class="dark_bubble"> |
||||||
|
|
||||||
|
<div class="flex-row"> |
||||||
|
<label class="left-label matchtitle winner"><span x-text="group_stage.title"></span></label> |
||||||
|
<!-- <label class="right-label info"><span x-text="group_stage.date"></span></label> --> |
||||||
|
</div> |
||||||
|
|
||||||
|
<template x-for="i in group_stage.teams.length"> |
||||||
|
|
||||||
|
<div> |
||||||
|
<div class="table-row-2-colums team-names-box padding-bottom-small"> |
||||||
|
|
||||||
|
<div class="table-cell table-cell-large"> |
||||||
|
<template x-for="name in group_stage.teams[i-1].names"> |
||||||
|
|
||||||
|
<div class="semibold" x-data="{ |
||||||
|
showName(name, team) { |
||||||
|
let html = `<span class='` |
||||||
|
if (team.is_winner) html += `winner` |
||||||
|
html += `'>` |
||||||
|
html += name |
||||||
|
html += `</span>` |
||||||
|
return html |
||||||
|
}, |
||||||
|
}" x-html="showName(name, group_stage.teams[i-1])"> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
</div> |
||||||
|
<div class="table-cell center"> |
||||||
|
<div class="score ws"><span x-text="group_stage.teams[i-1].win_loss"></span></div> |
||||||
|
<div class="ws"><span x-text="group_stage.teams[i-1].diff"></span></div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div x-show="i != group_stage.teams.length"> |
||||||
|
<div class="dark-bottom-border"></div> |
||||||
|
</div> |
||||||
|
|
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<div class="top-margin flex-row"> |
||||||
|
<label class="left-label minor-info"><span class="beige" x-text="group_stage.duration"></span></label> |
||||||
|
<!-- <label class="right-label minor-info"><span x-text="group_stage.court"></span></label> --> |
||||||
|
</div> |
||||||
|
|
||||||
|
</div> |
||||||
@ -0,0 +1,63 @@ |
|||||||
|
<div class="bubble"> |
||||||
|
|
||||||
|
<div class="flex-row"> |
||||||
|
<label class="left-label matchtitle"><span x-text="match.title"></span></label> |
||||||
|
<!-- <label class="right-label info"><span x-text="match.date"></span></label> --> |
||||||
|
</div> |
||||||
|
|
||||||
|
<template x-for="i in match.teams.length"> |
||||||
|
|
||||||
|
<div> |
||||||
|
<div class="table-row-3-colums team-names-box padding-bottom-small"> |
||||||
|
|
||||||
|
<div class="table-cell table-cell-large"> |
||||||
|
<template x-for="name in match.teams[i-1].names"> |
||||||
|
|
||||||
|
<div class="ws" x-data="{ |
||||||
|
showName(name, team) { |
||||||
|
let html = `<span class='` |
||||||
|
if (team.is_winner) html += `winner` |
||||||
|
html += `'>` |
||||||
|
html += name |
||||||
|
html += `</span>` |
||||||
|
return html |
||||||
|
}, |
||||||
|
}" x-html="showName(name, match.teams[i-1])"> |
||||||
|
</div> |
||||||
|
|
||||||
|
</template> |
||||||
|
</div> |
||||||
|
<div class="table-cell alignright"> |
||||||
|
<template x-for="score in match.teams[i-1].scores"> |
||||||
|
|
||||||
|
<span class="score ws" x-data="{ |
||||||
|
showScore(score, team) { |
||||||
|
let html = `<span class='` |
||||||
|
if (team.is_winner) html += `winner` |
||||||
|
html += `'>` |
||||||
|
html += score |
||||||
|
html += `</span>` |
||||||
|
return html |
||||||
|
}, |
||||||
|
}" x-html="showScore(score, match.teams[i-1])"> |
||||||
|
</span> |
||||||
|
|
||||||
|
<!-- <span class="score ws" x-text="score"></span> --> |
||||||
|
</template> |
||||||
|
</div> |
||||||
|
|
||||||
|
</div> |
||||||
|
|
||||||
|
<div x-show="i === 1"> |
||||||
|
<div class="bottom-border"></div> |
||||||
|
</div> |
||||||
|
|
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<div class="top-margin flex-row"> |
||||||
|
<label class="left-label minor-info bold"><span x-text="match.duration"></span></label> |
||||||
|
<label class="right-label minor-info semibold"><span x-text="match.court"></span></label> |
||||||
|
</div> |
||||||
|
|
||||||
|
</div> |
||||||
@ -0,0 +1,15 @@ |
|||||||
|
<div class="bubble"> |
||||||
|
<template x-for="summon in column" > |
||||||
|
<div class="table-row-4-colums bottom-border"> |
||||||
|
<div class="table-cell table-cell-large semibold"> |
||||||
|
<template x-for="i in summon.names.length"> |
||||||
|
<div x-text="summon.names[i-1]"></div> |
||||||
|
</template> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="table-cell center"><span x-text="summon.weight"></span></div> |
||||||
|
<div class="table-cell large center"><span x-text="summon.date"></span></div> |
||||||
|
<div class="table-cell"><div class="mybox center"><span x-text="summon.stage"></span></div></div> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
</div> |
||||||
Loading…
Reference in new issue