Initial commit - LEGO Instructions Manager v1.5.0
This commit is contained in:
192
app/templates/sets/list.html
Normal file
192
app/templates/sets/list.html
Normal file
@@ -0,0 +1,192 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}My Sets - {{ app_name }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-8">
|
||||
<h1><i class="bi bi-grid"></i> My LEGO Sets</h1>
|
||||
<p class="text-muted">{{ pagination.total }} sets in your collection</p>
|
||||
</div>
|
||||
<div class="col-md-4 text-end">
|
||||
<a href="{{ url_for('sets.add_set') }}" class="btn btn-danger">
|
||||
<i class="bi bi-plus-circle"></i> Add New Set
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Search and Filters -->
|
||||
<div class="card mb-4">
|
||||
<div class="card-body">
|
||||
<form method="GET" action="{{ url_for('sets.list_sets') }}" class="row g-3">
|
||||
<div class="col-md-4">
|
||||
<label for="search" class="form-label">Search</label>
|
||||
<input type="text" class="form-control" id="search" name="q"
|
||||
value="{{ search_query }}" placeholder="Set number or name...">
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<label for="theme" class="form-label">Theme</label>
|
||||
<select class="form-select" id="theme" name="theme">
|
||||
<option value="">All Themes</option>
|
||||
{% for theme in themes %}
|
||||
<option value="{{ theme }}" {% if theme == current_theme %}selected{% endif %}>
|
||||
{{ theme }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<label for="year" class="form-label">Year</label>
|
||||
<select class="form-select" id="year" name="year">
|
||||
<option value="">All Years</option>
|
||||
{% for year in years %}
|
||||
<option value="{{ year }}" {% if year == current_year %}selected{% endif %}>
|
||||
{{ year }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<label for="sort" class="form-label">Sort By</label>
|
||||
<select class="form-select" id="sort" name="sort">
|
||||
<option value="set_number" {% if current_sort == 'set_number' %}selected{% endif %}>Set Number</option>
|
||||
<option value="name" {% if current_sort == 'name' %}selected{% endif %}>Name</option>
|
||||
<option value="theme" {% if current_sort == 'theme' %}selected{% endif %}>Theme</option>
|
||||
<option value="year" {% if current_sort == 'year' %}selected{% endif %}>Year</option>
|
||||
<option value="newest" {% if current_sort == 'newest' %}selected{% endif %}>Newest First</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-md-1 d-flex align-items-end">
|
||||
<button type="submit" class="btn btn-primary w-100">
|
||||
<i class="bi bi-search"></i>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Sets Grid -->
|
||||
{% if sets %}
|
||||
<div class="row">
|
||||
{% for set in sets %}
|
||||
<div class="col-md-6 col-lg-4 col-xl-3 mb-4">
|
||||
<div class="card h-100 shadow-sm">
|
||||
<a href="{{ url_for('sets.view_set', set_id=set.id) }}">
|
||||
{% if set.cover_image %}
|
||||
<img src="{{ url_for('static', filename='uploads/' + set.cover_image.replace('\\', '/')) }}"
|
||||
class="card-img-top set-image" alt="{{ set.set_name }}">
|
||||
{% elif set.image_url %}
|
||||
<img src="{{ set.image_url }}" class="card-img-top set-image" alt="{{ set.set_name }}">
|
||||
{% else %}
|
||||
<div class="card-img-top set-image d-flex align-items-center justify-content-center bg-light">
|
||||
<i class="bi bi-image display-1 text-muted"></i>
|
||||
</div>
|
||||
{% endif %}
|
||||
</a>
|
||||
|
||||
<div class="card-body">
|
||||
<h6 class="card-title">
|
||||
<a href="{{ url_for('sets.view_set', set_id=set.id) }}" class="text-decoration-none">
|
||||
{{ set.set_number }}
|
||||
</a>
|
||||
{% if set.is_moc %}
|
||||
<span class="badge bg-warning text-dark" title="My Own Creation">
|
||||
<i class="bi bi-star-fill"></i>
|
||||
</span>
|
||||
{% endif %}
|
||||
</h6>
|
||||
<p class="card-text small text-truncate" title="{{ set.set_name }}">
|
||||
{{ set.set_name }}
|
||||
</p>
|
||||
|
||||
<div class="d-flex justify-content-between align-items-center mb-2">
|
||||
<span class="badge bg-primary">{{ set.theme }}</span>
|
||||
<span class="badge bg-warning text-dark">{{ set.year_released }}</span>
|
||||
</div>
|
||||
|
||||
{% if set.piece_count %}
|
||||
<p class="card-text small text-muted mb-2">
|
||||
<i class="bi bi-grid-3x3"></i> {{ set.piece_count }} pieces
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
<p class="card-text small">
|
||||
<i class="bi bi-file-pdf"></i> {{ set.instructions.count() }} instruction(s)
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="card-footer bg-transparent">
|
||||
<div class="btn-group w-100" role="group">
|
||||
<a href="{{ url_for('sets.view_set', set_id=set.id) }}"
|
||||
class="btn btn-sm btn-outline-primary">
|
||||
<i class="bi bi-eye"></i> View
|
||||
</a>
|
||||
<a href="{{ url_for('sets.edit_set', set_id=set.id) }}"
|
||||
class="btn btn-sm btn-outline-secondary">
|
||||
<i class="bi bi-pencil"></i> Edit
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<!-- Pagination -->
|
||||
{% if pagination.pages > 1 %}
|
||||
<nav aria-label="Page navigation">
|
||||
<ul class="pagination justify-content-center">
|
||||
<li class="page-item {% if not pagination.has_prev %}disabled{% endif %}">
|
||||
<a class="page-link" href="{{ url_for('sets.list_sets', page=pagination.prev_num, sort=current_sort, theme=current_theme, year=current_year, q=search_query) }}">
|
||||
Previous
|
||||
</a>
|
||||
</li>
|
||||
|
||||
{% for page_num in pagination.iter_pages(left_edge=1, right_edge=1, left_current=2, right_current=2) %}
|
||||
{% if page_num %}
|
||||
<li class="page-item {% if page_num == pagination.page %}active{% endif %}">
|
||||
<a class="page-link" href="{{ url_for('sets.list_sets', page=page_num, sort=current_sort, theme=current_theme, year=current_year, q=search_query) }}">
|
||||
{{ page_num }}
|
||||
</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="page-item disabled"><span class="page-link">...</span></li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
<li class="page-item {% if not pagination.has_next %}disabled{% endif %}">
|
||||
<a class="page-link" href="{{ url_for('sets.list_sets', page=pagination.next_num, sort=current_sort, theme=current_theme, year=current_year, q=search_query) }}">
|
||||
Next
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
{% endif %}
|
||||
|
||||
{% else %}
|
||||
<div class="text-center py-5">
|
||||
<i class="bi bi-inbox display-1 text-muted"></i>
|
||||
<h3 class="mt-3">No Sets Found</h3>
|
||||
<p class="text-muted">
|
||||
{% if search_query or current_theme or current_year %}
|
||||
Try adjusting your filters or search terms.
|
||||
{% else %}
|
||||
Start by adding your first LEGO set or MOC to your collection!
|
||||
{% endif %}
|
||||
</p>
|
||||
<div class="d-flex justify-content-center gap-2">
|
||||
<a href="{{ url_for('sets.add_set') }}" class="btn btn-danger">
|
||||
<i class="bi bi-box-seam"></i> Add Official Set
|
||||
</a>
|
||||
<a href="{{ url_for('sets.add_set') }}?type=moc" class="btn btn-warning">
|
||||
<i class="bi bi-star-fill"></i> Add MOC
|
||||
</a>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user