Compare commits

..

No commits in common. "main" and "1.1" have entirely different histories.
main ... 1.1

4 changed files with 37 additions and 83 deletions

View file

@ -863,7 +863,6 @@ def add_game():
notes=request.form.get('notes', ''),
url=url,
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,
user_id=current_user.id
)
@ -1673,11 +1672,6 @@ cat <<'HTML_END' > templates/index.html
{% extends "base.html" %}
{% block content %}
<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 %}
<div class="table-responsive">
<table class="table table-hover align-middle">
@ -1685,7 +1679,7 @@ cat <<'HTML_END' > templates/index.html
<tr>
<th>{{ _('Cover') }}</th>
<th>{{ _('Name') }}</th>
<th class="key-col">{{ _('Key') }}</th>
<th class="key-col d-md-table-cell">{{ _('Key') }}</th>
<th>{{ _('Status') }}</th>
<th>{{ _('Created') }}</th>
<th>{{ _('Redeem by') }}</th>
@ -1718,7 +1712,7 @@ cat <<'HTML_END' > templates/index.html
</a>
</td>
<td>{{ game.name }}</td>
<td class="font-monospace key-col">{{ game.steam_key }}</td>
<td class="font-monospace key-col d-none d-md-table-cell">{{ game.steam_key }}</td>
<td>
{% if game.status == 'nicht eingelöst' %}
<span class="badge bg-warning text-dark">{{ _('Not redeemed') }}</span>
@ -1846,34 +1840,22 @@ document.querySelectorAll('.generate-redeem').forEach(btn => {
</script>
<script>
document.addEventListener('DOMContentLoaded', function() {
const KEY_STORAGE = 'showKeys';
const toggleBtn = document.getElementById('toggle-keys');
function toggleKeys(visible) {
document.querySelectorAll('.key-col').forEach(el => {
visible ? el.classList.remove('d-none') : el.classList.add('d-none');
});
}
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)}`);
console.log("DOM ist geladen!"); // Überprüfe, ob DOMContentLoaded überhaupt ausgeführt wird
const toggleKeysButton = document.getElementById('toggle-keys');
if (toggleKeysButton) {
console.log("Button with ID 'toggle-keys' found!");
toggleKeysButton.addEventListener('click', function() {
console.log("Button clicked!");
const keyCols = document.querySelectorAll('.key-col');
keyCols.forEach(function(el) {
el.classList.toggle('hidden');
});
});
} else {
console.log("Button with ID 'toggle-keys' not found!");
}
});
</script>
{% else %}
<div class="alert alert-info">{{ _('No games yet') }}</div>
{% endif %}
@ -2030,7 +2012,7 @@ cat <<HTML_END > templates/edit_game.html
<div class="card p-4 shadow-sm">
<h2 class="mb-4">{{ _('Spiel bearbeiten') }}</h2>
<!-- Flash-Messages -->
<!-- Flash-Nachrichten -->
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
<div class="flash-messages mb-4">
@ -2093,12 +2075,7 @@ cat <<HTML_END > templates/edit_game.html
</div>
<div class="col-md-6">
<label class="form-label">{{ _('Steam Key') }} <span class="text-danger">*</span></label>
<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>
<input type="text" name="steam_key" class="form-control" value="{{ game.steam_key }}" required>
</div>
<div class="col-md-6">
<label for="game_appid" class="form-label">{{ _('Steam AppID') }}</label>
@ -2124,7 +2101,6 @@ cat <<HTML_END > templates/edit_game.html
<textarea id="game_notes" name="notes" class="form-control" rows="3">{{ game.notes }}</textarea>
</div>
<!-- Show External Data -->
<div class="col-12">
<div class="card mb-4">
@ -2163,7 +2139,7 @@ cat <<HTML_END > templates/edit_game.html
</div>
</div>
<!-- Redeem-Links -->
<!-- Einlöse-Links -->
{% if game.status == 'geschenkt' %}
<div class="col-12">
<div class="card mb-3">
@ -2213,7 +2189,6 @@ cat <<HTML_END > templates/edit_game.html
});
});
</script>
{% endblock %}

View file

@ -682,7 +682,6 @@ def add_game():
notes=request.form.get('notes', ''),
url=url,
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,
user_id=current_user.id
)

View file

@ -3,7 +3,7 @@
<div class="card p-4 shadow-sm">
<h2 class="mb-4">{{ _('Spiel bearbeiten') }}</h2>
<!-- Flash-Messages -->
<!-- Flash-Nachrichten -->
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
<div class="flash-messages mb-4">
@ -66,12 +66,7 @@
</div>
<div class="col-md-6">
<label class="form-label">{{ _('Steam Key') }} <span class="text-danger">*</span></label>
<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>
<input type="text" name="steam_key" class="form-control" value="{{ game.steam_key }}" required>
</div>
<div class="col-md-6">
<label for="game_appid" class="form-label">{{ _('Steam AppID') }}</label>
@ -97,7 +92,6 @@
<textarea id="game_notes" name="notes" class="form-control" rows="3">{{ game.notes }}</textarea>
</div>
<!-- Show External Data -->
<div class="col-12">
<div class="card mb-4">
@ -136,7 +130,7 @@
</div>
</div>
<!-- Redeem-Links -->
<!-- Einlöse-Links -->
{% if game.status == 'geschenkt' %}
<div class="col-12">
<div class="card mb-3">
@ -186,5 +180,6 @@
});
});
</script>
{% endblock %}

View file

@ -1,11 +1,6 @@
{% extends "base.html" %}
{% block content %}
<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 %}
<div class="table-responsive">
<table class="table table-hover align-middle">
@ -13,7 +8,7 @@
<tr>
<th>{{ _('Cover') }}</th>
<th>{{ _('Name') }}</th>
<th class="key-col">{{ _('Key') }}</th>
<th class="key-col d-md-table-cell">{{ _('Key') }}</th>
<th>{{ _('Status') }}</th>
<th>{{ _('Created') }}</th>
<th>{{ _('Redeem by') }}</th>
@ -46,7 +41,7 @@
</a>
</td>
<td>{{ game.name }}</td>
<td class="font-monospace key-col">{{ game.steam_key }}</td>
<td class="font-monospace key-col d-none d-md-table-cell">{{ game.steam_key }}</td>
<td>
{% if game.status == 'nicht eingelöst' %}
<span class="badge bg-warning text-dark">{{ _('Not redeemed') }}</span>
@ -174,30 +169,19 @@ document.querySelectorAll('.generate-redeem').forEach(btn => {
</script>
<script>
document.addEventListener('DOMContentLoaded', function() {
const KEY_STORAGE = 'showKeys';
const toggleBtn = document.getElementById('toggle-keys');
function toggleKeys(visible) {
document.querySelectorAll('.key-col').forEach(el => {
visible ? el.classList.remove('d-none') : el.classList.add('d-none');
});
}
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)}`);
console.log("DOM ist geladen!"); // Überprüfe, ob DOMContentLoaded überhaupt ausgeführt wird
const toggleKeysButton = document.getElementById('toggle-keys');
if (toggleKeysButton) {
console.log("Button with ID 'toggle-keys' found!");
toggleKeysButton.addEventListener('click', function() {
console.log("Button clicked!");
const keyCols = document.querySelectorAll('.key-col');
keyCols.forEach(function(el) {
el.classList.toggle('hidden');
});
});
} else {
console.log("Button with ID 'toggle-keys' not found!");
}
});
</script>
@ -205,3 +189,4 @@ document.addEventListener('DOMContentLoaded', function() {
<div class="alert alert-info">{{ _('No games yet') }}</div>
{% endif %}
{% endblock %}