Update performace code accordingly.
This commit is contained in:
@@ -3,10 +3,8 @@ defmodule Runosaari.Schedule.Performance do
|
|||||||
import Ecto.Changeset
|
import Ecto.Changeset
|
||||||
|
|
||||||
schema "performances" do
|
schema "performances" do
|
||||||
field :description, :string
|
field :name, :string
|
||||||
field :notes, :string
|
field :desc, :string
|
||||||
field :time, :naive_datetime
|
|
||||||
field :performer_id, :id
|
|
||||||
|
|
||||||
timestamps()
|
timestamps()
|
||||||
end
|
end
|
||||||
@@ -14,7 +12,7 @@ defmodule Runosaari.Schedule.Performance do
|
|||||||
@doc false
|
@doc false
|
||||||
def changeset(performance, attrs) do
|
def changeset(performance, attrs) do
|
||||||
performance
|
performance
|
||||||
|> cast(attrs, [:time, :description, :notes])
|
|> cast(attrs, [:name, :desc])
|
||||||
|> validate_required([:time, :description, :notes])
|
|> validate_required([:name, :desc])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,9 +3,8 @@
|
|||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Time</th>
|
<th>Nimi</th>
|
||||||
<th>Description</th>
|
<th>Seloste</th>
|
||||||
<th>Notes</th>
|
|
||||||
|
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -13,9 +12,8 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<%= for performance <- @performances do %>
|
<%= for performance <- @performances do %>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= performance.time %></td>
|
<td><%= performance.name %></td>
|
||||||
<td><%= performance.description %></td>
|
<td><%= performance.desc %></td>
|
||||||
<td><%= performance.notes %></td>
|
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<span><%= link "Show", to: Routes.performance_path(@conn, :show, performance) %></span>
|
<span><%= link "Show", to: Routes.performance_path(@conn, :show, performance) %></span>
|
||||||
|
|||||||
@@ -5,17 +5,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= label f, :time %>
|
<%= label f, :name %>
|
||||||
<%= datetime_select f, :time %>
|
<%= text_input f, :name %>
|
||||||
<%= error_tag f, :time %>
|
<%= error_tag f, :name %>
|
||||||
|
|
||||||
<%= 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, :desc %>
|
<%= label f, :desc %>
|
||||||
<%= text_input f, :desc %>
|
<%= text_input f, :desc %>
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th>Time</th>
|
<th>Time</th>
|
||||||
<th>Description</th>
|
<th>Description</th>
|
||||||
<th>Notes</th>
|
|
||||||
|
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -13,9 +12,8 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<%= for performance <- @performances do %>
|
<%= for performance <- @performances do %>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= performance.time %></td>
|
<td><%= performance.name %></td>
|
||||||
<td><%= performance.description %></td>
|
<td><%= performance.desc %></td>
|
||||||
<td><%= performance.notes %></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -4,17 +4,12 @@
|
|||||||
|
|
||||||
<li>
|
<li>
|
||||||
<strong>Time:</strong>
|
<strong>Time:</strong>
|
||||||
<%= @performance.time %>
|
<%= @performance.name %>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<strong>Description:</strong>
|
<strong>Description:</strong>
|
||||||
<%= @performance.description %>
|
<%= @performance.desc %>
|
||||||
</li>
|
|
||||||
|
|
||||||
<li>
|
|
||||||
<strong>Notes:</strong>
|
|
||||||
<%= @performance.notes %>
|
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
Reference in New Issue
Block a user