This commit is contained in:
parent
3fd6410bb4
commit
720a43a38c
4 changed files with 25 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
2
priv/static/templates/member_import_de.csv
Normal file
2
priv/static/templates/member_import_de.csv
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
Vorname;Nachname;E-Mail;Straße;PLZ;Stadt
|
||||
Max;Mustermann;max.mustermann@example.com;Hauptstraße;10115;Berlin
|
||||
|
2
priv/static/templates/member_import_en.csv
Normal file
2
priv/static/templates/member_import_en.csv
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
first_name;last_name;email;street;postal_code;city
|
||||
John;Doe;john.doe@example.com;Main Street;12345;Berlin
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue