From 8503310497876359e78844fbe3182e4620fc75dd Mon Sep 17 00:00:00 2001
From: jac267 <jackpotchap@gmail.com>
Date: Wed, 1 Jan 2025 18:31:43 -0500
Subject: [PATCH] la liste des equipe est afficher dans le menue

---
 CTFd/teams.py                                   |  6 +++---
 CTFd/themes/core-beta/assets/js/teams/list.js   |  3 ---
 .../static/assets/teams_list.1abaa917.js        |  1 -
 .../static/assets/teams_list.38e3b76b.js        |  1 +
 CTFd/themes/core-beta/static/manifest.json      |  2 +-
 .../core-beta/templates/teams/join_team.html    | 17 ++++++++++-------
 .../core-beta/templates/teams/new_team.html     | 17 ++++++++++-------
 .../templates/teams/team_enrollment.html        | 17 ++++++++++-------
 8 files changed, 35 insertions(+), 29 deletions(-)
 delete mode 100644 CTFd/themes/core-beta/static/assets/teams_list.1abaa917.js
 create mode 100644 CTFd/themes/core-beta/static/assets/teams_list.38e3b76b.js

diff --git a/CTFd/teams.py b/CTFd/teams.py
index 57ee52c5..d9b55c8a 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 484c211a..3f763867 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 01b31b9d..00000000
--- 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 00000000..069907fe
--- /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 4bd41c23..0f9581ae 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 f4cf08fa..6d072151 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 5c0de2df..a5b4631c 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 b2987415..e95a9d09 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 %}
           
           
         
-- 
GitLab