Skip to content

Commit 7e0b7f9

Browse files
docs: (backport) adding comprehensive readme documentation for plugin slots (#2340)
1 parent 4bc34c2 commit 7e0b7f9

File tree

5 files changed

+111
-2
lines changed

5 files changed

+111
-2
lines changed

src/plugin-slots/AdditionalCourseContentPluginSlot/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
### Slot ID: `org.openedx.frontend.authoring.additional_course_content_plugin.v1`
44

55
### Slot ID Aliases
6-
* `additional_course_content_plugin`
6+
* `additional_course_content_plugin`
Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,64 @@
1-
# AdditionalCoursePluginSlot
1+
# Additional Course Plugin Slot
22

33
### Slot ID: `org.openedx.frontend.authoring.additional_course_plugin.v1`
44

55
### Slot ID Aliases
66
* `additional_course_plugin`
7+
8+
## Description
9+
10+
This slot is used to add a custom card on the the page & resources page.
11+
12+
## Example
13+
14+
The following `env.config.jsx` will add a custom card at the end of the page & resources section.
15+
16+
![Screenshot of the unit sidebar surrounded by border](./images/additional-course-plugin-slot-example.png)
17+
18+
```jsx
19+
import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';
20+
import { Badge, Card } from '@openedx/paragon';
21+
import { Settings } from '@openedx/paragon/icons';
22+
23+
const config = {
24+
pluginSlots: {
25+
'org.openedx.frontend.authoring.additional_course_plugin.v1': {
26+
plugins: [
27+
{
28+
op: PLUGIN_OPERATIONS.Hide,
29+
widgetId: 'default_contents',
30+
},
31+
{
32+
op: PLUGIN_OPERATIONS.Insert,
33+
widget: {
34+
id: 'custom_additional_course',
35+
type: DIRECT_PLUGIN,
36+
RenderWidget: () => (
37+
<Card className={'shadow justify-content-between'} >
38+
<Card.Header
39+
title={'Additional Course'}
40+
subtitle={(
41+
<Badge variant="success" className="mt-1">
42+
slot props course
43+
</Badge>
44+
)}
45+
actions={<Settings />}
46+
size="sm"
47+
/>
48+
<Card.Body>
49+
<Card.Section>
50+
Additional course from slot props description.
51+
Or anything else.
52+
</Card.Section>
53+
</Card.Body>
54+
</Card>
55+
),
56+
},
57+
},
58+
]
59+
}
60+
},
61+
}
62+
63+
export default config;
64+
```
324 KB
Loading

src/plugin-slots/AdditionalTranslationsComponentSlot/README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,54 @@
1313
* `additionalProps` - Object
1414
* `transcriptType` - String
1515
* `isAiTranslationsEnabled` - Boolean
16+
17+
18+
## Description
19+
20+
This slot is used to add a custom block in the **Video Transcription Settings** drawer.
21+
22+
## Example
23+
24+
The following `env.config.jsx` will add a custom transcript option in the Transcript Settings drawer.
25+
26+
![Screenshot of the unit sidebar surrounded by border](./images/additional-translation-example.png)
27+
28+
```jsx
29+
import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';
30+
import { Collapsible, Icon } from '@openedx/paragon';
31+
import { ChevronRight } from '@openedx/paragon/icons';
32+
33+
const TranslationsBlock = ({ setIsAiTranslations, courseId }) => (
34+
<div key="transcript-type-selection" className="mt-3">
35+
<Collapsible.Advanced
36+
onOpen={() => setIsAiTranslations(courseId === 'anyId')}
37+
>
38+
<Collapsible.Trigger
39+
className="row m-0 justify-content-between align-items-center"
40+
>
41+
Custom transcript 💬
42+
<Icon src={ChevronRight} />
43+
</Collapsible.Trigger>
44+
</Collapsible.Advanced>
45+
</div>
46+
);
47+
48+
const config = {
49+
pluginSlots: {
50+
'org.openedx.frontend.authoring.video_transcript_additional_translations_component.v1': {
51+
plugins: [
52+
{
53+
op: PLUGIN_OPERATIONS.Insert,
54+
widget: {
55+
id: 'custom_additional_translation_id',
56+
type: DIRECT_PLUGIN,
57+
RenderWidget: TranslationsBlock,
58+
},
59+
},
60+
],
61+
},
62+
},
63+
}
64+
65+
export default config;
66+
```
36.2 KB
Loading

0 commit comments

Comments
 (0)