From 4d50936d49b352c341adde93fb16649a21112ac9 Mon Sep 17 00:00:00 2001 From: codevictory Date: Sat, 24 Apr 2021 16:50:47 +0300 Subject: [PATCH] Change performer field usage according to the changes in schema. --- lib/runosaari/registration/performer.ex | 35 +++++++++++++-- .../templates/performance/form.html.eex | 6 +-- .../templates/performer/admin.html.eex | 2 +- .../templates/performer/form.html.eex | 29 ++++++++++-- .../templates/performer/index.html.eex | 2 +- .../templates/performer/show.html.eex | 45 ++++++++++++++----- 6 files changed, 97 insertions(+), 22 deletions(-) diff --git a/lib/runosaari/registration/performer.ex b/lib/runosaari/registration/performer.ex index 9cb9601..f88af5e 100644 --- a/lib/runosaari/registration/performer.ex +++ b/lib/runosaari/registration/performer.ex @@ -7,8 +7,13 @@ defmodule Runosaari.Registration.Performer do field :email, :string field :fname, :string field :lname, :string - field :notes, :string + field :desc, :string field :tel, :string + field :date1, :boolean, default: false + field :date2, :boolean, default: false + field :date3, :boolean, default: false + field :bus, :boolean, default: false + field :accom, :boolean, default: false timestamps() end @@ -16,8 +21,32 @@ defmodule Runosaari.Registration.Performer do @doc false def changeset(performer, attrs) do performer - |> cast(attrs, [:fname, :lname, :email, :tel, :confirmed, :notes]) - |> validate_required([:fname, :lname, :email, :tel, :confirmed, :notes]) + |> cast(attrs, [ + :fname, + :lname, + :email, + :tel, + :confirmed, + :desc, + :date1, + :date2, + :date3, + :bus, + :accom + ]) + |> validate_required([ + :fname, + :lname, + :email, + :tel, + :confirmed, + :desc, + :date1, + :date2, + :date3, + :bus, + :accom + ]) |> unique_constraint(:email) end end diff --git a/lib/runosaari_web/templates/performance/form.html.eex b/lib/runosaari_web/templates/performance/form.html.eex index 55fae0e..a9a452e 100644 --- a/lib/runosaari_web/templates/performance/form.html.eex +++ b/lib/runosaari_web/templates/performance/form.html.eex @@ -21,9 +21,9 @@ <%= text_input f, :description %> <%= error_tag f, :description %> - <%= label f, :notes %> - <%= text_input f, :notes %> - <%= error_tag f, :notes %> + <%= label f, :desc %> + <%= text_input f, :desc %> + <%= error_tag f, :desc %>
<%= submit "Save" %> diff --git a/lib/runosaari_web/templates/performer/admin.html.eex b/lib/runosaari_web/templates/performer/admin.html.eex index 83d9f56..0dc5f40 100644 --- a/lib/runosaari_web/templates/performer/admin.html.eex +++ b/lib/runosaari_web/templates/performer/admin.html.eex @@ -21,7 +21,7 @@ <%= performer.email %> <%= performer.tel %> <%= performer.confirmed %> - <%= performer.notes %> + <%= performer.desc %> <%= link "Näytä", to: Routes.performer_path(@conn, :show, performer) %> diff --git a/lib/runosaari_web/templates/performer/form.html.eex b/lib/runosaari_web/templates/performer/form.html.eex index 2fcb2f1..949c2b9 100644 --- a/lib/runosaari_web/templates/performer/form.html.eex +++ b/lib/runosaari_web/templates/performer/form.html.eex @@ -21,14 +21,35 @@ <%= text_input form, :tel %> <%= error_tag form, :tel %> - <%= label form, :notes, "Huomiot" %> - <%= textarea form, :notes %> - <%= error_tag form, :notes %> + <%= label form, :desc, "Huomiot" %> + <%= textarea form, :desc %> + <%= error_tag form, :desc %> - <%= label form, :confirmed, "Vahvitettu" %> + <%= label form, :confirmed, "Vahvistettu" %> <%= checkbox form, :confirmed %> <%= error_tag form, :confirmed %> +

Ilmoita alustava kiinnostuksesi tässä

+ <%= label form, :date1, "Torstai 22.7" %> + <%= checkbox form, :date1 %> + <%= error_tag form, :date1 %> + + <%= label form, :date2, "Perjantai 23.7." %> + <%= checkbox form, :date2 %> + <%= error_tag form, :date2 %> + + <%= label form, :date3, "Lauantai 24.7." %> + <%= checkbox form, :date3 %> + <%= error_tag form, :date3 %> + + <%= label form, :bus, "olen kiinnostunut bussikuljetuksesta" %> + <%= checkbox form, :bus %> + <%= error_tag form, :bus %> + + <%= label form, :accom, "olen kiinnostunut majoituksesta" %> + <%= checkbox form, :accom %> + <%= error_tag form, :accom %> +
<%= submit "Lähetä" %>
diff --git a/lib/runosaari_web/templates/performer/index.html.eex b/lib/runosaari_web/templates/performer/index.html.eex index c31f250..ad04791 100644 --- a/lib/runosaari_web/templates/performer/index.html.eex +++ b/lib/runosaari_web/templates/performer/index.html.eex @@ -4,7 +4,7 @@ <%= if performer.confirmed == true do %>

<%= performer.fname %> <%= performer.lname %>

-

<%= performer.notes %>

+

<%= performer.desc %>

<% end %> <% end %> diff --git a/lib/runosaari_web/templates/performer/show.html.eex b/lib/runosaari_web/templates/performer/show.html.eex index 1b2534c..5cd6b71 100644 --- a/lib/runosaari_web/templates/performer/show.html.eex +++ b/lib/runosaari_web/templates/performer/show.html.eex @@ -1,38 +1,63 @@ -

Show Performer

+

Esiintyjän tiedot

-<%= link "Edit", to: Routes.admin_performer_path(@conn, :edit, @performer) %> -<%= link "Back", to: Routes.performer_path(@conn, :index) %> +<%= link "Muokkaa", to: Routes.admin_performer_path(@conn, :edit, @performer) %> +<%= link "Takaisin", to: Routes.performer_path(@conn, :index) %>