Add home page with source list
This commit is contained in:
parent
bb1bdee4c9
commit
466ce50e3c
|
@ -35,7 +35,20 @@ def datetimeformat(value):
|
|||
|
||||
@app.route("/")
|
||||
def root():
|
||||
return "hello, world"
|
||||
"""
|
||||
Navigation home page.
|
||||
"""
|
||||
data_path = intake_data_dir()
|
||||
sources = []
|
||||
for child in data_path.iterdir():
|
||||
if (child / "intake.json").exists():
|
||||
sources.append(LocalSource(data_path, child.name))
|
||||
sources.sort(key=lambda s: s.source_name)
|
||||
|
||||
return render_template(
|
||||
"home.jinja2",
|
||||
sources=sources,
|
||||
)
|
||||
|
||||
|
||||
@app.route("/source/<string:source_name>")
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Intake</title>
|
||||
<link rel="icon" type="image/png" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAOwgAADsIBFShKgAAAABh0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMS41ZEdYUgAAAGFJREFUOE+lkFEKwDAIxXrzXXB3ckMm9EnAV/YRCxFCcUXEL3Jc77NDjpDA/VGL3RFWYEICfeGC8oQc9IPuCAnQDcoRVmBCAn3hgvKEHPSD7ggJ0A3KEVZgQgJ94YLSJ9YDUzNGDXGZ/JEAAAAASUVORK5CYII=">
|
||||
<style>
|
||||
div#wrapper {
|
||||
max-width: 700px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.readable-item {
|
||||
border: 1px solid black; border-radius: 6px;
|
||||
padding: 5px;
|
||||
margin-bottom: 20px;
|
||||
word-break: break-word;
|
||||
}
|
||||
.item-title {
|
||||
font-size: 1.4em;
|
||||
}
|
||||
.readable-item img {
|
||||
max-width: 100%;
|
||||
}
|
||||
button, summary {
|
||||
cursor: pointer;
|
||||
}
|
||||
summary {
|
||||
display: block;
|
||||
}
|
||||
summary:focus {
|
||||
outline: 1px dotted gray;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="wrapper">
|
||||
<div class="readable-item">
|
||||
<details open>
|
||||
<summary><span class="item-title">Sources</span></summary>
|
||||
{% if not sources %}
|
||||
<p>No sources found.</p>
|
||||
{% else %}
|
||||
{% for source in sources %}
|
||||
<p><a href="{{ url_for('source_feed', source_name=source.source_name) }}">{{ source.source_name|safe }}</a></p>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</details>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue