You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
<!DOCTYPE html>
< html >
< head >
< title > Habits Tracker< / title >
< style >
. has-rep {
background-color : #aaffaa ;
}
. not-current-month {
color : #ccc ;
}
< / style >
< / head >
< body >
< nav >
< a href = "{% url 'habits:habit_list' %}" > Home< / a >
{% if user.is_authenticated %}
< a href = "{% url 'account_logout' %}" > Log Out< / a >
{% else %}
< a href = "{% url 'account_login' %}" > Log In< / a >
< a href = "{% url 'account_signup' %}" > Sign Up< / a >
{% endif %}
< / nav >
< hr >
{% block content %}
{% endblock %}
< script >
document . querySelectorAll ( '.log-repetition-form' ) . forEach ( form => {
form . addEventListener ( 'submit' , e => {
e . preventDefault ( ) ;
const formData = new FormData ( form ) ;
fetch ( form . action , {
method : 'POST' ,
body : formData ,
headers : {
'X-CSRFToken' : formData . get ( 'csrfmiddlewaretoken' )
}
} ) . then ( response => {
if ( response . status === 204 ) {
const button = form . querySelector ( 'button' ) ;
if ( button . innerHTML . includes ( '✓' ) ) {
button . innerHTML = '× ' ;
} else {
button . innerHTML = '✓' ;
}
}
} ) ;
} ) ;
} ) ;
< / script >
< / body >
< / html >