From f8858deefb59c5a0806ded34259ce4a59962eb12 Mon Sep 17 00:00:00 2001 From: codevictory Date: Sun, 25 Apr 2021 00:09:55 +0300 Subject: [PATCH] Update performace code accordingly. --- lib/runosaari/schedule/performance.ex | 10 ++++------ .../templates/performance/admin.html.eex | 10 ++++------ .../templates/performance/form.html.eex | 14 +++----------- .../templates/performance/index.html.eex | 6 ++---- .../templates/performance/show.html.eex | 9 ++------- 5 files changed, 15 insertions(+), 34 deletions(-) diff --git a/lib/runosaari/schedule/performance.ex b/lib/runosaari/schedule/performance.ex index 42ff1ac..b129bda 100644 --- a/lib/runosaari/schedule/performance.ex +++ b/lib/runosaari/schedule/performance.ex @@ -3,10 +3,8 @@ defmodule Runosaari.Schedule.Performance do import Ecto.Changeset schema "performances" do - field :description, :string - field :notes, :string - field :time, :naive_datetime - field :performer_id, :id + field :name, :string + field :desc, :string timestamps() end @@ -14,7 +12,7 @@ defmodule Runosaari.Schedule.Performance do @doc false def changeset(performance, attrs) do performance - |> cast(attrs, [:time, :description, :notes]) - |> validate_required([:time, :description, :notes]) + |> cast(attrs, [:name, :desc]) + |> validate_required([:name, :desc]) end end diff --git a/lib/runosaari_web/templates/performance/admin.html.eex b/lib/runosaari_web/templates/performance/admin.html.eex index eabc5d4..cd40284 100644 --- a/lib/runosaari_web/templates/performance/admin.html.eex +++ b/lib/runosaari_web/templates/performance/admin.html.eex @@ -3,9 +3,8 @@ - - - + + @@ -13,9 +12,8 @@ <%= for performance <- @performances do %> - - - + + - @@ -13,9 +12,8 @@ <%= for performance <- @performances do %> - - - + + <% end %> diff --git a/lib/runosaari_web/templates/performance/show.html.eex b/lib/runosaari_web/templates/performance/show.html.eex index 8f17292..de00b5b 100644 --- a/lib/runosaari_web/templates/performance/show.html.eex +++ b/lib/runosaari_web/templates/performance/show.html.eex @@ -4,17 +4,12 @@
  • Time: - <%= @performance.time %> + <%= @performance.name %>
  • Description: - <%= @performance.description %> -
  • - -
  • - Notes: - <%= @performance.notes %> + <%= @performance.desc %>
  • TimeDescriptionNotesNimiSeloste
    <%= performance.time %><%= performance.description %><%= performance.notes %><%= performance.name %><%= performance.desc %> <%= link "Show", to: Routes.performance_path(@conn, :show, performance) %> diff --git a/lib/runosaari_web/templates/performance/form.html.eex b/lib/runosaari_web/templates/performance/form.html.eex index 633eeb9..1339ceb 100644 --- a/lib/runosaari_web/templates/performance/form.html.eex +++ b/lib/runosaari_web/templates/performance/form.html.eex @@ -5,17 +5,9 @@ <% end %> - <%= label f, :time %> - <%= datetime_select f, :time %> - <%= error_tag f, :time %> - - <%= label f, :performer_id %> - <%= multiple_select f, :performer_id, Runosaari.Registration.list_performers |> Enum.map(fn perf -> {perf.fname <> " " <> perf.lname, perf.id} end) %> - <%= error_tag f, :performer_id %> - - <%= label f, :description %> - <%= text_input f, :description %> - <%= error_tag f, :description %> + <%= label f, :name %> + <%= text_input f, :name %> + <%= error_tag f, :name %> <%= label f, :desc %> <%= text_input f, :desc %> diff --git a/lib/runosaari_web/templates/performance/index.html.eex b/lib/runosaari_web/templates/performance/index.html.eex index bcf6ef8..d9fa68a 100644 --- a/lib/runosaari_web/templates/performance/index.html.eex +++ b/lib/runosaari_web/templates/performance/index.html.eex @@ -5,7 +5,6 @@
    Time DescriptionNotes
    <%= performance.time %><%= performance.description %><%= performance.notes %><%= performance.name %><%= performance.desc %>