feat: implement simple file upload
This commit is contained in:
parent
c10b9baa95
commit
52478379a0
11 changed files with 232 additions and 9 deletions
16
templates/components/image.html
Normal file
16
templates/components/image.html
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{% macro form(plant_id, target="#images > ul") %}
|
||||
<form hx-post="/images" hx-target="{{ target }}" hx-swap="beforeend" enctype="multipart/form-data">
|
||||
<input type="hidden" id="plant_id" name="plant_id" value="{{ plant_id }}">
|
||||
|
||||
<label for="date_taken">Date taken:</label>
|
||||
<input type="date" id="date_taken" name="date_taken"></br>
|
||||
|
||||
<label for="note">Note:</label>
|
||||
<textarea id="note" name="note" rows=1></textarea></br>
|
||||
|
||||
<label for="image">Image:</label>
|
||||
<input type="file" id="image" name="image" accept="image/*" capture="environment"></br>
|
||||
|
||||
<input type="submit">
|
||||
</form>
|
||||
{% endmacro form %}
|
||||
|
|
@ -1,7 +1,13 @@
|
|||
{% import "components/event.html" as comp_event %}
|
||||
{% import "components/plant.html" as comp_plant %}
|
||||
{% import "components/image.html" as comp_image %}
|
||||
|
||||
{{ comp_plant::info(plant=plant) }}
|
||||
<h3>Events</h3>
|
||||
{{ comp_event::list(events=events) }}
|
||||
{{ comp_event::form(plant_id=plant.id) }}
|
||||
<h3>Images</h3>
|
||||
<div id="images">
|
||||
<ul></ul>
|
||||
</div>
|
||||
{{ comp_image::form(plant_id=plant.id) }}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue