Style home page a bit

This commit is contained in:
Daniel Egger 2022-06-03 10:12:52 +02:00
parent 65ecf77a59
commit fd008be527
8 changed files with 49 additions and 48 deletions

View File

@ -1,9 +1,17 @@
<script setup lang="ts"> <script setup lang="ts">
</script> import MainNavigationBar from '@/components/MainNavigationBar.vue';</script>
<template> <template>
<main> <MainNavigationBar/>
<p class="title">Hello from Home View</p>
<main class="px-8 py-8">
<h1>myVBV Start Page</h1>
<div class="mt-8 flex flex-row justify-start gap-4">
<router-link class="link text-xl" to="/styleguide">Styelguide</router-link>
<a class="link text-xl" href="/login/">Login</a>
<router-link class="link text-xl" to="/circle/analyse">Circle "Analyse" (Login benötigt)</router-link>
</div>
</main> </main>
</template> </template>

View File

@ -1,24 +1,20 @@
<script lang="ts"> <script setup lang="ts">
import {defineComponent} from 'vue'
export default defineComponent({ import MainNavigationBar from '@/components/MainNavigationBar.vue';
data() {
return { const colors = ['blue', 'sky', 'orange', 'green', 'red', 'gray',];
colors: ['blue', 'sky', 'orange', 'green', 'red', 'gray',], const colorValues = [100, 300, 500, 700, 900,];
colorValues: [100, 300, 500, 700, 900],
} function colorBgClass(color: string, value: number) {
}, return `bg-${color}-${value}`;
methods: { }
colorBgClass(color: string, value: integer) {
return `bg-${color}-${value}`;
}
},
});
</script> </script>
<template> <template>
<main class="container mx-auto mt-4"> <MainNavigationBar/>
<main class="px-8 py-4">
<h1>Style Guide</h1> <h1>Style Guide</h1>
<div class="border-b text-gray-700 pb-2 mt-8"> <div class="border-b text-gray-700 pb-2 mt-8">
@ -47,12 +43,12 @@ export default defineComponent({
<div class="mt-8 text-xl font-bold">Text Large Bold</div> <div class="mt-8 text-xl font-bold">Text Large Bold</div>
<div class="mt-8 text-xl">Text Large</div> <div class="mt-8 text-xl">Text Large</div>
<div class="mt-8 underline underline-offset-2">Link Large</div> <div class="mt-8 link text-xl">Link Large</div>
<div class="mt-8 font-bold">Text Bold</div> <div class="mt-8 font-bold">Text Bold</div>
<div class="mt-8">Text</div> <div class="mt-8">Text</div>
<div class="mt-8 underline underline-offset-2">Link</div> <div class="mt-8 link">Link</div>
<div class="mt-8 text-sm">Text Small</div> <div class="mt-8 text-sm">Text Small</div>
<div class="mt-8 text-sm underline underline-offset-2">Link Small</div> <div class="mt-8 link text-sm">Link Small</div>
<div class="border-b text-gray-700 pb-2 mt-12"> <div class="border-b text-gray-700 pb-2 mt-12">
<h2 class="heading-1">Components</h2> <h2 class="heading-1">Components</h2>

View File

@ -124,12 +124,12 @@ AUTHENTICATION_BACKENDS = [
# https://docs.djangoproject.com/en/dev/ref/settings/#auth-user-model # https://docs.djangoproject.com/en/dev/ref/settings/#auth-user-model
AUTH_USER_MODEL = "core.User" AUTH_USER_MODEL = "core.User"
# https://docs.djangoproject.com/en/dev/ref/settings/#login-redirect-url # https://docs.djangoproject.com/en/dev/ref/settings/#login-redirect-url
# LOGIN_REDIRECT_URL = "users:redirect"
# https://docs.djangoproject.com/en/dev/ref/settings/#login-url # https://docs.djangoproject.com/en/dev/ref/settings/#login-url
# FIXME make configurable!? # FIXME make configurable!?
# LOGIN_URL = "/sso/login/" # LOGIN_URL = "/sso/login/"
LOGIN_URL = "/login/" LOGIN_URL = "/login/"
LOGIN_REDIRECT_URL = "/"
ALLOW_LOCAL_LOGIN = env.bool("IT_ALLOW_LOCAL_LOGIN", default=False) ALLOW_LOCAL_LOGIN = env.bool("IT_ALLOW_LOCAL_LOGIN", default=False)

View File

@ -1,17 +0,0 @@
<div class="container mx-auto bg-blue-900">
<div class="flex flex-col md:flex-row items-center p-4 text-white space-x-8">
<div class="text-2xl mx-4">
<a href="/">
VBV Ausbildungsportal
</a>
</div>
<div>
<a href="/todo/">
SimpleTodo App
</a>
</div>
<div>Infos zu Berufen</div>
<div>Branchennews</div>
</div>
</div>

View File

@ -118,7 +118,10 @@ class LearningSequence(Page):
@classmethod @classmethod
def get_serializer_class(cls): def get_serializer_class(cls):
return get_it_serializer_class(cls, field_names=['id', 'title', 'slug', 'type']) return get_it_serializer_class(cls, field_names=['id', 'title', 'slug', 'type', 'translation_key'])
def get_admin_display_title(self):
return f'Lernsequenz: {self.draft_title}'
def full_clean(self, *args, **kwargs): def full_clean(self, *args, **kwargs):
super(LearningSequence, self).full_clean(*args, **kwargs) super(LearningSequence, self).full_clean(*args, **kwargs)
@ -130,7 +133,8 @@ class LearningUnit(Page):
""" """
# TODO: Review model architecture, is the stream field the right thing here? # TODO: Review model architecture, is the stream field the right thing here?
parent_page_types = ['learnpath.LearningSequence'] parent_page_types = ['learnpath.Circle']
subpage_types = []
content_blocks = [ content_blocks = [
('web_based_training', WebBasedTrainingBlock()), ('web_based_training', WebBasedTrainingBlock()),
@ -152,7 +156,8 @@ class LearningUnit(Page):
APIField('contents'), APIField('contents'),
] ]
subpage_types = [] def get_admin_display_title(self):
return f'FOOBAR {self.draft_title}'
class Meta: class Meta:
verbose_name = "Learning Unit" verbose_name = "Learning Unit"
@ -163,7 +168,7 @@ class LearningUnit(Page):
@classmethod @classmethod
def get_serializer_class(cls): def get_serializer_class(cls):
return get_it_serializer_class(cls, field_names=['id', 'title', 'contents', 'slug', 'type']) return get_it_serializer_class(cls, field_names=['id', 'title', 'contents', 'slug', 'type', 'translation_key'])
def __str__(self): def __str__(self):
return f"{self.title}" return f"{self.title}"

View File

@ -1,13 +1,17 @@
import wagtail_factories import wagtail_factories
from django.conf import settings from django.conf import settings
from wagtail.core.models import Site from wagtail.core.models import Site, Page
from vbv_lernwelt.core.admin import User
from vbv_lernwelt.learnpath.models import LearningPath, Topic, Circle, LearningSequence, LearningUnit from vbv_lernwelt.learnpath.models import LearningPath, Topic, Circle, LearningSequence, LearningUnit
from vbv_lernwelt.learnpath.tests.learning_path_factories import LearningPathFactory, TopicFactory, CircleFactory, \ from vbv_lernwelt.learnpath.tests.learning_path_factories import LearningPathFactory, TopicFactory, CircleFactory, \
LearningSequenceFactory, LearningUnitFactory, VideoBlockFactory, WebBasedTrainingBlockFactory LearningSequenceFactory, LearningUnitFactory, VideoBlockFactory, WebBasedTrainingBlockFactory
def create_default_learning_path(): def create_default_learning_path(user=None):
if user is None:
user = User.objects.get(username='admin')
site = Site.objects.filter(is_default_site=True).first() site = Site.objects.filter(is_default_site=True).first()
if not site: if not site:
@ -128,6 +132,9 @@ von Neukunden zu benützen
tp = TopicFactory.create(title="Prüfung", is_visible=False, learning_path=lp) tp = TopicFactory.create(title="Prüfung", is_visible=False, learning_path=lp)
circle_7 = CircleFactory.create(title="Prüfungsvorbereitung", parent=lp, topic=tp) circle_7 = CircleFactory.create(title="Prüfungsvorbereitung", parent=lp, topic=tp)
# all pages belong to 'admin' by default
Page.objects.update(owner=user)
def delete_default_learning_path(): def delete_default_learning_path():
LearningUnit.objects.all().delete() LearningUnit.objects.all().delete()

View File

@ -30,8 +30,6 @@
<body> <body>
{% include "core/partials/header.html" %}
<div class="container"> <div class="container">
{% if messages %} {% if messages %}

View File

@ -31,6 +31,10 @@ html {
.heading-3 { .heading-3 {
@apply text-3xl xl:text-4xl font-bold @apply text-3xl xl:text-4xl font-bold
} }
.link {
@apply underline underline-offset-2
}
} }
@layer components { @layer components {