Add thing type detail page and move functionality
All checks were successful
Build containers when image tags change / build-if-image-changed (., web, containers, main container, git.baumann.gr/adebaumann/labhelper) (push) Successful in 29s
Build containers when image tags change / build-if-image-changed (data-loader, loader, initContainers, init-container, git.baumann.gr/adebaumann/labhelper-data-loader) (push) Successful in 7s
All checks were successful
Build containers when image tags change / build-if-image-changed (., web, containers, main container, git.baumann.gr/adebaumann/labhelper) (push) Successful in 29s
Build containers when image tags change / build-if-image-changed (data-loader, loader, initContainers, init-container, git.baumann.gr/adebaumann/labhelper-data-loader) (push) Successful in 7s
- Add thing type detail page showing hierarchical structure and things - Add move to box functionality on thing detail page - Fix add things form to only show items in current box - Update thumbnails to 50x50 on box detail page - Make thing names linkable on box detail page Bump container version to 0.026
This commit is contained in:
@@ -83,6 +83,45 @@
|
||||
.nav-links a {
|
||||
margin-right: 15px;
|
||||
}
|
||||
.move-form {
|
||||
background: white;
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
|
||||
margin-top: 20px;
|
||||
}
|
||||
.move-form label {
|
||||
font-weight: 600;
|
||||
color: #666;
|
||||
font-size: 14px;
|
||||
margin-bottom: 8px;
|
||||
display: block;
|
||||
}
|
||||
.move-form select {
|
||||
padding: 8px 12px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
font-size: 14px;
|
||||
background-color: white;
|
||||
margin-right: 10px;
|
||||
}
|
||||
.move-form select:focus {
|
||||
outline: none;
|
||||
border-color: #4a90a4;
|
||||
}
|
||||
.btn {
|
||||
background-color: #4a90a4;
|
||||
color: white;
|
||||
padding: 8px 16px;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
font-weight: 600;
|
||||
}
|
||||
.btn:hover {
|
||||
background-color: #3d7a96;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@@ -125,7 +164,22 @@
|
||||
<div class="detail-value description">{{ thing.description }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form method="post" class="move-form">
|
||||
{% csrf_token %}
|
||||
<label for="new_box">Move to:</label>
|
||||
<select name="new_box" id="new_box">
|
||||
<option value="">Select a box...</option>
|
||||
{% for box in boxes %}
|
||||
<option value="{{ box.id }}" {% if box.id == thing.box.id %}selected{% endif %}>
|
||||
Box {{ box.id }} ({{ box.box_type.name }})
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<button type="submit" class="btn">Move</button>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
183
boxes/templates/boxes/thing_type_detail.html
Normal file
183
boxes/templates/boxes/thing_type_detail.html
Normal file
@@ -0,0 +1,183 @@
|
||||
{% load thumbnail %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{{ thing_type.name }} - LabHelper</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
||||
margin: 20px;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
h1 {
|
||||
color: #333;
|
||||
}
|
||||
.type-header {
|
||||
background: white;
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.type-section {
|
||||
background: white;
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.type-section h2 {
|
||||
color: #333;
|
||||
margin-top: 0;
|
||||
font-size: 18px;
|
||||
}
|
||||
.type-hierarchy {
|
||||
color: #666;
|
||||
font-size: 14px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
.type-hierarchy span {
|
||||
margin-right: 5px;
|
||||
}
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
th, td {
|
||||
padding: 12px 15px;
|
||||
text-align: left;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
th {
|
||||
background-color: #f8f9fa;
|
||||
color: #666;
|
||||
font-weight: 600;
|
||||
font-size: 14px;
|
||||
}
|
||||
tr:hover {
|
||||
background-color: #f8f9fa;
|
||||
}
|
||||
.thumbnail {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
object-fit: cover;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.no-image {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
background-color: #e0e0e0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #999;
|
||||
border-radius: 4px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.back-link {
|
||||
margin-bottom: 20px;
|
||||
display: inline-block;
|
||||
color: #4a90a4;
|
||||
text-decoration: none;
|
||||
}
|
||||
.back-link:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
.thing-name {
|
||||
font-weight: 500;
|
||||
}
|
||||
.thing-name a {
|
||||
color: #4a90a4;
|
||||
text-decoration: none;
|
||||
}
|
||||
.thing-name a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
.box-link {
|
||||
color: #4a90a4;
|
||||
text-decoration: none;
|
||||
font-size: 14px;
|
||||
}
|
||||
.box-link:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
.empty-message {
|
||||
color: #999;
|
||||
text-align: center;
|
||||
padding: 20px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<a href="/" class="back-link">← Home</a>
|
||||
|
||||
<h1>{{ thing_type.name }}</h1>
|
||||
|
||||
<div class="type-header">
|
||||
{% if thing_type.parent %}
|
||||
<div class="type-hierarchy">
|
||||
Parent: <a href="{% url 'thing_type_detail' thing_type.parent.id %}" class="box-link">{{ thing_type.parent.name }}</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if thing_type.children.exists %}
|
||||
<div class="type-hierarchy">
|
||||
Subtypes:
|
||||
{% for child in thing_type.children.all %}
|
||||
<span><a href="{% url 'thing_type_detail' child.id %}" class="box-link">{{ child.name }}</a></span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if things_by_type %}
|
||||
{% for subtype, things in things_by_type.items %}
|
||||
<div class="type-section">
|
||||
<h2>{{ subtype.name }}</h2>
|
||||
{% if things %}
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Picture</th>
|
||||
<th>Name</th>
|
||||
<th>Box</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for thing in things %}
|
||||
<tr>
|
||||
<td>
|
||||
{% if thing.picture %}
|
||||
{% thumbnail thing.picture "50x50" crop="center" as thumb %}
|
||||
<img src="{{ thumb.url }}" alt="{{ thing.name }}" class="thumbnail">
|
||||
{% endthumbnail %}
|
||||
{% else %}
|
||||
<div class="no-image">No image</div>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="thing-name">
|
||||
<a href="{% url 'thing_detail' thing.id %}">{{ thing.name }}</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="{% url 'box_detail' thing.box.id %}" class="box-link">Box {{ thing.box.id }}</a>
|
||||
<br><small>{{ thing.box.box_type.name }}</small>
|
||||
</td>
|
||||
<td>{{ thing.description|default:"-" }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<div class="empty-message">No things in this category</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<div class="type-section">
|
||||
<div class="empty-message">No things found in this category or its subcategories</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user