|
1 | 1 | <template>
|
2 | 2 |
|
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> |
19 | 25 | <KCheckbox
|
20 | 26 | v-if="contentHasCheckbox(content) && !showRadioButtons"
|
21 |
| - class="content-checkbox" |
22 | 27 | :label="content.title"
|
23 | 28 | :showLabel="false"
|
24 | 29 | :checked="contentIsChecked(content)"
|
|
28 | 33 | />
|
29 | 34 | <KRadioButton
|
30 | 35 | v-else-if="contentHasCheckbox(content) && showRadioButtons"
|
31 |
| - class="content-checkbox" |
32 | 36 | :label="content.title"
|
33 | 37 | :showLabel="false"
|
34 | 38 | :currentValue="contentIsChecked(content) ? content.id : 'none'"
|
35 | 39 | :buttonValue="content.id"
|
36 | 40 | :disabled="contentCheckboxDisabled(content)"
|
37 | 41 | @change="handleCheckboxChange(content, true)"
|
38 | 42 | />
|
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> |
64 | 46 |
|
65 | 47 | <template>
|
66 | 48 | <KButton
|
|
90 | 72 | <script>
|
91 | 73 |
|
92 | 74 | import commonCoreStrings from 'kolibri/uiText/commonCoreStrings';
|
| 75 | + import AccessibleFolderCard from 'kolibri-common/components/Cards/AccessibleFolderCard'; |
| 76 | + import AccessibleResourceCard from 'kolibri-common/components/Cards/AccessibleResourceCard'; |
93 | 77 | import { ViewMoreButtonStates } from '../../../constants/index';
|
94 |
| - import LessonContentCard from './LessonContentCard'; |
95 | 78 |
|
96 | 79 | export default {
|
97 | 80 | name: 'ContentCardList',
|
98 | 81 | components: {
|
99 |
| - LessonContentCard, |
| 82 | + AccessibleResourceCard, |
| 83 | + AccessibleFolderCard, |
100 | 84 | },
|
101 | 85 | mixins: [commonCoreStrings],
|
102 | 86 | setup() {
|
|
173 | 157 | showButton() {
|
174 | 158 | return this.viewMoreButtonState === this.ViewMoreButtonStates.HAS_MORE;
|
175 | 159 | },
|
176 |
| - needCheckboxes() { |
177 |
| - return this.contentList.some(c => this.contentHasCheckbox(c)); |
178 |
| - }, |
179 | 160 | },
|
180 | 161 | methods: {
|
181 | 162 | handleCheckboxChange(content, checked) {
|
|
0 commit comments