Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new singleText content types for courses #4990

Merged
merged 3 commits into from
Apr 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions api/fixtures/contentTypes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ App\Entity\ContentType:
name: 'Notes'
active: true
entityClass: 'App\Entity\ContentNode\SingleText'
contentTypeLearningObjectives:
name: 'LearningObjectives'
active: true
entityClass: 'App\Entity\ContentNode\SingleText'
contentTypeLearningTopics:
name: 'LearningTopics'
active: true
entityClass: 'App\Entity\ContentNode\SingleText'
contentTypeColumnLayout:
name: 'ColumnLayout'
active: true
Expand Down
23 changes: 23 additions & 0 deletions api/migrations/schema/Version20240416120000.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

final class Version20240416120000 extends AbstractMigration {
public function getDescription(): string {
return 'Adds new content types';
}

public function up(Schema $schema): void {
$this->addSql('INSERT INTO public.content_type (id, name, active, entityclass, jsonconfig, createtime, updatetime) VALUES (\'c462edd869f3\', \'LearningObjectives\', true, \'App\Entity\ContentNode\SingleText\', \'[]\', \'2024-04-16 12:00:00\', \'2024-04-16 12:00:00\');');
$this->addSql('INSERT INTO public.content_type (id, name, active, entityclass, jsonconfig, createtime, updatetime) VALUES (\'5e2028c55ee4\', \'LearningTopics\', true, \'App\Entity\ContentNode\SingleText\', \'[]\', \'2024-04-16 12:00:00\', \'2024-04-16 12:00:00\');');
}

public function down(Schema $schema): void {
$this->addSql('DELETE FROM public.content_type WHERE id IN (\'c462edd869f3\', \'5e2028c55ee4\')');
}
}
8 changes: 4 additions & 4 deletions api/tests/Api/ContentTypes/ListContentTypesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public function testListContentTypesIsAllowedForAnonymousUser() {
$response = static::createBasicClient()->request('GET', '/content_types');
$this->assertResponseStatusCodeSame(200);
$this->assertJsonContains([
'totalItems' => 8,
'totalItems' => 10,
'_links' => [
'items' => [],
],
Expand All @@ -21,21 +21,21 @@ public function testListContentTypesIsAllowedForAnonymousUser() {
],
]);

$this->assertCount(8, $response->toArray()['_links']['items']);
$this->assertCount(10, $response->toArray()['_links']['items']);
}

public function testListContentTypesIsAllowedForLoggedInUser() {
$response = static::createClientWithCredentials()->request('GET', '/content_types');
$this->assertResponseStatusCodeSame(200);
$this->assertJsonContains([
'totalItems' => 8,
'totalItems' => 10,
'_links' => [
'items' => [],
],
'_embedded' => [
'items' => [],
],
]);
$this->assertCount(8, $response->toArray()['_links']['items']);
$this->assertCount(10, $response->toArray()['_links']['items']);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,32 @@
"id": "escaped_value",
"name": "escaped_value"
},
{
"_links": {
"contentNodes": {
"href": "escaped_value"
},
"self": {
"href": "escaped_value"
}
},
"active": "escaped_value",
"id": "escaped_value",
"name": "escaped_value"
},
{
"_links": {
"contentNodes": {
"href": "escaped_value"
},
"self": {
"href": "escaped_value"
}
},
"active": "escaped_value",
"id": "escaped_value",
"name": "escaped_value"
},
{
"_links": {
"contentNodes": {
Expand Down Expand Up @@ -130,6 +156,12 @@
{
"href": "escaped_value"
},
{
"href": "escaped_value"
},
{
"href": "escaped_value"
},
{
"href": "escaped_value"
}
Expand Down
10 changes: 10 additions & 0 deletions common/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@
"info": "Eine J+S Lageraktivität muss mindestens eines der aufgeführten Themen behandeln.{br}Erfasse, welche Themen in diesem Block behandelt werden.",
"name": "LA Themenbereich"
},
"learningObjectives": {
"icon": "mdi-school",
"info": "Formuliere die Kompetenzen, über welche die Teilnehmenden nach diesem Block verfügen, in der Form von Lernzielen.",
"name": "Blockziele"
},
"learningTopics": {
"icon": "mdi-school",
"info": "Liste die Ausbildungs-Themen auf, mit welchen die Teilnehmenden sich in diesem Block auseinandersetzen werden.",
"name": "Blockinhalte"
},
"material": {
"info": "Hier kannst du den Material-Bedarf für diesen Block erfassen.{br}Die Materiallisten kannst du im Menu 'Admin' verwalten.{br}Eine Zusammenstellung für den Einkauf findest du im Menu 'Material'.",
"name": "Material"
Expand Down
10 changes: 10 additions & 0 deletions common/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@
"info": "A Y+S camp activity must address at least one of the listed topics.{br}Select what topics are covered in this block.",
"name": "LA thematic area"
},
"learningObjectives": {
"icon": "mdi-school",
"info": "Formulate as goals the competences which the participants will have after this activity.",
"name": "Learning objectives"
},
"learningTopics": {
"icon": "mdi-school",
"info": "List the topics about which the participants will learn something in this activity.",
"name": "Learning topics"
},
"material": {
"icon": "mdi-package-variant",
"info": "Here you can enter the material requirements for this block.{br}You can manage the material lists in the menu 'Admin'.{br}You can find a summary for the purchase in the menu 'Material'.",
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/components/activity/ContentNode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import ResponsiveLayout from './content/ResponsiveLayout.vue'
import Notes from './content/Notes.vue'
import Material from './content/Material.vue'
import LAThematicArea from './content/LAThematicArea.vue'
import LearningObjectives from './content/LearningObjectives.vue'
import LearningTopics from './content/LearningTopics.vue'
import SafetyConcept from './content/SafetyConcept.vue'
import Storyboard from './content/Storyboard.vue'
import Storycontext from './content/Storycontext.vue'
Expand All @@ -28,6 +30,8 @@ const contentNodeComponents = {
Notes,
Material,
LAThematicArea,
LearningObjectives,
LearningTopics,
SafetyConcept,
Storyboard,
Storycontext,
Expand Down
29 changes: 29 additions & 0 deletions frontend/src/components/activity/content/LearningObjectives.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<template>
<ContentNodeCard v-bind="$props">
<api-richtext
:uri="contentNode._meta.self"
path="data.html"
:placeholder="$tc('contentNode.learningObjectives.name')"
rows="2"
:disabled="layoutMode || disabled"
class="grow-v-slot"
/>
</ContentNodeCard>
</template>

<script>
import ApiRichtext from '@/components/form/api/ApiRichtext.vue'
import ContentNodeCard from '@/components/activity/content/layout/ContentNodeCard.vue'
import { contentNodeMixin } from '@/mixins/contentNodeMixin.js'

export default {
name: 'LearningObjectives',
components: {
ContentNodeCard,
ApiRichtext,
},
mixins: [contentNodeMixin],
}
</script>

<style scoped></style>
29 changes: 29 additions & 0 deletions frontend/src/components/activity/content/LearningTopics.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<template>
<ContentNodeCard v-bind="$props">
<api-richtext
:uri="contentNode._meta.self"
path="data.html"
:placeholder="$tc('contentNode.learningTopics.name')"
rows="2"
:disabled="layoutMode || disabled"
class="grow-v-slot"
/>
</ContentNodeCard>
</template>

<script>
import ApiRichtext from '@/components/form/api/ApiRichtext.vue'
import ContentNodeCard from '@/components/activity/content/layout/ContentNodeCard.vue'
import { contentNodeMixin } from '@/mixins/contentNodeMixin.js'

export default {
name: 'LearningTopics',
components: {
ContentNodeCard,
ApiRichtext,
},
mixins: [contentNodeMixin],
}
</script>

<style scoped></style>
4 changes: 4 additions & 0 deletions pdf/src/campPrint/scheduleEntry/contentNode/ContentNode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import PdfComponent from '@/PdfComponent.js'
import ColumnLayout from './ColumnLayout.vue'
import ResponsiveLayout from './ResponsiveLayout.vue'
import LAThematicArea from './LAThematicArea.vue'
import LearningObjectives from './LearningObjectives.vue'
import LearningTopics from './LearningTopics.vue'
import Storyboard from './Storyboard.vue'
import Notes from './Notes.vue'
import SafetyConcept from './SafetyConcept.vue'
Expand All @@ -32,6 +34,8 @@ export default {
ColumnLayout,
ResponsiveLayout,
LAThematicArea,
LearningObjectives,
LearningTopics,
Storyboard,
Notes,
SafetyConcept,
Expand Down
24 changes: 24 additions & 0 deletions pdf/src/campPrint/scheduleEntry/contentNode/LearningObjectives.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<template>
<View class="content-node">
<InstanceName :content-node="contentNode" />
<View style="line-height: 1.4">
<RichText :rich-text="contentNode.data.html" />
</View>
</View>
</template>
<script>
import PdfComponent from '@/PdfComponent.js'
import InstanceName from '../InstanceName.vue'
import RichText from '../../RichText.vue'

export default {
name: 'LearningObjectives',
components: { RichText, InstanceName },
extends: PdfComponent,
props: {
contentNode: { type: Object, required: true },
},
}
</script>
<pdf-style>
</pdf-style>
24 changes: 24 additions & 0 deletions pdf/src/campPrint/scheduleEntry/contentNode/LearningTopics.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<template>
<View class="content-node">
<InstanceName :content-node="contentNode" />
<View style="line-height: 1.4">
<RichText :rich-text="contentNode.data.html" />
</View>
</View>
</template>
<script>
import PdfComponent from '@/PdfComponent.js'
import InstanceName from '../InstanceName.vue'
import RichText from '../../RichText.vue'

export default {
name: 'LearningTopics',
components: { RichText, InstanceName },
extends: PdfComponent,
props: {
contentNode: { type: Object, required: true },
},
}
</script>
<pdf-style>
</pdf-style>
4 changes: 4 additions & 0 deletions print/components/scheduleEntry/contentNode/ContentNode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ import NotImplemented from './NotImplemented.vue'
import ColumnLayout from './ColumnLayout.vue'
import ResponsiveLayout from './ResponsiveLayout.vue'
import LAThematicArea from './LAThematicArea.vue'
import LearningObjectives from './LearningObjectives.vue'
import LearningTopics from './LearningTopics.vue'
import Material from './Material.vue'
import Notes from './Notes.vue'
import SafetyConcept from './SafetyConcept.vue'
Expand All @@ -42,6 +44,8 @@ export default defineNuxtComponent({
ColumnLayout,
ResponsiveLayout,
LAThematicArea,
LearningObjectives,
LearningTopics,
Material,
Notes,
SafetyConcept,
Expand Down
26 changes: 26 additions & 0 deletions print/components/scheduleEntry/contentNode/LearningObjectives.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<template>
<content-node-content :content-node="contentNode" :icon-path="mdiSchool">
<rich-text :rich-text="contentNode.data.html" />
</content-node-content>
</template>

<script>
import RichText from '../../generic/RichText.vue'
import ContentNodeContent from './ContentNodeContent.vue'
import { mdiSchool } from '@mdi/js'

export default {
components: {
RichText,
ContentNodeContent,
},
props: {
contentNode: { type: Object, required: true },
},
data() {
return {
mdiSchool,
}
},
}
</script>
26 changes: 26 additions & 0 deletions print/components/scheduleEntry/contentNode/LearningTopics.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<template>
<content-node-content :content-node="contentNode" :icon-path="mdiSchool">
<rich-text :rich-text="contentNode.data.html" />
</content-node-content>
</template>

<script>
import RichText from '../../generic/RichText.vue'
import ContentNodeContent from './ContentNodeContent.vue'
import { mdiSchool } from '@mdi/js'

export default {
components: {
RichText,
ContentNodeContent,
},
props: {
contentNode: { type: Object, required: true },
},
data() {
return {
mdiSchool,
}
},
}
</script>
Loading