fit search page to custom designe
This commit is contained in:
parent
2c6b856f66
commit
e9436df364
22
search.py
22
search.py
@ -1,7 +1,7 @@
|
|||||||
import sqlite3
|
import sqlite3
|
||||||
from flask import Flask, render_template, request, request, jsonify, session
|
from flask import Flask, render_template, request, request, jsonify, session
|
||||||
import os
|
|
||||||
import random
|
import random
|
||||||
|
import json
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
@ -10,6 +10,9 @@ SEARCH_DB_NAME = 'search.db'
|
|||||||
search_db = sqlite3.connect(SEARCH_DB_NAME, check_same_thread=False)
|
search_db = sqlite3.connect(SEARCH_DB_NAME, check_same_thread=False)
|
||||||
search_db.row_factory = sqlite3.Row
|
search_db.row_factory = sqlite3.Row
|
||||||
|
|
||||||
|
with open("app_config.json", 'r') as file:
|
||||||
|
app_config = json.load(file)
|
||||||
|
|
||||||
def searchcommand():
|
def searchcommand():
|
||||||
query = request.form.get("query", "").strip()
|
query = request.form.get("query", "").strip()
|
||||||
category = request.form.get("category", "").strip()
|
category = request.form.get("category", "").strip()
|
||||||
@ -90,7 +93,18 @@ def searchcommand():
|
|||||||
return jsonify(results=results)
|
return jsonify(results=results)
|
||||||
|
|
||||||
def search():
|
def search():
|
||||||
title_short = os.environ.get('TITLE_SHORT', 'Default Title')
|
title_short = app_config.get('TITLE_SHORT', 'Default Title')
|
||||||
title_long = os.environ.get('TITLE_LONG', 'Default Title')
|
title_long = app_config.get('TITLE_LONG' , 'Default Title')
|
||||||
return render_template("search.html", title_short=title_short, title_long=title_long)
|
header_color = app_config.get('header_color' , '#000')
|
||||||
|
header_text_color = app_config.get('header_text_color', '#fff')
|
||||||
|
background_color = app_config.get('background_color', '#fff')
|
||||||
|
main_text_color = app_config.get('main_text_color', '#000')
|
||||||
|
return render_template("search.html",
|
||||||
|
title_short=title_short,
|
||||||
|
title_long=title_long,
|
||||||
|
header_color=header_color,
|
||||||
|
header_text_color=header_text_color,
|
||||||
|
main_text_color=main_text_color,
|
||||||
|
background_color=background_color,
|
||||||
|
)
|
||||||
|
|
||||||
|
|||||||
@ -40,7 +40,7 @@
|
|||||||
background-color: {{ header_color }};
|
background-color: {{ header_color }};
|
||||||
color: {{ header_text_color }};
|
color: {{ header_text_color }};
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header class="site-header">
|
<header class="site-header">
|
||||||
|
|||||||
@ -3,15 +3,14 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
|
|
||||||
<meta property="og:title" content="Gottesdienste Speyer und Schwegenheim" />
|
<meta property="og:title" content="{{ title_long }}" />
|
||||||
<meta property="og:description" content="... uns aber, die wir gerettet werden, ist es eine Gotteskraft." />
|
<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/icon/logo-200x200.png" />
|
<meta property="og:image" content="/icon/logo-200x200.png" />
|
||||||
<meta property="og:url" content="https://app.bethaus-speyer.de" />
|
|
||||||
|
|
||||||
<title>{{ title_short }}</title>
|
<title>{{ title_short }}</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
<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="description" content="... uns aber, die wir gerettet werden, ist es eine Gotteskraft.">
|
||||||
<meta name="author" content="Bethaus Speyer">
|
<meta name="author" content="{{ title_short }}">
|
||||||
<link rel="icon" href="/icon/logo-192x192.png" type="image/png" sizes="192x192">
|
<link rel="icon" href="/icon/logo-192x192.png" type="image/png" sizes="192x192">
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +18,7 @@
|
|||||||
<link rel="manifest" href="{{ url_for('static', filename='manifest.json') }}">
|
<link rel="manifest" href="{{ url_for('static', filename='manifest.json') }}">
|
||||||
|
|
||||||
<!-- Android Theme Color -->
|
<!-- Android Theme Color -->
|
||||||
<meta name="theme-color" content="#34495e">
|
<meta name="theme-color" content="{{ header_color }}">
|
||||||
|
|
||||||
<!-- Apple-specific tags -->
|
<!-- Apple-specific tags -->
|
||||||
<link rel="touch-icon" href="{{ url_for('static', filename='icons/icon-192x192.png') }}">
|
<link rel="touch-icon" href="{{ url_for('static', filename='icons/icon-192x192.png') }}">
|
||||||
@ -35,9 +34,17 @@
|
|||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
||||||
<style>
|
<style>
|
||||||
body { background-color: #f8f9fa; }
|
body {
|
||||||
.site-header { width: 100%; }
|
background-color: {{ background_color }};
|
||||||
.card { margin-bottom: 20px; }
|
color: {{ main_text_color }};
|
||||||
|
}
|
||||||
|
.site-header {
|
||||||
|
background-color: {{ header_color }};
|
||||||
|
color: {{ header_text_color }};
|
||||||
|
}
|
||||||
|
.card {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user