re-ordering methods

This commit is contained in:
2025-12-20 13:16:14 +01:00
parent bd2fb255d2
commit 851df52458

View File

@@ -30,30 +30,6 @@
let stateList = {};
$effect(() => updateUrl(filter_input));
async function do_archive(ex){
ex.preventDefault();
var task = dragged;
const url = api(`task/${task.id}`);
const resp = await fetch(url,{
credentials : 'include',
method : 'PATCH',
body : JSON.stringify({no_index:true})
});
delete highlight.archive;
if (resp.ok){
yikes();
delete tasks[task.assignee][task.status][task.id]
} else {
error(resp);
}
}
function updateUrl(){
let url = window.location.origin + window.location.pathname;
if (filter_input) url += '?filter=' + encodeURI(filter_input);
window.history.replaceState(window.history.state, '', url);
}
function byName(a,b) {
return a.name.localeCompare(b.name);
}
@@ -88,6 +64,24 @@
}
}
async function do_archive(ex){
ex.preventDefault();
var task = dragged;
const url = api(`task/${task.id}`);
const resp = await fetch(url,{
credentials : 'include',
method : 'PATCH',
body : JSON.stringify({no_index:true})
});
delete highlight.archive;
if (resp.ok){
yikes();
delete tasks[task.assignee][task.status][task.id]
} else {
error(resp);
}
}
async function drop(user_id,state){
let task = dragged;
dragged = null;
@@ -131,6 +125,22 @@
}
function hover(ev,user_id,state){
ev.preventDefault();
highlight = {user:user_id,state:state};
}
function hover_archive(ev){
ev.preventDefault();
highlight.archive = true;
}
function is_custom(state){
return [10,20,40,60,100].includes(state);
}
async function load(){
try {
eventSource = eventStream(handleUpdateEvent);
@@ -182,6 +192,10 @@
}
}
function openTask(task_id){
window.open(`/task/${task_id}/view`, '_blank').focus();
}
function processTask(task){
if (task.no_index) return;
@@ -201,23 +215,6 @@
tasks[assignee][state][task.id] = task;
}
function hover(ev,user_id,state){
ev.preventDefault();
highlight = {user:user_id,state:state};
}
function hover_archive(ev){
ev.preventDefault();
highlight.archive = true;
}
function is_custom(state){
return [10,20,40,60,100].includes(state);
}
function openTask(task_id){
window.open(`/task/${task_id}/view`, '_blank').focus();
}
async function save_bookmark(){
const user_ids = Object.values(project.members).map(member => member.user.id);
@@ -241,12 +238,17 @@
}
}
onMount(load);
function updateUrl(){
let url = window.location.origin + window.location.pathname;
if (filter_input) url += '?filter=' + encodeURI(filter_input);
window.history.replaceState(window.history.state, '', url);
}
onDestroy(() => {
if (eventSource) eventSource.close();
});
onMount(load);
</script>
<svelte:head>