From fcfee8ce1838bc4b572056f6421ffb9602f5517d Mon Sep 17 00:00:00 2001 From: codevictory Date: Sat, 22 May 2021 11:34:33 +0300 Subject: [PATCH] Sequence number to performance list and creation form. --- lib/runosaari/schedule/performance.ex | 2 +- .../templates/performance/admin.html.eex | 2 ++ .../templates/performance/form.html.eex | 18 +++++++++++------- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/lib/runosaari/schedule/performance.ex b/lib/runosaari/schedule/performance.ex index 94bc690..67b307a 100644 --- a/lib/runosaari/schedule/performance.ex +++ b/lib/runosaari/schedule/performance.ex @@ -5,7 +5,7 @@ defmodule Runosaari.Schedule.Performance do schema "performances" do field :name, :string field :desc, :string - field :seqnum, :integer + field :seqnum, :integer, default: 999 timestamps() end diff --git a/lib/runosaari_web/templates/performance/admin.html.eex b/lib/runosaari_web/templates/performance/admin.html.eex index f9cd88e..a649bbc 100644 --- a/lib/runosaari_web/templates/performance/admin.html.eex +++ b/lib/runosaari_web/templates/performance/admin.html.eex @@ -6,6 +6,7 @@ Nimi Seloste + Prioriteetti @@ -15,6 +16,7 @@ <%= performance.name %> <%= performance.desc %> + <%= performance.seqnum %> <%= link "Lisätietoja", to: Routes.admin_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 22eccec..61469ba 100644 --- a/lib/runosaari_web/templates/performance/form.html.eex +++ b/lib/runosaari_web/templates/performance/form.html.eex @@ -1,17 +1,21 @@ -<%= form_for @changeset, @action, fn f -> %> +<%= form_for @changeset, @action, fn form -> %> <%= if @changeset.action do %>

Jokin kentistä on tyhjä.

<% end %> - <%= label f, :name, "Nimi" %> - <%= text_input f, :name %> - <%= error_tag f, :name %> + <%= label form, :name, "Nimi" %> + <%= text_input form, :name %> + <%= error_tag form, :name %> - <%= label f, :desc, "Seloste" %> - <%= textarea f, :desc %> - <%= error_tag f, :desc %> + <%= label form, :desc, "Seloste" %> + <%= textarea form, :desc %> + <%= error_tag form, :desc %> + + <%= label form, :seqnum, "Prioriteetti (1 on korkein)" %> + <%= textarea form, :seqnum %> + <%= error_tag form, :seqnum %>
<%= submit "Tallenna" %>