finishing
This commit is contained in:
parent
b66a9d0d2c
commit
41a5ed92f1
5 changed files with 62 additions and 60 deletions
|
|
@ -67,11 +67,10 @@ class FragifyApp(BaseTemplateResource):
|
||||||
def on_post(self, req, resp):
|
def on_post(self, req, resp):
|
||||||
"""Handle form submission and generate link"""
|
"""Handle form submission and generate link"""
|
||||||
try:
|
try:
|
||||||
# Parse form data
|
# Parse form data - use get_param for form fields
|
||||||
form_data = req.get_media()
|
publicbody_id = req.get_param('publicbody_id', default='')
|
||||||
publicbody_id = form_data.get('publicbody_id', '')
|
subject = req.get_param('subject', default='')
|
||||||
subject = form_data.get('subject', '')
|
body = req.get_param('body', default='')
|
||||||
body = form_data.get('body', '')
|
|
||||||
|
|
||||||
# Generate FragDenStaat.de link
|
# Generate FragDenStaat.de link
|
||||||
base_url = "https://fragdenstaat.de/anfrage-stellen/"
|
base_url = "https://fragdenstaat.de/anfrage-stellen/"
|
||||||
|
|
|
||||||
|
|
@ -67,8 +67,8 @@
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
.footer {
|
.footer {
|
||||||
background: rgba(255, 255, 255, 0.9);
|
background: transparent;
|
||||||
backdrop-filter: blur(10px);
|
margin-top: 3rem;
|
||||||
}
|
}
|
||||||
.footer-links a {
|
.footer-links a {
|
||||||
font-size: 0.9rem;
|
font-size: 0.9rem;
|
||||||
|
|
@ -83,6 +83,13 @@
|
||||||
.footer-text a:hover {
|
.footer-text a:hover {
|
||||||
color: #667eea !important;
|
color: #667eea !important;
|
||||||
}
|
}
|
||||||
|
.footer-text a {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
.footer-text {
|
||||||
|
font-size: 0.8rem;
|
||||||
|
margin-bottom: 2rem;
|
||||||
|
}
|
||||||
.legal-content {
|
.legal-content {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
line-height: 1.6;
|
line-height: 1.6;
|
||||||
|
|
@ -98,6 +105,9 @@
|
||||||
.legal-content ul {
|
.legal-content ul {
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
}
|
}
|
||||||
|
.main-container {
|
||||||
|
margin-bottom: 4rem;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
{% block extra_css %}{% endblock %}
|
{% block extra_css %}{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
|
|
@ -108,7 +118,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Footer -->
|
<!-- Footer -->
|
||||||
<footer class="footer mt-5 pt-4 border-top">
|
<footer class="footer mt-5 pt-4">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12 text-center">
|
<div class="col-12 text-center">
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,10 @@
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<h1 class="title display-4">Datenschutzerklärung</h1>
|
<h1 class="title display-4">
|
||||||
|
<a href="/" class="text-decoration-none text-dark">Fragify</a>
|
||||||
|
</h1>
|
||||||
|
<h2 class="text-muted h4 mt-3">Datenschutzerklärung</h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="legal-content">
|
<div class="legal-content">
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,10 @@
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<h1 class="title display-4">Impressum</h1>
|
<h1 class="title display-4">
|
||||||
|
<a href="/" class="text-decoration-none text-dark">Fragify</a>
|
||||||
|
</h1>
|
||||||
|
<h2 class="text-muted h4 mt-3">Impressum</h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="legal-content">
|
<div class="legal-content">
|
||||||
|
|
|
||||||
|
|
@ -41,12 +41,10 @@
|
||||||
|
|
||||||
<div id="result" class="mt-4" style="display: none;">
|
<div id="result" class="mt-4" style="display: none;">
|
||||||
<h5 class="text-success mb-3">Link erfolgreich generiert!</h5>
|
<h5 class="text-success mb-3">Link erfolgreich generiert!</h5>
|
||||||
<div class="result-link">
|
<div class="input-group">
|
||||||
<a href="" id="generatedLink" target="_blank"></a>
|
<input type="text" class="form-control" id="generatedLinkInput" readonly>
|
||||||
|
<button class="btn btn-outline-primary" type="button" id="copyBtn">In Zwischenablage</button>
|
||||||
</div>
|
</div>
|
||||||
<button class="btn btn-outline-primary mt-3" onclick="copyToClipboard()">
|
|
||||||
Link kopieren
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
@ -72,14 +70,14 @@
|
||||||
processResults: function(data, params) {
|
processResults: function(data, params) {
|
||||||
params.page = params.page || 1;
|
params.page = params.page || 1;
|
||||||
return {
|
return {
|
||||||
results: data.results.map(function(item) {
|
results: data.objects.map(function(item) {
|
||||||
return {
|
return {
|
||||||
id: item.id,
|
id: item.id,
|
||||||
text: item.name + ' (' + item.jurisdiction + ')'
|
text: item.name + ' (' + item.jurisdiction.name + ')'
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
pagination: {
|
pagination: {
|
||||||
more: data.next !== null
|
more: data.meta.next !== null
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
@ -87,52 +85,41 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Handle form submission
|
// Handle form submission (client-side)
|
||||||
$('#fragifyForm').on('submit', function(e) {
|
$('#fragifyForm').on('submit', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
const formData = new FormData(this);
|
const publicbodyId = $('#publicbody').val() || '';
|
||||||
const submitBtn = $('button[type="submit"]');
|
const subject = $('#subject').val() || '';
|
||||||
const btnText = submitBtn.find('.btn-text');
|
const body = $('#body').val() || '';
|
||||||
const loading = submitBtn.find('.loading');
|
|
||||||
|
|
||||||
// Show loading state
|
let link = 'https://fragdenstaat.de/anfrage-stellen/';
|
||||||
btnText.hide();
|
if (publicbodyId) {
|
||||||
loading.show();
|
link += `an/${publicbodyId}/`;
|
||||||
submitBtn.prop('disabled', true);
|
}
|
||||||
|
|
||||||
fetch('/', {
|
const params = new URLSearchParams();
|
||||||
method: 'POST',
|
if (subject) params.set('subject', subject);
|
||||||
body: formData
|
if (body) params.set('body', body);
|
||||||
})
|
|
||||||
.then(response => response.json())
|
if ([...params].length > 0) {
|
||||||
.then(data => {
|
link += `?${params.toString()}`;
|
||||||
if (data.success) {
|
}
|
||||||
$('#generatedLink').attr('href', data.link).text(data.link);
|
|
||||||
|
$('#generatedLinkInput').val(link);
|
||||||
$('#result').show();
|
$('#result').show();
|
||||||
$('#fragifyForm')[0].reset();
|
|
||||||
$('#publicbody').val(null).trigger('change');
|
|
||||||
} else {
|
|
||||||
alert('Fehler: ' + data.error);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
alert('Fehler beim Generieren des Links: ' + error);
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
// Hide loading state
|
|
||||||
btnText.show();
|
|
||||||
loading.hide();
|
|
||||||
submitBtn.prop('disabled', false);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function copyToClipboard() {
|
// Copy to clipboard
|
||||||
const link = document.getElementById('generatedLink').href;
|
$(document).on('click', '#copyBtn', function() {
|
||||||
|
const link = $('#generatedLinkInput').val();
|
||||||
navigator.clipboard.writeText(link).then(function() {
|
navigator.clipboard.writeText(link).then(function() {
|
||||||
alert('Link wurde in die Zwischenablage kopiert!');
|
const btn = $('#copyBtn');
|
||||||
|
const originalText = btn.text();
|
||||||
|
btn.text('Kopiert!');
|
||||||
|
setTimeout(() => btn.text(originalText), 1500);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue