Fakultas Ilmu Komputer UI

Commit 71bae416 authored by Muhammad Ilham Peruzzi's avatar Muhammad Ilham Peruzzi
Browse files

refactor templates to use a base template

parent 56b0e478
<html>
<head>
<title>To-Do lists</title>
</head>
<body>
<h2>Homepage</h2>
<hr>
<div id="nama_lengkap">Muhammad Ilham Peruzzi</div>
<h5>Bio</h5>
<div><p>{{bio}}</p></div>
<hr>
<h1>{% block header_text %}{% endblock %}</h1>
<form method="POST" action="{% block form_action %}{% endblock %}">
<input name="item_text" id="id_new_item" placeholder="Enter a to-do item" />
{% csrf_token %}
</form>
{% block table %}
{% endblock %}
</body>
</html>
\ No newline at end of file
<html>
<head>
<title>To-Do lists</title>
</head>
<body>
<h2>Homepage</h2>
<hr>
<div id="nama_lengkap">Muhammad Ilham Peruzzi</div>
<h5>Bio</h5>
<div>
<p>{{bio}}</p>
</div>
<hr>
<h1>Start a new To-Do list</h1>
<form method="POST" action="/lists/new">
<input name="item_text" id="id_new_item" placeholder="Enter a to-do item" />
{% csrf_token %}
</form>
</body>
</html>
\ No newline at end of file
{% extends 'base.html' %}
{% block header_text %}Start a new To-Do list{% endblock %}
{% block form_action %}/lists/new{% endblock %}
\ No newline at end of file
<html>
<head>
<title>To-Do lists</title>
</head>
<body>
<h2>Homepage</h2>
<hr>
<div id="nama_lengkap">Muhammad Ilham Peruzzi</div>
<h5>Bio</h5>
<div>
<p>{{bio}}</p>
</div>
<hr>
<h1>Your To-Do list</h1>
<form method="POST" action="/lists/{{ list.id }}/add_item">
<input name="item_text" id="id_new_item" placeholder="Enter a to-do item" />
{% csrf_token %}
</form>
{% if list.item_set.all|length == 0 %}
{% extends 'base.html' %}
{% block header_text %}Your To-Do list{% endblock %}
{% block form_action %}/lists/{{ list.id }}/add_item{% endblock %}
{% block table %}
{% if list.item_set.all|length == 0 %}
<p>yey, waktunya berlibur</p>
{% elif list.item_set.all|length < 5 %}
<p>sibuk tapi santai</p>
{% else %}
<p>oh tidak</p>
{% endif %}
<table id="id_list_table">
{% for item in list.item_set.all %}
<tr>
<td>{{ forloop.counter }}: {{ item.text }}</td>
</tr>
{% endfor %}
</table>
</body>
</html>
\ No newline at end of file
<table id="id_list_table">
{% for item in list.item_set.all %}
<tr><td>{{ forloop.counter }}: {{ item.text }}</td></tr>
{% endfor %}
</table>
{% endblock %}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment