Update circle view

This commit is contained in:
Daniel Egger 2022-06-01 11:29:19 +02:00
parent 19cc0c2af3
commit cd676bbe96
5 changed files with 21 additions and 29 deletions

View File

@ -5,7 +5,7 @@ export default {
</script> </script>
<template> <template>
<nav class="bg-blue-dark flex flex-row gap-x-8 items-center text-white px-8 py-4"> <nav class="bg-blue-900 flex flex-row gap-x-8 items-center text-white px-8 py-4">
<a href="" class="text-xl">myVBV</a> <a href="" class="text-xl">myVBV</a>
<a href="" class="">Lernpfad</a> <a href="" class="">Lernpfad</a>
<a href="" class="">Kompetenzprofil</a> <a href="" class="">Kompetenzprofil</a>

View File

@ -5,7 +5,7 @@ defineProps(['learningSequence'])
<template> <template>
<div class="mb-8 learning-sequence"> <div class="mb-8 learning-sequence">
<h3 class="mb-2">{{ learningSequence.title }}</h3> <h3 class="mb-2 text-xl">{{ learningSequence.title }}</h3>
<div class="bg-white p-4 border border-slate-300 border-l-4 border-l-blue-500"> <div class="bg-white p-4 border border-slate-300 border-l-4 border-l-blue-500">
<div v-for="learningPackage in learningSequence.learning_packages"> <div v-for="learningPackage in learningSequence.learning_packages">

View File

@ -16,7 +16,7 @@ export default {
console.log('CircleAnalyseExampleView mounted', this.circleSlug); console.log('CircleAnalyseExampleView mounted', this.circleSlug);
axios({ axios({
method: 'get', method: 'get',
url: `http://localhost:8000/wagtailapi/v2/pages/?type=learnpath.Circle&slug=${this.circleSlug}&fields=title,description,learning_sequences` url: `/wagtailapi/v2/pages/?type=learnpath.Circle&slug=${this.circleSlug}&fields=title,description,learning_sequences(title,learning_packages(title,my_title,learning_units(title)))`,
}).then((response) => { }).then((response) => {
this.circleData = response.data.items[0]; this.circleData = response.data.items[0];
}); });
@ -29,33 +29,35 @@ export default {
<MainNavigationBar/> <MainNavigationBar/>
<div class="circle"> <div class="circle">
<div class="flex"> <div class="flex flex-col lg:flex-row">
<div class="flex-initial w-128 p-8"> <div class="flex-initial lg:w-128 px-8 py-8">
<h1 class="text-blue-dark text-7xl"> <h1 class="text-blue-dark text-7xl">
{{ circleData.title }} {{ circleData.title }}
</h1> </h1>
<div class="circle-image mt-8"></div> <div class="mt-8">
<img src="@/assets/circle-analyse.svg" alt="">
</div>
<div class="outcome border border-slate-300 mt-8 p-6"> <div class="outcome border border-gray-500 mt-8 p-6">
<h3 class="text-blue-dark">Das lernst du in diesem Circle.</h3> <h3 class="text-blue-dark">Das lernst du in diesem Circle.</h3>
<div class="prose mt-4"> <div class="prose mt-4">
{{ circleData.description }} {{ circleData.description }}
</div> </div>
<button class="px-4 py-3 bg-blue-dark text-white text-xl mt-4">Erfahre mehr dazu</button> <button class="btn-primary mt-4">Erfahre mehr dazu</button>
</div> </div>
<div class="expert border border-slate-300 mt-8 p-6"> <div class="expert border border-gray-500 mt-8 p-6">
<h3 class="text-blue-dark">Hast du Fragen?</h3> <h3 class="text-blue-dark">Hast du Fragen?</h3>
<div class="prose mt-4">Tausche dich mit der Fachexpertin aus für den Circle Analyse aus.</div> <div class="prose mt-4">Tausche dich mit der Fachexpertin aus für den Circle Analyse aus.</div>
<button class="px-4 py-3 border-2 border-blue-dark bg-white text-blue-dark text-xl mt-4"> <button class="btn-secondary mt-4">
Fachexpertin kontaktieren Fachexpertin kontaktieren
</button> </button>
</div> </div>
</div> </div>
<div class="flex-auto bg-blue-100 p-8 pl-24"> <div class="flex-auto bg-gray-100 px-4 py-8">
<div v-for="learningSequence in circleData.learning_sequences"> <div v-for="learningSequence in circleData.learning_sequences">
<LearningSequence :learning-sequence="learningSequence"></LearningSequence> <LearningSequence :learning-sequence="learningSequence"></LearningSequence>
</div> </div>
@ -67,11 +69,4 @@ export default {
</template> </template>
<style scoped> <style scoped>
.circle-image {
width: 440px;
height: 440px;
background: url('@/assets/circle-analyse.svg');
background-size: contain;
background-repeat: no-repeat;
}
</style> </style>

View File

@ -25,14 +25,14 @@ export default defineComponent({
<h2 class="heading-1">Colors</h2> <h2 class="heading-1">Colors</h2>
</div> </div>
<table class="text-gray-700"> <table class="text-gray-700">
<tr class="h-12 md:h-18 xl:h-24"> <tr class="h-12 md:h-18 lg:h-24">
<td></td> <td></td>
<td class="text-center" v-for="value in colorValues">{{value}}</td> <td class="text-center" v-for="value in colorValues">{{value}}</td>
</tr> </tr>
<tr v-for="color in colors" class="h-12 md:h-18 xl:h-24"> <tr v-for="color in colors" class="h-12 md:h-18 lg:h-24">
<td>{{color}}</td> <td>{{color}}</td>
<td v-for="value in colorValues" class="px-2"> <td v-for="value in colorValues" class="px-2">
<div class="w-8 h-8 md:w-12 md:h-12 xl:w-16 xl:h-16 rounded-full" :class="[colorBgClass(color, value)]"></div> <div class="w-8 h-8 md:w-12 md:h-12 lg:w-16 lg:h-16 rounded-full" :class="[colorBgClass(color, value)]"></div>
</td> </td>
</tr> </tr>
</table> </table>

View File

@ -97,11 +97,15 @@ class Circle(Page, Orderable):
APIField('title'), APIField('title'),
APIField('description'), APIField('description'),
APIField('topic'), APIField('topic'),
APIField('learning_sequences'),
# APIField('content_structure'), # APIField('content_structure'),
] ]
@property @property
def content_structure(self): def content_structure(self):
# FIXME: not needed!?
# you can access nested content with the following url scheme (look a the nested parentheses!):
# /wagtailapi/v2/pages/?type=learnpath.Circle&slug=analyse&fields=title,description,learning_sequences(title,learning_packages(title,my_title,learning_units(title)))
learning_sequences = LearningSequence.objects.filter(circle_id=self.id).values() learning_sequences = LearningSequence.objects.filter(circle_id=self.id).values()
learning_packages = LearningPackage.objects.filter(learning_sequence__circle_id=self.id).values() learning_packages = LearningPackage.objects.filter(learning_sequence__circle_id=self.id).values()
learning_units = LearningUnit.objects.filter(learning_package__learning_sequence__circle_id=self.id).values('learning_package_id', 'title') learning_units = LearningUnit.objects.filter(learning_package__learning_sequence__circle_id=self.id).values('learning_package_id', 'title')
@ -123,9 +127,6 @@ class Circle(Page, Orderable):
return content return content
def full_clean(self, *args, **kwargs): def full_clean(self, *args, **kwargs):
self.slug = find_available_slug(Circle, slugify(self.title, allow_unicode=True)) self.slug = find_available_slug(Circle, slugify(self.title, allow_unicode=True))
super(Circle, self).full_clean(*args, **kwargs) super(Circle, self).full_clean(*args, **kwargs)
@ -163,15 +164,12 @@ class LearningSequence(Orderable):
panels = [FieldPanel('title'), FieldPanel('category'), FieldPanel('circle')] panels = [FieldPanel('title'), FieldPanel('category'), FieldPanel('circle')]
api_fields = [ api_fields = [
APIField('title'), APIField('title'),
APIField('category'), APIField('category'),
APIField('learning_packages'), APIField('learning_packages'),
] ]
class Meta: class Meta:
verbose_name = "Learning Sequence" verbose_name = "Learning Sequence"
@ -183,7 +181,6 @@ class LearningSequence(Orderable):
super(LearningSequence, self).full_clean(*args, **kwargs) super(LearningSequence, self).full_clean(*args, **kwargs)
class LearningPackage(Orderable): class LearningPackage(Orderable):
title = models.CharField(max_length=256, default='') title = models.CharField(max_length=256, default='')
@ -199,13 +196,13 @@ class LearningPackage(Orderable):
api_fields = [ api_fields = [
APIField('title'), APIField('title'),
APIField('my_title'), APIField('my_title'),
APIField('learning_units'),
] ]
@property @property
def my_title(self): def my_title(self):
return self.title return self.title
def full_clean(self, *args, **kwargs): def full_clean(self, *args, **kwargs):
self.slug = find_available_slug(LearningPackage, slugify(self.title, allow_unicode=True)) self.slug = find_available_slug(LearningPackage, slugify(self.title, allow_unicode=True))
super(LearningPackage, self).full_clean(*args, **kwargs) super(LearningPackage, self).full_clean(*args, **kwargs)