add base path setting
This commit is contained in:
1 parent
5368d6f32d
commit
a7f440c658
7 files changed
+29
-21
No files matched your search
+3
-3
@@ -8,6 +8,6 @@ table{border-collapse:collapse;width:100%}td,th{border-bottom:1px solid #8884;pa
|
||||
form.i{display:inline}input,select{max-width:100%}
|
||||
</style>
|
||||
<script nonce="<%= nonce %>">document.addEventListener("submit",e=>{const m=e.target.dataset.confirm;if(m&&!confirm(m))e.preventDefault()})</script>
|
||||
<nav><a href="/">Leagues</a> ·
|
||||
<% if (admin) { %><b>admin</b> <form class="i" method="post" action="/logout"><button>Logout</button></form>
|
||||
<% } else { %><a href="/login">Admin login</a><% } %></nav>
|
||||
<nav><a href="<%= base %>/">Leagues</a> ·
|
||||
<% if (admin) { %><b>admin</b> <form class="i" method="post" action="<%= base %>/logout"><button>Logout</button></form>
|
||||
<% } else { %><a href="<%= base %>/login">Admin login</a><% } %></nav>
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
<%- include('head') %>
|
||||
<h1>MTG Leagues</h1>
|
||||
<ul><% leagues.forEach(l => { %><li><a href="/league/<%= l.id %>"><%= l.name %></a> (best <%= l.best_n %> sessions count)</li><% }) %></ul>
|
||||
<ul><% leagues.forEach(l => { %><li><a href="<%= base %>/league/<%= l.id %>"><%= l.name %></a> (best <%= l.best_n %> sessions count)</li><% }) %></ul>
|
||||
<% if (admin) { %>
|
||||
<h2>New league</h2>
|
||||
<form method="post" action="/admin/league"><input name="name" placeholder="Name" required>
|
||||
<form method="post" action="<%= base %>/admin/league"><input name="name" placeholder="Name" required>
|
||||
<input name="best_n" type="number" min="1" value="6"> best sessions count <button>Create</button></form>
|
||||
<% } %>
|
||||
+2
-2
@@ -5,7 +5,7 @@
|
||||
<% rows.forEach((r, i) => { %><tr><td><%= i + 1 %></td><td><%= r.name %></td><td><b><%= r.score %></b></td><td><%= r.total %></td>
|
||||
<td><%= r.sessions %></td><td><%= r.rec ? r.rec.join('-') : '–' %></td></tr><% }) %></table>
|
||||
<h2>Sessions</h2>
|
||||
<ul><% sessions.forEach(g => { %><li><a href="/session/<%= g.id %>">Session <%= g.number %> – <%= g.date %></a></li><% }) %></ul>
|
||||
<% if (admin) { %><form method="post" action="/admin/league/<%= lg.id %>/session"><input type="date" name="date" required> <button>New session</button></form><% } %>
|
||||
<ul><% sessions.forEach(g => { %><li><a href="<%= base %>/session/<%= g.id %>">Session <%= g.number %> – <%= g.date %></a></li><% }) %></ul>
|
||||
<% if (admin) { %><form method="post" action="<%= base %>/admin/league/<%= lg.id %>/session"><input type="date" name="date" required> <button>New session</button></form><% } %>
|
||||
<h2>Deck performance <small>(match W-D-L)</small></h2>
|
||||
<table><tr><th>Deck</th><th>W-D-L</th></tr><% decks.forEach(([d, r]) => { %><tr><td><%= d %></td><td><%= r.join('-') %></td></tr><% }) %></table>
|
||||
+5
-5
@@ -1,6 +1,6 @@
|
||||
<%- include('head') %>
|
||||
<h1><%= lg.name %> – Session <%= gs.number %> (<%= gs.date %>)</h1>
|
||||
<p><a href="/league/<%= lg.id %>">← Standings</a></p>
|
||||
<p><a href="<%= base %>/league/<%= lg.id %>">← Standings</a></p>
|
||||
<% rounds.forEach(r => { %><h2>Round <%= r.round %></h2><table>
|
||||
<% r.matches.forEach(m => { %><tr>
|
||||
<td><%= m.p1 %> <small>(<%= m.p1_deck || '?' %>)</small></td>
|
||||
@@ -9,7 +9,7 @@
|
||||
<% }) %></table><% }) %>
|
||||
<% if (!rounds.length && !results.length) { %><p>No results yet.</p><% } %>
|
||||
<% if (results.length) { %><h2>Standings <small>(imported)</small></h2>
|
||||
<form method="post" action="/admin/session/<%= gs.id %>/decks">
|
||||
<form method="post" action="<%= base %>/admin/session/<%= gs.id %>/decks">
|
||||
<table><tr><th>Player</th><th>Points</th><th>W-D-L</th><th>Deck</th></tr>
|
||||
<% results.forEach(r => { %><tr><td><%= r.name %></td><td><b><%= r.points %></b></td><td><%= r.rec %></td>
|
||||
<td><% if (admin) { %><input name="deck_<%= r.id %>" value="<%= r.deck || '' %>" list="decks"><% } else { %><%= r.deck || '' %><% } %></td></tr><% }) %></table>
|
||||
@@ -19,13 +19,13 @@
|
||||
<% if (admin) { %>
|
||||
<h2>Import Melee standings export</h2>
|
||||
<p>Upload the CSV/JSON from Melee's Standings tab (or paste it). Saving replaces this session's imported standings but keeps decks already entered.</p>
|
||||
<form method="post" enctype="multipart/form-data" action="/admin/session/<%= gs.id %>/import-standings">
|
||||
<form method="post" enctype="multipart/form-data" action="<%= base %>/admin/session/<%= gs.id %>/import-standings">
|
||||
<input type="file" name="file" accept=".csv,.json,.txt"><br>
|
||||
<textarea name="data" rows="5" style="width:100%;font-family:monospace" placeholder="...or paste here"></textarea><br><button>Import standings</button></form>
|
||||
<h2>Import matches by hand</h2>
|
||||
<p>One match per line: <code>round, player1, deck1, player2, deck2, p1 wins, p2 wins, draws</code>. Leave player 2 blank for a bye.
|
||||
Comma- or tab-separated. Saving <b>replaces</b> this session's matches.</p>
|
||||
<form method="post" action="/admin/session/<%= gs.id %>/import">
|
||||
<form method="post" action="<%= base %>/admin/session/<%= gs.id %>/import">
|
||||
<textarea name="data" rows="12" style="width:100%;font-family:monospace"><%= csvtext %></textarea><br><button>Save matches</button></form>
|
||||
<form method="post" action="/admin/session/<%= gs.id %>/delete" data-confirm="Delete this session and its results?"><button>Delete session</button></form>
|
||||
<form method="post" action="<%= base %>/admin/session/<%= gs.id %>/delete" data-confirm="Delete this session and its results?"><button>Delete session</button></form>
|
||||
<% } %>
|
||||
Reference in new issue
Block a user