fix tag field names

This commit is contained in:
2021-09-10 00:41:06 -04:00
committed by oliviasculley
parent 3cdd7729a6
commit 0bf93b4945
5 changed files with 20 additions and 20 deletions

View File

@ -5,9 +5,9 @@ defmodule Cannery.Tags.Tag do
@primary_key {:id, :binary_id, autogenerate: true}
@foreign_key_type :binary_id
schema "tags" do
field :"bg-color", :string
field :bg_color, :string
field :name, :string
field :"text-color", :string
field :text_color, :string
field :user_id, :binary_id
timestamps()
@ -16,7 +16,7 @@ defmodule Cannery.Tags.Tag do
@doc false
def changeset(tag, attrs) do
tag
|> cast(attrs, [:name, :"bg-color", :"text-color"])
|> validate_required([:name, :"bg-color", :"text-color"])
|> cast(attrs, [:name, :bg_color, :text_color])
|> validate_required([:name, :bg_color, :text_color])
end
end

View File

@ -6,17 +6,17 @@
phx_change: "validate",
phx_submit: "save" %>
<%= label f, :name %>
<%= text_input f, :name %>
<%= label f, :name, class: "title text-lg text-primary-500" %>
<%= text_input f, :name, class: "input input-primary" %>
<%= error_tag f, :name %>
<%= label f, :"bg-color" %>
<%= text_input f, :"bg-color" %>
<%= error_tag f, :"bg-color" %>
<%= label f, :bg_color, class: "title text-lg text-primary-500" %>
<%= text_input f, :bg_color %>
<%= error_tag f, :bg_color %>
<%= label f, :"text-color" %>
<%= text_input f, :"text-color" %>
<%= error_tag f, :"text-color" %>
<%= label f, :text_color, class: "title text-lg text-primary-500" %>
<%= text_input f, :text_color %>
<%= error_tag f, :text_color %>
<%= submit "Save", phx_disable_with: "Saving..." %>
</form>