summaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
authorJulien Dessaux2022-11-21 21:39:17 +0100
committerJulien Dessaux2022-11-21 21:39:17 +0100
commit8ac636186cf5f704264e7473864c54b3edaf4049 (patch)
tree6f575d5b4dc5afc0c087e0467c4dd7d6e4a6dd6b /views
parentcleaned up the distinction between routes and controllers (diff)
downloadjeux-de-mots-8ac636186cf5f704264e7473864c54b3edaf4049.tar.gz
jeux-de-mots-8ac636186cf5f704264e7473864c54b3edaf4049.tar.bz2
jeux-de-mots-8ac636186cf5f704264e7473864c54b3edaf4049.zip
Added basic games handling
Diffstat (limited to 'views')
-rw-r--r--views/game.ejs (renamed from views/play.ejs)18
-rw-r--r--views/games.ejs17
2 files changed, 26 insertions, 9 deletions
diff --git a/views/play.ejs b/views/game.ejs
index bc98c94..e1fab41 100644
--- a/views/play.ejs
+++ b/views/game.ejs
@@ -17,20 +17,20 @@
<tr><td id="s13_0"><td id="s13_1" class="dw" title="double word"><td id="s13_2"><td id="s13_3"><td id="s13_4"><td id="s13_5" class="tl" title="triple letter"><td id="s13_6"><td id="s13_7"><td id="s13_8"><td id="s13_9" class="tl" title="triple letter"><td id="s13_10"><td id="s13_11"><td id="s13_12"><td id="s13_13" class="dw" title="double word"><td id="s13_14"></tr>
<tr><td id="s14_0" class="tw" title="triple word"><td id="s14_1"><td id="s14_2"><td id="s14_3" class="dl" title="double letter"><td id="s14_4"><td id="s14_5"><td id="s14_6"><td id="s14_7" class="tw" title="triple word"><td id="s14_8"><td id="s14_9"><td id="s14_10"><td id="s14_11" class="dl" title="double letter"><td id="s14_12"><td id="s14_13"><td id="s14_14" class="tw" title="triple word"></tr>
</table>
-<p>
-<table id="rack">
- <tr><td id="l0"><td id="l1"><td id="l2"><td id="l3"><td id="l4"><td id="l5"><td id="l6"></tr>
-</table>
-<aside>
- <button title="validate your move" onclick="onvalidatemoveclick()" id="validate" disabled>0 - Validate</button>
- <button onclick="onSelectSwapTilesClicked()" id="pass">Pass</button>
-</aside>
+<p id="rack-area">
+ <table id="rack">
+ <tr><td id="l0"><td id="l1"><td id="l2"><td id="l3"><td id="l4"><td id="l5"><td id="l6"></tr>
+ </table>
+ <aside>
+ <button title="validate your move" onclick="onvalidatemoveclick()" id="validate" disabled>0 - Validate</button>
+ <button onclick="onSelectSwapTilesClicked()" id="pass">Pass</button>
+ </aside>
</p>
<p>
<span id="player_1_name">player one name</span>: <span class="player_name" id="player_1_points">0</span><br>
<span id="player_2_name">player two name</span>: <span class="player_name" id="player_2_points">0</span>
</p>
<p id="remaining_letters"></p>
-<script>var CWDATA = <%- JSON.stringify(CWDATA) %></script>
+<script>var CWDATA = <%- CWDATA.data %></script>
<script type="module" src="/static/index.js"></script>
<%- include("footer") %>
diff --git a/views/games.ejs b/views/games.ejs
new file mode 100644
index 0000000..3189be8
--- /dev/null
+++ b/views/games.ejs
@@ -0,0 +1,17 @@
+<%- include("header") %>
+<% if (Object.keys(games).length === 0) { %>
+<h2>Aucune partie en cours</h2>
+<% } else { %>
+<h2>Liste des parties en cours</h2>
+<table id="games">
+ <tr><th>Partie</th><th>Joueur 1</th><th>Joueur 2</th></tr>
+ <% games.forEach((game) => { %>
+ <tr>
+ <td><a href="/games/<%= game.id %>"><%= game.data.title %></a></td>
+ <td><a href="/users/<%= game.player1 %>"><%= game.data.player1.name %></a></td>
+ <td><a href="/users/<%= game.player2 %>"><%= game.data.player2.name %></a></td>
+ </tr>
+ <% }) %>
+</table>
+<% } %>
+<%- include("footer") %>