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';
let heading_image = "";
let current_authors = "";
$: if ($current_theme) {
if ($current_exercice && $current_exercice.image) {
heading_image = $current_exercice.image;
} else {
heading_image = $current_theme.image;
}
if ($current_exercice && $current_exercice.authors) {
current_authors = $current_exercice.authors;
} else {
current_authors = $current_theme.authors;
}
} else {
heading_image = "";
current_authors = "";
}
</script>
@ -44,7 +52,7 @@
<h1 class="display-2">
<a href="{$current_theme.urlid}">{$current_theme.name}</a>
</h1>
<h2>{@html $current_theme.authors}</h2>
<h2>{@html current_authors}</h2>
</Container>
<div class="headerfade"></div>
</div>

View File

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