fix some htmls about teams

clubs
Razmig Sarkissian 1 year ago
parent d0c575c60c
commit 1d7fc3ddf0
  1. 201
      static/admin/js/actions.js
  2. 9
      static/tournaments/css/broadcast.css
  3. 234
      static/tournaments/css/style.css
  4. BIN
      static/tournaments/fonts/Montserrat/Montserrat-Bold.ttf
  5. 8
      tournaments/models/match.py
  6. 4
      tournaments/models/tournament.py
  7. 10
      tournaments/static/tournaments/css/style.css
  8. 2
      tournaments/templates/tournaments/ranking_row.html
  9. 4
      tournaments/templates/tournaments/rankings.html
  10. 3
      tournaments/templates/tournaments/summon_row.html
  11. 4
      tournaments/templates/tournaments/summons.html
  12. 4
      tournaments/templates/tournaments/teams.html

@ -0,0 +1,201 @@
/*global gettext, interpolate, ngettext*/
'use strict';
{
function show(selector) {
document.querySelectorAll(selector).forEach(function(el) {
el.classList.remove('hidden');
});
}
function hide(selector) {
document.querySelectorAll(selector).forEach(function(el) {
el.classList.add('hidden');
});
}
function showQuestion(options) {
hide(options.acrossClears);
show(options.acrossQuestions);
hide(options.allContainer);
}
function showClear(options) {
show(options.acrossClears);
hide(options.acrossQuestions);
document.querySelector(options.actionContainer).classList.remove(options.selectedClass);
show(options.allContainer);
hide(options.counterContainer);
}
function reset(options) {
hide(options.acrossClears);
hide(options.acrossQuestions);
hide(options.allContainer);
show(options.counterContainer);
}
function clearAcross(options) {
reset(options);
const acrossInputs = document.querySelectorAll(options.acrossInput);
acrossInputs.forEach(function(acrossInput) {
acrossInput.value = 0;
});
document.querySelector(options.actionContainer).classList.remove(options.selectedClass);
}
function checker(actionCheckboxes, options, checked) {
if (checked) {
showQuestion(options);
} else {
reset(options);
}
actionCheckboxes.forEach(function(el) {
el.checked = checked;
el.closest('tr').classList.toggle(options.selectedClass, checked);
});
}
function updateCounter(actionCheckboxes, options) {
const sel = Array.from(actionCheckboxes).filter(function(el) {
return el.checked;
}).length;
const counter = document.querySelector(options.counterContainer);
// data-actions-icnt is defined in the generated HTML
// and contains the total amount of objects in the queryset
const actions_icnt = Number(counter.dataset.actionsIcnt);
counter.textContent = interpolate(
ngettext('%(sel)s of %(cnt)s selected', '%(sel)s of %(cnt)s selected', sel), {
sel: sel,
cnt: actions_icnt
}, true);
const allToggle = document.getElementById(options.allToggleId);
allToggle.checked = sel === actionCheckboxes.length;
if (allToggle.checked) {
showQuestion(options);
} else {
clearAcross(options);
}
}
const defaults = {
actionContainer: "div.actions",
counterContainer: "span.action-counter",
allContainer: "div.actions span.all",
acrossInput: "div.actions input.select-across",
acrossQuestions: "div.actions span.question",
acrossClears: "div.actions span.clear",
allToggleId: "action-toggle",
selectedClass: "selected"
};
window.Actions = function(actionCheckboxes, options) {
options = Object.assign({}, defaults, options);
let list_editable_changed = false;
let lastChecked = null;
let shiftPressed = false;
document.addEventListener('keydown', (event) => {
shiftPressed = event.shiftKey;
});
document.addEventListener('keyup', (event) => {
shiftPressed = event.shiftKey;
});
document.getElementById(options.allToggleId).addEventListener('click', function(event) {
checker(actionCheckboxes, options, this.checked);
updateCounter(actionCheckboxes, options);
});
document.querySelectorAll(options.acrossQuestions + " a").forEach(function(el) {
el.addEventListener('click', function(event) {
event.preventDefault();
const acrossInputs = document.querySelectorAll(options.acrossInput);
acrossInputs.forEach(function(acrossInput) {
acrossInput.value = 1;
});
showClear(options);
});
});
document.querySelectorAll(options.acrossClears + " a").forEach(function(el) {
el.addEventListener('click', function(event) {
event.preventDefault();
document.getElementById(options.allToggleId).checked = false;
clearAcross(options);
checker(actionCheckboxes, options, false);
updateCounter(actionCheckboxes, options);
});
});
function affectedCheckboxes(target, withModifier) {
const multiSelect = (lastChecked && withModifier && lastChecked !== target);
if (!multiSelect) {
return [target];
}
const checkboxes = Array.from(actionCheckboxes);
const targetIndex = checkboxes.findIndex(el => el === target);
const lastCheckedIndex = checkboxes.findIndex(el => el === lastChecked);
const startIndex = Math.min(targetIndex, lastCheckedIndex);
const endIndex = Math.max(targetIndex, lastCheckedIndex);
const filtered = checkboxes.filter((el, index) => (startIndex <= index) && (index <= endIndex));
return filtered;
};
Array.from(document.getElementById('result_list').tBodies).forEach(function(el) {
el.addEventListener('change', function(event) {
const target = event.target;
if (target.classList.contains('action-select')) {
const checkboxes = affectedCheckboxes(target, shiftPressed);
checker(checkboxes, options, target.checked);
updateCounter(actionCheckboxes, options);
lastChecked = target;
} else {
list_editable_changed = true;
}
});
});
document.querySelector('#changelist-form button[name=index]').addEventListener('click', function(event) {
if (list_editable_changed) {
const confirmed = confirm(gettext("You have unsaved changes on individual editable fields. If you run an action, your unsaved changes will be lost."));
if (!confirmed) {
event.preventDefault();
}
}
});
const el = document.querySelector('#changelist-form input[name=_save]');
// The button does not exist if no fields are editable.
if (el) {
el.addEventListener('click', function(event) {
if (document.querySelector('[name=action]').value) {
const text = list_editable_changed
? gettext("You have selected an action, but you haven’t saved your changes to individual fields yet. Please click OK to save. You’ll need to re-run the action.")
: gettext("You have selected an action, and you haven’t made any changes on individual fields. You’re probably looking for the Go button rather than the Save button.");
if (!confirm(text)) {
event.preventDefault();
}
}
});
}
};
// Call function fn when the DOM is loaded and ready. If it is already
// loaded, call the function now.
// http://youmightnotneedjquery.com/#ready
function ready(fn) {
if (document.readyState !== 'loading') {
fn();
} else {
document.addEventListener('DOMContentLoaded', fn);
}
}
ready(function() {
const actionsEls = document.querySelectorAll('tr input.action-select');
if (actionsEls.length > 0) {
Actions(actionsEls);
}
});
}

@ -1,3 +1,8 @@
@font-face {
font-family: "Montserrat-Bold";
src: url("../fonts/Montserrat/Montserrat-Bold.ttf") format("truetype");
}
html, html,
body { body {
background: linear-gradient( background: linear-gradient(
@ -17,3 +22,7 @@ body {
/* box-shadow: 0 0 0px 1px #fbead6; */ /* box-shadow: 0 0 0px 1px #fbead6; */
box-shadow: 0 0 0px 0px #fbead6; box-shadow: 0 0 0px 0px #fbead6;
} }
.bold {
font-family: "Montserrat-Bold";
}

@ -18,7 +18,7 @@ body {
background: #fff7ed; background: #fff7ed;
font-family: "Montserrat-Regular"; font-family: "Montserrat-Regular";
font-size: 16px; font-size: 1em;
/* color: #1b223a; */ /* color: #1b223a; */
color: #707070; color: #707070;
@ -26,7 +26,7 @@ body {
box-sizing: border-box; box-sizing: border-box;
height: 100%; height: 100%;
padding: 0; padding: 0;
margin: 0; margin: 0px;
} }
label { label {
@ -34,7 +34,7 @@ label {
} }
h1 { h1 {
font-size: 20px; font-size: 1.5em;
margin: 0px; margin: 0px;
line-height: 1.1; line-height: 1.1;
} }
@ -45,16 +45,31 @@ footer {
} }
header { header {
font-size: 20px; font-size: 1.5em;
} }
a { a {
color: #707070; color: #707070;
} }
a:hover { a:hover {
color: #f39200; color: #f39200;
} }
nav {
display: flex;
/* Use flexbox */
flex-wrap: wrap;
/* Allow items to wrap onto multiple lines */
justify-content: flex-start;
/* Align items to the start */
}
nav a {
margin-right: 6px;
/* Adjust the horizontal spacing between <a> elements */
}
/* a { /* a {
color: #707070; color: #707070;
padding: 8px 12px; padding: 8px 12px;
@ -73,7 +88,9 @@ a:hover {
.wrapper { .wrapper {
margin: 0px 10px; margin: 0px 10px;
} }
@media print, screen and (min-width: 40em) {
@media print,
screen and (min-width: 40em) {
.wrapper { .wrapper {
margin: 0px 40px; margin: 0px 40px;
} }
@ -96,11 +113,11 @@ table {
} }
.score-table { .score-table {
font-size: 18px; font-size: 1.1em;
} }
label { label {
font-size: 18px; font-size: 1.1em;
} }
td { td {
@ -112,7 +129,7 @@ tr {
} }
.beige { .beige {
color: red; color: #fff7ed;
} }
.topblock { .topblock {
@ -124,7 +141,7 @@ tr {
} }
.big { .big {
font-size: 20px; font-size: 1.5em;
font-weight: 600; font-weight: 600;
} }
@ -134,38 +151,44 @@ tr {
.matchtitle { .matchtitle {
font-family: "Anybody-ExtraBold"; font-family: "Anybody-ExtraBold";
font-size: 18px; font-size: 1.2em;
color: #1b223a; color: #1b223a;
} }
.title { .title {
font-family: "Anybody-ExtraBold"; font-family: "Anybody-ExtraBold";
font-size: 18px; font-size: 1.2em;
color: #f39200; color: #f39200;
} }
.large { .large {
font-family: "Montserrat-SemiBold"; font-family: "Montserrat-SemiBold";
font-size: 18px; font-size: 1.2em;
/* color: #707070; */ /* color: #707070; */
} }
.semibold { .semibold {
font-weight: 600; font-weight: 600;
} }
.bold {
font-family: "Montserrat-SemiBold";
font-weight: 800;
}
.info { .info {
font-family: "Montserrat-SemiBold"; font-family: "Montserrat-SemiBold";
font-size: 14px; font-size: 0.9em;
color: #707070; color: #707070;
} }
.small { .small {
font-size: 12px; font-size: 0.8em;
} }
.minor-info { .minor-info {
color: #707070; color: #707070;
font-size: 14px; font-size: 0.85em;
} }
.logo { .logo {
@ -176,9 +199,11 @@ tr {
.padding-bottom-small { .padding-bottom-small {
padding-bottom: 4px; padding-bottom: 4px;
} }
.padding-bottom { .padding-bottom {
padding-bottom: 20px; padding-bottom: 20px;
} }
.padding-top-small { .padding-top-small {
padding-top: 4px; padding-top: 4px;
} }
@ -186,25 +211,46 @@ tr {
.names { .names {
/* width: 70%; */ /* width: 70%; */
} }
.team-names-box { .team-names-box {
height: 60px; height: 60px;
} }
.match-result {
display: flex;
align-items: center;
padding: 8px 0px;
}
.player {
flex: 1;
display: flex;
flex-direction: column;
/* Stack player names vertically */
}
.scores { .scores {
vertical-align: middle; display: flex;
/* margin: 0 auto 0 0; */
} }
.separator { /* .score-span {
width: 30px; /* Fixed width for each score cell */
}
*/ .separator {
height: 1px; height: 1px;
background-color: #707070; background-color: #707070;
margin: 5px 0px; margin: 5px 0px;
} }
.score { .score {
font-size: 20px; display: inline-block;
font-size: 1.4em;
vertical-align: middle; vertical-align: middle;
text-align: center;
padding: 0px 5px; padding: 0px 5px;
/* width: 30px; */
} }
.winner { .winner {
@ -213,6 +259,8 @@ tr {
.ws { .ws {
font-family: "Montserrat-SemiBold"; font-family: "Montserrat-SemiBold";
/* text-align: right; */
/* background-color: red; */
} }
.center { .center {
@ -234,6 +282,10 @@ tr {
background-color: red; background-color: red;
} }
svg {
border-radius: 16px;
}
.bubble { .bubble {
padding: 20px; padding: 20px;
background-color: white; background-color: white;
@ -266,36 +318,39 @@ tr {
vertical-align: middle; vertical-align: middle;
} }
/* .table-container {
display: table;
}
.table-cell {
display: table-cell;
vertical-align: middle;
} */
.horizontal-padding { .horizontal-padding {
padding: 0px 20px; padding: 0px 20px;
} }
.horizontal-margin { .horizontal-margin {
margin: 0px 10px; margin: 0px 10px;
} }
.hpadding10 { .hpadding10 {
padding: 0px 10px; padding: 0px 10px;
} }
.margin10 {
margin: 10px;
}
.left-margin {
margin-left: 10px;
}
.vert-middle { .vert-middle {
vertical-align: middle; vertical-align: middle;
} }
.club { .club {
font-family: "Anybody-ExtraBold"; font-family: "Anybody-ExtraBold";
font-size: 24px; font-size: 1.3em;
color: #f39200; color: #f39200;
} }
.event { .event {
font-family: "Anybody-ExtraBold"; font-family: "Anybody-ExtraBold";
font-size: 48px; font-size: 2em;
color: #1b223a; color: #1b223a;
} }
@ -303,8 +358,12 @@ tr {
border-bottom: 1px solid #ccc; border-bottom: 1px solid #ccc;
} }
.dark-bottom-border {
border-bottom: 1px solid #485170;
}
.bubble-bottom { .bubble-bottom {
font-size: 14px; font-size: 0.9em;
} }
.duration { .duration {
@ -333,6 +392,7 @@ tr {
.top-margin { .top-margin {
margin-top: 10px; margin-top: 10px;
} }
.top-margin20 { .top-margin20 {
margin-top: 20px; margin-top: 20px;
} }
@ -360,6 +420,18 @@ tr {
padding: 8px 0px; padding: 8px 0px;
} }
.topmargin5 {
margin-top: 5px;
}
.topmargin10 {
margin-top: 10px;
}
.topmargin20 {
margin-top: 20px;
}
.tight { .tight {
line-height: 1.1; line-height: 1.1;
} }
@ -367,7 +439,7 @@ tr {
.flex-row { .flex-row {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
height: 29px; height: 24px;
align-items: center; align-items: center;
/* vertical-align: middle; */ /* vertical-align: middle; */
} }
@ -390,6 +462,7 @@ tr {
flex-grow: 1; flex-grow: 1;
text-align: right; text-align: right;
} }
.team_image { .team_image {
height: 40px; height: 40px;
width: 40px; width: 40px;
@ -398,75 +471,138 @@ tr {
.w15 { .w15 {
width: 15%; width: 15%;
} }
.w20 { .w20 {
width: 20%; width: 20%;
} }
.w25 { .w25 {
width: 25%; width: 25%;
} }
.w30 { .w30 {
width: 30%; width: 30%;
} }
.w40 { .w40 {
width: 40%; width: 40%;
} }
.w50 { .w50 {
width: 50%; width: 50%;
} }
.w60 { .w60 {
width: 60%; width: 60%;
} }
.w70 { .w70 {
width: 70%; width: 70%;
} }
.w80 { .w80 {
width: 80%; width: 80%;
} }
.w100 { .w100 {
width: 100%; width: 100%;
} }
.w20px {
width: 20px;
}
.w30px {
width: 30px;
}
.w40px { .w40px {
width: 40px; width: 40px;
} }
.w60px { .w60px {
width: 60px; width: 60px;
} }
.w70px { .w70px {
width: 70px; width: 7px;
} }
.w80px { .w80px {
width: 80px; width: 80px;
} }
.w100px { .w100px {
width: 100px; width: 100px;
} }
.table-row-2-colums { .table-row-2-colums {
display: grid; display: grid;
grid-template-columns: 1px auto 40px; grid-template-columns: 2fr 60px;
align-items: center; /* Vertically center the content within each column */ align-items: center;
/* Vertically center the content within each column */
padding: 5px 0px;
}
.table-row-2-colums-test {
display: grid;
grid-template-columns: 1px auto 100px;
align-items: center;
/* Vertically center the content within each column */
padding: 5px 0px; padding: 5px 0px;
} }
.table-row-3-colums { .table-row-3-colums {
display: grid; display: grid;
grid-template-columns: auto 1fr auto; grid-template-columns: auto 1fr auto;
align-items: center; /* Vertically center the content within each column */ align-items: center;
/* Vertically center the content within each column */
padding: 5px 0px; padding: 5px 0px;
} }
.table-row-4-colums { .table-row-4-colums {
display: grid; display: grid;
grid-template-columns: 1px auto 50px 70px 130px; /* first column is a hack */ grid-template-columns: 1px auto 50px 70px 100px;
align-items: center; /* Vertically center the content within each column */ /* first column is a hack */
align-items: center;
/* Vertically center the content within each column */
padding: 5px 0px;
}
.table-row-3-colums-teams {
display: grid;
grid-template-columns: 1px auto 50px 80px;
/* first column is a hack */
align-items: center;
/* Vertically center the content within each column */
padding: 5px 0px;
}
.table-row-3-colums-summons {
display: grid;
grid-template-columns: 1px auto 70px 70px;
/* first column is a hack */
align-items: center;
/* Vertically center the content within each column */
padding: 5px 0px; padding: 5px 0px;
} }
@media print,
screen and (min-width: 80em) {
.table-row-4-colums {
display: grid;
grid-template-columns: 1px auto 50px 70px 180px;
/* first column is a hack */
align-items: center;
/* Vertically center the content within each column */
padding: 5px 0px;
}
}
.table-row-5-colums { .table-row-5-colums {
display: grid; display: grid;
grid-template-columns: 60px auto 50px 70px 130px; grid-template-columns: 60px auto 50px 70px 130px;
align-items: center; /* Vertically center the content within each column */ align-items: center;
/* Vertically center the content within each column */
padding: 5px 0px; padding: 5px 0px;
} }
@ -477,7 +613,8 @@ tr {
} }
.table-cell-large { .table-cell-large {
grid-column: 2 / span 1; /* Center column spans from column 2 to column 3 */ grid-column: 2 / span 1;
/* Center column spans from column 2 to column 3 */
text-align: left; text-align: left;
} }
@ -485,7 +622,8 @@ tr {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
flex-wrap: wrap; flex-wrap: wrap;
height: 100vh; /*the height will need to be customized*/ height: 100vh;
/*the height will need to be customized*/
width: 50px; width: 50px;
} }
@ -496,3 +634,21 @@ tr {
width: 50px; width: 50px;
margin-left: 10px; margin-left: 10px;
} }
.flex {
display: flex;
align-items: center;
}
.flex-left {
flex: 1;
text-align: left;
padding: 5px 0px;
}
.flex-right {
flex: initial;
text-align: right;
vertical-align: middle;
padding: 5px 0px;
}

@ -44,6 +44,14 @@ class Match(models.Model):
items.append(f"Match #{self.index}") items.append(f"Match #{self.index}")
return " ".join(items) return " ".join(items)
def summon_stage_name(self):
if self.round:
return self.round.name()
elif self.group_stage:
return "Poule"
else:
return '--'
def stage_name(self): def stage_name(self):
if self.name: if self.name:
return self.name return self.name

@ -83,12 +83,12 @@ class Tournament(models.Model):
next_match = team_registration.next_match() next_match = team_registration.next_match()
if next_match: if next_match:
names = team_registration.team_names() names = team_registration.team_names()
stage = next_match.stage_name() stage = next_match.summon_stage_name()
weight = team_registration.weight weight = team_registration.weight
summon = TeamSummon(names, next_match.start_date, weight, stage, team_registration.logo) summon = TeamSummon(names, next_match.start_date, weight, stage, team_registration.logo)
summons.append(summon) summons.append(summon)
summons.sort(key=lambda s: s.weight) summons.sort(key=lambda s: s.date)
return summons return summons
def rankings(self): def rankings(self):

@ -571,13 +571,21 @@ svg {
.table-row-3-colums-teams { .table-row-3-colums-teams {
display: grid; display: grid;
grid-template-columns: 1px auto 100px 100px; grid-template-columns: 1px auto 50px 80px;
/* first column is a hack */ /* first column is a hack */
align-items: center; align-items: center;
/* Vertically center the content within each column */ /* Vertically center the content within each column */
padding: 5px 0px; padding: 5px 0px;
} }
.table-row-3-colums-summons {
display: grid;
grid-template-columns: 1px auto 70px 70px;
/* first column is a hack */
align-items: center;
/* Vertically center the content within each column */
padding: 5px 0px;
}
@media print, @media print,
screen and (min-width: 80em) { screen and (min-width: 80em) {
.table-row-4-colums { .table-row-4-colums {

@ -1,6 +1,6 @@
{% load static %} {% load static %}
<div class="table-row-3-colums-teams bottom-border"> <div class="table-row-3-colums bottom-border">
<div class="table-cell table-cell-large semibold"> <div class="table-cell table-cell-large semibold">
{% for name in ranking.names %} {% for name in ranking.names %}

@ -1,8 +1,8 @@
{% extends 'tournaments/base.html' %} {% extends 'tournaments/base.html' %}
{% block head_title %}Classement{% endblock %} {% block head_title %}Classement{% endblock %}
{% block first_title %}{{ tournament.display_name }}{% endblock %} {% block first_title %}{{ tournament.event.display_name }}{% endblock %}
{% block second_title %}Classement{% endblock %} {% block second_title %}{{ tournament.display_name }}{% endblock %}
{% if tournament.display_rankings %} {% if tournament.display_rankings %}

@ -1,6 +1,6 @@
{% load static %} {% load static %}
<div class="table-row-4-colums bottom-border"> <div class="table-row-3-colums-summons bottom-border">
<div class="table-cell table-cell-large semibold"> <div class="table-cell table-cell-large semibold">
{% for name in summon.names %} {% for name in summon.names %}
@ -8,7 +8,6 @@
{% endfor %} {% endfor %}
</div> </div>
<div class="table-cell center">{{ summon.weight }}</div>
<div class="table-cell large center">{{ summon.date|date:'H:i' }}</div> <div class="table-cell large center">{{ summon.date|date:'H:i' }}</div>
<div class="table-cell"><div class="mybox center">{{ summon.stage }}</div></div> <div class="table-cell"><div class="mybox center">{{ summon.stage }}</div></div>
</div> </div>

@ -1,8 +1,8 @@
{% extends 'tournaments/base.html' %} {% extends 'tournaments/base.html' %}
{% block head_title %}Convocations{% endblock %} {% block head_title %}Convocations{% endblock %}
{% block first_title %}{{ tournament.display_name }}{% endblock %} {% block first_title %}{{ tournament.event.display_name }}{% endblock %}
{% block second_title %}Convocations{% endblock %} {% block second_title %}{{ tournament.display_name }}{% endblock %}
{% if tournament.display_summons %} {% if tournament.display_summons %}

@ -1,8 +1,8 @@
{% extends 'tournaments/base.html' %} {% extends 'tournaments/base.html' %}
{% block head_title %}Équipes{% endblock %} {% block head_title %}Équipes{% endblock %}
{% block first_title %}{{ tournament.display_name }}{% endblock %} {% block first_title %}{{ tournament.event.display_name }}{% endblock %}
{% block second_title %}Équipes{% endblock %} {% block second_title %}{{ tournament.display_name }}{% endblock %}
{% if tournament.display_teams %} {% if tournament.display_teams %}

Loading…
Cancel
Save