mirror of
https://codeberg.org/SimpleWeb/SimpleerTube.git
synced 2024-11-15 05:33:17 +00:00
Create base template and use it everywhere
Also added a nice and shiny search field in the template.
This commit is contained in:
parent
88394abd42
commit
20a2d43b74
2
main.py
2
main.py
|
@ -66,7 +66,7 @@ async def search_redirect(domain):
|
||||||
async def search(domain, term):
|
async def search(domain, term):
|
||||||
amount, results = peertube.search(domain, term)
|
amount, results = peertube.search(domain, term)
|
||||||
return await render_template(
|
return await render_template(
|
||||||
"search_results.html", domain=domain, amount=amount, results=results
|
"search_results.html", domain=domain, amount=amount, results=results, search_term=term
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
21
templates/base.html
Normal file
21
templates/base.html
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
<!doctype html>
|
||||||
|
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
{% block head %}
|
||||||
|
<title>{% block full_title %}{% block title %}{% endblock %} - SimpleerTube{% endblock %}</title>
|
||||||
|
{% endblock %}
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<form action="/{{ domain }}/search" method="POST">
|
||||||
|
<input type="text" name="query" id="query" value="{{ search_term }}"/>
|
||||||
|
<button type="submit">Search</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
{% block content %}{% endblock %}
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -1,10 +1,7 @@
|
||||||
<!doctype html>
|
{% extends "base.html" %}
|
||||||
<html>
|
|
||||||
<body>
|
{% block title %}{{ domain }}{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
<b>{{ instance_name }}</b>
|
<b>{{ instance_name }}</b>
|
||||||
<form action="/{{ domain }}/search" method="POST">
|
{% endblock %}
|
||||||
<input type="text" name="query" id="query"/>
|
|
||||||
<button type="submit">Search</button>
|
|
||||||
</form>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
<!doctype html>
|
{% extends "base.html" %}
|
||||||
<html>
|
|
||||||
<body>
|
{% block title %}{{ search_term }} - {{ domain }}{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
<p>{{ amount }} results</p>
|
<p>{{ amount }} results</p>
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
{% for result in results %}
|
{% for result in results %}
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -20,5 +23,4 @@
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
</body>
|
{% endblock %}
|
||||||
</html>
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
<!doctype html>
|
{% extends "base.html" %}
|
||||||
<html>
|
|
||||||
<body>
|
{% block title %}{{ video.name }} - {{ domain }}{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
<h3>{{ video.name }}</h3>
|
<h3>{{ video.name }}</h3>
|
||||||
By:
|
By:
|
||||||
<b>{{ video.channel.displayName }}</b> ({{ video.channel.name }}@{{ video.channel.host }})
|
<b>{{ video.channel.displayName }}</b> ({{ video.channel.name }}@{{ video.channel.host }})
|
||||||
|
@ -60,5 +62,4 @@
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</body>
|
{% endblock %}
|
||||||
</html>
|
|
||||||
|
|
Loading…
Reference in a new issue