ui: Handle exercice image
This commit is contained in:
parent
ab23ef8f71
commit
1a8ebcb8bf
@ -7,7 +7,19 @@
|
|||||||
} from 'sveltestrap';
|
} from 'sveltestrap';
|
||||||
|
|
||||||
import { challengeInfo } from '$lib/stores/challengeinfo';
|
import { challengeInfo } from '$lib/stores/challengeinfo';
|
||||||
|
import { current_exercice } from '$lib/stores/exercices';
|
||||||
import { current_theme } from '$lib/stores/themes';
|
import { current_theme } from '$lib/stores/themes';
|
||||||
|
|
||||||
|
let heading_image = "";
|
||||||
|
$: if ($current_theme) {
|
||||||
|
if ($current_exercice && $current_exercice.image) {
|
||||||
|
heading_image = $current_exercice.image;
|
||||||
|
} else {
|
||||||
|
heading_image = $current_theme.image;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
heading_image = "";
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
@ -27,7 +39,7 @@
|
|||||||
</Alert>
|
</Alert>
|
||||||
</Container>
|
</Container>
|
||||||
{:else}
|
{:else}
|
||||||
<div style="background-image: url({$current_theme.image})" class="page-header">
|
<div style="background-image: url({heading_image})" class="page-header">
|
||||||
<Container class="text-primary">
|
<Container class="text-primary">
|
||||||
<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>
|
||||||
|
@ -13,6 +13,7 @@ type exportedExercice struct {
|
|||||||
Id int64 `json:"id"`
|
Id int64 `json:"id"`
|
||||||
Title string `json:"title"`
|
Title string `json:"title"`
|
||||||
Headline string `json:"headline,omitempty"`
|
Headline string `json:"headline,omitempty"`
|
||||||
|
Image string `json:"image,omitempty"`
|
||||||
URLId string `json:"urlid"`
|
URLId string `json:"urlid"`
|
||||||
Tags []string `json:"tags"`
|
Tags []string `json:"tags"`
|
||||||
Gain int64 `json:"gain"`
|
Gain int64 `json:"gain"`
|
||||||
@ -53,11 +54,17 @@ func ExportThemes() (interface{}, error) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exoimgpath := ""
|
||||||
|
if len(exercice.Image) > 0 {
|
||||||
|
exoimgpath = path.Join(FilesDir, exercice.Image)
|
||||||
|
}
|
||||||
|
|
||||||
tags, _ := exercice.GetTags()
|
tags, _ := exercice.GetTags()
|
||||||
exos = append(exos, exportedExercice{
|
exos = append(exos, exportedExercice{
|
||||||
exercice.Id,
|
exercice.Id,
|
||||||
exercice.Title,
|
exercice.Title,
|
||||||
exercice.Headline,
|
exercice.Headline,
|
||||||
|
exoimgpath,
|
||||||
exercice.URLId,
|
exercice.URLId,
|
||||||
tags,
|
tags,
|
||||||
int64(float64(exercice.Gain) * GlobalScoreCoefficient),
|
int64(float64(exercice.Gain) * GlobalScoreCoefficient),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user