mirror of
https://github.com/lalanza808/monero.fail.git
synced 2025-03-15 09:46:31 -04:00
refactoring page buttons and front page time loads
This commit is contained in:
parent
69262619fe
commit
2315989b1e
@ -27,7 +27,7 @@ app.secret_key = app.config["SECRET_KEY"]
|
||||
@app.route("/", methods=["GET", "POST"])
|
||||
def index():
|
||||
form = SubmitNode()
|
||||
itp = 20
|
||||
itp = 10
|
||||
page = request.args.get("page", 1)
|
||||
try:
|
||||
page = int(page)
|
||||
@ -52,7 +52,7 @@ def index():
|
||||
nodes = nodes.where(Node.is_tor==True)
|
||||
|
||||
paginated = nodes.paginate(page, itp)
|
||||
total_pages = nodes.count() / itp
|
||||
total_pages = int(nodes.count() / itp) + 1
|
||||
return render_template(
|
||||
"index.html",
|
||||
nodes=paginated,
|
||||
|
@ -61,3 +61,11 @@ input[type="text"] {
|
||||
.container2 {
|
||||
padding: 4em;
|
||||
}
|
||||
|
||||
.page-btn {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.current-page-btn {
|
||||
background-color: #b8b8b8;
|
||||
}
|
||||
|
@ -57,7 +57,7 @@
|
||||
<td>{{ node.last_height }}</td>
|
||||
<td>{{ node.datetime_checked | humanize }}</td>
|
||||
<td>{% for hc in node.healthchecks %}
|
||||
{% if loop.index > loop.length - 11 %}
|
||||
{% if loop.index > loop.length - 6 %}
|
||||
<span class="dot glowing-{% if hc.health %}green{% else %}red{% endif %}"></span>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
@ -66,12 +66,11 @@
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% if page > 1 %}
|
||||
<a href="/?page={{ page - 1 }}" class="pure-button btn">Back</a>
|
||||
{% endif %}
|
||||
{% if page < total_pages and total_pages > 0 %}
|
||||
<a href="/?page={{ page + 1 }}" class="pure-button btn">Next</a>
|
||||
{% endif %}
|
||||
<div class="page-btn">
|
||||
{% for p in range(1, total_pages + 1) %}
|
||||
<a href="/?page={{ p }}" class="pure-button btn {% if p == page %}current-page-btn{% endif %}">{{ p }}</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
<p>No nodes in the database yet...</p>
|
||||
{% endif %}
|
||||
|
Loading…
x
Reference in New Issue
Block a user