diff --git a/lib/philomena_web/templates/tag/_tag_info_row.html.slime b/lib/philomena_web/templates/tag/_tag_info_row.html.slime index 777da850..8de6c9b3 100644 --- a/lib/philomena_web/templates/tag/_tag_info_row.html.slime +++ b/lib/philomena_web/templates/tag/_tag_info_row.html.slime @@ -11,6 +11,8 @@ = if manages_tags?(@conn) do = link "Edit details", to: Routes.tag_path(@conn, :edit, @tag), class: "detail-link" = link "Usage", to: Routes.tag_detail_path(@conn, :index, @tag), class: "detail-link" + = if manages_dnp?(@conn) do + = link "Create new DNP entry", to: Routes.dnp_entry_path(@conn, :new, tag_id: @tag.id), class: "detail-link" br diff --git a/lib/philomena_web/views/dnp_entry_view.ex b/lib/philomena_web/views/dnp_entry_view.ex index e9f9db47..3a117749 100644 --- a/lib/philomena_web/views/dnp_entry_view.ex +++ b/lib/philomena_web/views/dnp_entry_view.ex @@ -23,6 +23,6 @@ defmodule PhilomenaWeb.DnpEntryView do def pretty_state(_dnp_entry), do: "Requested" def show_steps?(changeset) do - not is_nil(changeset.action) and not changeset.data.state == :loaded + changeset.action == nil and changeset.data.__meta__.state != :loaded end end diff --git a/lib/philomena_web/views/tag_view.ex b/lib/philomena_web/views/tag_view.ex index b3e18793..b3a11b69 100644 --- a/lib/philomena_web/views/tag_view.ex +++ b/lib/philomena_web/views/tag_view.ex @@ -144,6 +144,9 @@ defmodule PhilomenaWeb.TagView do defp manages_links?(conn), do: can?(conn, :index, Philomena.UserLinks.UserLink) + defp manages_dnp?(conn), + do: can?(conn, :index, Philomena.DnpEntries.DnpEntry) + defp tag_url_root do Application.get_env(:philomena, :tag_url_root) end