diff --git a/src/plugin/flashcard/Entity/Flashcard.php b/src/plugin/flashcard/Entity/Flashcard.php
index a4c27200854..53f2e138da7 100644
--- a/src/plugin/flashcard/Entity/Flashcard.php
+++ b/src/plugin/flashcard/Entity/Flashcard.php
@@ -27,11 +27,21 @@ class Flashcard
*/
private string $visibleContent;
+ /**
+ * @ORM\Column(type="string")
+ */
+ private string $visibleContentType;
+
/**
* @ORM\Column(type="text")
*/
private string $hiddenContent;
+ /**
+ * @ORM\Column(type="string")
+ */
+ private string $hiddenContentType;
+
/**
* @ORM\ManyToOne(targetEntity="FlashcardDeck", inversedBy="cards")
*
@@ -73,6 +83,18 @@ public function setVisibleContent(string $visibleContent): self
return $this;
}
+ public function getVisibleContentType(): string
+ {
+ return $this->visibleContentType;
+ }
+
+ public function setVisibleContentType(string $visibleContentType): self
+ {
+ $this->visibleContentType = $visibleContentType;
+
+ return $this;
+ }
+
public function getHiddenContent(): string
{
return $this->hiddenContent;
@@ -85,6 +107,18 @@ public function setHiddenContent(string $hiddenContent): self
return $this;
}
+ public function getHiddenContentType(): string
+ {
+ return $this->hiddenContentType;
+ }
+
+ public function setHiddenContentType(string $hiddenContentType): self
+ {
+ $this->hiddenContentType = $hiddenContentType;
+
+ return $this;
+ }
+
public function getDeck(): FlashcardDeck
{
return $this->deck;
diff --git a/src/plugin/flashcard/Installation/Migrations/Version20230913120151.php b/src/plugin/flashcard/Installation/Migrations/Version20230913120151.php
new file mode 100644
index 00000000000..892bcc1d1cb
--- /dev/null
+++ b/src/plugin/flashcard/Installation/Migrations/Version20230913120151.php
@@ -0,0 +1,32 @@
+addSql('
+ ALTER TABLE claro_flashcard_card
+ ADD visibleContentType VARCHAR(255) NOT NULL,
+ ADD hiddenContentType VARCHAR(255) NOT NULL
+ ');
+ }
+
+ public function down(Schema $schema): void
+ {
+ $this->addSql('
+ ALTER TABLE claro_flashcard_card
+ DROP visibleContentType,
+ DROP hiddenContentType
+ ');
+ }
+}
diff --git a/src/plugin/flashcard/Resources/modules/resources/flashcard/components/cards.jsx b/src/plugin/flashcard/Resources/modules/resources/flashcard/components/cards.jsx
deleted file mode 100644
index 5212e362abc..00000000000
--- a/src/plugin/flashcard/Resources/modules/resources/flashcard/components/cards.jsx
+++ /dev/null
@@ -1,43 +0,0 @@
-import React from 'react'
-import {PropTypes as T} from 'prop-types'
-
-import {ContentHtml} from '#/main/app/content/components/html'
-import {Toolbar} from '#/main/app/action/components/toolbar'
-import {Card as CardTypes} from '#/plugin/flashcard/resources/flashcard/prop-types'
-
-const Cards = props =>
-
- {props.cards.map((card) =>
- -
-
- {props.actions && (
-
-
-
- )}
-
- {card.visibleContent}
-
-
-
- )}
-
-
-Cards.propTypes = {
- cards: T.arrayOf(T.shape(
- CardTypes.propTypes
- )),
- actions: T.func
-}
-
-export {
- Cards
-}
diff --git a/src/plugin/flashcard/Resources/modules/resources/flashcard/editor/components/cards.jsx b/src/plugin/flashcard/Resources/modules/resources/flashcard/editor/components/cards.jsx
new file mode 100644
index 00000000000..cf0d16d9470
--- /dev/null
+++ b/src/plugin/flashcard/Resources/modules/resources/flashcard/editor/components/cards.jsx
@@ -0,0 +1,58 @@
+import React from 'react'
+import {PropTypes as T} from 'prop-types'
+
+import {asset} from '#/main/app/config/asset'
+import {ContentHtml} from '#/main/app/content/components/html'
+import {Toolbar} from '#/main/app/action/components/toolbar'
+
+import {Card as CardTypes} from '#/plugin/flashcard/resources/flashcard/prop-types'
+
+const Cards = props =>
+
+
+Cards.propTypes = {
+ cards: T.arrayOf(T.shape(
+ CardTypes.propTypes
+ )),
+ visibleContentType: T.string,
+ actions: T.func
+}
+
+export {
+ Cards
+}
diff --git a/src/plugin/flashcard/Resources/modules/resources/flashcard/editor/components/editor.jsx b/src/plugin/flashcard/Resources/modules/resources/flashcard/editor/components/editor.jsx
index 93c9aa76a4b..fb8cf96eac4 100644
--- a/src/plugin/flashcard/Resources/modules/resources/flashcard/editor/components/editor.jsx
+++ b/src/plugin/flashcard/Resources/modules/resources/flashcard/editor/components/editor.jsx
@@ -1,10 +1,9 @@
-import React, {Fragment} from 'react'
+import React from 'react'
import {PropTypes as T} from 'prop-types'
import {connect} from 'react-redux'
import get from 'lodash/get'
import {trans} from '#/main/app/intl/translation'
-import {ContentTitle} from '#/main/app/content/components/title'
import {CALLBACK_BUTTON, LINK_BUTTON, MODAL_BUTTON} from '#/main/app/buttons'
import {actions as formActions} from '#/main/app/content/form/store'
import {FormData} from '#/main/app/content/form/containers/data'
@@ -17,82 +16,90 @@ import {selectors} from '#/plugin/flashcard/resources/flashcard/editor/store'
import {selectors as baseSelectors} from '#/plugin/flashcard/resources/flashcard/store/selectors'
import {Card as CardTypes} from '#/plugin/flashcard/resources/flashcard/prop-types'
import {MODAL_CARD} from '#/plugin/flashcard/resources/flashcard/editor/modals/card'
-import {Cards} from '#/plugin/flashcard/resources/flashcard/components/cards'
+import {Cards} from '#/plugin/flashcard/resources/flashcard/editor/components/cards'
const EditorComponent = props =>
-
-
-
- ['apiv2_flashcard_deck_update', {id: props.flashcardDeck.id}]}
- cancel={{
- type: LINK_BUTTON,
- target: props.path,
- exact: true
- }}
- definition={[{
+ ['apiv2_flashcard_deck_update', {id: props.flashcardDeck.id}]}
+ cancel={{
+ type: LINK_BUTTON,
+ target: props.path,
+ exact: true
+ }}
+ definition={[
+ {
icon: 'fa fa-fw fa-home',
title: trans('overview'),
- fields: [{
- name: 'overview.display',
- type: 'boolean',
- label: trans('enable_overview'),
- linked: [{
- name: 'overview.message',
- type: 'html',
- label: trans('overview_message'),
- displayed: (flashcardDeck) => get(flashcardDeck, 'overview.display')
- }]
- }]
+ fields: [
+ {
+ name: 'overview.display',
+ type: 'boolean',
+ label: trans('enable_overview'),
+ linked: [
+ {
+ name: 'overview.message',
+ type: 'html',
+ label: trans('overview_message'),
+ displayed: (flashcardDeck) => get(flashcardDeck, 'overview.display')
+ }
+ ]
+ }
+ ]
}, {
icon: 'fa fa-fw fa-dice-d20',
title: trans('flashcard_options', {}, 'flashcard'),
- fields: [{
- name: 'draw',
- type: 'number',
- label: trans('draw_options', {}, 'flashcard'),
- help: trans('options_desc', {}, 'flashcard'),
- options: {
- min: 1,
- max: props.cards.length
+ fields: [
+ {
+ name: 'draw',
+ type: 'number',
+ label: trans('draw_options', {}, 'flashcard'),
+ help: trans('options_desc', {}, 'flashcard'),
+ options: {
+ min: 1,
+ max: props.cards.length
+ }
}
- }]
+ ]
}, {
icon: 'fa fa-fw fa-flag-checkered',
title: trans('end_page'),
- fields: [{
- name: 'end.display',
- type: 'boolean',
- label: trans('show_end_page'),
- linked: [{
- name: 'end.message',
- type: 'html',
- label: trans('end_message'),
- displayed: (flashcardDeck) => get(flashcardDeck, 'end.display')
- }]
- }]
- }]}
- >
- {0 === props.cards.length &&
-
+ fields: [
+ {
+ name: 'end.display',
+ type: 'boolean',
+ label: trans('show_end_page'),
+ linked: [
+ {
+ name: 'end.message',
+ type: 'html',
+ label: trans('end_message'),
+ displayed: (flashcardDeck) => get(flashcardDeck, 'end.display')
+ }
+ ]
+ }
+ ]
}
+ ]}
+ >
+ {0 === props.cards.length &&
+
+ }
- {0 !== props.cards.length &&
- [{
+ {0 !== props.cards.length &&
+ [
+ {
name: 'configure',
type: MODAL_BUTTON,
icon: 'fa fa-fw fa-cog',
@@ -128,21 +135,22 @@ const EditorComponent = props =>
message: trans('card_delete_message', {}, 'flashcard'),
button: trans('delete', {}, 'actions')
}
- }]}
- />}
-
-
-
+ }
+
+