Load articles when needed.
This commit is contained in:
parent
a64aa82835
commit
d5bd9adedd
3 changed files with 43 additions and 4 deletions
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
import type { Aggregate } from "$lib/aggregates"
|
import type { Aggregate } from "$lib/aggregates"
|
||||||
import ArticleView from "$lib/components/ArticleView.svelte"
|
import ArticleView from "$lib/components/ArticleView.svelte"
|
||||||
import type { SectionTa } from "$lib/legal"
|
import { pathnameFromLegalId, type SectionTa } from "$lib/legal"
|
||||||
import { summarizeLegalObject } from "$lib/summaries"
|
import { summarizeLegalObject } from "$lib/summaries"
|
||||||
|
|
||||||
export let data: Aggregate
|
export let data: Aggregate
|
||||||
|
@ -35,7 +35,12 @@
|
||||||
<ul class="inline">
|
<ul class="inline">
|
||||||
{#each [...iterArrayOrSingleton(sectionTa.STRUCTURE_TA.LIEN_ART)] as lienArt}
|
{#each [...iterArrayOrSingleton(sectionTa.STRUCTURE_TA.LIEN_ART)] as lienArt}
|
||||||
<li class="inline after:content-[',_'] after:last:content-['']">
|
<li class="inline after:content-[',_'] after:last:content-['']">
|
||||||
|
<a
|
||||||
|
class="link link-hover link-primary"
|
||||||
|
href={pathnameFromLegalId(lienArt["@id"])}
|
||||||
|
>
|
||||||
Article {lienArt["@num"]}
|
Article {lienArt["@num"]}
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{/each}
|
{/each}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
import type { Aggregate } from "$lib/aggregates"
|
import type { Aggregate } from "$lib/aggregates"
|
||||||
import ArticleView from "$lib/components/ArticleView.svelte"
|
import ArticleView from "$lib/components/ArticleView.svelte"
|
||||||
import SectionTaView from "$lib/components/SectionTaView.svelte"
|
import SectionTaView from "$lib/components/SectionTaView.svelte"
|
||||||
import type { Textelr } from "$lib/legal"
|
import { pathnameFromLegalId, type Textelr } from "$lib/legal"
|
||||||
|
|
||||||
export let data: Aggregate
|
export let data: Aggregate
|
||||||
export let level = 1
|
export let level = 1
|
||||||
|
@ -23,7 +23,12 @@
|
||||||
<ul class="inline">
|
<ul class="inline">
|
||||||
{#each [...iterArrayOrSingleton(textelr.STRUCT.LIEN_ART)] as lienArt}
|
{#each [...iterArrayOrSingleton(textelr.STRUCT.LIEN_ART)] as lienArt}
|
||||||
<li class="inline after:content-[',_'] after:last:content-['']">
|
<li class="inline after:content-[',_'] after:last:content-['']">
|
||||||
|
<a
|
||||||
|
class="link link-hover link-primary"
|
||||||
|
href={pathnameFromLegalId(lienArt["@id"])}
|
||||||
|
>
|
||||||
Article {lienArt["@num"]}
|
Article {lienArt["@num"]}
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{/each}
|
{/each}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { TreeView, SummaryView } from "augmented-data-viewer"
|
import { TreeView, SummaryView } from "augmented-data-viewer"
|
||||||
|
|
||||||
|
import { goto } from "$app/navigation"
|
||||||
|
import { page } from "$app/stores"
|
||||||
|
import type { Follow } from "$lib/aggregates"
|
||||||
import IdPagesSwitcher from "$lib/components/IdPagesSwitcher.svelte"
|
import IdPagesSwitcher from "$lib/components/IdPagesSwitcher.svelte"
|
||||||
import TexteVersionView from "$lib/components/TexteVersionView.svelte"
|
import TexteVersionView from "$lib/components/TexteVersionView.svelte"
|
||||||
import { summarizeLegalObject } from "$lib/summaries"
|
import { summarizeLegalObject } from "$lib/summaries"
|
||||||
|
@ -9,17 +12,43 @@
|
||||||
|
|
||||||
export let data: PageData
|
export let data: PageData
|
||||||
|
|
||||||
|
let follow = data.follow
|
||||||
let showArticles = false
|
let showArticles = false
|
||||||
let showRawData = false
|
let showRawData = false
|
||||||
|
|
||||||
$: id = data.id!
|
$: id = data.id!
|
||||||
$: texteVersion = data.texte_version![id]
|
$: texteVersion = data.texte_version![id]
|
||||||
|
$: url = $page.url
|
||||||
|
|
||||||
$: summary = summarizeLegalObject(
|
$: summary = summarizeLegalObject(
|
||||||
{ key: "texte_version" },
|
{ key: "texte_version" },
|
||||||
"texte_version",
|
"texte_version",
|
||||||
texteVersion,
|
texteVersion,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
$: if (
|
||||||
|
showArticles &&
|
||||||
|
!(["STRUCT.LIEN_ART.@id", "STRUCTURE_TA.LIEN_ART.@id"] as Follow[]).every(
|
||||||
|
(aFollow) => follow.includes(aFollow),
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
const newFollow = new Set(follow)
|
||||||
|
for (const aFollow of [
|
||||||
|
"STRUCT.LIEN_ART.@id",
|
||||||
|
"STRUCTURE_TA.LIEN_ART.@id",
|
||||||
|
] as Follow[]) {
|
||||||
|
newFollow.add(aFollow)
|
||||||
|
}
|
||||||
|
const searchParams = new URLSearchParams(url.search)
|
||||||
|
searchParams.delete("follow")
|
||||||
|
for (const aFollow of [...newFollow].sort()) {
|
||||||
|
searchParams.append("follow", aFollow)
|
||||||
|
}
|
||||||
|
goto(new URL(`${url.pathname}?${searchParams.toString()}`, url), {
|
||||||
|
keepfocus: true,
|
||||||
|
noscroll: true,
|
||||||
|
})
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<IdPagesSwitcher {id} />
|
<IdPagesSwitcher {id} />
|
||||||
|
|
Loading…
Reference in a new issue