feat: added csv templates
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
carla 2026-01-12 17:36:15 +01:00
parent 3fd6410bb4
commit 720a43a38c
4 changed files with 25 additions and 1 deletions

View file

@ -191,6 +191,26 @@ A **basic CSV member import feature** that allows administrators to upload a CSV
- `/templates/member_import_de.csv`
- In LiveView, link them using Phoenix static path helpers (e.g. `~p` or `Routes.static_path/2`, depending on Phoenix version).
**Example Usage in LiveView Templates:**
```heex
<!-- Using ~p sigil (Phoenix 1.7+) -->
<.link href={~p"/templates/member_import_en.csv"} download>
<%= gettext("Download English Template") %>
</.link>
<.link href={~p"/templates/member_import_de.csv"} download>
<%= gettext("Download German Template") %>
</.link>
<!-- Alternative: Using Routes.static_path/2 -->
<.link href={Routes.static_path(MvWeb.Endpoint, "/templates/member_import_en.csv")} download>
<%= gettext("Download English Template") %>
</.link>
```
**Note:** The `templates` directory must be included in `MvWeb.static_paths()` (configured in `lib/mv_web.ex`) for the files to be served.
### File Limits
- **Max file size:** 10 MB

View file

@ -17,7 +17,7 @@ defmodule MvWeb do
those modules here.
"""
def static_paths, do: ~w(assets fonts images favicon.ico robots.txt)
def static_paths, do: ~w(assets fonts images favicon.ico robots.txt templates)
def router do
quote do

View file

@ -0,0 +1,2 @@
Vorname;Nachname;E-Mail;Straße;PLZ;Stadt
Max;Mustermann;max.mustermann@example.com;Hauptstraße;10115;Berlin
1 Vorname Nachname E-Mail Straße PLZ Stadt
2 Max Mustermann max.mustermann@example.com Hauptstraße 10115 Berlin

View file

@ -0,0 +1,2 @@
first_name;last_name;email;street;postal_code;city
John;Doe;john.doe@example.com;Main Street;12345;Berlin
1 first_name last_name email street postal_code city
2 John Doe john.doe@example.com Main Street 12345 Berlin