added project delete + changed to list template

This commit is contained in:
2025-02-02 23:01:17 +01:00
parent 35d5a81e6f
commit 092812b9b7
8 changed files with 74 additions and 44 deletions

View File

@ -1,39 +1,29 @@
{% extends "base.html" %}
{% extends "list.html" %}
{% load static %}
{% block title %}Projects{% endblock %}
{% block head %}
{% block extra-head %}
<link rel="stylesheet" href="{% static "projects.css" %}">
<script src="{% static "projects.js" %}"></script>
{% endblock %}
{% block footer %}{% endblock %}
{% block main %}
{% csrf_token %}
<table class="projects">
<thead>
<tr>
<th>Project</th>
<th>Parent</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for project in projects %}
<tr data-id="{{ project.id }}">
<td>{{ project.name }}</td>
<td>
<select class="parent-sel">
<option value=""></option>
{% for parent in parents %}
<option value="{{ parent.id }}" {% if project.parent.id == parent.id %}selected{% endif %}>{{ parent.name }}</option>
{% endfor %}
</select>
</td>
<td>
<button class="edit">Edit</button>
<button class="delete">Delete</button>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}
{% block extra-class %}{% if element.parent.is_productive %}productive{% endif %}{% endblock %}
{% block element-name %}{{ element.name }}{% endblock %}
{% block element %}
<div class="name">{{ element.name }}</div>
{% endblock %}
{% block actions %}
<select class="parent-sel">
<option value=""></option>
{% for parent in parents %}
<option value="{{ parent.id }}" {% if element.parent.id == parent.id %}selected{% endif %}>{{ parent.name }}</option>
{% endfor %}
</select>
<button class="edit">Edit</button>
<button class="delete">Delete</button>
{% endblock %}
{% block delete-desc %}
Are sure you want to delete <span class="elmt-name"></span> ?
This action is <u>IRREVERSIBLE</u> ! By deleting this element, you will also delete:
<ul>
<li><span class="task-count"></span> task imputation(s)</li>
</ul>
{% endblock %}