a ton of fun happened, refactored alot

This commit is contained in:
2025-07-03 04:29:43 -05:00
parent 72e060d783
commit 1bbe6e2743
121 changed files with 2315 additions and 900 deletions

View File

@ -7,6 +7,6 @@
<body>
<h1>400 Bad Request</h1>
<p>{{ error.description or "Sorry, we couldnt understand that request." }}</p>
<a href="{{ url_for('main.index') }}">Return home</a>
<a href="{{ url_for('home') }}">Return home</a>
</body>
</html>

View File

@ -0,0 +1,34 @@
{% macro render_media_list(media_list, thumb_width=150, current_user=None) -%}
{% if media_list %}
<div class="row">
{% for media in media_list %}
<div class="col-md-3 mb-4" data-media-id="{{ media.id }}">
<div class="card shadow-sm">
<img src="{{ url_for('media.serve', plugin=media.plugin, filename=media.filename) }}"
class="card-img-top" style="width:100%; height:auto;">
{% if media.caption %}
<div class="card-body p-2">
<p class="card-text text-center">{{ media.caption }}</p>
</div>
{% endif %}
<div class="card-footer d-flex justify-content-between align-items-center p-2">
<button class="btn btn-sm btn-outline-danger heart-btn" data-id="{{ media.id }}">
❤️ <span class="heart-count">{{ media.hearts|length }}</span>
</button>
{% if current_user and (current_user.id == media.uploader_id or current_user.role == 'admin') %}
<form method="POST" action="{{ url_for('media.set_featured_image', media_id=media.id) }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
{% if media.featured_entries|length %}
<button class="btn btn-sm btn-outline-secondary" type="submit">★ Featured</button>
{% else %}
<button class="btn btn-sm btn-outline-primary" type="submit">☆ Set Featured</button>
{% endif %}
</form>
{% endif %}
</div>
</div>
</div>
{% endfor %}
</div>
{% endif %}
{%- endmacro %}

View File

@ -0,0 +1,220 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{% block title %}Nature In Pots Community{% endblock %}</title>
<link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css"
rel="stylesheet"
>
<link
href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css"
rel="stylesheet"
>
<style>
body { display: flex; flex-direction: column; min-height: 100vh; }
main { flex: 1; }
footer { background: #f8f9fa; padding: 1rem 0; text-align: center; }
</style>
{% block styles %}{% endblock %}
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-white shadow-sm mb-4">
<div class="container">
<a class="navbar-brand fw-bold" href="{{ url_for('home') }}">
Nature In Pots
</a>
<button
class="navbar-toggler"
type="button"
data-bs-toggle="collapse"
data-bs-target="#mainNav"
>
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="mainNav">
<!-- Left links -->
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item me-2">
<a class="nav-link" href="{{ url_for('home') }}">Home</a>
</li>
{% if current_user.is_authenticated %}
<li class="nav-item me-2">
<a class="nav-link" href="{{ url_for('plant.index') }}">Plants</a>
</li>
<li class="nav-item me-2">
<a class="nav-link" href="{{ url_for('growlog.list_logs') }}">Grow Logs</a>
</li>
<li class="nav-item me-2">
<a class="nav-link" href="{{ url_for('submission.list_submissions') }}">
Submissions
</a>
</li>
{% endif %}
</ul>
<!-- New-item + Admin + Plugins -->
{% if current_user.is_authenticated %}
<div class="d-flex align-items-center">
<!-- + New dropdown -->
<div class="btn-group me-3">
<button
type="button"
class="btn btn-success"
onclick="location.href='{{ url_for('plant.create') }}'"
>
<i class="bi bi-plus-lg"></i>
</button>
<button
type="button"
class="btn btn-success dropdown-toggle dropdown-toggle-split"
data-bs-toggle="dropdown"
aria-expanded="false"
>
<span class="visually-hidden">Toggle menu</span>
</button>
<ul class="dropdown-menu">
<li>
<a class="dropdown-item" href="{{ url_for('plant.create') }}">
New Plant
</a>
</li>
<li>
<a class="dropdown-item" href="{{ url_for('growlog.add_log') }}">
New Grow Log
</a>
</li>
<li>
<a
class="dropdown-item"
href="{{ url_for('submission.new_submission') }}"
>
New Submission
</a>
</li>
</ul>
</div>
<!-- Admin link -->
{% if current_user.role == 'admin' %}
<a
class="btn btn-outline-danger me-3"
href="{{ url_for('admin.dashboard') }}"
>
Admin Dashboard
</a>
{% endif %}
<!-- Plugins dropdown -->
<div class="dropdown me-3">
<a
class="btn btn-outline-secondary dropdown-toggle"
href="#"
id="pluginsDropdown"
role="button"
data-bs-toggle="dropdown"
>
Plugins
</a>
<ul
class="dropdown-menu dropdown-menu-end"
aria-labelledby="pluginsDropdown"
>
<li><a class="dropdown-item" href="#">Materials</a></li>
<li><a class="dropdown-item" href="#">Ledger</a></li>
<li><a class="dropdown-item" href="#">Inventory</a></li>
<li><a class="dropdown-item" href="#">Collectives</a></li>
</ul>
</div>
<!-- Profile dropdown -->
<div class="dropdown">
<a
class="d-flex align-items-center text-decoration-none dropdown-toggle"
href="#"
id="profileDropdown"
data-bs-toggle="dropdown"
aria-expanded="false"
>
<i class="bi bi-person-circle fs-4 me-1"></i>
<span>{{ current_user.username }}</span>
</a>
<ul
class="dropdown-menu dropdown-menu-end text-small"
aria-labelledby="profileDropdown"
>
<li><a class="dropdown-item" href="#">My Profile</a></li>
<li><a class="dropdown-item" href="#">Settings</a></li>
<li><hr class="dropdown-divider"></li>
<li>
<a class="dropdown-item" href="{{ url_for('utility.upload') }}">
Import
</a>
</li>
<li>
<a class="dropdown-item" href="{{ url_for('utility.export_data') }}">
Export
</a>
</li>
<li><hr class="dropdown-divider"></li>
<li>
<a
class="dropdown-item text-danger"
href="{{ url_for('auth.logout') }}"
>
<i class="bi bi-box-arrow-right me-1"></i> Logout
</a>
</li>
</ul>
</div>
</div>
{% else %}
<!-- Login / Register buttons -->
<ul class="navbar-nav ms-auto mb-2 mb-lg-0">
<li class="nav-item me-2">
<a class="btn btn-outline-primary" href="{{ url_for('auth.login') }}">
Login
</a>
</li>
<li class="nav-item">
<a class="btn btn-primary" href="{{ url_for('auth.register') }}">
Register
</a>
</li>
</ul>
{% endif %}
</div>
</div>
</nav>
<main class="container">
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
<div class="mt-3">
{% for category, message in messages %}
<div
class="alert alert-{{ category }} alert-dismissible fade show"
role="alert"
>
{{ message }}
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
</div>
{% endfor %}
</div>
{% endif %}
{% endwith %}
{% block content %}{% endblock %}
</main>
<footer>
&copy; {{ current_year | default(2025) }} Nature In Pots Community. All rights reserved.
</footer>
<script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"
></script>
{% block scripts %}{% endblock %}
</body>
</html>

View File

@ -0,0 +1,55 @@
{% extends 'core/base.html' %}
{% block title %}Home | Nature In Pots{% endblock %}
{% block content %}
<!-- Hero Section -->
<div class="py-5 text-center bg-light rounded-3">
<h1 class="display-5 fw-bold">Welcome to Nature In Pots</h1>
<p class="fs-5 text-muted mb-4">
Your internal platform for comprehensive plant tracking, propagation history, and collaborative logging.
</p>
<p class="mb-0">
<strong class="text-success">Free to use for the time being</strong><br>
(A future subscription or licensing model may be introduced as needed.)
</p>
</div>
<!-- Features Overview -->
<div class="row mt-5 gy-4">
<div class="col-md-4">
<h3>Plant Profiles</h3>
<p>Quickly create and manage detailed records—type, names, lineage, notes, and custom slugs for easy sharing.</p>
</div>
<div class="col-md-4">
<h3>Grow Logs</h3>
<p>Maintain a timeline of growth metrics, health events, substrate mixes, and propagation notes.</p>
</div>
<div class="col-md-4">
<h3>Image Gallery</h3>
<p>Upload, rotate, and feature photos for each plant. Community voting and one-click “featured” selection.</p>
</div>
<div class="col-md-4">
<h3>Lineage Tracking</h3>
<p>Visualize parentchild relationships with a graph powered by Neo4j—track every cutting, seed, and division.</p>
</div>
<div class="col-md-4">
<h3>Pricing & Transfers</h3>
<p>Securely log acquisition costs, resale prices, and ownership changes—with history retained and protected.</p>
</div>
<div class="col-md-4">
<h3>Import & Export</h3>
<p>Bulk-import plants and media via CSV/ZIP. Export your entire dataset and images for backups or reporting.</p>
</div>
</div>
<!-- Call to Action -->
<div class="text-center mt-5">
{% if current_user.is_authenticated %}
<a href="{{ url_for('plant.index') }}" class="btn btn-primary btn-lg me-2">View My Plants</a>
<a href="{{ url_for('utility.upload') }}" class="btn btn-outline-secondary btn-lg">Import Data</a>
{% else %}
<a href="{{ url_for('auth.register') }}" class="btn btn-success btn-lg me-2">Register Now</a>
<a href="{{ url_for('auth.login') }}" class="btn btn-outline-primary btn-lg">Log In</a>
{% endif %}
</div>
{% endblock %}

View File

@ -0,0 +1,18 @@
<style>
.media-thumbnails {
list-style-type: none;
padding: 0;
display: flex;
flex-wrap: wrap;
gap: 10px;
}
.media-thumbnails li {
display: inline-block;
text-align: center;
}
.media-thumbnails img {
border: 1px solid #ccc;
border-radius: 4px;
padding: 2px;
}
</style>