Compare commits

...

14 commits
1.1 ... main

Author SHA1 Message Date
nocci
5f5800734f test 2025-06-12 11:50:52 +02:00
nocci
c7c60c9e56 Merge branch 'dev' 2025-06-10 11:51:52 +02:00
nocci
00f1767b6a fixed game_edit in app.py 2025-06-10 11:51:11 +02:00
nocci
0ac64ac7c1 fix edit_game in setup.sh 2025-06-10 11:46:32 +02:00
c9ee2925a2 cleanup 2025-05-25 15:26:34 +02:00
8ac203a3b5 small fix in edit_game.html 2025-05-25 15:25:34 +02:00
cb01f1ec60 copy key from edit_game.html 2025-05-25 12:32:57 +02:00
9ad102c020 add game moved 2025-05-19 15:06:03 +02:00
b9bb3d5574 Merge branch 'main' into dev 2025-05-19 15:03:40 +02:00
0c22d15ee4 info 2025-05-19 14:45:03 +02:00
2042d56131 fix index 2025-05-19 14:43:50 +02:00
d8e53aa02f LOL - Im sorry - I forgot the Add Game Button 2025-05-19 14:34:55 +02:00
24ae1a622c updated index.html 2025-05-12 12:15:57 +02:00
f2b434983e make "Show/Hide Keys" persistent 2025-05-12 12:14:52 +02:00
4 changed files with 83 additions and 37 deletions

View file

@ -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 %}

View file

@ -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
) )

View file

@ -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 %}

View file

@ -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 %}