Update performace code accordingly.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -3,9 +3,8 @@
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Time</th>
|
||||
<th>Description</th>
|
||||
<th>Notes</th>
|
||||
<th>Nimi</th>
|
||||
<th>Seloste</th>
|
||||
|
||||
<th></th>
|
||||
</tr>
|
||||
@@ -13,9 +12,8 @@
|
||||
<tbody>
|
||||
<%= for performance <- @performances do %>
|
||||
<tr>
|
||||
<td><%= performance.time %></td>
|
||||
<td><%= performance.description %></td>
|
||||
<td><%= performance.notes %></td>
|
||||
<td><%= performance.name %></td>
|
||||
<td><%= performance.desc %></td>
|
||||
|
||||
<td>
|
||||
<span><%= link "Show", to: Routes.performance_path(@conn, :show, performance) %></span>
|
||||
|
||||
@@ -5,17 +5,9 @@
|
||||
</div>
|
||||
<% 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 %>
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
<tr>
|
||||
<th>Time</th>
|
||||
<th>Description</th>
|
||||
<th>Notes</th>
|
||||
|
||||
<th></th>
|
||||
</tr>
|
||||
@@ -13,9 +12,8 @@
|
||||
<tbody>
|
||||
<%= for performance <- @performances do %>
|
||||
<tr>
|
||||
<td><%= performance.time %></td>
|
||||
<td><%= performance.description %></td>
|
||||
<td><%= performance.notes %></td>
|
||||
<td><%= performance.name %></td>
|
||||
<td><%= performance.desc %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
|
||||
@@ -4,17 +4,12 @@
|
||||
|
||||
<li>
|
||||
<strong>Time:</strong>
|
||||
<%= @performance.time %>
|
||||
<%= @performance.name %>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<strong>Description:</strong>
|
||||
<%= @performance.description %>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<strong>Notes:</strong>
|
||||
<%= @performance.notes %>
|
||||
<%= @performance.desc %>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
Reference in New Issue
Block a user