mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-24 04:27:59 +01:00
allow admins to create dnp entries on arbitrary tags
This commit is contained in:
parent
7503e48591
commit
a5966ae287
3 changed files with 6 additions and 1 deletions
|
@ -11,6 +11,8 @@
|
||||||
= if manages_tags?(@conn) do
|
= if manages_tags?(@conn) do
|
||||||
= link "Edit details", to: Routes.tag_path(@conn, :edit, @tag), class: "detail-link"
|
= 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"
|
= 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
|
br
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,6 @@ defmodule PhilomenaWeb.DnpEntryView do
|
||||||
def pretty_state(_dnp_entry), do: "Requested"
|
def pretty_state(_dnp_entry), do: "Requested"
|
||||||
|
|
||||||
def show_steps?(changeset) do
|
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
|
||||||
end
|
end
|
||||||
|
|
|
@ -144,6 +144,9 @@ defmodule PhilomenaWeb.TagView do
|
||||||
defp manages_links?(conn),
|
defp manages_links?(conn),
|
||||||
do: can?(conn, :index, Philomena.UserLinks.UserLink)
|
do: can?(conn, :index, Philomena.UserLinks.UserLink)
|
||||||
|
|
||||||
|
defp manages_dnp?(conn),
|
||||||
|
do: can?(conn, :index, Philomena.DnpEntries.DnpEntry)
|
||||||
|
|
||||||
defp tag_url_root do
|
defp tag_url_root do
|
||||||
Application.get_env(:philomena, :tag_url_root)
|
Application.get_env(:philomena, :tag_url_root)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue