Skip to content

Commit f676591

Browse files
committed
use Accessible*Cards in LessonResourceSelectiionPage
1 parent 8c5f609 commit f676591

File tree

3 files changed

+33
-48
lines changed

3 files changed

+33
-48
lines changed

Diff for: kolibri/plugins/coach/assets/src/views/lessons/LessonResourceSelectionPage/ContentCardList.vue

+29-48
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,29 @@
11
<template>
22

3-
<div>
4-
<ul class="content-list">
5-
<KCheckbox
6-
v-if="showSelectAll"
7-
:label="$tr('selectAllCheckboxLabel')"
8-
:checked="selectAllChecked"
9-
:indeterminate="selectAllIndeterminate"
10-
@change="$emit('changeselectall', $event)"
11-
/>
12-
<KRadioButtonGroup>
13-
<li
14-
v-for="content in contentList"
15-
:key="content.id"
16-
class="content-list-item"
17-
:aria-selected="contentIsChecked(content)"
18-
>
3+
<div class="content-list">
4+
<KCheckbox
5+
v-if="showSelectAll"
6+
:label="$tr('selectAllCheckboxLabel')"
7+
:checked="selectAllChecked"
8+
:indeterminate="selectAllIndeterminate"
9+
@change="$emit('changeselectall', $event)"
10+
/>
11+
<KCardGrid layout="1-1-1">
12+
<component
13+
:is="content.is_leaf ? 'AccessibleResourceCard' : 'AccessibleFolderCard'"
14+
v-for="content in contentList"
15+
:key="content.id"
16+
:to="contentCardLink(content)"
17+
:contentNode="content"
18+
:thumbnailSrc="content.thumbnail"
19+
:headingLevel="cardsHeadingLevel"
20+
>
21+
<template #belowTitle>
22+
<p v-if="contentCardMessage(content)">{{ contentCardMessage(content) }}</p>
23+
</template>
24+
<template #select>
1925
<KCheckbox
2026
v-if="contentHasCheckbox(content) && !showRadioButtons"
21-
class="content-checkbox"
2227
:label="content.title"
2328
:showLabel="false"
2429
:checked="contentIsChecked(content)"
@@ -28,39 +33,16 @@
2833
/>
2934
<KRadioButton
3035
v-else-if="contentHasCheckbox(content) && showRadioButtons"
31-
class="content-checkbox"
3236
:label="content.title"
3337
:showLabel="false"
3438
:currentValue="contentIsChecked(content) ? content.id : 'none'"
3539
:buttonValue="content.id"
3640
:disabled="contentCheckboxDisabled(content)"
3741
@change="handleCheckboxChange(content, true)"
3842
/>
39-
<!--
40-
disabled, tabindex, is-leaf class set here to hack making the card not clickable
41-
if you're trying to make the card clickable remove these properties
42-
-->
43-
<LessonContentCard
44-
class="content-card"
45-
:disabled="content.is_leaf"
46-
:tabindex="content.is_leaf ? -1 : 0"
47-
:class="{ 'with-checkbox': needCheckboxes }"
48-
:content="content"
49-
:message="contentCardMessage(content)"
50-
:link="contentCardLink(content)"
51-
:headingLevel="cardsHeadingLevel"
52-
>
53-
<template #notice>
54-
<slot
55-
name="notice"
56-
:content="content"
57-
>
58-
</slot>
59-
</template>
60-
</LessonContentCard>
61-
</li>
62-
</KRadioButtonGroup>
63-
</ul>
43+
</template>
44+
</component>
45+
</KCardGrid>
6446

6547
<template>
6648
<KButton
@@ -90,13 +72,15 @@
9072
<script>
9173
9274
import commonCoreStrings from 'kolibri/uiText/commonCoreStrings';
75+
import AccessibleFolderCard from 'kolibri-common/components/Cards/AccessibleFolderCard';
76+
import AccessibleResourceCard from 'kolibri-common/components/Cards/AccessibleResourceCard';
9377
import { ViewMoreButtonStates } from '../../../constants/index';
94-
import LessonContentCard from './LessonContentCard';
9578
9679
export default {
9780
name: 'ContentCardList',
9881
components: {
99-
LessonContentCard,
82+
AccessibleResourceCard,
83+
AccessibleFolderCard,
10084
},
10185
mixins: [commonCoreStrings],
10286
setup() {
@@ -173,9 +157,6 @@
173157
showButton() {
174158
return this.viewMoreButtonState === this.ViewMoreButtonStates.HAS_MORE;
175159
},
176-
needCheckboxes() {
177-
return this.contentList.some(c => this.contentHasCheckbox(c));
178-
},
179160
},
180161
methods: {
181162
handleCheckboxChange(content, checked) {

Diff for: packages/kolibri-common/components/Cards/AccessibleFolderCard.vue

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
</template>
2121

2222
<template #belowTitle>
23+
<slot name="belowTitle"></slot>
2324
<div
2425
class="header-bar"
2526
:style="headerStyles"

Diff for: packages/kolibri-common/components/Cards/AccessibleResourceCard.vue

+3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
/>
2424
</div>
2525
</template>
26+
<template #select>
27+
<slot name="select"></slot>
28+
</template>
2629
<template #footer>
2730
<div class="default-icon">
2831
<KIconButton

0 commit comments

Comments
 (0)