Fix payment system balance integration and add calendar functionality
- Implement automated payment tracking with Django signals - Fix duplicate transaction creation with unique referenz system - Add calendar system with CRUD operations and event management - Reorganize navigation menu (rename sections, move admin functions) - Replace Geschichte editor with EasyMDE markdown editor - Add management commands for balance reconciliation - Create missing transactions for previously paid payments - Ensure account balances accurately reflect all payment activity Features added: - Calendar entries creation and administration via menu - Payment status tracking with automatic balance updates - Duplicate prevention for payment transactions - Markdown editor with live preview for Geschichte pages - Database reconciliation tools for payment/balance sync Bug fixes: - Resolved IntegrityError on payment status changes - Fixed missing account balance updates for paid payments - Prevented duplicate balance deductions on re-saves - Corrected menu structure and admin function placement
This commit is contained in:
66
app/templates/stiftung/geschichte/bild_delete.html
Normal file
66
app/templates/stiftung/geschichte/bild_delete.html
Normal file
@@ -0,0 +1,66 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load help_tags %}
|
||||
|
||||
{% block title %}{{ title }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="{% url 'stiftung:dashboard' %}">Dashboard</a></li>
|
||||
<li class="breadcrumb-item"><a href="{% url 'stiftung:geschichte_list' %}">Geschichte</a></li>
|
||||
<li class="breadcrumb-item"><a href="{{ seite.get_absolute_url }}">{{ seite.titel }}</a></li>
|
||||
<li class="breadcrumb-item active" aria-current="page">Bild löschen</li>
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8">
|
||||
<div class="card shadow">
|
||||
<div class="card-header bg-danger text-white">
|
||||
<h5 class="mb-0">
|
||||
<i class="fas fa-trash me-2"></i>{{ title }}
|
||||
</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="alert alert-warning">
|
||||
<i class="fas fa-exclamation-triangle me-2"></i>
|
||||
<strong>Achtung!</strong> Dieser Vorgang kann nicht rückgängig gemacht werden.
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<img src="{{ bild.bild.url }}" alt="{{ bild.alt_text }}" class="img-fluid rounded">
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<h6>Bild-Details:</h6>
|
||||
<ul class="list-unstyled">
|
||||
<li><strong>Titel:</strong> {{ bild.titel }}</li>
|
||||
<li><strong>Beschreibung:</strong> {{ bild.beschreibung|default:"Keine Beschreibung" }}</li>
|
||||
<li><strong>Hochgeladen:</strong> {{ bild.hochgeladen_am|date:"d.m.Y H:i" }}</li>
|
||||
{% if bild.hochgeladen_von %}
|
||||
<li><strong>Hochgeladen von:</strong> {{ bild.hochgeladen_von.get_full_name|default:bild.hochgeladen_von.username }}</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<p>Möchten Sie dieses Bild wirklich löschen?</p>
|
||||
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
<div class="d-flex justify-content-between">
|
||||
<a href="{{ seite.get_absolute_url }}" class="btn btn-secondary">
|
||||
<i class="fas fa-arrow-left me-1"></i>Abbrechen
|
||||
</a>
|
||||
<button type="submit" class="btn btn-danger">
|
||||
<i class="fas fa-trash me-1"></i>Endgültig löschen
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -67,7 +67,7 @@
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="geschichte-content">
|
||||
{{ seite.inhalt|linebreaks }}
|
||||
{{ seite.inhalt|markdown_to_html }}
|
||||
</div>
|
||||
|
||||
{% if bilder %}
|
||||
@@ -75,13 +75,22 @@
|
||||
<h4><i class="fas fa-images me-2"></i>Bildergalerie</h4>
|
||||
{% for bild in bilder %}
|
||||
<div class="geschichte-bild">
|
||||
<img src="{{ bild.bild.url }}" alt="{{ bild.alt_text|default:bild.titel }}" class="img-fluid">
|
||||
<div class="bild-beschreibung">
|
||||
<strong>{{ bild.titel }}</strong>
|
||||
{% if bild.beschreibung %}
|
||||
<br>{{ bild.beschreibung }}
|
||||
<div class="d-flex justify-content-between align-items-start mb-2">
|
||||
<h6 class="mb-0">{{ bild.titel }}</h6>
|
||||
{% if perms.stiftung.delete_geschichtebild %}
|
||||
<a href="{% url 'stiftung:geschichte_bild_delete' slug=seite.slug bild_id=bild.id %}"
|
||||
class="btn btn-outline-danger btn-sm"
|
||||
title="Bild löschen">
|
||||
<i class="fas fa-trash"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
<img src="{{ bild.bild.url }}" alt="{{ bild.alt_text|default:bild.titel }}" class="img-fluid">
|
||||
{% if bild.beschreibung %}
|
||||
<div class="bild-beschreibung mt-2">
|
||||
{{ bild.beschreibung }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
@@ -4,19 +4,37 @@
|
||||
{% block title %}{{ title }}{% endblock %}
|
||||
|
||||
{% block extra_css %}
|
||||
<link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/easymde@2.18.0/dist/easymde.min.css">
|
||||
<style>
|
||||
.ql-editor {
|
||||
.EasyMDEContainer {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.EasyMDEContainer .editor-toolbar {
|
||||
border-color: #dee2e6;
|
||||
background: #f8f9fa;
|
||||
}
|
||||
|
||||
.EasyMDEContainer .CodeMirror {
|
||||
border-color: #dee2e6;
|
||||
font-family: inherit;
|
||||
font-size: 1rem;
|
||||
min-height: 300px;
|
||||
}
|
||||
.ql-toolbar {
|
||||
border-top-left-radius: 0.375rem;
|
||||
border-top-right-radius: 0.375rem;
|
||||
}
|
||||
.ql-container {
|
||||
border-bottom-left-radius: 0.375rem;
|
||||
border-bottom-right-radius: 0.375rem;
|
||||
|
||||
.EasyMDEContainer .editor-preview,
|
||||
.EasyMDEContainer .editor-preview-side {
|
||||
font-family: inherit;
|
||||
font-size: 1rem;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.editor-help {
|
||||
background: #f8f9fa;
|
||||
border: 1px solid #dee2e6;
|
||||
border-radius: 0.375rem;
|
||||
padding: 1rem;
|
||||
margin-top: 0.5rem;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
@@ -75,13 +93,37 @@
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">{{ form.inhalt.label }}</label>
|
||||
<div id="quill-editor" style="height: 400px;"></div>
|
||||
<textarea name="inhalt" id="id_inhalt" style="display: none;">{{ form.inhalt.value|default:"" }}</textarea>
|
||||
<label class="form-label" for="{{ form.inhalt.id_for_label }}">{{ form.inhalt.label }}</label>
|
||||
|
||||
<!-- Markdown Editor -->
|
||||
{{ form.inhalt }}
|
||||
|
||||
{% if form.inhalt.errors %}
|
||||
<div class="text-danger">{{ form.inhalt.errors }}</div>
|
||||
{% endif %}
|
||||
<div class="form-text">{{ form.inhalt.help_text }}</div>
|
||||
|
||||
<div class="editor-help mt-2">
|
||||
<h6><i class="fas fa-info-circle me-1"></i>Markdown-Hilfe</h6>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<small>
|
||||
<strong>Formatierung:</strong><br>
|
||||
<code>**Fett**</code> → <strong>Fett</strong><br>
|
||||
<code>*Kursiv*</code> → <em>Kursiv</em><br>
|
||||
<code>~~Durchgestrichen~~</code> → <del>Durchgestrichen</del>
|
||||
</small>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<small>
|
||||
<strong>Überschriften:</strong><br>
|
||||
<code># Überschrift 1</code><br>
|
||||
<code>## Überschrift 2</code><br>
|
||||
<code>### Überschrift 3</code>
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3 form-check">
|
||||
@@ -110,18 +152,26 @@
|
||||
<div class="col-lg-4">
|
||||
<div class="card">
|
||||
<div class="card-header bg-info text-white">
|
||||
<h6 class="mb-0"><i class="fas fa-info-circle me-2"></i>Rich Text Editor</h6>
|
||||
<h6 class="mb-0"><i class="fas fa-markdown me-2"></i>Markdown Editor</h6>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p class="small">Der Editor unterstützt:</p>
|
||||
<p class="small">Der Markdown-Editor unterstützt:</p>
|
||||
<ul class="small">
|
||||
<li>Formatierung (Fett, Kursiv, Unterstrichen)</li>
|
||||
<li>Überschriften (H1, H2, H3)</li>
|
||||
<li>Listen (nummeriert und Aufzählungen)</li>
|
||||
<li>Links</li>
|
||||
<li>Bilder (über separaten Upload)</li>
|
||||
<li>Live-Vorschau beim Schreiben</li>
|
||||
<li>Toolbar für häufige Formatierungen</li>
|
||||
<li>Vollbild-Modus für fokussiertes Schreiben</li>
|
||||
<li>Automatisches Speichern im Browser</li>
|
||||
</ul>
|
||||
<hr>
|
||||
<h6 class="small">Häufige Markdown-Syntax:</h6>
|
||||
<div class="small">
|
||||
<code>- Listen-Element</code><br>
|
||||
<code>1. Nummerierte Liste</code><br>
|
||||
<code>[Link Text](URL)</code><br>
|
||||
<code>> Zitat</code><br>
|
||||
<code>`Code`</code>
|
||||
</div>
|
||||
<hr>
|
||||
<p class="small text-muted">
|
||||
Tipp: Verwenden Sie die Bild-Upload-Funktion, um Bilder zur Seite hinzuzufügen.
|
||||
</p>
|
||||
@@ -132,46 +182,88 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block extra_js %}
|
||||
<script src="https://cdn.quilljs.com/1.3.6/quill.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/easymde@2.18.0/dist/easymde.min.js"></script>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// Initialize Quill editor
|
||||
var quill = new Quill('#quill-editor', {
|
||||
theme: 'snow',
|
||||
modules: {
|
||||
console.log('Initializing EasyMDE markdown editor...');
|
||||
|
||||
var textarea = document.getElementById('id_inhalt');
|
||||
|
||||
if (textarea) {
|
||||
var easyMDE = new EasyMDE({
|
||||
element: textarea,
|
||||
autofocus: false,
|
||||
autosave: {
|
||||
enabled: true,
|
||||
delay: 1000,
|
||||
uniqueId: 'geschichte_' + (window.location.pathname.match(/\/(\w+)\//) || ['', 'new'])[1]
|
||||
},
|
||||
spellChecker: false,
|
||||
toolbar: [
|
||||
[{ 'header': [1, 2, 3, false] }],
|
||||
['bold', 'italic', 'underline', 'strike'],
|
||||
[{ 'list': 'ordered'}, { 'list': 'bullet' }],
|
||||
[{ 'color': [] }, { 'background': [] }],
|
||||
['link'],
|
||||
['clean']
|
||||
]
|
||||
},
|
||||
placeholder: 'Schreiben Sie hier den Inhalt der Geschichtsseite...'
|
||||
});
|
||||
|
||||
// Load existing content
|
||||
var existingContent = document.getElementById('id_inhalt').value;
|
||||
if (existingContent) {
|
||||
quill.root.innerHTML = existingContent;
|
||||
'bold', 'italic', 'strikethrough', '|',
|
||||
'heading-1', 'heading-2', 'heading-3', '|',
|
||||
'unordered-list', 'ordered-list', '|',
|
||||
'link', 'quote', 'code', '|',
|
||||
'preview', 'side-by-side', 'fullscreen', '|',
|
||||
'guide'
|
||||
],
|
||||
placeholder: 'Schreiben Sie hier den Inhalt der Geschichtsseite...\n\nSie können Markdown verwenden für:\n- **Fettdruck**\n- *Kursiv*\n- # Überschriften\n- [Links](URL)\n- Listen und vieles mehr',
|
||||
renderingConfig: {
|
||||
singleLineBreaks: false,
|
||||
codeSyntaxHighlighting: false
|
||||
},
|
||||
previewRender: function(plainText) {
|
||||
// Simple markdown to HTML conversion for preview
|
||||
return plainText
|
||||
.replace(/^### (.*$)/gim, '<h3>$1</h3>')
|
||||
.replace(/^## (.*$)/gim, '<h2>$1</h2>')
|
||||
.replace(/^# (.*$)/gim, '<h1>$1</h1>')
|
||||
.replace(/^\> (.*$)/gim, '<blockquote>$1</blockquote>')
|
||||
.replace(/\*\*(.*)\*\*/gim, '<strong>$1</strong>')
|
||||
.replace(/\*(.*)\*/gim, '<em>$1</em>')
|
||||
.replace(/~~(.*)~~/gim, '<del>$1</del>')
|
||||
.replace(/`([^`]*)`/gim, '<code>$1</code>')
|
||||
.replace(/\[([^\]]*)\]\(([^)]*)\)/gim, '<a href="$2">$1</a>')
|
||||
.replace(/^\* (.*$)/gim, '<li>$1</li>')
|
||||
.replace(/^\d+\. (.*$)/gim, '<li>$1</li>')
|
||||
.replace(/\n/gim, '<br>');
|
||||
},
|
||||
status: ['autosave', 'lines', 'words', 'cursor'],
|
||||
insertTexts: {
|
||||
horizontalRule: ["", "\n\n-----\n\n"],
|
||||
image: [""],
|
||||
link: ["[", "](http://)"],
|
||||
table: ["", "\n\n| Column 1 | Column 2 | Column 3 |\n| -------- | -------- | -------- |\n| Text | Text | Text |\n\n"],
|
||||
}
|
||||
});
|
||||
|
||||
console.log('EasyMDE initialized successfully');
|
||||
|
||||
// Auto-generate slug from title
|
||||
var titleField = document.querySelector('input[name="titel"]');
|
||||
var slugField = document.querySelector('input[name="slug"]');
|
||||
|
||||
if (titleField && slugField) {
|
||||
titleField.addEventListener('input', function() {
|
||||
// Only auto-generate if slug is empty or matches previous title
|
||||
if (!slugField.value || slugField.getAttribute('data-auto-generated') === 'true') {
|
||||
var title = this.value;
|
||||
var slug = title.toLowerCase()
|
||||
.replace(/ä/g, 'ae').replace(/ö/g, 'oe').replace(/ü/g, 'ue').replace(/ß/g, 'ss')
|
||||
.replace(/[^\w\s-]/g, '')
|
||||
.replace(/[-\s]+/g, '-')
|
||||
.replace(/^-+|-+$/g, '');
|
||||
slugField.value = slug;
|
||||
slugField.setAttribute('data-auto-generated', 'true');
|
||||
}
|
||||
});
|
||||
|
||||
// Mark slug as manually edited if user changes it
|
||||
slugField.addEventListener('input', function() {
|
||||
slugField.setAttribute('data-auto-generated', 'false');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Auto-generate slug from title
|
||||
document.getElementById('{{ form.titel.id_for_label }}').addEventListener('input', function() {
|
||||
var title = this.value;
|
||||
var slug = title.toLowerCase()
|
||||
.replace(/ä/g, 'ae').replace(/ö/g, 'oe').replace(/ü/g, 'ue').replace(/ß/g, 'ss')
|
||||
.replace(/[^\w\s-]/g, '')
|
||||
.replace(/[-\s]+/g, '-')
|
||||
.trim();
|
||||
document.getElementById('{{ form.slug.id_for_label }}').value = slug;
|
||||
});
|
||||
|
||||
// Update textarea on form submit
|
||||
document.getElementById('geschichteForm').addEventListener('submit', function() {
|
||||
document.getElementById('id_inhalt').value = quill.root.innerHTML;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user