Add independent roast plan cloning from the plans table
Test and deploy / test-and-deploy (push) Successful in 1m52s
Test and deploy / test-and-deploy (push) Successful in 1m52s
This commit is contained in:
1 parent
393978195c
commit
a9358048ef
5 files changed
+46
-1
No files matched your search
+14
-1
@@ -60,6 +60,19 @@ async function load() {
|
||||
);
|
||||
const actions = document.createElement("td");
|
||||
actions.className = "data-table-actions";
|
||||
const clone = node("button", "Clone", "ghost-btn small");
|
||||
clone.type = "button";
|
||||
clone.setAttribute("aria-label", "Clone " + plan.title);
|
||||
clone.onclick = async () => {
|
||||
clone.disabled = true;
|
||||
try {
|
||||
const result = await api(`/api/plans/${plan.id}/clone`, {method:"POST"});
|
||||
location.assign("/app?plan=" + encodeURIComponent(result.plan.id));
|
||||
} catch (error) {
|
||||
showToast(error.message, "fail");
|
||||
clone.disabled = false;
|
||||
}
|
||||
};
|
||||
const rename = node("button", "Rename", "ghost-btn small");
|
||||
rename.type = "button";
|
||||
rename.setAttribute("aria-label", "Rename " + plan.title);
|
||||
@@ -88,7 +101,7 @@ async function load() {
|
||||
showToast(e.message, "fail");
|
||||
}
|
||||
};
|
||||
actions.append(rename, remove);
|
||||
actions.append(clone, rename, remove);
|
||||
tr.append(actions);
|
||||
body.append(tr);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user