Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- query_params mi zwracało %{"PLN" => "true", "USD" => "true"}
- def selected_currencies(%{query_params: query_params}) do
- if query_params |> Enum.empty?() do
- gettext("Choose currency")
- else
- query_params
- |> Enum.map(fn {name, _} -> name end)
- |> Enum.join(", ")
- end
- end
- Dodałem w template as: "currencies" do forma. Czyli coś takiego
- = form_for @conn, "", [method: "get", enforce_utf8: false, as: "currencies"], fn f ->
- I zmieniłem funkcję na:
- def selected_currencies(%{query_params: query_params}) do
- if query_params |> Map.get("currencies") |> Enum.empty?() do
- gettext("Choose currency")
- else
- query_params
- |> Map.get("currencies")
- |> Enum.map(fn {name, _} -> name end)
- |> Enum.join(", ")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement