-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added types de contenus for flashcard content
- Loading branch information
Showing
12 changed files
with
437 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/plugin/flashcard/Installation/Migrations/Version20230913120151.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
namespace Claroline\FlashcardBundle\Installation\Migrations; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use Doctrine\Migrations\AbstractMigration; | ||
|
||
/** | ||
* Auto-generated migration based on mapping information: modify it with caution. | ||
* | ||
* Generation date: 2023/09/13 12:01:51 | ||
*/ | ||
final class Version20230913120151 extends AbstractMigration | ||
{ | ||
public function up(Schema $schema): void | ||
{ | ||
$this->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 | ||
'); | ||
} | ||
} |
43 changes: 0 additions & 43 deletions
43
src/plugin/flashcard/Resources/modules/resources/flashcard/components/cards.jsx
This file was deleted.
Oops, something went wrong.
58 changes: 58 additions & 0 deletions
58
src/plugin/flashcard/Resources/modules/resources/flashcard/editor/components/cards.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 => | ||
<ul className="flashcards"> | ||
{props.cards.map((card) => | ||
<li key={card.id} className="flashcard-preview"> | ||
{props.actions && | ||
<div className="flashcard-actions"> | ||
<Toolbar | ||
id={`${card.id}-btn`} | ||
buttonName="action-button" | ||
tooltip="right" | ||
size="sm" | ||
toolbar="more" | ||
actions={props.actions(card)} | ||
/> | ||
</div> | ||
} | ||
{ card.visibleContentType === 'image' && | ||
<img src={asset(card.visibleContent.url)} alt={card.question} className="flashcard-thumbnail" /> | ||
} | ||
{ card.visibleContentType === 'video' && | ||
<video className="flashcard-thumbnail not-video-js vjs-default-skin vjs-16-9"> | ||
<source src={asset(card.visibleContent.url)} /> | ||
</video> | ||
} | ||
{ card.visibleContentType === 'audio' && | ||
<audio controls style={{margin: '50px 10px'}} controlsList="noremoteplayback nodownload noplaybackrate"> | ||
<source src={asset(card.visibleContent.url)}/> | ||
</audio> | ||
} | ||
{ card.visibleContentType === 'text' && | ||
<div className="flashcard-content"> | ||
<ContentHtml>{card.visibleContent}</ContentHtml> | ||
</div> | ||
} | ||
</li> | ||
)} | ||
</ul> | ||
|
||
Cards.propTypes = { | ||
cards: T.arrayOf(T.shape( | ||
CardTypes.propTypes | ||
)), | ||
visibleContentType: T.string, | ||
actions: T.func | ||
} | ||
|
||
export { | ||
Cards | ||
} |
Oops, something went wrong.