Compare commits
14 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5f5800734f | ||
|
|
c7c60c9e56 | ||
|
|
00f1767b6a | ||
|
|
0ac64ac7c1 | ||
| c9ee2925a2 | |||
| 8ac203a3b5 | |||
| cb01f1ec60 | |||
| 9ad102c020 | |||
| b9bb3d5574 | |||
| 0c22d15ee4 | |||
| 2042d56131 | |||
| d8e53aa02f | |||
| 24ae1a622c | |||
| f2b434983e |
4 changed files with 83 additions and 37 deletions
59
setup.sh
59
setup.sh
|
|
@ -863,6 +863,7 @@ def add_game():
|
||||||
notes=request.form.get('notes', ''),
|
notes=request.form.get('notes', ''),
|
||||||
url=url,
|
url=url,
|
||||||
steam_appid=steam_appid,
|
steam_appid=steam_appid,
|
||||||
|
platform=request.form.get('platform', 'pc'),
|
||||||
redeem_date=datetime.strptime(request.form['redeem_date'], '%Y-%m-%d') if request.form['redeem_date'] else None,
|
redeem_date=datetime.strptime(request.form['redeem_date'], '%Y-%m-%d') if request.form['redeem_date'] else None,
|
||||||
user_id=current_user.id
|
user_id=current_user.id
|
||||||
)
|
)
|
||||||
|
|
@ -1672,6 +1673,11 @@ cat <<'HTML_END' > templates/index.html
|
||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<button id="toggle-keys" class="btn btn-sm btn-outline-secondary mb-2">{{ _('Show/Hide Keys') }}</button>
|
<button id="toggle-keys" class="btn btn-sm btn-outline-secondary mb-2">{{ _('Show/Hide Keys') }}</button>
|
||||||
|
<div class="mb-2 d-flex justify-content-end">
|
||||||
|
<a href="{{ url_for('add_game') }}" class="btn btn-sm btn-warning">
|
||||||
|
{{ _('Add New Game') }}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
{% if games %}
|
{% if games %}
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-hover align-middle">
|
<table class="table table-hover align-middle">
|
||||||
|
|
@ -1679,7 +1685,7 @@ cat <<'HTML_END' > templates/index.html
|
||||||
<tr>
|
<tr>
|
||||||
<th>{{ _('Cover') }}</th>
|
<th>{{ _('Cover') }}</th>
|
||||||
<th>{{ _('Name') }}</th>
|
<th>{{ _('Name') }}</th>
|
||||||
<th class="key-col d-md-table-cell">{{ _('Key') }}</th>
|
<th class="key-col">{{ _('Key') }}</th>
|
||||||
<th>{{ _('Status') }}</th>
|
<th>{{ _('Status') }}</th>
|
||||||
<th>{{ _('Created') }}</th>
|
<th>{{ _('Created') }}</th>
|
||||||
<th>{{ _('Redeem by') }}</th>
|
<th>{{ _('Redeem by') }}</th>
|
||||||
|
|
@ -1712,7 +1718,7 @@ cat <<'HTML_END' > templates/index.html
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>{{ game.name }}</td>
|
<td>{{ game.name }}</td>
|
||||||
<td class="font-monospace key-col d-none d-md-table-cell">{{ game.steam_key }}</td>
|
<td class="font-monospace key-col">{{ game.steam_key }}</td>
|
||||||
<td>
|
<td>
|
||||||
{% if game.status == 'nicht eingelöst' %}
|
{% if game.status == 'nicht eingelöst' %}
|
||||||
<span class="badge bg-warning text-dark">{{ _('Not redeemed') }}</span>
|
<span class="badge bg-warning text-dark">{{ _('Not redeemed') }}</span>
|
||||||
|
|
@ -1840,22 +1846,34 @@ document.querySelectorAll('.generate-redeem').forEach(btn => {
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
console.log("DOM ist geladen!"); // Überprüfe, ob DOMContentLoaded überhaupt ausgeführt wird
|
const KEY_STORAGE = 'showKeys';
|
||||||
const toggleKeysButton = document.getElementById('toggle-keys');
|
const toggleBtn = document.getElementById('toggle-keys');
|
||||||
if (toggleKeysButton) {
|
|
||||||
console.log("Button with ID 'toggle-keys' found!");
|
function toggleKeys(visible) {
|
||||||
toggleKeysButton.addEventListener('click', function() {
|
document.querySelectorAll('.key-col').forEach(el => {
|
||||||
console.log("Button clicked!");
|
visible ? el.classList.remove('d-none') : el.classList.add('d-none');
|
||||||
const keyCols = document.querySelectorAll('.key-col');
|
});
|
||||||
keyCols.forEach(function(el) {
|
}
|
||||||
el.classList.toggle('hidden');
|
|
||||||
});
|
const savedState = localStorage.getItem(KEY_STORAGE);
|
||||||
|
const initialVisibility = savedState ? JSON.parse(savedState) : true;
|
||||||
|
toggleKeys(initialVisibility);
|
||||||
|
|
||||||
|
if (toggleBtn) {
|
||||||
|
let isVisible = initialVisibility;
|
||||||
|
|
||||||
|
toggleBtn.addEventListener('click', () => {
|
||||||
|
isVisible = !isVisible;
|
||||||
|
toggleKeys(isVisible);
|
||||||
|
localStorage.setItem(KEY_STORAGE, JSON.stringify(isVisible));
|
||||||
|
|
||||||
|
console.log(`Keys sind jetzt: ${isVisible ? 'sichtbar' : 'versteckt'}`);
|
||||||
|
console.log(`LocalStorage-Wert: ${localStorage.getItem(KEY_STORAGE)}`);
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
console.log("Button with ID 'toggle-keys' not found!");
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="alert alert-info">{{ _('No games yet') }}</div>
|
<div class="alert alert-info">{{ _('No games yet') }}</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
@ -2012,7 +2030,7 @@ cat <<HTML_END > templates/edit_game.html
|
||||||
<div class="card p-4 shadow-sm">
|
<div class="card p-4 shadow-sm">
|
||||||
<h2 class="mb-4">{{ _('Spiel bearbeiten') }}</h2>
|
<h2 class="mb-4">{{ _('Spiel bearbeiten') }}</h2>
|
||||||
|
|
||||||
<!-- Flash-Nachrichten -->
|
<!-- Flash-Messages -->
|
||||||
{% with messages = get_flashed_messages(with_categories=true) %}
|
{% with messages = get_flashed_messages(with_categories=true) %}
|
||||||
{% if messages %}
|
{% if messages %}
|
||||||
<div class="flash-messages mb-4">
|
<div class="flash-messages mb-4">
|
||||||
|
|
@ -2075,7 +2093,12 @@ cat <<HTML_END > templates/edit_game.html
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<label class="form-label">{{ _('Steam Key') }} <span class="text-danger">*</span></label>
|
<label class="form-label">{{ _('Steam Key') }} <span class="text-danger">*</span></label>
|
||||||
<input type="text" name="steam_key" class="form-control" value="{{ game.steam_key }}" required>
|
<div class="input-group">
|
||||||
|
<input type="text" name="steam_key" class="form-control" value="{{ game.steam_key }}" id="steam-key-input" required>
|
||||||
|
<button type="button" class="btn btn-outline-secondary copy-btn" data-clipboard-target="#steam-key-input">
|
||||||
|
{{ _('Copy') }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<label for="game_appid" class="form-label">{{ _('Steam AppID') }}</label>
|
<label for="game_appid" class="form-label">{{ _('Steam AppID') }}</label>
|
||||||
|
|
@ -2101,6 +2124,7 @@ cat <<HTML_END > templates/edit_game.html
|
||||||
<textarea id="game_notes" name="notes" class="form-control" rows="3">{{ game.notes }}</textarea>
|
<textarea id="game_notes" name="notes" class="form-control" rows="3">{{ game.notes }}</textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<!-- Show External Data -->
|
<!-- Show External Data -->
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="card mb-4">
|
<div class="card mb-4">
|
||||||
|
|
@ -2139,7 +2163,7 @@ cat <<HTML_END > templates/edit_game.html
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Einlöse-Links -->
|
<!-- Redeem-Links -->
|
||||||
{% if game.status == 'geschenkt' %}
|
{% if game.status == 'geschenkt' %}
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="card mb-3">
|
<div class="card mb-3">
|
||||||
|
|
@ -2189,6 +2213,7 @@ cat <<HTML_END > templates/edit_game.html
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -682,6 +682,7 @@ def add_game():
|
||||||
notes=request.form.get('notes', ''),
|
notes=request.form.get('notes', ''),
|
||||||
url=url,
|
url=url,
|
||||||
steam_appid=steam_appid,
|
steam_appid=steam_appid,
|
||||||
|
platform=request.form.get('platform', 'pc'),
|
||||||
redeem_date=datetime.strptime(request.form['redeem_date'], '%Y-%m-%d') if request.form['redeem_date'] else None,
|
redeem_date=datetime.strptime(request.form['redeem_date'], '%Y-%m-%d') if request.form['redeem_date'] else None,
|
||||||
user_id=current_user.id
|
user_id=current_user.id
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<div class="card p-4 shadow-sm">
|
<div class="card p-4 shadow-sm">
|
||||||
<h2 class="mb-4">{{ _('Spiel bearbeiten') }}</h2>
|
<h2 class="mb-4">{{ _('Spiel bearbeiten') }}</h2>
|
||||||
|
|
||||||
<!-- Flash-Nachrichten -->
|
<!-- Flash-Messages -->
|
||||||
{% with messages = get_flashed_messages(with_categories=true) %}
|
{% with messages = get_flashed_messages(with_categories=true) %}
|
||||||
{% if messages %}
|
{% if messages %}
|
||||||
<div class="flash-messages mb-4">
|
<div class="flash-messages mb-4">
|
||||||
|
|
@ -66,7 +66,12 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<label class="form-label">{{ _('Steam Key') }} <span class="text-danger">*</span></label>
|
<label class="form-label">{{ _('Steam Key') }} <span class="text-danger">*</span></label>
|
||||||
<input type="text" name="steam_key" class="form-control" value="{{ game.steam_key }}" required>
|
<div class="input-group">
|
||||||
|
<input type="text" name="steam_key" class="form-control" value="{{ game.steam_key }}" id="steam-key-input" required>
|
||||||
|
<button type="button" class="btn btn-outline-secondary copy-btn" data-clipboard-target="#steam-key-input">
|
||||||
|
{{ _('Copy') }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<label for="game_appid" class="form-label">{{ _('Steam AppID') }}</label>
|
<label for="game_appid" class="form-label">{{ _('Steam AppID') }}</label>
|
||||||
|
|
@ -92,6 +97,7 @@
|
||||||
<textarea id="game_notes" name="notes" class="form-control" rows="3">{{ game.notes }}</textarea>
|
<textarea id="game_notes" name="notes" class="form-control" rows="3">{{ game.notes }}</textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<!-- Show External Data -->
|
<!-- Show External Data -->
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="card mb-4">
|
<div class="card mb-4">
|
||||||
|
|
@ -130,7 +136,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Einlöse-Links -->
|
<!-- Redeem-Links -->
|
||||||
{% if game.status == 'geschenkt' %}
|
{% if game.status == 'geschenkt' %}
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="card mb-3">
|
<div class="card mb-3">
|
||||||
|
|
@ -180,6 +186,5 @@
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,11 @@
|
||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<button id="toggle-keys" class="btn btn-sm btn-outline-secondary mb-2">{{ _('Show/Hide Keys') }}</button>
|
<button id="toggle-keys" class="btn btn-sm btn-outline-secondary mb-2">{{ _('Show/Hide Keys') }}</button>
|
||||||
|
<div class="mb-2 d-flex justify-content-end">
|
||||||
|
<a href="{{ url_for('add_game') }}" class="btn btn-sm btn-warning">
|
||||||
|
{{ _('Add New Game') }}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
{% if games %}
|
{% if games %}
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-hover align-middle">
|
<table class="table table-hover align-middle">
|
||||||
|
|
@ -8,7 +13,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<th>{{ _('Cover') }}</th>
|
<th>{{ _('Cover') }}</th>
|
||||||
<th>{{ _('Name') }}</th>
|
<th>{{ _('Name') }}</th>
|
||||||
<th class="key-col d-md-table-cell">{{ _('Key') }}</th>
|
<th class="key-col">{{ _('Key') }}</th>
|
||||||
<th>{{ _('Status') }}</th>
|
<th>{{ _('Status') }}</th>
|
||||||
<th>{{ _('Created') }}</th>
|
<th>{{ _('Created') }}</th>
|
||||||
<th>{{ _('Redeem by') }}</th>
|
<th>{{ _('Redeem by') }}</th>
|
||||||
|
|
@ -41,7 +46,7 @@
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>{{ game.name }}</td>
|
<td>{{ game.name }}</td>
|
||||||
<td class="font-monospace key-col d-none d-md-table-cell">{{ game.steam_key }}</td>
|
<td class="font-monospace key-col">{{ game.steam_key }}</td>
|
||||||
<td>
|
<td>
|
||||||
{% if game.status == 'nicht eingelöst' %}
|
{% if game.status == 'nicht eingelöst' %}
|
||||||
<span class="badge bg-warning text-dark">{{ _('Not redeemed') }}</span>
|
<span class="badge bg-warning text-dark">{{ _('Not redeemed') }}</span>
|
||||||
|
|
@ -169,19 +174,30 @@ document.querySelectorAll('.generate-redeem').forEach(btn => {
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
console.log("DOM ist geladen!"); // Überprüfe, ob DOMContentLoaded überhaupt ausgeführt wird
|
const KEY_STORAGE = 'showKeys';
|
||||||
const toggleKeysButton = document.getElementById('toggle-keys');
|
const toggleBtn = document.getElementById('toggle-keys');
|
||||||
if (toggleKeysButton) {
|
|
||||||
console.log("Button with ID 'toggle-keys' found!");
|
function toggleKeys(visible) {
|
||||||
toggleKeysButton.addEventListener('click', function() {
|
document.querySelectorAll('.key-col').forEach(el => {
|
||||||
console.log("Button clicked!");
|
visible ? el.classList.remove('d-none') : el.classList.add('d-none');
|
||||||
const keyCols = document.querySelectorAll('.key-col');
|
});
|
||||||
keyCols.forEach(function(el) {
|
}
|
||||||
el.classList.toggle('hidden');
|
|
||||||
});
|
const savedState = localStorage.getItem(KEY_STORAGE);
|
||||||
|
const initialVisibility = savedState ? JSON.parse(savedState) : true;
|
||||||
|
toggleKeys(initialVisibility);
|
||||||
|
|
||||||
|
if (toggleBtn) {
|
||||||
|
let isVisible = initialVisibility;
|
||||||
|
|
||||||
|
toggleBtn.addEventListener('click', () => {
|
||||||
|
isVisible = !isVisible;
|
||||||
|
toggleKeys(isVisible);
|
||||||
|
localStorage.setItem(KEY_STORAGE, JSON.stringify(isVisible));
|
||||||
|
|
||||||
|
console.log(`Keys sind jetzt: ${isVisible ? 'sichtbar' : 'versteckt'}`);
|
||||||
|
console.log(`LocalStorage-Wert: ${localStorage.getItem(KEY_STORAGE)}`);
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
console.log("Button with ID 'toggle-keys' not found!");
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
@ -189,4 +205,3 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||||
<div class="alert alert-info">{{ _('No games yet') }}</div>
|
<div class="alert alert-info">{{ _('No games yet') }}</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue