diff --git a/lib/pinchflat_web/components/core_components.ex b/lib/pinchflat_web/components/core_components.ex index e715b97..a2e9189 100644 --- a/lib/pinchflat_web/components/core_components.ex +++ b/lib/pinchflat_web/components/core_components.ex @@ -546,6 +546,30 @@ defmodule PinchflatWeb.CoreComponents do """ end + @doc """ + Renders a data list from a given map. Used in development to + quickly show the attributes of a database record. + """ + attr :map, :map, required: true + + def list_items_from_map(assigns) do + attrs = + Enum.filter(assigns.map, fn + {_, %{__struct__: _}} -> false + _ -> true + end) + + assigns = assign(assigns, iterable_attributes: attrs) + + ~H""" + <.list> + <:item :for={{k, v} <- @iterable_attributes} title={k}> + <%= v %> + + + """ + end + @doc """ Renders a back navigation link. diff --git a/lib/pinchflat_web/controllers/media_profiles/media_profile_html.ex b/lib/pinchflat_web/controllers/media_profiles/media_profile_html.ex index edb33ee..564a4cc 100644 --- a/lib/pinchflat_web/controllers/media_profiles/media_profile_html.ex +++ b/lib/pinchflat_web/controllers/media_profiles/media_profile_html.ex @@ -10,4 +10,12 @@ defmodule PinchflatWeb.MediaProfiles.MediaProfileHTML do attr :action, :string, required: true def media_profile_form(assigns) + + def friendly_format_type_options do + [ + {"Include (default)", :include}, + {"Exclude", :exclude}, + {"Only", :only} + ] + end end diff --git a/lib/pinchflat_web/controllers/media_profiles/media_profile_html/media_profile_form.html.heex b/lib/pinchflat_web/controllers/media_profiles/media_profile_html/media_profile_form.html.heex index ec7b13a..b0e79ab 100644 --- a/lib/pinchflat_web/controllers/media_profiles/media_profile_html/media_profile_form.html.heex +++ b/lib/pinchflat_web/controllers/media_profiles/media_profile_html/media_profile_form.html.heex @@ -4,10 +4,31 @@ <.input field={f[:name]} type="text" label="Name" /> <.input field={f[:output_path_template]} type="text" label="Output path template" /> + +