philomena/lib/philomena_web/templates/admin/dnp_entry/index.html.heex

108 lines
4.6 KiB
Text
Raw Normal View History

2024-06-02 05:50:36 +02:00
<h2>
Do-Not-Post Requests
</h2>
<%= form_for :dnp_entry, ~p"/admin/dnp_entries", [method: "get", class: "hform"], fn f -> %>
<div class="field">
<%= text_input(f, :q, name: :q, value: @conn.params["q"], class: "input hform__text", placeholder: "Search query", autocapitalize: "none") %>
<%= submit("Search", class: "hform__button button") %>
</div>
<% end %>
<% route = fn p -> ~p"/admin/dnp_entries?#{p}" end %>
<% pagination = render(PhilomenaWeb.PaginationView, "_pagination.html", page: @dnp_entries, route: route, params: [states: state_param(@conn.params["states"])]) %>
<div class="block">
<div class="block__header">
<%= pagination %>
<span class="block__header__title">
Display Only:
</span>
<%= link("All Open", to: ~p"/admin/dnp_entries?#{[states: ~W(requested claimed rescinded acknowledged)]}") %>
<%= link("Listed", to: ~p"/admin/dnp_entries?#{[states: ~W(listed)]}") %>
<%= link("Rescinded", to: ~p"/admin/dnp_entries?#{[states: ~W(rescinded acknowledged)]}") %>
<%= link("Closed", to: ~p"/admin/dnp_entries?#{[states: ~W(closed)]}") %>
</div>
<div class="block__content">
<table class="table">
<thead>
<tr>
<td>
Tag
</td>
<td>
Requesting User
</td>
<td>
Type
</td>
<td>
Conditions
</td>
<td>
Status
</td>
<td>
Created
</td>
<td>
Modified
</td>
<td>
Options
</td>
</tr>
</thead>
<tbody>
<%= for {body, request} <- @dnp_entries do %>
<tr>
<td>
<%= render(PhilomenaWeb.TagView, "_tag.html", tag: request.tag, conn: @conn) %>
</td>
<td>
<%= link(request.requesting_user.name, to: ~p"/profiles/#{request.requesting_user}") %>
</td>
<td>
<%= request.dnp_type %>
</td>
<td>
<%= body %>
</td>
<td class={dnp_entry_row_class(request)}>
<%= pretty_state(request) %>
<%= if request.modifying_user do %>
2024-06-02 05:50:49 +02:00
by <%= link(request.modifying_user.name, to: ~p"/profiles/#{request.modifying_user}") %>
2024-06-02 05:50:36 +02:00
<% end %>
</td>
<td>
<%= pretty_time(request.created_at) %>
</td>
<td>
<%= pretty_time(request.updated_at) %>
</td>
<td>
2024-06-02 05:50:49 +02:00
<%= link("Show", to: ~p"/dnp/#{request}") %> &bull; <%= link("Send PM", to: ~p"/conversations/new?#{[recipient: request.requesting_user.name]}") %>
2024-06-02 05:50:36 +02:00
<%= case request.aasm_state do %>
<% s when s in ["requested", "claimed"] -> %>
2024-06-02 05:50:49 +02:00
&bull; <%= link("Claim", to: ~p"/admin/dnp_entries/#{request}/transition?#{[state: "claimed"]}", data: [method: "post", confirm: "Are you really, really sure?"]) %> &bull; <%= link("Approve",
to: ~p"/admin/dnp_entries/#{request}/transition?#{[state: "listed"]}",
data: [method: "post", confirm: "Are you really, really sure?"]
) %> &bull; <%= link("Close", to: ~p"/admin/dnp_entries/#{request}/transition?#{[state: "closed"]}", data: [method: "post", confirm: "Are you really, really sure?"]) %>
2024-06-02 05:50:36 +02:00
<% "listed" -> %>
2024-06-02 05:50:49 +02:00
&bull; <%= link("Rescind", to: ~p"/admin/dnp_entries/#{request}/transition?#{[state: "rescinded"]}", data: [method: "post", confirm: "Are you really, really sure?"]) %> &bull; <%= link("Close",
to: ~p"/admin/dnp_entries/#{request}/transition?#{[state: "closed"]}",
data: [method: "post", confirm: "Are you really, really sure?"]
) %>
2024-06-02 05:50:36 +02:00
<% s when s in ["rescinded", "acknowledged"] -> %>
2024-06-02 05:50:49 +02:00
&bull; <%= link("Claim", to: ~p"/admin/dnp_entries/#{request}/transition?#{[state: "acknowledged"]}", data: [method: "post", confirm: "Are you really, really sure?"]) %> &bull; <%= link("Close",
to: ~p"/admin/dnp_entries/#{request}/transition?#{[state: "closed"]}",
data: [method: "post", confirm: "Are you really, really sure?"]
) %>
2024-06-02 05:50:36 +02:00
<% _state -> %>
2024-06-02 05:50:49 +02:00
&bull; <%= link("Claim", to: ~p"/admin/dnp_entries/#{request}/transition?#{[state: "claimed"]}", data: [method: "post", confirm: "Are you really, really sure?"]) %>
2024-06-02 05:50:36 +02:00
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>