add: put ip block button on blocked page as well
This commit is contained in:
parent
0163391380
commit
0272985b81
2 changed files with 43 additions and 7 deletions
|
@ -228,7 +228,7 @@
|
||||||
(icon_class (text "chevron-down") (text "dropdown-arrow"))
|
(icon_class (text "chevron-down") (text "dropdown-arrow"))
|
||||||
(str (text "auth:action.block")))
|
(str (text "auth:action.block")))
|
||||||
(div
|
(div
|
||||||
("class" "inner")
|
("class" "inner left")
|
||||||
(button
|
(button
|
||||||
("onclick" "toggle_block_user()")
|
("onclick" "toggle_block_user()")
|
||||||
(icon (text "shield"))
|
(icon (text "shield"))
|
||||||
|
|
|
@ -24,12 +24,24 @@
|
||||||
(div
|
(div
|
||||||
("class" "card w-full secondary flex gap-2")
|
("class" "card w-full secondary flex gap-2")
|
||||||
(text "{% if user -%} {% if not is_blocking -%}")
|
(text "{% if user -%} {% if not is_blocking -%}")
|
||||||
|
(div
|
||||||
|
("class" "dropdown")
|
||||||
|
(button
|
||||||
|
("onclick" "trigger('atto::hooks::dropdown', [event])")
|
||||||
|
("exclude" "dropdown")
|
||||||
|
("class" "lowered red")
|
||||||
|
(icon_class (text "chevron-down") (text "dropdown-arrow"))
|
||||||
|
(str (text "auth:action.block")))
|
||||||
|
(div
|
||||||
|
("class" "inner left")
|
||||||
(button
|
(button
|
||||||
("onclick" "toggle_block_user()")
|
("onclick" "toggle_block_user()")
|
||||||
("class" "lowered red")
|
(icon (text "shield"))
|
||||||
(text "{{ icon \"shield\" }}")
|
(str (text "auth:action.block")))
|
||||||
(span
|
(button
|
||||||
(text "{{ text \"auth:action.block\" }}")))
|
("onclick" "ip_block_user()")
|
||||||
|
(icon (text "wifi"))
|
||||||
|
(str (text "auth:action.ip_block")))))
|
||||||
(text "{% else %}")
|
(text "{% else %}")
|
||||||
(button
|
(button
|
||||||
("onclick" "toggle_block_user()")
|
("onclick" "toggle_block_user()")
|
||||||
|
@ -58,6 +70,30 @@
|
||||||
res.message,
|
res.message,
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
globalThis.ip_block_user = async () => {
|
||||||
|
if (
|
||||||
|
!(await trigger(\"atto::confirm\", [
|
||||||
|
\"Are you sure you would like to do this?\",
|
||||||
|
]))
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
fetch(
|
||||||
|
\"/api/v1/auth/user/{{ profile.id }}/block_ip\",
|
||||||
|
{
|
||||||
|
method: \"POST\",
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.then((res) => res.json())
|
||||||
|
.then((res) => {
|
||||||
|
trigger(\"atto::toast\", [
|
||||||
|
res.ok ? \"success\" : \"error\",
|
||||||
|
res.message,
|
||||||
|
]);
|
||||||
|
});
|
||||||
};"))
|
};"))
|
||||||
(text "{%- endif %}")
|
(text "{%- endif %}")
|
||||||
(a
|
(a
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue