Initial commit - cloned the Svelte todo's app with google login enabled as a starting point. This system will initially be used to let the chrome extension for students report which computers are used by which students and when.

This commit is contained in:
2021-09-16 07:26:57 -07:00
commit 08ec0543ca
29 changed files with 2477 additions and 0 deletions

56
imports/ui/Task.svelte Normal file
View File

@@ -0,0 +1,56 @@
<script>
import { useTracker } from 'meteor/rdb:svelte-meteor-data';
import { Tasks } from "../api/tasks.js";
export let key;
export let task;
let showPrivateButton;
$: currentUser = useTracker(() => Meteor.user());
$: {
showPrivateButton = false;
if($currentUser){
showPrivateButton = task.owner === $currentUser._id;
}
}
function toggleChecked() {
// Set the checked property to the opposite of its current value
Meteor.call("tasks.setChecked", task._id, !task.checked);
}
function deleteThisTask() {
Meteor.call("tasks.remove", task._id);
}
function togglePrivate() {
Meteor.call("tasks.setPrivate", task._id, !task.private);
}
</script>
<li class:checked="{task.checked}"
class:private="{task.private}" >
<button class="delete" on:click={deleteThisTask}>
&times;
</button>
<input
type="checkbox"
readonly
checked={!!task.checked}
on:click={toggleChecked}
/>
{#if showPrivateButton}
<button className="toggle-private" on:click="{togglePrivate}">
{ task.private ? "Private" : "Public" }
</button>
{/if}
<span class="text">
<strong>{ task.username }</strong>
: { task.text }
</span>
</li>