From 788360a361e4e284a921217aaf12bf0bd7e2fbcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonatan=20M=C3=A4nnchen?= Date: Sun, 21 Dec 2025 13:23:23 +0100 Subject: [PATCH 1/2] Replace Email Order form with External Form --- lib/erlef/admins.ex | 15 +- lib/erlef/admins/notifications.ex | 15 +- lib/erlef/members.ex | 130 +------------ lib/erlef/members/email_request.ex | 88 --------- .../members/email_request_notification.ex | 53 ------ .../admin/email_requests_controller.ex | 59 ------ .../members/email_request_controller.ex | 38 ---- .../controllers/members/profile_controller.ex | 6 - lib/erlef_web/router.ex | 14 +- .../templates/admin/dashboard/index.html.eex | 2 - .../admin/email_request/index.html.eex | 31 --- .../admin/email_request/show.html.eex | 179 ------------------ .../templates/admin/layout/sidebar.html.eex | 2 - .../members/email_request/new.html.eex | 65 ------- .../templates/members/profile/show.html.eex | 59 +++--- .../views/admin/email_request_view.ex | 5 - .../views/members/email_request_view.ex | 3 - ...51221121218_drop_member_email_requests.exs | 7 + test/erlef/admins_test.exs | 1 - test/erlef/members/email_request_test.exs | 32 ---- test/erlef/members_test.exs | 99 ---------- 21 files changed, 48 insertions(+), 855 deletions(-) delete mode 100644 lib/erlef/members/email_request.ex delete mode 100644 lib/erlef/members/email_request_notification.ex delete mode 100644 lib/erlef_web/controllers/admin/email_requests_controller.ex delete mode 100644 lib/erlef_web/controllers/members/email_request_controller.ex delete mode 100644 lib/erlef_web/templates/admin/email_request/index.html.eex delete mode 100644 lib/erlef_web/templates/admin/email_request/show.html.eex delete mode 100644 lib/erlef_web/templates/members/email_request/new.html.eex delete mode 100644 lib/erlef_web/views/admin/email_request_view.ex delete mode 100644 lib/erlef_web/views/members/email_request_view.ex create mode 100644 priv/repo/migrations/20251221121218_drop_member_email_requests.exs delete mode 100644 test/erlef/members/email_request_test.exs delete mode 100644 test/erlef/members_test.exs diff --git a/lib/erlef/admins.ex b/lib/erlef/admins.ex index 0e6f46e0..4cdd2b34 100644 --- a/lib/erlef/admins.ex +++ b/lib/erlef/admins.ex @@ -28,16 +28,15 @@ defmodule Erlef.Admins do def resource_counts() do q = """ - select - (select count(id) from volunteers), - (select count(id) from working_groups), + select + (select count(id) from volunteers), + (select count(id) from working_groups), (select count(id) from sponsors), - (select count(id) from events where events.approved = false), - (select count(id) from member_email_requests where member_email_requests.status != 'complete'), + (select count(id) from events where events.approved = false), (select count(id) from apps), (select count(id) from academic_papers where - academic_papers.deleted_at is null and academic_papers.published_at is not null), - (select count(id) from academic_papers where + academic_papers.deleted_at is null and academic_papers.published_at is not null), + (select count(id) from academic_papers where academic_papers.deleted_at is null and academic_papers.published_at is null) """ @@ -48,7 +47,6 @@ defmodule Erlef.Admins do working_group_count, sponsors_count, unapproved_events_count, - outstanding_email_requests_count, apps_count, academic_papers_count, unapproved_academic_papers_count @@ -61,7 +59,6 @@ defmodule Erlef.Admins do working_groups_count: working_group_count, sponsors_count: sponsors_count, unapproved_events_count: unapproved_events_count, - outstanding_email_requests_count: outstanding_email_requests_count, apps_count: apps_count, academic_papers_count: academic_papers_count, unapproved_academic_papers_count: unapproved_academic_papers_count diff --git a/lib/erlef/admins/notifications.ex b/lib/erlef/admins/notifications.ex index bd07e6ac..0f80787d 100644 --- a/lib/erlef/admins/notifications.ex +++ b/lib/erlef/admins/notifications.ex @@ -4,26 +4,13 @@ defmodule Erlef.Admins.Notifications do import Swoosh.Email @type notification_type() :: - :new_email_request - | :new_event_submitted + :new_event_submitted | :new_academic_paper_submitted | :new_slack_invite @type params() :: map() @spec new(notification_type(), params()) :: Swoosh.Email.t() - def new(:new_email_request, _) do - msg = """ - A new email request was created. Visit https://erlef.org/admin/ to view outstanding requests. - """ - - new() - |> to({"Infrastructure Requests", "infra.requests@erlef.org"}) - |> from({"Erlef Notifications", "notifications@erlef.org"}) - |> subject("A new email request was created") - |> text_body(msg) - end - def new(:new_event_submitted, _) do msg = """ A new event was submitted. Visit https://erlef.org/admin/ to view unapproved events. diff --git a/lib/erlef/members.ex b/lib/erlef/members.ex index b2f0837b..240ad2b4 100644 --- a/lib/erlef/members.ex +++ b/lib/erlef/members.ex @@ -3,140 +3,12 @@ defmodule Erlef.Members do Members context """ - alias Erlef.Repo - alias Erlef.Members.{EmailRequest, EmailRequestNotification, Notifications} + alias Erlef.Members.Notifications alias Erlef.Mailer - alias Erlef.Admins - alias Erlef.Accounts.Member - - import Ecto.Query - - def new_email_request(params \\ %{}) do - EmailRequest.changeset(%EmailRequest{}, params) - end def notify(type, params) do type |> Notifications.new(params) |> Mailer.deliver() end - - def create_email_request(params) do - result = - params - |> new_email_request() - |> Repo.insert() - - case result do - {:ok, _} -> - Admins.notify(:new_email_request) - result - - err -> - err - end - end - - def get_email_request(id), do: Repo.one(EmailRequest.get(id)) - - def has_email_request?(member) do - case Repo.get_by(EmailRequest, submitted_by_id: member.id) do - nil -> false - _ -> true - end - end - - def get_email_request_by_member(member) do - Repo.get_by(EmailRequest, submitted_by_id: member.id) - end - - def update_email_request(%EmailRequest{} = req, params) do - req - |> EmailRequest.changeset(params) - |> Repo.update() - end - - def update_email_request(id, params) do - case get_email_request(id) do - %EmailRequest{} = req -> - update_email_request(req, params) - - nil -> - {:error, :not_found} - end - end - - def complete_email_request(%{id: id, password: password}) do - with %EmailRequest{} = req <- get_email_request(id), - {:ok, member} <- update_member_fields(req), - {:ok, _req} <- update_email_request(req.id, %{status: :completed}) do - do_notify(req, %{member: member, password: password}) - end - end - - def complete_email_request(%{id: id}) do - with %EmailRequest{} = req <- get_email_request(id), - {:ok, member} <- update_member_fields(req), - {:ok, req} <- update_email_request(req.id, %{status: :completed}) do - do_notify(req, %{member: member}) - end - end - - def outstanding_email_requests() do - q = - from(p in EmailRequest, - where: p.status not in [:completed] - ) - - Repo.all(q) - end - - def outstanding_email_requests_count() do - q = - from(p in EmailRequest, - where: p.status not in [:completed], - select: count(p.id) - ) - - Repo.one(q) - end - - defp update_member_fields(req) do - email = "#{req.username}@erlef.org" - - update = - case req.type do - :email_box -> - %{erlef_email_address: email, has_email_box?: true, has_email_alias?: false} - - :email_alias -> - %{erlef_email_address: email, has_email_box?: false, has_email_alias?: true} - end - - case Erlef.Accounts.get_member!(req.submitted_by_id) do - %Member{} = member -> - Erlef.Accounts.update_member(member, update, update_external: true) - - err -> - err - end - end - - def do_notify(%EmailRequest{type: :email_alias}, params) do - {:ok, _} = - params.member - |> EmailRequestNotification.email_alias_created() - |> Mailer.deliver() - - :ok - end - - def do_notify(%EmailRequest{type: :email_box}, params) do - {:ok, _} = - params.member - |> EmailRequestNotification.email_box_created(params.password) - |> Erlef.Mailer.deliver() - - :ok - end end diff --git a/lib/erlef/members/email_request.ex b/lib/erlef/members/email_request.ex deleted file mode 100644 index 44b6fde1..00000000 --- a/lib/erlef/members/email_request.ex +++ /dev/null @@ -1,88 +0,0 @@ -defmodule Erlef.Members.EmailRequest do - @moduledoc """ - Erlef.Members.EmailRequest - """ - use Erlef.Schema - - @derive {Jason.Encoder, - only: [:id, :type, :username, :status, :submitted_by_id, :assigned_to_id]} - @type t :: %__MODULE__{ - id: Ecto.UUID.t(), - type: String.t(), - username: String.t(), - status: String.t(), - submitted_by_id: Ecto.UUID.t() - } - - @required_fields [ - :type, - :username, - :status, - :submitted_by_id - ] - - @optional_fields [ - :assigned_to_id - ] - - @all_fields @required_fields ++ @optional_fields - - schema "member_email_requests" do - field(:type, Ecto.Enum, values: [:email_box, :email_alias]) - field(:username, :string) - field(:status, Ecto.Enum, values: [:created, :in_progress, :completed]) - - belongs_to(:submitted_by, Erlef.Accounts.Member) - belongs_to(:assigned_to, Erlef.Accounts.Member) - - embeds_many(:logs, LogEntry, primary_key: false, on_replace: :delete) do - field(:type, Ecto.Enum, values: [:email_box, :email_alias]) - field(:username, :string) - field(:status, Ecto.Enum, values: [:created, :in_progress, :completed]) - field(:submitted_by_id, Ecto.UUID) - field(:assigned_to, Ecto.UUID) - field(:assigned_to_id, Ecto.UUID) - timestamps() - end - - timestamps() - end - - @spec changeset(%__MODULE__{}, map()) :: Ecto.Changeset.t() - def changeset(struct, params) do - struct - |> cast(params, @all_fields) - |> validate_required(@required_fields) - |> validate_format(:username, ~r/^[A-Za-z0-9\._]+\Z/) - |> validate_length(:username, min: 1, max: 40) - |> maybe_add_log_entry() - end - - defp maybe_add_log_entry(%{data: %{id: nil}} = cs) do - cs - end - - defp maybe_add_log_entry(cs) do - req = cs.data - - entry = - req - |> Map.delete(:assigned_to) - |> Map.delete(:logs) - |> Map.delete(:id) - |> Map.delete(:__meta__) - |> Map.delete(:submitted_by) - |> Map.delete(:__struct__) - - put_embed(cs, :logs, [entry | req.logs]) - end - - def get(id) do - from(e in __MODULE__, - join: m in assoc(e, :submitted_by), - left_join: ma in assoc(e, :assigned_to), - where: e.id == ^id, - preload: [submitted_by: m, assigned_to: ma] - ) - end -end diff --git a/lib/erlef/members/email_request_notification.ex b/lib/erlef/members/email_request_notification.ex deleted file mode 100644 index 9d3c42a6..00000000 --- a/lib/erlef/members/email_request_notification.ex +++ /dev/null @@ -1,53 +0,0 @@ -defmodule Erlef.Members.EmailRequestNotification do - @moduledoc false - - import Swoosh.Email - - def email_alias_created(member) do - new() - |> to({member.name, member.email}) - |> from({"Erlef Notifications", "notifications@erlef.org"}) - |> subject("Your erlef.org email alias has been created!") - |> text_body(alias_body(member)) - end - - def email_box_created(member, password) do - new() - |> to({member.name, member.email}) - |> from({"Erlef Notifications", "notifications@erlef.org"}) - |> subject("Your erlef.org email account has been created!") - |> text_body(email_box_body(member, password)) - end - - defp alias_body(member) do - """ - Hello #{member.first_name}, - - We are glad to inform you that the mail alias you requested has been created. - - It may take up to 15 minutes for the alias to become active. Once the alias is active you will - begin receiving emails sent to your new alias at this address. - - If you have any problems, please reach out to infra.requests@erlef.org - """ - end - - defp email_box_body(member, password) do - """ - Hello #{member.first_name}, - - We are glad to inform you that the erlef.org mail account you requested has been created. - - You may login at https://fastmail.com/login using your new email address and the following credentials : - - username : #{member.erlef_email_address} - password : #{password} - - Once logged in we strongly advise you change this password immediately and enable two-factor authentication. - See https://www.fastmail.com/help/guides/personal.html for information on getting started with - your new email account. - - If you have any problems logging in, please reach out to infra.requests@erlef.org - """ - end -end diff --git a/lib/erlef_web/controllers/admin/email_requests_controller.ex b/lib/erlef_web/controllers/admin/email_requests_controller.ex deleted file mode 100644 index f473f684..00000000 --- a/lib/erlef_web/controllers/admin/email_requests_controller.ex +++ /dev/null @@ -1,59 +0,0 @@ -defmodule ErlefWeb.Admin.EmailRequestController do - use ErlefWeb, :controller - action_fallback ErlefWeb.FallbackController - alias Erlef.Members - - def index(conn, _params) do - requests = Members.outstanding_email_requests() - render(conn, email_requests: requests) - end - - def show(conn, %{"id" => id}) do - req = Members.get_email_request(id) - - logs = - Enum.map(req.logs, fn l -> - cast_assigned_to(l, conn) - end) - - render(conn, - email_request: %{req | logs: logs} - ) - end - - def assign(conn, %{"request" => id}) do - req = Members.get_email_request(id) - - {:ok, _req} = - Members.update_email_request(req, %{ - status: :in_progress, - assigned_to_id: conn.assigns.current_user.id - }) - - redirect(conn, to: Routes.admin_email_request_path(conn, :show, id)) - end - - def complete(conn, %{"id" => id, "password" => password}) do - :ok = Members.complete_email_request(%{id: id, password: password}) - redirect(conn, to: Routes.admin_email_request_path(conn, :show, id)) - end - - def complete(conn, %{"id" => id}) do - :ok = Members.complete_email_request(%{id: id}) - redirect(conn, to: Routes.admin_email_request_path(conn, :show, id)) - end - - defp cast_assigned_to(req, conn) do - case req.assigned_to_id do - nil -> - req - - id when id == conn.assigns.current_user.id -> - %{req | assigned_to: conn.assigns.current_user} - - _not_current_user -> - member = Erlef.Accounts.get_member!(req.assigned_to) - %{req | assigned_to: member} - end - end -end diff --git a/lib/erlef_web/controllers/members/email_request_controller.ex b/lib/erlef_web/controllers/members/email_request_controller.ex deleted file mode 100644 index e209d7bd..00000000 --- a/lib/erlef_web/controllers/members/email_request_controller.ex +++ /dev/null @@ -1,38 +0,0 @@ -defmodule ErlefWeb.Members.EmailRequestController do - use ErlefWeb, :controller - - alias Erlef.Members - - def new(conn, _) do - case Members.has_email_request?(conn.assigns.current_user) do - false -> - render(conn, error: nil, changeset: Members.new_email_request()) - - true -> - conn - |> put_flash(:info, "You already have an outstanding email request") - |> redirect(to: Routes.members_profile_path(conn, :show)) - end - end - - def create(conn, %{"email_request" => params}) do - req_params = %{ - "status" => "created", - "submitted_by_id" => conn.assigns.current_user.id - } - - case Members.create_email_request(Map.merge(params, req_params)) do - {:ok, _req} -> - conn - |> put_flash(:success, "Email request successfully created") - |> redirect(to: Routes.members_profile_path(conn, :show)) - - err -> - err - end - end - - def show(conn, _) do - render(conn) - end -end diff --git a/lib/erlef_web/controllers/members/profile_controller.ex b/lib/erlef_web/controllers/members/profile_controller.ex index c3d3a93a..1d9b0b88 100644 --- a/lib/erlef_web/controllers/members/profile_controller.ex +++ b/lib/erlef_web/controllers/members/profile_controller.ex @@ -1,16 +1,10 @@ defmodule ErlefWeb.Members.ProfileController do use ErlefWeb, :controller - alias Erlef.Members - def show(conn, _) do conference_perks = Application.get_env(:erlef, :conference_perks) - has_email_request = Members.has_email_request?(conn.assigns.current_user) - email_request = Members.get_email_request_by_member(conn.assigns.current_user) render(conn, - has_email_request: has_email_request, - email_request: email_request, conference_perks: conference_perks, video_perks_on: true, conference_perks_on: false diff --git a/lib/erlef_web/router.ex b/lib/erlef_web/router.ex index 103be59f..96f2fa0c 100644 --- a/lib/erlef_web/router.ex +++ b/lib/erlef_web/router.ex @@ -8,14 +8,14 @@ defmodule ErlefWeb.Router do syndication.twitter.com/settings cdn.syndication.twimg.com licensebuttons.net i.creativecommons.org pbs.twimg.com use.typekit.net p.typekit.net - avatar-images.ewr1.vultrobjects.com event-org-images.ewr1.vultrobjects.com + avatar-images.ewr1.vultrobjects.com event-org-images.ewr1.vultrobjects.com sponsors.ewr1.vultrobjects.com erlef.matomo.cloud cdn.rawgit.com 127.0.0.1:9998 cdn.datatables.net user.fm cdnjs.cloudflare.com uicdn.toast.com - plausible.io fonts.googleapis.com fonts.gstatic.com + plausible.io fonts.googleapis.com fonts.gstatic.com tally.so forms.erlef.org ) - @trusted_connect_sources ~w(https://user.fm https://www.erlef.org wss://erlef.org - wss://www.erlef.org ws://erlef.org ws://www.erlef.org https://stats.erlef.org https://plausible.io https://raw.githubusercontent.com) + @trusted_connect_sources ~w(https://user.fm https://www.erlef.org wss://erlef.org + wss://www.erlef.org ws://erlef.org ws://www.erlef.org https://stats.erlef.org https://plausible.io https://raw.githubusercontent.com) if Erlef.in_env?([:dev, :test]) do @default_source Enum.join(@trusted_sources ++ ["127.0.0.1:9998"], " ") @@ -96,7 +96,7 @@ defmodule ErlefWeb.Router do get "/wg-proposal-template", PageController, :wg_proposal_template # NOTE: News routes are still in place for links that may be out there. - # Please use blog routes. + # Please use blog routes. get "/news", BlogController, :index, as: :news get "/news/:topic", BlogController, :index, as: :news get "/news/:topic/:id", BlogController, :show, as: :news @@ -159,7 +159,6 @@ defmodule ErlefWeb.Router do scope "/members", Members, as: :members do pipe_through [:session_required] resources "/profile", ProfileController, only: [:show], singleton: true - resources "/email_requests", EmailRequestController resources "/slack-invite", SlackInviteController, only: [:create] end @@ -179,9 +178,6 @@ defmodule ErlefWeb.Router do end resources "/events", EventController, only: [:index, :show] - resources "/email_requests", EmailRequestController, only: [:index, :show] - post "/email_requests/assign", EmailRequestController, :assign - post "/email_requests/complete", EmailRequestController, :complete put "/events/:id", EventController, :approve resources "/sponsors", SponsorController diff --git a/lib/erlef_web/templates/admin/dashboard/index.html.eex b/lib/erlef_web/templates/admin/dashboard/index.html.eex index 09fdd40e..bb29c511 100644 --- a/lib/erlef_web/templates/admin/dashboard/index.html.eex +++ b/lib/erlef_web/templates/admin/dashboard/index.html.eex @@ -8,8 +8,6 @@ %> <%= small_info_box(@resource_counts.unapproved_academic_papers_count , "Unapproved Academic Papers" , "fa-file-download" , Routes.admin_unapproved_academic_paper_path(@conn , :index) , "green") %> - - <%= small_info_box(@resource_counts.outstanding_email_requests_count, "Email Requests", "fa-envelope", Routes.admin_email_request_path(@conn, :index)) %> <%= small_info_box(@resource_counts.sponsors_count, "Sponsors", "fa-hand-holding-heart", Routes.admin_sponsor_path(@conn, :index), "maroon") %> diff --git a/lib/erlef_web/templates/admin/email_request/index.html.eex b/lib/erlef_web/templates/admin/email_request/index.html.eex deleted file mode 100644 index e03a396c..00000000 --- a/lib/erlef_web/templates/admin/email_request/index.html.eex +++ /dev/null @@ -1,31 +0,0 @@ -
-
-

Unapproved email requests

-
- -
- - - - - - - - - - - - <%= for req <- @email_requests do %> - - - - - - - - <% end %> - -
IdTypeStatusRequested UsernameSubmitted on
<%= link(req.id, to: Routes.admin_email_request_path(@conn, :show, req.id)) %><%= humanize(req.status) %><%= humanize(req.type) %><%= req.username %><%= req.inserted_at %>
-
- -
diff --git a/lib/erlef_web/templates/admin/email_request/show.html.eex b/lib/erlef_web/templates/admin/email_request/show.html.eex deleted file mode 100644 index c5c2d7c7..00000000 --- a/lib/erlef_web/templates/admin/email_request/show.html.eex +++ /dev/null @@ -1,179 +0,0 @@ -

Email request - <%= @email_request.id %>

-
- -
-
-
- <% path = Routes.admin_email_request_path(@conn, :assign, request: @email_request.id) %> - <%= if @email_request.status != :completed && @email_request.assigned_to && @email_request.assigned_to.id != @current_user.id do %> -

- This request is currently assigned to <%= @email_request.assigned_to.name %>. - If for some reason the current assignee can not fulfil the request you may assign it to yourself. - Please be sure to communicate with current assignee before re-assigning -

- <%= link("Re-Assign to yourself", to: path, class: "btn btn-primary", data: [confirm: "Are you sure?"], method: :post ) %> - - <% else %> - <%= if is_nil(@email_request.assigned_to) do %> -

This request is currently unassigned. Please click the button below to mark it as assigned to you, which will change the status to in progress

- - <%= link("Assign to yourself", to: path, class: "btn btn-primary", data: [confirm: "Are you sure?"], method: :post ) %> - <% end %> - <% end %> -
- -
-
- -

Request Details

-
- - - - - - - - - - - - - - - - - - - - - - - - -
Submitted byTypeStatusRequested nameSubmitted onUpdated atAssigned to
<%= @email_request.submitted_by.name %><%= humanize(@email_request.type) %><%= humanize(@email_request.status) %><%= @email_request.username %><%= @email_request.inserted_at %><%= @email_request.updated_at %> - <%= if @email_request.assigned_to do %> - <%= @email_request.assigned_to.name %> - <% else %> - No one - <% end %> - -
-
-
- -<%= if @email_request.assigned_to && @email_request.status != :completed do %> -

Instructions

- <%= if @email_request.type == :email_alias do %> -
    -
  1. With an administrative account login to <%= link("Fastmail", to: "https://www.fastmail.com/login/") %>
  2. -
  3. In the left upper corner click on your name and then choose settings
  4. -
  5. From the left sidebar click Users & Aliases
  6. -
  7. Re-enter your account password at the top of the page and click the Unlock button.
  8. -
  9. Scroll down to the Aliases section and click the New Alias button
  10. -
  11. Enter <%= @email_request.username %> in text field left of the @ symbol.
  12. -
  13. Ensure erlef.org is selected from the drop down menu on the right side of the user part field you just filled in
  14. -
  15. Now click the Show advanced preferences link
  16. -
  17. Click the Remove link next to your name and email address.
  18. -
  19. Add the email address <%= @email_request.submitted_by.email %> in the field below.
  20. -
  21. Check the box to enable SRS
  22. -
  23. Click the Save
  24. -
- -

- <% path = Routes.admin_email_request_path(@conn, :complete, id: @email_request.id) %> - Click the complete button below to finish the request. Once completed a notification will be sent to <%= @email_request.submitted_by.email %> informing them the alias has been created and may take up to 15 minutes to become active. -

- <%= link("Complete", to: path, method: :post, class: "btn btn-warning", data: [confirm: "Are you sure?"] ) %> - <% else %> - - <% path = Routes.admin_email_request_path(@conn, :complete) %> - <%= form_for @conn, path, fn f -> %> - <%= hidden_input(f, :id, value: @email_request.id) %> - -
    -
  1. With an administrative account login to <%= link("Fastmail", to: "https://www.fastmail.com/login/") %>
  2. -
  3. In the left upper corner click on your name and then choose settings
  4. -
  5. From the left sidebar click Users & Aliases
  6. -
  7. Re-enter your account password at the top of the page and click the Unlock button.
  8. -
  9. Now click the New User button
  10. -
  11. Enter <%= @email_request.submitted_by.name %> in the Name field
  12. -
  13. Enter <%= @email_request.username %> in the username field.
  14. -
  15. Copy the password generated by fastmail and paste it here : - <%= text_input(f, :password, required: true, placeholder: " Paste password here") %>
  16. -
  17. Ensure the Standard plan is selected.
  18. -
  19. Tick the privacy checkbox - Admins may not log in to this user’s account.
  20. -
  21. Ensure the following are not checked
  22. - -
  23. Click the Purchase button
  24. -
- -

- Click the complete button below to finish the request. Once completed a notification will be sent to <%= @email_request.submitted_by.email %> informing them the alias has been created and may take up to 15 minutes to become active. -

- <%= submit("Complete", class: "btn btn-warning") %> - <% end %> - <% end %> -<% end %> - -
- -

History

-<%= if Enum.empty?(@email_request.logs) do %> -
No history yet
-<% else %> - -
-
-
- <%= for log <- @email_request.logs do %> -
- -
- <%= to_date_string(log.inserted_at) %> -

Email Request Change

-
- - - - - - - - - - - - - - - - - - - - - -
TypeStatusRequested nameAssigned toInserted at
<%= humanize(log.type) %><%= humanize(log.status) %><%= log.username %> - <%= if log.assigned_to do %> - <%= log.assigned_to.name %> - <% else %> - No one - <% end %> - - <%= to_date_string(log.inserted_at) %>
-
-
-
- <% end %> - -
- -
-
-
- <% end %> -
diff --git a/lib/erlef_web/templates/admin/layout/sidebar.html.eex b/lib/erlef_web/templates/admin/layout/sidebar.html.eex index 456f3824..efc51999 100644 --- a/lib/erlef_web/templates/admin/layout/sidebar.html.eex +++ b/lib/erlef_web/templates/admin/layout/sidebar.html.eex @@ -13,8 +13,6 @@ <%= nav_link(to: Routes.admin_event_path(@conn, :index), name: "Events", icon: "fa-calendar-alt") %> - <%= nav_link(to: Routes.admin_email_request_path(@conn, :index), name: "Email Requests", icon: "fa-envelope") %> - <%= nav_link(to: Routes.admin_sponsor_path(@conn, :index), name: "Sponsors", icon: "fa-hand-holding-heart") %> <%= nav_link(to: Routes.admin_working_group_path(@conn, :index), name: "Working Groups", icon: "fa-users-cog") %> diff --git a/lib/erlef_web/templates/members/email_request/new.html.eex b/lib/erlef_web/templates/members/email_request/new.html.eex deleted file mode 100644 index b2d4ec82..00000000 --- a/lib/erlef_web/templates/members/email_request/new.html.eex +++ /dev/null @@ -1,65 +0,0 @@ -
-

Erlef Request Form

-
- - <%= if @changeset.action do %> -
-

Oops, something went wrong! Please check the errors below.

-
- <% end %> - - <%= if @error do %> -
-

<%= @error %>

-
- <% end %> - - <%= form_for @changeset, Routes.members_email_request_path(@conn, :create), [autocomplete: "off", multipart: true], fn f -> %> -
-
- Email Type -
-
- - -
-
- - -
- -
- -
- - - You may choose either alias or mailbox. Choosing an alias will forward email sent to your new erlef.org address to <%= @current_user.email %>, while choosing the mail box option will create an entirely new email account. - -
-
- -
- -
-
- <%= label f, :email, "Email username", class: "col-sm-2 col-form-label"%> -
- <%= text_input(f, :username, placeholder: "Username", class: "form-control", pattern: "[A-Za-z0-9\._]+" ) %> - <%= error_tag f, :username %> -
- -
- - Alpha, numeric, . (dot), and _ (underscore) characters are allowed. We recommend using firstname.lastname. In the event that an address is taken an admin will reach out to. Please refrain from general names (e.g., elixir, erlang, hex), names belonging to others, or any offensive terms. - -
-
- -
- <%= submit "Submit", class: "btn-primary" %> - <% end %> -
diff --git a/lib/erlef_web/templates/members/profile/show.html.eex b/lib/erlef_web/templates/members/profile/show.html.eex index 8c19d58b..f861a145 100644 --- a/lib/erlef_web/templates/members/profile/show.html.eex +++ b/lib/erlef_web/templates/members/profile/show.html.eex @@ -17,38 +17,35 @@

Requests

- <%= if is_paying?(@current_user) do %> + <%= if is_paying?(@current_user) && not @current_user.has_email_address do %>

Erlef Email Request

- <% end %> - - <%= if is_paying?(@current_user) && not @current_user.has_email_address && not @has_email_request do %> - - <% end %> - - <%= if @has_email_request do %> -

You submitted a request for an erlef.org address. Details are below :

- - - - - - - - - - - - - - - - - - -
TypeStatusRequested nameSubmitted on
<%= humanize(@email_request.type) %><%= humanize(@email_request.status) %><%= @email_request.username %><%= to_date_string(@email_request.inserted_at) %>
+

As a paying member, you are eligible for a free erlef.org email address. Fill out the form below to request yours.

+ <% tally_url = %URI{ + scheme: "https", + host: "forms.erlef.org", + path: "/email-request", + query: URI.encode_query(%{ + "embed" => "1", + "alignLeft" => "1", + "hideTitle" => "1", + "transparentBackground" => "1", + "dynamicHeight" => "1", + "formEventsForwarding" => "1", + "name" => @current_user.name, + "email" => @current_user.email + }) + } |> URI.to_string() %> + + <% end %>

Erlef Slack invite

diff --git a/lib/erlef_web/views/admin/email_request_view.ex b/lib/erlef_web/views/admin/email_request_view.ex deleted file mode 100644 index 15cbcb1f..00000000 --- a/lib/erlef_web/views/admin/email_request_view.ex +++ /dev/null @@ -1,5 +0,0 @@ -defmodule ErlefWeb.Admin.EmailRequestView do - use ErlefWeb, :view - - def title(_), do: "Email Requests" -end diff --git a/lib/erlef_web/views/members/email_request_view.ex b/lib/erlef_web/views/members/email_request_view.ex deleted file mode 100644 index 0e02f589..00000000 --- a/lib/erlef_web/views/members/email_request_view.ex +++ /dev/null @@ -1,3 +0,0 @@ -defmodule ErlefWeb.Members.EmailRequestView do - use ErlefWeb, :view -end diff --git a/priv/repo/migrations/20251221121218_drop_member_email_requests.exs b/priv/repo/migrations/20251221121218_drop_member_email_requests.exs new file mode 100644 index 00000000..e59d75a8 --- /dev/null +++ b/priv/repo/migrations/20251221121218_drop_member_email_requests.exs @@ -0,0 +1,7 @@ +defmodule Erlef.Repo.Migrations.DropMemberEmailRequests do + use Ecto.Migration + + def change do + drop table(:member_email_requests) + end +end diff --git a/test/erlef/admins_test.exs b/test/erlef/admins_test.exs index 0838cb22..8c3daca9 100644 --- a/test/erlef/admins_test.exs +++ b/test/erlef/admins_test.exs @@ -9,7 +9,6 @@ defmodule Erlef.AdminsTest do working_groups_count: 0, sponsors_count: 0, unapproved_events_count: 0, - outstanding_email_requests_count: 0, apps_count: 0, academic_papers_count: 0, unapproved_academic_papers_count: 0 diff --git a/test/erlef/members/email_request_test.exs b/test/erlef/members/email_request_test.exs deleted file mode 100644 index 477b8c18..00000000 --- a/test/erlef/members/email_request_test.exs +++ /dev/null @@ -1,32 +0,0 @@ -defmodule Erlef.Members.EmailRequestTest do - use Erlef.DataCase - - alias Erlef.Members.EmailRequest - - describe "changeset/2" do - test "when username is valid" do - p = %{status: :created, type: :email_alias, submitted_by_id: Ecto.UUID.generate()} - cs = EmailRequest.changeset(%EmailRequest{}, Map.put(p, :username, "foo.bar")) - assert cs.valid? - cs = EmailRequest.changeset(%EmailRequest{}, Map.put(p, :username, "f_o_o.b_a_r")) - assert cs.valid? - max_length = String.duplicate("x", 40) - cs = EmailRequest.changeset(%EmailRequest{}, Map.put(p, :username, max_length)) - assert cs.valid? - end - - test "when username is invalid" do - p = %{status: :created, type: :email_alias, submitted_by_id: Ecto.UUID.generate()} - cs = EmailRequest.changeset(%EmailRequest{}, Map.put(p, :username, "foo.bar!")) - refute cs.valid? - cs = EmailRequest.changeset(%EmailRequest{}, Map.put(p, :username, "f_o_o.b_a_r@")) - refute cs.valid? - rand = :crypto.strong_rand_bytes(4) - cs = EmailRequest.changeset(%EmailRequest{}, Map.put(p, :username, rand)) - refute cs.valid? - too_long = String.duplicate("x", 41) - cs = EmailRequest.changeset(%EmailRequest{}, Map.put(p, :username, too_long)) - refute cs.valid? - end - end -end diff --git a/test/erlef/members_test.exs b/test/erlef/members_test.exs deleted file mode 100644 index 5e6a2d4a..00000000 --- a/test/erlef/members_test.exs +++ /dev/null @@ -1,99 +0,0 @@ -defmodule Erlef.MembersTest do - use Erlef.DataCase - - alias Erlef.Accounts - alias Erlef.Members - alias Erlef.Members.EmailRequest - import Swoosh.TestAssertions - - setup do - member = insert_member!("annual_member") - admin = insert_member!("admin") - [member: member, admin: admin] - end - - test "new_email_request/0" do - assert %Ecto.Changeset{} = Members.new_email_request() - end - - test "new_email_request/1" do - assert %Ecto.Changeset{} = Members.new_email_request(%{}) - end - - test "create_new_email_request/1", %{member: member} do - assert {:ok, %EmailRequest{} = req} = - Members.create_email_request(%{ - status: :created, - type: :email_alias, - username: "starbelly", - submitted_by_id: member.id - }) - - assert %EmailRequest{id: id} = Members.get_email_request(req.id) - assert %EmailRequest{id: ^id} = Members.get_email_request_by_member(member) - assert_email_sent(Erlef.Admins.Notifications.new(:new_email_request, %{})) - end - - test "outstanding_email_requests/0", %{member: member} do - assert {:ok, %EmailRequest{} = _req} = - Members.create_email_request(%{ - status: :created, - type: :email_alias, - username: "starbelly", - submitted_by_id: member.id - }) - - assert Members.has_email_request?(member) - - assert Members.outstanding_email_requests_count() == 1 - - assert Members.outstanding_email_requests_count() == - Enum.count(Members.outstanding_email_requests()) - end - - test "update_email_request/2", %{member: member} do - assert {:ok, %EmailRequest{} = req} = - Members.create_email_request(%{ - status: :created, - type: :email_alias, - username: "starbelly", - submitted_by_id: member.id - }) - - assert Members.update_email_request(req, %{status: :in_progress}) - - assert Members.update_email_request(req.id, %{status: :created}) - end - - describe "complete_email_request/1" do - test "when request is of type email_alias", %{admin: admin, member: member} do - assert {:ok, %EmailRequest{} = req} = - Members.create_email_request(%{ - status: :created, - type: :email_alias, - username: "starbelly", - assigned_to_id: admin.id, - submitted_by_id: member.id - }) - - assert Members.complete_email_request(%{id: req.id}) - assert_email_sent(Members.EmailRequestNotification.email_alias_created(member)) - end - - test "when request is of type email_box", %{admin: admin, member: member} do - assert {:ok, %EmailRequest{} = req} = - Members.create_email_request(%{ - status: :created, - type: :email_box, - username: "starbelly", - assigned_to_id: admin.id, - submitted_by_id: member.id - }) - - member = Accounts.get_member!(member.id) - member = %{member | erlef_email_address: "starbelly@erlef.org"} - assert Members.complete_email_request(%{id: req.id, password: "hunter42"}) - assert_email_sent(Members.EmailRequestNotification.email_box_created(member, "hunter42")) - end - end -end From fe05e2e95491226d86444ec9a8b6acc9ad8c1dfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonatan=20M=C3=A4nnchen?= Date: Sun, 21 Dec 2025 13:32:43 +0100 Subject: [PATCH 2/2] Replace Stipend form with External Form --- lib/erlef/stipend_mail.ex | 65 ---- lib/erlef/stipend_proposal.ex | 77 ---- .../controllers/stipend_controller.ex | 25 +- lib/erlef_web/router.ex | 2 +- .../email/stipend_submission.html.eex | 149 -------- .../templates/stipend/create.html.eex | 6 - .../templates/stipend/default_form.html.eex | 308 --------------- .../templates/stipend/devel_form.html.eex | 237 ------------ lib/erlef_web/templates/stipend/form.html.eex | 63 ++-- .../templates/stipend/index.html.eex | 2 +- .../templates/stipend/sidebar.html.eex | 2 +- lib/erlef_web/views/stipend_view.ex | 357 ------------------ .../controllers/stipend_controller_test.exs | 73 ---- 13 files changed, 32 insertions(+), 1334 deletions(-) delete mode 100644 lib/erlef/stipend_mail.ex delete mode 100644 lib/erlef/stipend_proposal.ex delete mode 100644 lib/erlef_web/templates/email/stipend_submission.html.eex delete mode 100644 lib/erlef_web/templates/stipend/create.html.eex delete mode 100644 lib/erlef_web/templates/stipend/default_form.html.eex delete mode 100644 lib/erlef_web/templates/stipend/devel_form.html.eex delete mode 100644 test/erlef_web/controllers/stipend_controller_test.exs diff --git a/lib/erlef/stipend_mail.ex b/lib/erlef/stipend_mail.ex deleted file mode 100644 index 05945bc3..00000000 --- a/lib/erlef/stipend_mail.ex +++ /dev/null @@ -1,65 +0,0 @@ -defmodule Erlef.StipendMail do - @moduledoc """ - Erlef.StipendMail - """ - - import Swoosh.Email - - use Phoenix.Swoosh, view: ErlefWeb.EmailView, layout: {ErlefWeb.LayoutView, :email} - - @spec submission(Erlef.StipendProposal.t()) :: Swoosh.Email.t() - def submission(proposal) do - dt_str = DateTime.utc_now() |> DateTime.truncate(:second) - - subject_suffix = "on #{dt_str} via #{full_name(proposal)} (#{proposal.email_address}" - - new() - |> recipients(proposal.stipend_type) - |> from({"EEF Stipend Submissions", "notifications@erlef.org"}) - |> subject("EEF Stipend Proposal Submission #{subject_suffix}") - |> attach_files(proposal.files) - |> render_body("stipend_submission.html", proposal: proposal, copy: false) - end - - defp recipients(email, "Elixir Outreach") do - to(email, {"Elixir Outreach Stipend Committee", "elixir_outreach@erlef.org"}) - end - - defp recipients(email, _) do - email - |> to({"eef-stipends", "eef-stipends@googlegroups.com"}) - |> bcc({"eef-stipends", "stipends@erlef.org"}) - end - - def submission_copy(proposal) do - email = - new() - |> to({full_name(proposal), proposal.email_address}) - |> from({"EEF Stipend Submissions", "notifications@erlef.org"}) - |> subject("EEF Stipend Proposal Copy") - - new_email = attach_files(email, proposal.files) - render_body(new_email, "stipend_submission.html", proposal: proposal, copy: true) - end - - defp attach_files(email, nil), do: email - defp attach_files(email, []), do: email - - defp attach_files(email, files) do - only_plugs = - Enum.filter(files, fn f -> - case f do - %Plug.Upload{} -> true - _ -> false - end - end) - - Enum.reduce(only_plugs, email, fn f, acc -> - attachment(acc, f) - end) - end - - defp full_name(proposal) do - "#{proposal.first_name} #{proposal.last_name}" - end -end diff --git a/lib/erlef/stipend_proposal.ex b/lib/erlef/stipend_proposal.ex deleted file mode 100644 index 9505c45d..00000000 --- a/lib/erlef/stipend_proposal.ex +++ /dev/null @@ -1,77 +0,0 @@ -defmodule Erlef.StipendProposal do - @moduledoc """ - Erlef.StipendProposal - """ - - @type t() :: Ecto.Schema.schema() - - # The string version of the key name followed by - # a tuple consisting of the atom version of the key, - # a second atom declaring its type or a tuple declaring its type and size - # - @string_key_map %{ - "first_name" => {:first_name, {:binary, 50}}, - "last_name" => {:last_name, {:binary, 50}}, - "nick_name" => {:nick_name, {:binary, 50}}, - "email_address" => {:email_address, {:binary, 50}}, - "phone_number" => {:phone_number, {:binary, 20}}, - "org_name" => {:org_name, {:binary, 50}}, - "org_email" => {:org_email, :binary}, - "city" => {:city, {:binary, 85}}, - "region" => {:region, {:binary, 50}}, - "country" => {:country, {:binary, 50}}, - "postal_code" => {:postal_code, {:binary, 10}}, - "twitter" => {:twitter, {:binary, 50}}, - "linkedin" => {:linkedin, {:binary, 50}}, - "website" => {:website, {:binary, 50}}, - "bio" => {:bio, {:binary, 5000}}, - "code_of_conduct_link" => {:code_of_conduct_link, {:binary, 50}}, - "files" => {:files, :list}, - "purpose" => {:purpose, {:binary, 5000}}, - "devel_plan" => {:devel_plan, {:binary, 5000}}, - "intended_product" => {:intended_product, {:binary, 5000}}, - "delivery_method" => {:delivery_method, {:binary, 5000}}, - "stipend_type" => {:stipend_type, {:binary, 25}}, - "stipend_amount" => {:stipend_amount, {:binary, 50}}, - "payment_method" => {:payment_method, {:binary, 6}}, - "beneficiaries" => {:beneficiaries, {:binary, 5000}}, - "report" => {:report, {:binary, 5000}} - } - - defstruct Enum.map(@string_key_map, fn {_k, {f, _}} -> f end) - - def from_map(params) do - kept = Map.take(params, Map.keys(@string_key_map)) - - {proposal, errors} = - Enum.reduce(kept, {%__MODULE__{}, []}, fn {k, v}, {acc, errs} -> - {key, t} = Map.get(@string_key_map, k) - - case validate(t, k, v) do - {:ok, ^k, ^v} -> - {%{acc | key => v}, errs} - - {:error, reason} -> - {acc, [reason] ++ errs} - end - end) - - case errors do - [] -> - {:ok, proposal} - - errors -> - {:error, errors} - end - end - - defp validate({:binary, length}, key, val) when is_binary(val) and byte_size(val) <= length do - {:ok, key, val} - end - - defp validate({:binary, length}, key, _val), do: {:error, "invalid #{key} - max size #{length}"} - - defp validate(:binary, key, val) when is_binary(val), do: {:ok, key, val} - - defp validate(:list, key, val) when is_list(val), do: {:ok, key, val} -end diff --git a/lib/erlef_web/controllers/stipend_controller.ex b/lib/erlef_web/controllers/stipend_controller.ex index ef0dcf6f..1c6733dc 100644 --- a/lib/erlef_web/controllers/stipend_controller.ex +++ b/lib/erlef_web/controllers/stipend_controller.ex @@ -1,34 +1,15 @@ defmodule ErlefWeb.StipendController do use ErlefWeb, :controller - action_fallback ErlefWeb.FallbackController def index(conn, _params) do - render(conn, errors: [], params: %{}) + render(conn) end def faq(conn, _params) do - render(conn, errors: [], params: %{}) - end - - def form(conn, %{"type" => type}) do - render(conn, errors: [], params: %{}, type: type) + render(conn) end def form(conn, _params) do - render(conn, errors: [], params: %{}, type: "default") - end - - def create(%{private: %{phoenix_format: "html"}} = conn, params) do - files = params["files"] || [] - - case Erlef.StipendProposal.from_map(Map.put(params, "files", files)) do - {:ok, proposal} -> - Erlef.StipendMail.submission(proposal) |> Erlef.Mailer.send() - Erlef.StipendMail.submission_copy(proposal) |> Erlef.Mailer.send() - render(conn) - - {:error, errs} -> - render(conn, "form.html", type: params["type"], params: params, errors: errs) - end + render(conn) end end diff --git a/lib/erlef_web/router.ex b/lib/erlef_web/router.ex index 96f2fa0c..7d29d307 100644 --- a/lib/erlef_web/router.ex +++ b/lib/erlef_web/router.ex @@ -124,7 +124,7 @@ defmodule ErlefWeb.Router do get "/wg/:slug/calendar", WorkingGroupController, :calendar - resources "/stipends", StipendController, only: [:index, :create] + resources "/stipends", StipendController, only: [:index] get "/stipends/faq", StipendController, :faq get "/stipends/form", StipendController, :form diff --git a/lib/erlef_web/templates/email/stipend_submission.html.eex b/lib/erlef_web/templates/email/stipend_submission.html.eex deleted file mode 100644 index 8a10188b..00000000 --- a/lib/erlef_web/templates/email/stipend_submission.html.eex +++ /dev/null @@ -1,149 +0,0 @@ -<%= if @copy do %> -

Congrats <%= "#{@proposal.first_name} #{@proposal.last_name}" %> !

-

Please find below a copy of your stipend proposal submission

-<% end %> -

Stipend Proposal

- -
- Stipend Type : <%= @proposal.stipend_type %> -
-
- -
- First name : <%= @proposal.first_name %> -
-
- -
- Last Name : <%= @proposal.last_name %> -
-
-
- Nick Name : <%= @proposal.nick_name %> -
-
- -
- Email Address : <%= @proposal.email_address %> -
-
- -
- Phone Number : <%= @proposal.phone_number %> -
-
- -
- Organization Name : <%= @proposal.org_name %> -
-
- - <%= unless @proposal.stipend_type == "Development Work" do %> -
- Organization Email : <%= @proposal.org_email %> -
-
- <% end %> - -
- City : <%= @proposal.city %> -
-
- -
- Region : <%= @proposal.region %> -
-
- -
- Postal Code : <%= @proposal.postal_code %> -
-
- -
- Country : <%= @proposal.country %> -
-
- -
- Twitter : <%= @proposal.twitter %> -
-
- -
- Linkedin : <%= @proposal.linkedin %> -
-
- -
- Website : <%= @proposal.website %> -
-
- - <%= if @proposal.stipend_type == "Development Work" do %> -
- Intended product of project :

<%= @proposal.intended_product %>

-
-
- <% else %> -
- Bio :

<%= @proposal.bio %>

-
-
- <% end %> - -
- Purpose

<%= @proposal.purpose %>

-
-
- - <%= if @proposal.stipend_type == "Development Work" do %> -
- Development Plan

<%= @proposal.devel_plan %>

-
-
- <% else %> -
- Code of Conduct link : <%= @proposal.code_of_conduct_link %> -
-
- <% end %> - - <%= if @proposal.stipend_type == "Development Work" do %> -
- Dissemination : <%= @proposal.report %> -
-
- <% end %> - - <%= if @proposal.stipend_type == "Development Work" do %> -
- Delivery Method : <%= @proposal.delivery_method %> -
-
- <% end %> - - <%= unless @proposal.stipend_type == "Development Work" do %> -
- Report : <%= @proposal.report %> -
-
- <% end %> - -
- Stipend Amount (USD) : <%= @proposal.stipend_amount %> -
-
- -
- Payment Method : <%= @proposal.payment_method %> -
-
- - <%= unless @proposal.stipend_type == "Development Work" do %> -
- Beneficiaries : <%= @proposal.beneficiaries %> -
-
- <% end %> - diff --git a/lib/erlef_web/templates/stipend/create.html.eex b/lib/erlef_web/templates/stipend/create.html.eex deleted file mode 100644 index 79b45c49..00000000 --- a/lib/erlef_web/templates/stipend/create.html.eex +++ /dev/null @@ -1,6 +0,0 @@ -
-
-

Congrats!

-

Expect a copy of your stipend proposal coming from notifications@erlef.org

-
-
diff --git a/lib/erlef_web/templates/stipend/default_form.html.eex b/lib/erlef_web/templates/stipend/default_form.html.eex deleted file mode 100644 index 8f69ffdb..00000000 --- a/lib/erlef_web/templates/stipend/default_form.html.eex +++ /dev/null @@ -1,308 +0,0 @@ -

Stipend Proposal Form

- - -<%= unless @errors == [] do %> -
- Errors : -
    - <% errs = Enum.reduce(@errors, "", fn(err, acc) -> acc <> "
  • #{err}
  • " end) %> - <%= raw errs %> -
-
-<% end %> - -<%= form_for @conn, Routes.stipend_path(@conn, :create), [id: "stipend_form", multipart: true], fn f -> %> - -
-
- - <%= stipend_type_select(f, @type) %> -
- -
-

-

- A gathering including talks and other events to promote Beam languages in the local community. A separate stipend should be submitted for educational programs that are a subset of conference events.

-

- Develop a Beam languages-based open source program or library. -

- -

- The subscription cost of a service providing advertising services for Beam languages-related events. -

- -

- Teach aspiring Beam language coders under age 18 coding skills. -

- -

- Development of an open-source project for 2+ days in a team environment. -

- -

- Multiple weeks or month course on Beam languages that is principally hands-on -

- -

- An interactive, hands-on, training into one or more specific Beam languages topics/themes/goals, which supports and mentors women.

- -

- An interactive, hands-on, training into one or more specific Beam languages topics/themes/goals. It should include at least 6 hours of instruction -

- -

-

-
-
-
-
- - - <%= text_input(f, :first_name, class: "form-control", maxlength: 50, required: true, placeholder: "First name") %> -
-
- - <%= text_input(f, :last_name, class: "form-control", maxlength: 50, required: true, placeholder: "Last name") %> -
-
- -
- <%= text_input(f, :nick_name, class: "form-control", maxlength: 50, required: true, placeholder: "Nick name") %> -
-
-
- -
-
- - <%= text_input(f, :email_address, class: "form-control", maxlength: 50, required: true, placeholder: "Email address") %> -
- - -
- - <%= telephone_input(f, :phone_number, class: "form-control", maxlength: 50, required: true, placeholder: "Phone number") %> -
-
- -
-
- - - <%= text_input(f, :org_name, class: "form-control", maxlength: 50, placeholder: "Organization name") %> -
- -
- - - <%= text_input(f, :org_email, class: "form-control", maxlength: 50, placeholder: "Organization email") %> -
-
- -
-
- - - <%= text_input(f, :city, class: "form-control", maxlength: 85, required: true, placeholder: "City") %> - -
-
- - - <%= text_input(f, :region, class: "form-control", maxlength: 50, required: true, placeholder: "Region") %> - - (e.g., state or province) -
-
- - <%= text_input(f, :postal_code, class: "form-control", maxlength: 10, required: true, placeholder: "Postal code") %> -
- -
- - <%= country_select(f) %> -
-
- -
-
- - - <%= text_input(f, :twitter, class: "form-control", maxlength: 50, placeholder: "Twitter Handle") %> - -
- - -
- - <%= text_input(f, :linkedin, class: "form-control", maxlength: 50, placeholder: "LinkedIn") %> -
- -
- - - <%= text_input(f, :website, class: "form-control", maxlength: 50, placeholder: "Website") %> -
-
- -
-
- - <%= textarea(f, :bio, class: "form-control", maxlength: "5000", rows: 3, required: true) %> -
-
- -
-
- - - - -
- - Maximum upload size in total limited to 8MB -
- <%= file_input(f, "files[]", accept: "image/png, image/jpeg, application/pdf") %> -
- -
- <%= file_input(f, "files[]", accept: "image/png, image/jpeg, application/pdf") %> -
- -
- <%= file_input(f, "files[]", accept: "image/png, image/jpeg, application/pdf") %> -
- -
- <%= file_input(f, "files[]", accept: "image/png, image/jpeg, application/pdf") %> -
- -
- <%= file_input(f, "files[]", accept: "image/png, image/jpeg, application/pdf") %> -
-
- -
-
- - - -

Describe - the purpose of the stipend, location and date, including the - date in which the funds must be received. We recommend to - send the requests at minimum 12 weeks before the - event so we have enough time to review, ask questions and - send you the funds. Also let us know what other forms of - sponsorship you have applied for.
- Make sure you explain how this stipend is designed to help - grow the community. We would love to have an overview of - other BEAM related activities/meetups/trainings/conferences - located in that area, the number of attendees, frequency, - and such.
- For workshops/trainings please include the staff:student - ratio, the amount of hands-on training time and a lesson - plan with learning outcomes for participants. -

- -
- <%= textarea(f, :purpose, class: "form-control", maxlength: "5000", rows: 3, required: true) %> -
-
- - -
- -
- -

- Specify here the stipend amount. -

-
-
-
- -
-
- -
-
- $ -
- - <%= number_input(f, :stipend_amount, class: "form-control currency", maxlength: 6, required: true, placeholder: "0.00", step: "1.00") %> - -
-
- -
- - - <%= payment_method_select(f) %> - We can do checks only within - the US. If the request is for $500 or less, PayPal is - suggested. -
- -
- -
-
- - - -

- Describe who will be the beneficiaries of the stipend and - the expected size of the event. Please note that the EEF - may only be able to provide partial funding for a proposal - so let us know if this is acceptable to you. Be sure to include - a breakdown of the amount you are requesting. - Example: 1200$ total ($700 for venue, $300 for travel, $200 for food).
- - If the beneficiary is the organizer of an event, we request that - the EEF logo be placed on your site as a sponsor. -

- - <%= textarea(f, :beneficiaries, class: "form-control", maxlength: "5000", rows: 3, required: true) %> - -
-
- -
-
- -

The EEF would like to - see how the stipend was used so we require that we receive a - report that will help us understand the impact that the - stipends are having and how the activities are received - by the community. We require to receive this report within - one month of the event. Please describe in this section - what items you will include on the report and what follow - up activities do you plan on. For example: blog posts, - post events write-ups, web pages, project updates, lessons - learned (what went well and what needs to improve), the - feedback from the participants, social media, number of - attendees, demographics, and such.

- <%= textarea(f, :report, class: "form-control", maxlength: "5000", rows: 3, required: true) %> -
-
- - - <%= hidden_input(f, :type, value: @type) %> - - - -
- -
-<% end %> diff --git a/lib/erlef_web/templates/stipend/devel_form.html.eex b/lib/erlef_web/templates/stipend/devel_form.html.eex deleted file mode 100644 index 7d7eca65..00000000 --- a/lib/erlef_web/templates/stipend/devel_form.html.eex +++ /dev/null @@ -1,237 +0,0 @@ -

Stipend Proposal Form

- - -<%= unless @errors == [] do %> -
- Errors : -
    - <% errs = Enum.reduce(@errors, "", fn(err, acc) -> acc <> "
  • #{err}
  • " end) %> - <%= raw errs %> -
-
-<% end %> - -<%= form_for @conn, Routes.stipend_path(@conn, :create), [id: "stipend_form", multipart: true], fn f -> %> - -
-
- - <%= stipend_type_select(f, @type) %> -
-
-

-

- Develop a Beam languages-based open source program or library. -

-
-
- -
-
- - - - - <%= text_input(f, :first_name, class: "form-control", maxlength: 50, required: true, placeholder: "First name") %> -
-
- - <%= text_input(f, :last_name, class: "form-control", maxlength: 50, required: true, placeholder: "Last name") %> -
-
- -
- <%= text_input(f, :nick_name, class: "form-control", maxlength: 50, placeholder: "Nick name") %> -
-
-
- -
-
- - <%= text_input(f, :email_address, class: "form-control", maxlength: 50, required: true, placeholder: "Email address") %> -
- - -
- - <%= telephone_input(f, :phone_number, class: "form-control", maxlength: 50, placeholder: "Phone number") %> -
-
- -
-
- - - <%= text_input(f, :org_name, class: "form-control", maxlength: 50, placeholder: "Organization name") %> -
- -
- -
-
- - - <%= text_input(f, :city, class: "form-control", maxlength: 85, required: true, placeholder: "City") %> - -
-
- - - <%= text_input(f, :region, class: "form-control", maxlength: 50, placeholder: "Region") %> - - (e.g., state or province) -
-
- - <%= text_input(f, :postal_code, class: "form-control", maxlength: 10, required: true, placeholder: "Postal code") %> -
- -
- - <%= country_select(f) %> -
-
- -
-
- - - <%= text_input(f, :twitter, class: "form-control", maxlength: 50, placeholder: "Twitter Handle") %> - -
- - -
- - <%= text_input(f, :linkedin, class: "form-control", maxlength: 50, placeholder: "LinkedIn") %> -
- -
- - - <%= text_input(f, :website, class: "form-control", maxlength: 50, placeholder: "Website") %> -
-
- -
-
- - - -

- In a couple of sentences, please, explain what you want to produce by the end of the project. -

- -
- <%= textarea(f, :intended_product, class: "form-control", maxlength: "5000", rows: 3, required: true) %> -
-
- -
-
- - - -

- In a paragraph or two, please, explain why you want to conduct this project and who will benefit from it. -

-
- <%= textarea(f, :purpose, class: "form-control", maxlength: "5000", rows: 3, required: true) %> -
-
- - -
-
- - - -

- In a couple of paragraphs, please, explain who will do the job and for how long, what development stages you - envision. -

-
- <%= textarea(f, :devel_plan, class: "form-control", maxlength: "5000", rows: 3, required: true) %> -
-
- -
-
- -

- Please, explain how you intend to inform the public about the project results, e.g. blog posts, conference talks, papers. -

- <%= textarea(f, :report, class: "form-control", maxlength: "5000", rows: 3, required: true) %> -
-
- - -
-
- -

- Please, explain how you intend to deliver the project results -

- <%= textarea(f, :delivery_method, class: "form-control", maxlength: "5000", rows: 3, required: true) %> -
-
- -
- - Maximum upload size in total limited to 8MB -
- <%= file_input(f, "files[]", accept: "image/png, image/jpeg, application/pdf") %> -
- -
- <%= file_input(f, "files[]", accept: "image/png, image/jpeg, application/pdf") %> -
- -
- <%= file_input(f, "files[]", accept: "image/png, image/jpeg, application/pdf") %> -
- -
- <%= file_input(f, "files[]", accept: "image/png, image/jpeg, application/pdf") %> -
- -
- <%= file_input(f, "files[]", accept: "image/png, image/jpeg, application/pdf") %> -
-
- -
-
- -
-
- $ -
- - <%= number_input(f, :stipend_amount, class: "form-control currency", maxlength: 6, required: true, placeholder: "0.00", step: "1.00") %> - -
-
- -
- - - <%= payment_method_select(f) %> - We can do checks only within - the US. If the request is for $500 or less, PayPal is - suggested. -
- -
- - <%= hidden_input(f, :type, value: @type) %> - - -
- -
-<% end %> diff --git a/lib/erlef_web/templates/stipend/form.html.eex b/lib/erlef_web/templates/stipend/form.html.eex index a19292cb..a37c972e 100644 --- a/lib/erlef_web/templates/stipend/form.html.eex +++ b/lib/erlef_web/templates/stipend/form.html.eex @@ -2,45 +2,34 @@

Stipend request process


- <%= render( "sidebar.html", assigns) %> + <%= render("sidebar.html", assigns) %>
-
-
- <%= if @type == "devel_work" do %> - <%= render("devel_form.html", assigns) %> - <% else %> - <%= render("default_form.html", assigns) %> - <% end %> -
-
+ <% tally_url = %URI{ + scheme: "https", + host: "forms.erlef.org", + path: "/stipend", + query: URI.encode_query(%{ + "embed" => "1", + "alignLeft" => "1", + "hideTitle" => "1", + "transparentBackground" => "1", + "dynamicHeight" => "1", + "tallyBranding" => "0", + "formEventsForwarding" => "1" + }) + } |> URI.to_string() %> + +
- - diff --git a/lib/erlef_web/templates/stipend/index.html.eex b/lib/erlef_web/templates/stipend/index.html.eex index 05ec9798..1aedfbf4 100644 --- a/lib/erlef_web/templates/stipend/index.html.eex +++ b/lib/erlef_web/templates/stipend/index.html.eex @@ -46,7 +46,7 @@ organizer and/or city that are stipended within a given year.

- If you want to apply for a stipend, fill out the form here. + If you want to apply for a stipend, fill out the form here. If you have any questions please reach out to stipends@erlef.org

diff --git a/lib/erlef_web/templates/stipend/sidebar.html.eex b/lib/erlef_web/templates/stipend/sidebar.html.eex index e8e734bc..d67641e5 100644 --- a/lib/erlef_web/templates/stipend/sidebar.html.eex +++ b/lib/erlef_web/templates/stipend/sidebar.html.eex @@ -8,7 +8,7 @@ href="/stipends/faq" role="tab" aria-controls="v-pills-messages" aria-selected="false">FAQ Form diff --git a/lib/erlef_web/views/stipend_view.ex b/lib/erlef_web/views/stipend_view.ex index c9613391..564ecdad 100644 --- a/lib/erlef_web/views/stipend_view.ex +++ b/lib/erlef_web/views/stipend_view.ex @@ -1,360 +1,3 @@ defmodule ErlefWeb.StipendView do use ErlefWeb, :view - - # Currently values chosen for select simply go into an html doc so we map name to name as to avoid - # stipend reviewers having to look up the country name for agiven code. - - @country_data [ - {"Select your country", ""}, - {"Afghanistan", "Afghanistan"}, - {"Albania", "Albania"}, - {"Algeria", "Algeria"}, - {"American Samoa", "American Samoa"}, - {"Andorra", "Andorra"}, - {"Angola", "Angola"}, - {"Anguilla", "Anguilla"}, - {"Antarctica", "Antarctica"}, - {"Antigua And Barbuda", "Antigua And Barbuda"}, - {"Argentina", "Argentina"}, - {"Armenia", "Armenia"}, - {"Aruba", "Aruba"}, - {"Australia", "Australia"}, - {"Austria", "Austria"}, - {"Azerbaijan", "Azerbaijan"}, - {"Bahamas", "Bahamas"}, - {"Bahrain", "Bahrain"}, - {"Bangladesh", "Bangladesh"}, - {"Barbados", "Barbados"}, - {"Belarus", "Belarus"}, - {"Belgium", "Belgium"}, - {"Belize", "Belize"}, - {"Benin", "Benin"}, - {"Bermuda", "Bermuda"}, - {"Bhutan", "Bhutan"}, - {"Bolivia", "Bolivia"}, - {"Bosnia And Herzegovina", "Bosnia And Herzegovina"}, - {"Botswana", "Botswana"}, - {"Bouvet Island", "Bouvet Island"}, - {"Brazil", "Brazil"}, - {"British Indian Ocean Territory", "British Indian Ocean Territory"}, - {"Brunei Darussalam", "Brunei Darussalam"}, - {"Bulgaria", "Bulgaria"}, - {"Burkina Faso", "Burkina Faso"}, - {"Burundi", "Burundi"}, - {"Cambodia", "Cambodia"}, - {"Cameroon", "Cameroon"}, - {"Canada", "Canada"}, - {"Cape Verde", "Cape Verde"}, - {"Cayman Islands", "Cayman Islands"}, - {"Central African Republic", "Central African Republic"}, - {"Chad", "Chad"}, - {"Chile", "Chile"}, - {"China", "China"}, - {"Christmas Island", "Christmas Island"}, - {"Cocos (keeling) Islands", "Cocos (keeling) Islands"}, - {"Colombia", "Colombia"}, - {"Comoros", "Comoros"}, - {"Congo", "Congo"}, - {"Congo, The Democratic Republic Of The", "Congo, The Democratic Republic Of The"}, - {"Cook Islands", "Cook Islands"}, - {"Costa Rica", "Costa Rica"}, - {"Cote D'ivoire", "Cote D'ivoire"}, - {"Croatia", "Croatia"}, - {"Cuba", "Cuba"}, - {"Cyprus", "Cyprus"}, - {"Czech Republic", "Czech Republic"}, - {"Denmark", "Denmark"}, - {"Djibouti", "Djibouti"}, - {"Dominica", "Dominica"}, - {"Dominican Republic", "Dominican Republic"}, - {"East Timor", "East Timor"}, - {"Ecuador", "Ecuador"}, - {"Egypt", "Egypt"}, - {"El Salvador", "El Salvador"}, - {"Equatorial Guinea", "Equatorial Guinea"}, - {"Eritrea", "Eritrea"}, - {"Estonia", "Estonia"}, - {"Ethiopia", "Ethiopia"}, - {"Falkland Islands (malvinas)", "Falkland Islands (malvinas)"}, - {"Faroe Islands", "Faroe Islands"}, - {"Fiji", "Fiji"}, - {"Finland", "Finland"}, - {"France", "France"}, - {"French Guiana", "French Guiana"}, - {"French Polynesia", "French Polynesia"}, - {"French Southern Territories", "French Southern Territories"}, - {"Gabon", "Gabon"}, - {"Gambia", "Gambia"}, - {"Georgia", "Georgia"}, - {"Germany", "Germany"}, - {"Ghana", "Ghana"}, - {"Gibraltar", "Gibraltar"}, - {"Greece", "Greece"}, - {"Greenland", "Greenland"}, - {"Grenada", "Grenada"}, - {"Guadeloupe", "Guadeloupe"}, - {"Guam", "Guam"}, - {"Guatemala", "Guatemala"}, - {"Guinea", "Guinea"}, - {"Guinea-bissau", "Guinea-bissau"}, - {"Guyana", "Guyana"}, - {"Haiti", "Haiti"}, - {"Heard Island And Mcdonald Islands", "Heard Island And Mcdonald Islands"}, - {"Holy See (vatican City State)", "Holy See (vatican City State)"}, - {"Honduras", "Honduras"}, - {"Hong Kong", "Hong Kong"}, - {"Hungary", "Hungary"}, - {"Iceland", "Iceland"}, - {"India", "India"}, - {"Indonesia", "Indonesia"}, - {"Iran, Islamic Republic Of", "Iran, Islamic Republic Of"}, - {"Iraq", "Iraq"}, - {"Ireland", "Ireland"}, - {"Israel", "Israel"}, - {"Italy", "Italy"}, - {"Jamaica", "Jamaica"}, - {"Japan", "Japan"}, - {"Jordan", "Jordan"}, - {"Kazakhstan", "Kazakhstan"}, - {"Kenya", "Kenya"}, - {"Kiribati", "Kiribati"}, - {"Korea, Democratic People's Republic Of", "Korea, Democratic People's Republic Of"}, - {"Korea, Republic Of", "Korea, Republic Of"}, - {"Kosovo", "Kosovo"}, - {"Kuwait", "Kuwait"}, - {"Kyrgyzstan", "Kyrgyzstan"}, - {"Lao People's Democratic Republic", "Lao People's Democratic Republic"}, - {"Latvia", "Latvia"}, - {"Lebanon", "Lebanon"}, - {"Lesotho", "Lesotho"}, - {"Liberia", "Liberia"}, - {"Libyan Arab Jamahiriya", "Libyan Arab Jamahiriya"}, - {"Liechtenstein", "Liechtenstein"}, - {"Lithuania", "Lithuania"}, - {"Luxembourg", "Luxembourg"}, - {"Macau", "Macau"}, - {"Macedonia, The Former Yugoslav Republic Of", "Macedonia, The Former Yugoslav Republic Of"}, - {"Madagascar", "Madagascar"}, - {"Malawi", "Malawi"}, - {"Malaysia", "Malaysia"}, - {"Maldives", "Maldives"}, - {"Mali", "Mali"}, - {"Malta", "Malta"}, - {"Marshall Islands", "Marshall Islands"}, - {"Martinique", "Martinique"}, - {"Mauritania", "Mauritania"}, - {"Mauritius", "Mauritius"}, - {"Mayotte", "Mayotte"}, - {"Mexico", "Mexico"}, - {"Micronesia, Federated States Of", "Micronesia, Federated States Of"}, - {"Moldova, Republic Of", "Moldova, Republic Of"}, - {"Monaco", "Monaco"}, - {"Mongolia", "Mongolia"}, - {"Montenegro", "Montenegro"}, - {"Montserrat", "Montserrat"}, - {"Morocco", "Morocco"}, - {"Mozambique", "Mozambique"}, - {"Myanmar", "Myanmar"}, - {"Namibia", "Namibia"}, - {"Nauru", "Nauru"}, - {"Nepal", "Nepal"}, - {"Netherlands", "Netherlands"}, - {"Netherlands Antilles", "Netherlands Antilles"}, - {"New Caledonia", "New Caledonia"}, - {"New Zealand", "New Zealand"}, - {"Nicaragua", "Nicaragua"}, - {"Niger", "Niger"}, - {"Nigeria", "Nigeria"}, - {"Niue", "Niue"}, - {"Norfolk Island", "Norfolk Island"}, - {"Northern Mariana Islands", "Northern Mariana Islands"}, - {"Norway", "Norway"}, - {"Oman", "Oman"}, - {"Pakistan", "Pakistan"}, - {"Palau", "Palau"}, - {"Palestinian Territory, Occupied", "Palestinian Territory, Occupied"}, - {"Panama", "Panama"}, - {"Papua New Guinea", "Papua New Guinea"}, - {"Paraguay", "Paraguay"}, - {"Peru", "Peru"}, - {"Philippines", "Philippines"}, - {"Pitcairn", "Pitcairn"}, - {"Poland", "Poland"}, - {"Portugal", "Portugal"}, - {"Puerto Rico", "Puerto Rico"}, - {"Qatar", "Qatar"}, - {"Reunion", "Reunion"}, - {"Romania", "Romania"}, - {"Russian Federation", "Russian Federation"}, - {"Rwanda", "Rwanda"}, - {"Saint Helena", "Saint Helena"}, - {"Saint Kitts And Nevis", "Saint Kitts And Nevis"}, - {"Saint Lucia", "Saint Lucia"}, - {"Saint Pierre And Miquelon", "Saint Pierre And Miquelon"}, - {"Saint Vincent And The Grenadines", "Saint Vincent And The Grenadines"}, - {"Samoa", "Samoa"}, - {"San Marino", "San Marino"}, - {"Sao Tome And Principe", "Sao Tome And Principe"}, - {"Saudi Arabia", "Saudi Arabia"}, - {"Senegal", "Senegal"}, - {"Serbia", "Serbia"}, - {"Seychelles", "Seychelles"}, - {"Sierra Leone", "Sierra Leone"}, - {"Singapore", "Singapore"}, - {"Slovakia", "Slovakia"}, - {"Slovenia", "Slovenia"}, - {"Solomon Islands", "Solomon Islands"}, - {"Somalia", "Somalia"}, - {"South Africa", "South Africa"}, - {"South Georgia And The South Sandwich Islands", - "South Georgia And The South Sandwich Islands"}, - {"Spain", "Spain"}, - {"Sri Lanka", "Sri Lanka"}, - {"Sudan", "Sudan"}, - {"Suriname", "Suriname"}, - {"Svalbard And Jan Mayen", "Svalbard And Jan Mayen"}, - {"Swaziland", "Swaziland"}, - {"Sweden", "Sweden"}, - {"Switzerland", "Switzerland"}, - {"Syrian Arab Republic", "Syrian Arab Republic"}, - {"Taiwan, Province Of China", "Taiwan, Province Of China"}, - {"Tajikistan", "Tajikistan"}, - {"Tanzania, United Republic Of", "Tanzania, United Republic Of"}, - {"Thailand", "Thailand"}, - {"Togo", "Togo"}, - {"Tokelau", "Tokelau"}, - {"Tonga", "Tonga"}, - {"Trinidad And Tobago", "Trinidad And Tobago"}, - {"Tunisia", "Tunisia"}, - {"Turkey", "Turkey"}, - {"Turkmenistan", "Turkmenistan"}, - {"Turks And Caicos Islands", "Turks And Caicos Islands"}, - {"Tuvalu", "Tuvalu"}, - {"Uganda", "Uganda"}, - {"Ukraine", "Ukraine"}, - {"United Arab Emirates", "United Arab Emirates"}, - {"United Kingdom", "United Kingdom"}, - {"United States", "United States"}, - {"United States Minor Outlying Islands", "United States Minor Outlying Islands"}, - {"Uruguay", "Uruguay"}, - {"Uzbekistan", "Uzbekistan"}, - {"Vanuatu", "Vanuatu"}, - {"Venezuela", "Venezuela"}, - {"Viet Nam", "Viet Nam"}, - {"Virgin Islands, British", "Virgin Islands, British"}, - {"Virgin Islands, U.s.", "Virgin Islands, U.s."}, - {"Wallis And Futuna", "Wallis And Futuna"}, - {"Western Sahara", "Western Sahara"}, - {"Yemen", "Yemen"}, - {"Zambia", "Zambia"}, - {"Zimbabwe", "Zimbabwe"} - ] - - @types [ - [ - key: "Development Work", - value: "Development Work", - type: "devel_work", - "data-type": "devel_work", - "data-requires-coc": "false" - ], - [ - key: "Conference", - value: "conference", - type: "conference", - "data-type": "conference", - "data-requires-coc": "true" - ], - [ - key: "Event Site Subscription", - value: "Event Site Subscription", - type: "event_site_sub", - "data-type": "event_site_sub", - "data-requires-coc": "false" - ], - [ - key: "Kids Coding Camp", - value: "Kids Coding Camp", - type: "kids_camp", - "data-type": "kids_camp", - "data-requires-coc": "false" - ], - [ - key: "Sprint", - type: "sprint", - value: "Sprint", - "data-type": "sprint", - "data-requires-coc": "false" - ], - [ - key: "Training Program", - value: "Training Program", - type: "training", - "data-type": "training", - "data-requires-coc": "false" - ], - [ - key: "Workshop-Education", - value: "Workshop-Education", - type: "workshop-edu", - "data-type": "workshop-edu", - "data-requires-coc": "true" - ], - [ - key: "Workshop-Women", - value: "Workshop-Women", - type: "workshop-women", - "data-type": "workshop-women", - "data-requires-coc": "true" - ], - [ - key: "Elixir Outreach", - value: "Elixir Outreach", - type: "elixir-outreach", - "data-type": "elixir-outreach", - "data-requires-coc": "false" - ], - [ - key: "Other", - value: "Other", - type: "other", - "data-type": "other", - "data-requires-coc": "false" - ] - ] - - def stipend_type_select(form, type) do - select( - form, - :stipend_type, - @types, - selected: selected(type), - id: "stipend_type", - class: "form-control" - ) - end - - defp selected(type) do - case Enum.find(@types, fn t -> Keyword.get(t, :type) == type end) do - nil -> 0 - v -> Keyword.get(v, :value) - end - end - - def payment_method_select(form) do - select( - form, - :payment_method, - [[key: "--", value: ""], "Paypal", "Zelle", "Check", "Wire"], - class: "form-control", - required: "true" - ) - end - - def country_select(form) do - select(form, :country, @country_data, - class: "form-control", - "data-live-search": "true" - ) - end end diff --git a/test/erlef_web/controllers/stipend_controller_test.exs b/test/erlef_web/controllers/stipend_controller_test.exs deleted file mode 100644 index 61d6aabd..00000000 --- a/test/erlef_web/controllers/stipend_controller_test.exs +++ /dev/null @@ -1,73 +0,0 @@ -defmodule ErlefWeb.StipendControllerTest do - use ErlefWeb.ConnCase - - test "GET /stipends", %{conn: conn} do - conn = get(conn, Routes.stipend_path(conn, :index)) - assert html_response(conn, 200) =~ "Stipend request process" - end - - describe "POST /stipends" do - test "with valid params", %{conn: conn} do - params = %{ - beneficiaries: "A bit about beneficiaries", - bio: "A bit about myself", - city: "Castle Rock", - code_of_conduct_link: "https://codeofconduct.tld/path", - country: "United States", - email_address: "stipendee@want-a-stipend.org", - first_name: "Firstname", - stipend_amount: "1,000,000.00", - stipend_type: "Development Work", - last_name: "Lastname", - linkedin: "https://linkedin.com/user124", - nick_name: "hmm", - org_email: "org_email@someorg.org", - org_name: "Org Name", - payment_method: "paypal", - phone_number: "+1555123456", - postal_code: "12345", - purpose: "To do things", - region: "Maine", - report: "How I plan on reporting expenses...", - twitter: "https://twitter.com/foo", - website: "https://epic-site.org/" - } - - upload = %Plug.Upload{path: "test/support/sample.pdf", filename: "sample.pdf"} - conn = post(conn, Routes.stipend_path(conn, :create, params), files: [upload]) - assert html_response(conn, 200) =~ "Expect a copy of your stipend proposal" - end - - test "with invalid size name param", %{conn: conn} do - params = %{ - beneficiaries: "A bit about beneficiaries", - bio: "A bit about myself", - city: "Castle Rock", - code_of_conduct_link: "https://codeofconduct.tld/path", - country: "United States", - email_address: "stipendee@want-a-stipend.org", - first_name: "Hubert Blaine Wolfeschlegelsteinhausenbergerdorff Sr.", - stipend_amount: "1,000,000.00", - stipend_type: "Development Work", - last_name: "Lastname", - linkedin: "https://linkedin.com/user124", - nick_name: "hmm", - org_email: "org_email@someorg.org", - org_name: "Org Name", - payment_method: "paypal", - phone_number: "+1555123456", - postal_code: "12345", - purpose: "To do things", - region: "Maine", - report: "How I plan on reporting expenses...", - twitter: "https://twitter.com/foo", - website: "https://epic-site.org/", - type: "devel_work" - } - - upload = %Plug.Upload{path: "test/support/sample.pdf", filename: "sample.pdf"} - conn = post(conn, Routes.stipend_path(conn, :create, params), files: [upload]) - assert html_response(conn, 200) =~ "invalid first_name - max size 50" - end - end -end