105 lines
3.9 KiB
HTML
105 lines
3.9 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
|
|
<meta property="og:title" content="Gottesdienste Speyer und Schwegenheim" />
|
|
<meta property="og:description" content="... uns aber, die wir gerettet werden, ist es eine Gotteskraft." />
|
|
<meta property="og:image" content="https://app.bethaus-speyer.de/static/icons/logo-200x200.png" />
|
|
<meta property="og:url" content="https://app.bethaus-speyer.de" />
|
|
|
|
<title>Dateisuche</title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
|
<meta name="description" content="... uns aber, die wir gerettet werden, ist es eine Gotteskraft.">
|
|
<meta name="author" content="Bethaus Speyer">
|
|
<link rel="icon" href="/static/icons/logo-192x192.png" type="image/png" sizes="192x192">
|
|
|
|
<!-- Bootstrap CSS for modern styling -->
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<link rel="stylesheet" href="{{ url_for('static', filename='app.css') }}">
|
|
<style>
|
|
body {
|
|
background-color: #f8f9fa;
|
|
}
|
|
.search-container {
|
|
margin-top: 50px;
|
|
}
|
|
.card {
|
|
margin-bottom: 20px;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<header class="site-header">
|
|
<a href="#">
|
|
<img src="/static/logoW.png" alt="Logo" class="logo">
|
|
</a>
|
|
<h1>Suche</h1>
|
|
</header>
|
|
<div class="container search-container">
|
|
<form id="searchForm" method="post" class="mb-4">
|
|
<div class="mb-3">
|
|
<label for="query" class="form-label">Suchwörter:</label>
|
|
<input type="text" id="query" name="query" class="form-control" required>
|
|
</div>
|
|
<div class="form-check mb-3">
|
|
<input type="checkbox" class="form-check-input" id="includeTranscript" name="includeTranscript">
|
|
<label class="form-check-label" for="includeTranscript">Im Transkript suchen</label>
|
|
</div>
|
|
<button type="submit" class="btn btn-primary">Suchen</button>
|
|
</form>
|
|
|
|
<!-- Container for AJAX-loaded results -->
|
|
<div id="results"></div>
|
|
</div>
|
|
|
|
<script>
|
|
document.getElementById('searchForm').addEventListener('submit', function(e) {
|
|
e.preventDefault();
|
|
const query = document.getElementById('query').value.trim();
|
|
const includeTranscript = document.getElementById('includeTranscript').checked;
|
|
|
|
// Prepare form data
|
|
const formData = new FormData();
|
|
formData.append('query', query);
|
|
formData.append('includeTranscript', includeTranscript);
|
|
|
|
fetch('/searchcommand', {
|
|
method: 'POST',
|
|
body: formData
|
|
})
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
const resultsDiv = document.getElementById('results');
|
|
resultsDiv.innerHTML = ''; // Clear previous results
|
|
if (data.results && data.results.length > 0) {
|
|
data.results.forEach(file => {
|
|
// Create a card element for each result
|
|
const card = document.createElement('div');
|
|
card.className = 'card';
|
|
card.innerHTML = `
|
|
<div class="card-body">
|
|
<h5 class="card-title">
|
|
<a href="/path/${file.relative_path}" target="_blank">${file.filename}</a>
|
|
</h5>
|
|
<h6 class="card-subtitle mb-2 text-muted">${file.relative_path}</h6>
|
|
${file.transcript_hits !== undefined ? `<p class="card-text">Treffer im Transkript: ${file.transcript_hits}</p>` : ''}
|
|
</div>
|
|
`;
|
|
resultsDiv.appendChild(card);
|
|
});
|
|
} else {
|
|
resultsDiv.innerHTML = '<p>No results found.</p>';
|
|
}
|
|
})
|
|
.catch(error => {
|
|
console.error('Error:', error);
|
|
});
|
|
});
|
|
</script>
|
|
|
|
<!-- Bootstrap Bundle with Popper -->
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
|
</body>
|
|
</html>
|