Add modern design with base template

- Create base.html with snazzy gradient design
- Add navigation header with glassmorphism effect
- Add Font Awesome icons throughout
- Update all templates to extend base:
  - index.html: Home page with boxes and thing types
  - box_detail.html: Box contents table
  - thing_detail.html: Thing details with move form
  - thing_type_detail.html: Type hierarchy and things
  - search.html: Search functionality
  - add_things.html: Form for adding things
- Add hover effects, smooth transitions, and modern UI
- Use purple gradient color scheme (#667eea to #764ba2)
- Add breadcrumbs for navigation
- Improve accessibility with proper focus states
This commit is contained in:
2025-12-29 00:15:31 +01:00
parent 02e949d0ad
commit c9d48255e2
10 changed files with 820 additions and 1013 deletions

View File

@@ -1,122 +1,90 @@
{% extends "base.html" %}
{% load thumbnail %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Box {{ box.id }} - LabHelper</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
margin: 20px;
background-color: #f5f5f5;
}
h1 {
color: #333;
}
.box-info {
background: white;
padding: 15px;
border-radius: 8px;
margin-bottom: 20px;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
table {
width: 100%;
border-collapse: collapse;
background: white;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
th, td {
padding: 12px 15px;
text-align: left;
border-bottom: 1px solid #eee;
}
th {
background-color: #4a90a4;
color: white;
font-weight: 600;
}
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;
}
.empty-message {
background: white;
padding: 40px;
text-align: center;
border-radius: 8px;
color: #666;
}
</style>
</head>
<body>
<a href="/" class="back-link">&larr; Back to Home</a>
<h1>Box {{ box.id }}</h1>
<div class="box-info">
<strong>Type:</strong> {{ box.box_type.name }}
({{ box.box_type.width }} x {{ box.box_type.height }} x {{ box.box_type.length }} mm)
<br><br>
<a href="/box/{{ box.id }}/add/">+ Add Things</a>
{% block title %}Box {{ box.id }} - LabHelper{% endblock %}
{% block page_header %}
<div class="page-header">
<h1><i class="fas fa-box"></i> Box {{ box.id }}</h1>
<p class="breadcrumb">
<a href="/"><i class="fas fa-home"></i> Home</a> / Box {{ box.id }}
</p>
</div>
{% endblock %}
{% block content %}
<div class="section">
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 15px;">
<div>
<div style="font-size: 16px; color: #555; margin-bottom: 5px;">
<strong><i class="fas fa-cube"></i> Type:</strong> {{ box.box_type.name }}
</div>
<div style="font-size: 14px; color: #777;">
<i class="fas fa-ruler-combined"></i> {{ box.box_type.width }} x {{ box.box_type.height }} x {{ box.box_type.length }} mm
</div>
</div>
<a href="{% url 'add_things' box.id %}" class="btn">
<i class="fas fa-plus"></i> Add Things
</a>
</div>
{% if things %}
<table>
<thead>
<tr>
<th>Picture</th>
<th>Name</th>
<th>Type</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><a href="{% url 'thing_detail' thing.id %}">{{ thing.name }}</a></td>
<td>{{ thing.thing_type.name }}</td>
<td>{{ thing.description|default:"-" }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<div class="empty-message">
This box is empty.
</div>
{% if things %}
<div class="section">
<div style="overflow-x: auto;">
<table style="width: 100%; border-collapse: collapse;">
<thead>
<tr style="background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white;">
<th style="padding: 15px 20px; text-align: left; font-weight: 600;">Picture</th>
<th style="padding: 15px 20px; text-align: left; font-weight: 600;">Name</th>
<th style="padding: 15px 20px; text-align: left; font-weight: 600;">Type</th>
<th style="padding: 15px 20px; text-align: left; font-weight: 600;">Description</th>
</tr>
</thead>
<tbody>
{% for thing in things %}
<tr style="border-bottom: 1px solid #e0e0e0; transition: background 0.2s;">
<td style="padding: 15px 20px;">
{% if thing.picture %}
{% thumbnail thing.picture "50x50" crop="center" as thumb %}
<img src="{{ thumb.url }}" alt="{{ thing.name }}" style="width: 50px; height: 50px; object-fit: cover; border-radius: 8px;">
{% endthumbnail %}
{% else %}
<div style="width: 50px; height: 50px; background: linear-gradient(135deg, #e0e0e0 0%, #f0f0f0 100%); display: flex; align-items: center; justify-content: center; color: #999; border-radius: 8px; font-size: 11px;">No image</div>
{% endif %}
</td>
<td style="padding: 15px 20px;">
<a href="{% url 'thing_detail' thing.id %}" style="color: #667eea; text-decoration: none; font-weight: 500;">{{ thing.name }}</a>
</td>
<td style="padding: 15px 20px; color: #555;">{{ thing.thing_type.name }}</td>
<td style="padding: 15px 20px; color: #777;">{{ thing.description|default:"-" }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
</body>
</html>
</div>
{% else %}
<div class="section" style="text-align: center; padding: 60px 30px;">
<i class="fas fa-box-open" style="font-size: 64px; color: #ddd; margin-bottom: 20px; display: block;"></i>
<h3 style="color: #888; font-size: 20px;">This box is empty</h3>
<p style="color: #999; margin-top: 10px;">Add some items to get started!</p>
<a href="{% url 'add_things' box.id %}" class="btn" style="margin-top: 20px;">
<i class="fas fa-plus"></i> Add Things
</a>
</div>
{% endif %}
{% endblock %}
{% block extra_js %}
<script>
$('tbody tr').hover(
function() {
$(this).css('background', '#f8f9fa');
},
function() {
$(this).css('background', 'white');
}
);
</script>
{% endblock %}