diff --git a/CTFd/teams.py b/CTFd/teams.py index 57ee52c536697bb3436a90fb97faf231a54f24bb..d9b55c8acd8dfb1b6c22c1fc8d6dbbbd73635c01 100644 --- a/CTFd/teams.py +++ b/CTFd/teams.py @@ -147,7 +147,7 @@ def join(): ) ) - return render_template("teams/join_team.html", infos=infos, errors=errors,team_as_password= get_config('team_as_password')) + return render_template("teams/join_team.html", infos=infos, errors=errors,team_as_password= get_config('team_as_password'), teams=Teams.query.filter_by()) if request.method == "POST": teamname = request.form.get("name") @@ -301,7 +301,7 @@ def new(): errors.append("Veuillez fournir une catégorie valide") if errors: - return render_template("teams/new_team.html", errors=errors), 403 + return render_template("teams/new_team.html", errors=errors, teams=Teams.query.filter_by()), 403 # Hide the created team if admin are set hidden hidden = False @@ -373,7 +373,7 @@ def private(): user = get_current_user() if not user.team_id: - return render_template("teams/team_enrollment.html") + return render_template("teams/team_enrollment.html", teams=Teams.query.filter_by()) team_id = user.team_id diff --git a/CTFd/themes/core-beta/assets/js/teams/list.js b/CTFd/themes/core-beta/assets/js/teams/list.js index 484c211a109fc466d90684932334a6c28ce22bc7..3f763867eb4e1191a11b7ba7551e6db4c1528b38 100644 --- a/CTFd/themes/core-beta/assets/js/teams/list.js +++ b/CTFd/themes/core-beta/assets/js/teams/list.js @@ -10,9 +10,6 @@ Alpine.data("TeamShowDown", () => ({ show: true, async init() { - - this.teams = await CTFd.pages.scoreboard.getScoreboard(); - this.show = true; }, diff --git a/CTFd/themes/core-beta/static/assets/teams_list.1abaa917.js b/CTFd/themes/core-beta/static/assets/teams_list.1abaa917.js deleted file mode 100644 index 01b31b9d63913e2d44d13f967cd068be57c7ef95..0000000000000000000000000000000000000000 --- a/CTFd/themes/core-beta/static/assets/teams_list.1abaa917.js +++ /dev/null @@ -1 +0,0 @@ -import{C as t,m as a}from"./index.5095421b.js";window.CTFd=t;window.Alpine=a;a.data("TeamShowDown",()=>({teams:[],show:!0,async init(){this.teams=await t.pages.scoreboard.getScoreboard(),this.show=!0}}));a.start(); diff --git a/CTFd/themes/core-beta/static/assets/teams_list.38e3b76b.js b/CTFd/themes/core-beta/static/assets/teams_list.38e3b76b.js new file mode 100644 index 0000000000000000000000000000000000000000..069907fe43c8a2334a745e7e1b06dc45d52c4872 --- /dev/null +++ b/CTFd/themes/core-beta/static/assets/teams_list.38e3b76b.js @@ -0,0 +1 @@ +import{C as a,m as t}from"./index.5095421b.js";window.CTFd=a;window.Alpine=t;t.data("TeamShowDown",()=>({teams:[],show:!0,async init(){this.show=!0}}));t.start(); diff --git a/CTFd/themes/core-beta/static/manifest.json b/CTFd/themes/core-beta/static/manifest.json index 4bd41c23bc1da380a3051b8db44179087b5f1575..0f9581ae8cc43d4dd2d0f59677cf3b983bf79feb 100644 --- a/CTFd/themes/core-beta/static/manifest.json +++ b/CTFd/themes/core-beta/static/manifest.json @@ -82,7 +82,7 @@ ] }, "assets/js/teams/list.js": { - "file": "assets/teams_list.1abaa917.js", + "file": "assets/teams_list.38e3b76b.js", "src": "assets/js/teams/list.js", "isEntry": true, "imports": [ diff --git a/CTFd/themes/core-beta/templates/teams/join_team.html b/CTFd/themes/core-beta/templates/teams/join_team.html index f4cf08fab5e1c896db5f5500769787ef2276e49c..6d072151b579fe92a53d555521061c18177178d1 100644 --- a/CTFd/themes/core-beta/templates/teams/join_team.html +++ b/CTFd/themes/core-beta/templates/teams/join_team.html @@ -47,24 +47,27 @@ </tr> </thead> <tbody class="table table-striped " > - <template x-for="(team, index) in teams"> + {% for team in teams %} + <tr > - <td class="team-id text-center" x-data="{ bcolor: team.color}" :style="`display:flex;justify-content: center;`"> + <td class="team-id text-center" data='bcolor: {{team.color}}' :style="`display:flex;justify-content: center;`"> - <b class="team-id text-center w-100" :style="`margin: 10% !important;display:block;background-color: ${bcolor} !important;width:10% !important;border-radius: 100%;`"></b> + <b class="team-id text-center w-100" :style="`margin: 10% !important;display:block;background-color: {{team.color}} !important;width:10% !important;border-radius: 100%;`"></b> </td> <td > - <b x-text="team.name"></b> + <b >{{team.name}}</b> </td> <td > - <b x-text="team.members.length"></b> + <b >{{team.members|length}} + + </b> </td> </tr> - </template> - + + {% endfor %} diff --git a/CTFd/themes/core-beta/templates/teams/new_team.html b/CTFd/themes/core-beta/templates/teams/new_team.html index 5c0de2df6a6e5bafece7868b032d3bfc1e4b7331..a5b4631ce9fcb032529f0000c270eaf91aa46411 100644 --- a/CTFd/themes/core-beta/templates/teams/new_team.html +++ b/CTFd/themes/core-beta/templates/teams/new_team.html @@ -93,24 +93,27 @@ </tr> </thead> <tbody class="table table-striped " > - <template x-for="(team, index) in teams"> + {% for team in teams %} + <tr > - <td class="team-id text-center" x-data="{ bcolor: team.color}" :style="`display:flex;justify-content: center;`"> + <td class="team-id text-center" data='bcolor: {{team.color}}' :style="`display:flex;justify-content: center;`"> - <b class="team-id text-center w-100" :style="`margin: 10% !important;display:block;background-color: ${bcolor} !important;width:10% !important;border-radius: 100%;`"></b> + <b class="team-id text-center w-100" :style="`margin: 10% !important;display:block;background-color: {{team.color}} !important;width:10% !important;border-radius: 100%;`"></b> </td> <td > - <b x-text="team.name"></b> + <b >{{team.name}}</b> </td> <td > - <b x-text="team.members.length"></b> + <b >{{team.members|length}} + + </b> </td> </tr> - </template> - + + {% endfor %} diff --git a/CTFd/themes/core-beta/templates/teams/team_enrollment.html b/CTFd/themes/core-beta/templates/teams/team_enrollment.html index b2987415a9cdf152dd1afcad5e940e3268dffb79..e95a9d09de227515250cfd71cbbd02e339b40c80 100644 --- a/CTFd/themes/core-beta/templates/teams/team_enrollment.html +++ b/CTFd/themes/core-beta/templates/teams/team_enrollment.html @@ -47,24 +47,27 @@ </tr> </thead> <tbody class="table table-striped " > - <template x-for="(team, index) in teams"> + {% for team in teams %} + <tr > - <td class="team-id text-center" x-data="{ bcolor: team.color}" :style="`display:flex;justify-content: center;`"> + <td class="team-id text-center" data='bcolor: {{team.color}}' :style="`display:flex;justify-content: center;`"> - <b class="team-id text-center w-100" :style="`margin: 10% !important;display:block;background-color: ${bcolor} !important;width:10% !important;border-radius: 100%;`"></b> + <b class="team-id text-center w-100" :style="`margin: 10% !important;display:block;background-color: {{team.color}} !important;width:10% !important;border-radius: 100%;`"></b> </td> <td > - <b x-text="team.name"></b> + <b >{{team.name}}</b> </td> <td > - <b x-text="team.members.length"></b> + <b >{{team.members|length}} + + </b> </td> </tr> - </template> - + + {% endfor %}