forked from e621ng/e621ng
[UserWarnable] Add confirmation to "mark for" buttons (#537)
* [UserWarnable] Add confirmation to "mark for" buttons * tweak message, better formatting --------- Co-authored-by: Earlopain <earlopain@protonmail.com>
This commit is contained in:
parent
49fb99b0ac
commit
b029997aa9
@ -11,8 +11,16 @@ class UserWarnable {
|
||||
const target = $(evt.target);
|
||||
const type = target.data('item-route');
|
||||
const id = target.data('item-id');
|
||||
const item_type = target.data('item-type');
|
||||
const record_type = target.data('record-type');
|
||||
|
||||
const message = record_type === "unmark"
|
||||
? `Are you sure you want to unmark this ${item_type}?`
|
||||
: `Are you sure you want to mark this ${item_type} for having received ${record_type}?`
|
||||
if(!confirm(message)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: `/${type}/${id}/warning.json`,
|
||||
|
@ -1,8 +1,8 @@
|
||||
<% if model.was_warned? %>
|
||||
<li><%= tag.a "Unmark", href: "#", class: "item-mark-user-warned", data: { "item-route": model.model_name.route_key, "item-id": model.id, "record-type": "unmark" } %></li>
|
||||
<li><%= tag.a "Unmark", href: "#", class: "item-mark-user-warned", data: { "item-route": model.model_name.route_key, "item-id": model.id, "record-type": "unmark", "item-type": model.model_name.human.downcase } %></li>
|
||||
<% else %>
|
||||
<li>Mark for:</li>
|
||||
<li><%= tag.a "Warning", href: "#", class: "item-mark-user-warned", data: { "item-route": model.model_name.route_key, "item-id": model.id, "record-type": "warning" } %></li>
|
||||
<li><%= tag.a "Record", href: "#", class: "item-mark-user-warned", data: { "item-route": model.model_name.route_key, "item-id": model.id, "record-type": "record" } %></li>
|
||||
<li><%= tag.a "Ban", href: "#", class: "item-mark-user-warned", data: { "item-route": model.model_name.route_key, "item-id": model.id, "record-type": "ban" } %></li>
|
||||
<li><%= tag.a "Warning", href: "#", class: "item-mark-user-warned", data: { "item-route": model.model_name.route_key, "item-id": model.id, "record-type": "warning", "item-type": model.model_name.human.downcase } %></li>
|
||||
<li><%= tag.a "Record", href: "#", class: "item-mark-user-warned", data: { "item-route": model.model_name.route_key, "item-id": model.id, "record-type": "record", "item-type": model.model_name.human.downcase } %></li>
|
||||
<li><%= tag.a "Ban", href: "#", class: "item-mark-user-warned", data: { "item-route": model.model_name.route_key, "item-id": model.id, "record-type": "ban", "item-type": model.model_name.human.downcase } %></li>
|
||||
<% end %>
|
||||
|
Loading…
Reference in New Issue
Block a user