Skip to content

Commit

Permalink
Add add game link to game pages (fixes opengaming#1662)
Browse files Browse the repository at this point in the history
  • Loading branch information
cxong committed Apr 6, 2022
1 parent 23ea2a7 commit 45dca37
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 4 additions & 1 deletion game.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
{{ common.nav() }}

<div id="content">
<h2><a href="/">Back to list</a></h2>
<h2>
<a href="/">Back to list</a>
<a class="add-link" href="/add_game.html?original={{ game.names[0] | urlencode }}" target="_blank"><i class="far fa-edit"></i>Add Game</a>
</h2>

<dl id="list">
{{ games.render(game, true) }}
Expand Down
7 changes: 6 additions & 1 deletion templates/forms/page.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,18 @@ $(document).ready(() => {
$('[data-toggle="tooltip"]').tooltip()
// Load data from params if provided
const dataUrl = new URL(window.location.href).searchParams.get('data');
const params = new URL(window.location.href).searchParams;
const dataUrl = params.get('data');
if (dataUrl) {
$.get(dataUrl, (data) => {
setFormValue([], data);
document.title = `Edit ${data.name} form`;
});
}
const original = params.get('original');
if (original) {
setFormValue([], {'originals': [original]});
}
});
</script>
</body>
Expand Down

0 comments on commit 45dca37

Please sign in to comment.