ui: Handle exercice authors

This commit is contained in:
nemunaire 2023-06-14 20:53:09 +02:00
parent 28ad0fa791
commit 60243dd486
2 changed files with 11 additions and 1 deletions

View File

@ -11,14 +11,22 @@
import { current_theme } from '$lib/stores/themes'; import { current_theme } from '$lib/stores/themes';
let heading_image = ""; let heading_image = "";
let current_authors = "";
$: if ($current_theme) { $: if ($current_theme) {
if ($current_exercice && $current_exercice.image) { if ($current_exercice && $current_exercice.image) {
heading_image = $current_exercice.image; heading_image = $current_exercice.image;
} else { } else {
heading_image = $current_theme.image; heading_image = $current_theme.image;
} }
if ($current_exercice && $current_exercice.authors) {
current_authors = $current_exercice.authors;
} else {
current_authors = $current_theme.authors;
}
} else { } else {
heading_image = ""; heading_image = "";
current_authors = "";
} }
</script> </script>
@ -44,7 +52,7 @@
<h1 class="display-2"> <h1 class="display-2">
<a href="{$current_theme.urlid}">{$current_theme.name}</a> <a href="{$current_theme.urlid}">{$current_theme.name}</a>
</h1> </h1>
<h2>{@html $current_theme.authors}</h2> <h2>{@html current_authors}</h2>
</Container> </Container>
<div class="headerfade"></div> <div class="headerfade"></div>
</div> </div>

View File

@ -12,6 +12,7 @@ var GlobalScoreCoefficient float64 = 1
type exportedExercice struct { type exportedExercice struct {
Id int64 `json:"id"` Id int64 `json:"id"`
Title string `json:"title"` Title string `json:"title"`
Authors string `json:"authors,omitempty"`
Headline string `json:"headline,omitempty"` Headline string `json:"headline,omitempty"`
Image string `json:"image,omitempty"` Image string `json:"image,omitempty"`
URLId string `json:"urlid"` URLId string `json:"urlid"`
@ -63,6 +64,7 @@ func ExportThemes() (interface{}, error) {
exos = append(exos, exportedExercice{ exos = append(exos, exportedExercice{
exercice.Id, exercice.Id,
exercice.Title, exercice.Title,
exercice.Authors,
exercice.Headline, exercice.Headline,
exoimgpath, exoimgpath,
exercice.URLId, exercice.URLId,