From 1559e5cdd9a6c8f71beeef1b41e169d5c224fa2a Mon Sep 17 00:00:00 2001 From: tomate Date: Tue, 29 Mar 2022 20:22:05 +0200 Subject: [PATCH] =?UTF-8?q?Rajoute=20le=20t=C3=A9l=C3=A9chargement=20des?= =?UTF-8?q?=20calendriers=20(#17)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Tom Hubrecht Reviewed-on: https://git.rz.ens.wtf/Klub-RZ/metis/pulls/17 Co-authored-by: tomate Co-committed-by: tomate --- src/FilterItem.svelte | 8 ++++++++ src/TriStateCheckbox.svelte | 29 ++++++++++++++++++++++++----- src/calendar.js | 7 ++++++- 3 files changed, 38 insertions(+), 6 deletions(-) diff --git a/src/FilterItem.svelte b/src/FilterItem.svelte index 7e4a6c6..de2c632 100644 --- a/src/FilterItem.svelte +++ b/src/FilterItem.svelte @@ -6,6 +6,8 @@ import { createTriState, createTriStates, UNCHECKED, CHECKED, WEIRD } from './stores'; import { Icon } from 'sveltestrap'; + import { mkSource } from './calendar.js'; + export let item = null; export let level = 1; export let generalToggle = undefined; @@ -78,6 +80,11 @@ }); } + const url = (() => { + const source = mkSource(item); + return source ? source.export_url : undefined; + })(); + $: selected = $filtering === CHECKED ? [item, ...subselected.flat()] : subselected.flat(); $: subHidden = () => (collapsed ? 'd-none' : ''); @@ -90,6 +97,7 @@ on:change={handleChange} value={item} bind:collapsed + {url} /> diff --git a/src/TriStateCheckbox.svelte b/src/TriStateCheckbox.svelte index 9f981ab..f65b04d 100644 --- a/src/TriStateCheckbox.svelte +++ b/src/TriStateCheckbox.svelte @@ -4,6 +4,7 @@ export let state; export let value; export let collapsed = undefined; + export let url; import { UNCHECKED, CHECKED, WEIRD } from './stores'; import { createEventDispatcher } from 'svelte'; @@ -28,14 +29,32 @@ {value} - {#if collapsed !== undefined} - (collapsed = !collapsed)}> - - - {/if} + + {#if url} + + + + {/if} + + {#if collapsed !== undefined} + (collapsed = !collapsed)}> + + + {/if} +