add: stack clones
This commit is contained in:
parent
3a48ef2969
commit
eec81f5718
5 changed files with 55 additions and 0 deletions
|
@ -37,6 +37,14 @@
|
|||
(text "{{ icon \"pencil\" }}")
|
||||
(span
|
||||
(text "{{ text \"general:action.manage\" }}")))
|
||||
(text "{% elif user -%}")
|
||||
; clone button for non-owner users
|
||||
(button
|
||||
("class" "lowered small")
|
||||
("onclick" "clone_stack()")
|
||||
(icon (text "book-copy"))
|
||||
(span
|
||||
(str (text "stacks:label.clone"))))
|
||||
(text "{%- endif %}")))
|
||||
(div
|
||||
("class" "card w_full flex flex_col gap_2")
|
||||
|
@ -114,5 +122,22 @@
|
|||
window.location.href = \"/settings#/account/blocks\";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async function clone_stack() {
|
||||
fetch(\"/api/v1/stacks/{{ stack.id }}/clone\", {
|
||||
method: \"POST\",
|
||||
})
|
||||
.then((res) => res.json())
|
||||
.then((res) => {
|
||||
trigger(\"atto::toast\", [
|
||||
res.ok ? \"success\" : \"error\",
|
||||
res.message,
|
||||
]);
|
||||
|
||||
if (res.ok) {
|
||||
window.location.href = `/stacks/${res.payload}`;
|
||||
}
|
||||
});
|
||||
}"))
|
||||
(text "{% endblock %}")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue