Restrict onclick to h1 text

This change modifies the onclick event to apply only to the h1 text
within the header section of the blog index page. Previously, the
onclick event was applied to the entire header section, which could
lead to unintended behavior when users interacted with other parts
of the header. By restricting the onclick event to just the h1 text,
we ensure that only the intended element responds to user clicks,
improving the user experience and preventing potential confusion.
This commit is contained in:
Neo 2024-09-09 22:25:18 +00:00
parent 890ee95d28
commit 2d7d750d91

View file

@ -10,9 +10,9 @@
{% block content %} {% block content %}
{% for post in posts %} {% for post in posts %}
<article class="post"> <article class="post">
<header class="post-header" onclick="togglePostBody({{ post['id'] }})"> <header class="post-header">
<div> <div>
<h1>{{ post['title'] }}</h1> <h1 onclick="togglePostBody({{ post['id'] }})">{{ post['title'] }}</h1>
<div class="about">by {{ post['username'] }} on {{ post['created'].strftime('%Y-%m-%d') }}</div> <div class="about">by {{ post['username'] }} on {{ post['created'].strftime('%Y-%m-%d') }}</div>
</div> </div>
{% if g.user['id'] == post['author_id'] %} {% if g.user['id'] == post['author_id'] %}