fix dnp editing

This commit is contained in:
byte[] 2020-02-01 10:45:44 -05:00
parent 7cee5f38ee
commit f8e5feb24c
4 changed files with 12 additions and 4 deletions

View file

@ -40,6 +40,12 @@
span.block__header__title DNP Request Form
.block__content
/ Option (set by script depending on the option chosen above)
strong Type
.field
= select f, :dnp_type, selectable_types(), class: "js-dnp-type input input--wide"
= error_tag f, :dnp_type
/ Artist Tag
strong Artist Tag
p Select the artist tag you would like to request a DNP entry for
@ -79,7 +85,5 @@
= textarea f, :feedback, class: "input input--wide", placeholder: "Feedback"
= error_tag f, :feedback
/ Option (hidden, set by script depending on the option chosen above)
= hidden_input f, :dnp_type, class: "js-dnp-type"
hr
= submit "Submit Request", class: "button"

View file

@ -1,2 +1,2 @@
h2 Edit DNP Request
= render PhilomenaWeb.DnpEntryView, "_form.html", changeset: @changeset, action: Routes.dnp_entry_path(@conn, :update, @dnp_entry), conn: @conn, selectable_tags: @selectable_tags
= render PhilomenaWeb.DnpEntryView, "_form.html", changeset: @changeset, action: Routes.dnp_entry_path(@conn, :update, @dnp_entry, tag_id: @dnp_entry.tag_id), conn: @conn, selectable_tags: @selectable_tags

View file

@ -1,2 +1,2 @@
h2 New DNP Request
= render PhilomenaWeb.DnpEntryView, "_form.html", changeset: @changeset, action: Routes.dnp_entry_path(@conn, :create), conn: @conn, selectable_tags: @selectable_tags
= render PhilomenaWeb.DnpEntryView, "_form.html", changeset: @changeset, action: Routes.dnp_entry_path(@conn, :create, tag_id: @conn.params["tag_id"]), conn: @conn, selectable_tags: @selectable_tags

View file

@ -16,6 +16,10 @@ defmodule PhilomenaWeb.DnpEntryView do
Enum.map(tags, &{&1.name, &1.id})
end
def selectable_types do
Enum.map(reasons(), fn {k, v} -> [key: v, value: k] end)
end
def pretty_state(%{aasm_state: "claimed"}), do: "Claimed"
def pretty_state(%{aasm_state: "listed"}), do: "Listed"
def pretty_state(%{aasm_state: "closed"}), do: "Closed"