|
2 | 2 |
|
3 | 3 | <VHover :disabled="copying"> |
4 | 4 | <template #default="{ hover }"> |
5 | | - <DraggableHandle v-bind="draggableHandle"> |
6 | | - <template #default> |
7 | | - <VListTile |
8 | | - v-if="node" |
9 | | - class="content-list-item pa-0" |
10 | | - :class="{ |
11 | | - 'compact': isCompact, |
12 | | - hover: hover && !copying, |
13 | | - active: (active || hover) && !copying, |
14 | | - disabled: copying, |
15 | | - highlight, |
16 | | - }" |
17 | | - data-test="content-item" |
18 | | - @click="handleTileClick" |
| 5 | + <DraggableHandle v-bind="draggableHandle"> |
| 6 | + <template #default> |
| 7 | + <VListTile |
| 8 | + v-if="node" |
| 9 | + class="content-list-item pa-0" |
| 10 | + :class="{ |
| 11 | + 'compact': isCompact, |
| 12 | + hover: hover && !copying, |
| 13 | + active: (active || hover) && !copying, |
| 14 | + disabled: copying, |
| 15 | + highlight, |
| 16 | + }" |
| 17 | + data-test="content-item" |
| 18 | + @click="handleTileClick" |
| 19 | + > |
| 20 | + <slot name="actions-start" :hover="hover" class="actions-start-col"></slot> |
| 21 | + <div |
| 22 | + class="mx-2 thumbnail-col" |
| 23 | + :class="{ |
| 24 | + 'px-2': !isCompact, |
| 25 | + 'py-4': !isCompact, |
| 26 | + 'py-3': isCompact, |
| 27 | + }" |
| 28 | + > |
| 29 | + <ImageOnlyThumbnail |
| 30 | + v-bind="thumbnailAttrs" |
| 31 | + :isTopic="isTopic" |
| 32 | + :learningActivities="node.learning_activities" |
| 33 | + :compact="isCompact" |
| 34 | + :isEmpty="node.total_count === 0" |
| 35 | + /> |
| 36 | + </div> |
| 37 | + <VListTileContent |
| 38 | + class="description-col grow px-2" |
| 39 | + :class="{ |
| 40 | + 'my-4': !isCompact, |
| 41 | + 'my-3': isCompact, |
| 42 | + }" |
| 43 | + > |
| 44 | + <VListTileTitle data-test="title"> |
| 45 | + <VLayout row> |
| 46 | + <VFlex shrink class="text-truncate"> |
| 47 | + <h3 |
| 48 | + v-if="hasTitle(node) || !canEdit || copying || isNew" |
| 49 | + class="notranslate text-truncate" |
| 50 | + :class="[ |
| 51 | + isCompact ? 'font-weight-regular' : '', |
| 52 | + getTitleClass(node), |
| 53 | + ]" |
| 54 | + dir="auto" |
| 55 | + > |
| 56 | + {{ getTitle(node) }} |
| 57 | + </h3> |
| 58 | + </VFlex> |
| 59 | + <VFlex v-if="!isTopic && isCoach" class="px-1"> |
| 60 | + <Icon |
| 61 | + color="roleVisibilityCoach" |
| 62 | + small |
| 63 | + style="vertical-align: middle;" |
| 64 | + > |
| 65 | + local_library |
| 66 | + </Icon> |
| 67 | + </VFlex> |
| 68 | + <VFlex> |
| 69 | + <ContentNodeValidator |
| 70 | + v-if="canEdit && !copying && !isNew" |
| 71 | + :node="node" |
| 72 | + /> |
| 73 | + </VFlex> |
| 74 | + </VLayout> |
| 75 | + </VListTileTitle> |
| 76 | + |
| 77 | + <ToggleText |
| 78 | + v-show="!isCompact && !comfortable" |
| 79 | + :text="node.description" |
| 80 | + data-test="description" |
| 81 | + notranslate |
| 82 | + dir="auto" |
| 83 | + :splitAt="280" |
| 84 | + /> |
| 85 | + |
| 86 | + <VListTileSubTitle |
| 87 | + v-if="!isCompact" |
| 88 | + data-test="subtitle" |
| 89 | + class="metadata" |
19 | 90 | > |
20 | | - <slot name="actions-start" :hover="hover" class="actions-start-col"></slot> |
21 | | - <div |
22 | | - class="mx-2 thumbnail-col" |
23 | | - :class="{ |
24 | | - 'px-2': !isCompact, |
25 | | - 'py-4': !isCompact, |
26 | | - 'py-3': isCompact, |
27 | | - }" |
| 91 | + <span v-if="subtitle" class="text">{{ subtitle }}</span> |
| 92 | + <span |
| 93 | + v-if="node.categories ? Object.keys(node.categories).length > 0 : null" |
| 94 | + class="text" |
28 | 95 | > |
29 | | - <ImageOnlyThumbnail |
30 | | - v-bind="thumbnailAttrs" |
31 | | - :isTopic="isTopic" |
32 | | - :learningActivities="node.learning_activities" |
33 | | - :compact="isCompact" |
34 | | - :isEmpty="node.total_count === 0" |
35 | | - /> |
36 | | - </div> |
37 | | - <VListTileContent |
38 | | - class="description-col grow px-2" |
39 | | - :class="{ |
40 | | - 'my-4': !isCompact, |
41 | | - 'my-3': isCompact, |
42 | | - }" |
43 | | - > |
44 | | - <VListTileTitle data-test="title"> |
45 | | - <VLayout row> |
46 | | - <VFlex shrink class="text-truncate"> |
47 | | - <h3 |
48 | | - v-if="hasTitle(node) || !canEdit || copying || isNew" |
49 | | - class="notranslate text-truncate" |
50 | | - :class="[ |
51 | | - isCompact ? 'font-weight-regular' : '', |
52 | | - getTitleClass(node), |
53 | | - ]" |
54 | | - dir="auto" |
55 | | - > |
56 | | - {{ getTitle(node) }} |
57 | | - </h3> |
58 | | - </VFlex> |
59 | | - <VFlex v-if="!isTopic && isCoach" class="px-1"> |
| 96 | + {{ category(node.categories) }} |
| 97 | + </span> |
| 98 | + <span v-if="isTopic && node.coach_count"> |
| 99 | + <!-- for each learning activity --> |
| 100 | + <VTooltip bottom lazy> |
| 101 | + <template #activator="{ on }"> |
| 102 | + <div style="display: inline-block;" v-on="on"> |
60 | 103 | <Icon |
61 | 104 | color="roleVisibilityCoach" |
62 | 105 | small |
63 | | - style="vertical-align: middle;" |
| 106 | + class="mx-1" |
| 107 | + style="vertical-align: sub;" |
64 | 108 | > |
65 | 109 | local_library |
66 | 110 | </Icon> |
67 | | - </VFlex> |
68 | | - <VFlex> |
69 | | - <ContentNodeValidator |
70 | | - v-if="canEdit && !copying && !isNew" |
71 | | - :node="node" |
72 | | - /> |
73 | | - </VFlex> |
74 | | - </VLayout> |
75 | | - </VListTileTitle> |
76 | | - |
77 | | - <ToggleText |
78 | | - v-show="!isCompact && !comfortable" |
79 | | - :text="node.description" |
80 | | - data-test="description" |
81 | | - notranslate |
82 | | - dir="auto" |
83 | | - :splitAt="280" |
84 | | - /> |
85 | | - |
86 | | - <VListTileSubTitle |
87 | | - v-if="!isCompact" |
88 | | - data-test="subtitle" |
89 | | - class="metadata" |
90 | | - > |
91 | | - <span v-if="subtitle" class="text">{{ subtitle }}</span> |
92 | | - <span |
93 | | - v-if="node.categories ? Object.keys(node.categories).length > 0 : null" |
94 | | - class="text" |
95 | | - > |
96 | | - {{ category(node.categories) }} |
97 | | - </span> |
98 | | - <span v-if="isTopic && node.coach_count"> |
99 | | - <!-- for each learning activity --> |
100 | | - <VTooltip bottom lazy> |
101 | | - <template #activator="{ on }"> |
102 | | - <div style="display: inline-block;" v-on="on"> |
103 | | - <Icon |
104 | | - color="roleVisibilityCoach" |
105 | | - small |
106 | | - class="mx-1" |
107 | | - style="vertical-align: sub;" |
108 | | - > |
109 | | - local_library |
110 | | - </Icon> |
111 | | - <span v-if="isTopic"> |
112 | | - {{ $formatNumber(node.coach_count) }} |
113 | | - </span> |
114 | | - </div> |
115 | | - </template> |
116 | | - <span> |
117 | | - {{ isTopic ? |
118 | | - $tr('hasCoachTooltip', { value: node.coach_count }) |
119 | | - : $tr('coachTooltip') |
120 | | - }} |
| 111 | + <span v-if="isTopic"> |
| 112 | + {{ $formatNumber(node.coach_count) }} |
121 | 113 | </span> |
122 | | - </VTooltip> |
123 | | - </span> |
124 | | - </VListTileSubTitle> |
125 | | - <span v-if="!isCompact"> |
126 | | - |
127 | | - <ContentNodeLearningActivityIcon |
128 | | - v-if="!isTopic" |
129 | | - :learningActivities="node.learning_activities" |
130 | | - showEachActivityIcon |
131 | | - includeText |
132 | | - small |
133 | | - chip |
134 | | - class="inline" |
135 | | - /> |
136 | | - <span v-if="node.grade_levels"> |
137 | | - <span |
138 | | - v-for="(key, index) in Object.keys(node.grade_levels)" |
139 | | - :key="index" |
140 | | - class="small-chip" |
141 | | - :style="{ backgroundColor: $themeTokens.fineLine }" |
142 | | - > |
143 | | - {{ levels(key) }} |
144 | | - </span> |
| 114 | + </div> |
| 115 | + </template> |
| 116 | + <span> |
| 117 | + {{ isTopic ? |
| 118 | + $tr('hasCoachTooltip', { value: node.coach_count }) |
| 119 | + : $tr('coachTooltip') |
| 120 | + }} |
145 | 121 | </span> |
| 122 | + </VTooltip> |
| 123 | + </span> |
| 124 | + </VListTileSubTitle> |
| 125 | + <span v-if="!isCompact"> |
| 126 | + |
| 127 | + <ContentNodeLearningActivityIcon |
| 128 | + v-if="!isTopic" |
| 129 | + :learningActivities="node.learning_activities" |
| 130 | + showEachActivityIcon |
| 131 | + includeText |
| 132 | + small |
| 133 | + chip |
| 134 | + class="inline" |
| 135 | + /> |
| 136 | + <span v-if="node.grade_levels"> |
| 137 | + <span |
| 138 | + v-for="(key, index) in Object.keys(node.grade_levels)" |
| 139 | + :key="index" |
| 140 | + class="small-chip" |
| 141 | + :style="{ backgroundColor: $themeTokens.fineLine }" |
| 142 | + > |
| 143 | + {{ levels(key) }} |
146 | 144 | </span> |
147 | | - </VListTileContent> |
148 | | - |
149 | | - <VListTileContent class="actions-end-col updated"> |
150 | | - <ContentNodeChangedIcon v-if="canEdit && !copying" :node="node" /> |
151 | | - </VListTileContent> |
152 | | - <template v-if="!copying"> |
153 | | - <VListTileAction class="actions-end-col"> |
154 | | - <KIconButton |
155 | | - v-if="isTopic" |
156 | | - :aria-hidden="hover" |
157 | | - data-test="btn-chevron" |
158 | | - icon="chevronRight" |
159 | | - :tooltip="$tr('openTopic')" |
160 | | - size="small" |
161 | | - @click="$emit('topicChevronClick')" |
162 | | - /> |
163 | | - </VListTileAction> |
164 | | - <slot name="actions-end" :hover="hover"></slot> |
165 | | - </template> |
166 | | - <template v-else> |
167 | | - <div class="copying"> |
168 | | - <p class="caption pr-3"> |
169 | | - <span |
170 | | - class="grey--text" |
171 | | - :style="{ 'cursor': hasCopyingErrored ? 'default' : 'progress' }" |
172 | | - > |
173 | | - {{ copyingMessage }} |
174 | | - </span> |
175 | | - <slot name="copy-fail-retry-action"></slot> |
176 | | - </p> |
177 | | - <ContentNodeCopyTaskProgress |
178 | | - :node="node" |
179 | | - size="30" |
180 | | - /> |
181 | | - <slot name="copy-fail-remove-action"></slot> |
182 | | - </div> |
183 | | - <div class="disabled-overlay"></div> |
184 | | - </template> |
185 | | - <slot name="context-menu" v-if="!contextMenuDisabled"></slot> |
186 | | - </VListTile> |
| 145 | + </span> |
| 146 | + </span> |
| 147 | + </VListTileContent> |
| 148 | + |
| 149 | + <VListTileContent class="actions-end-col updated"> |
| 150 | + <ContentNodeChangedIcon v-if="canEdit && !copying" :node="node" /> |
| 151 | + </VListTileContent> |
| 152 | + <template v-if="!copying"> |
| 153 | + <VListTileAction class="actions-end-col"> |
| 154 | + <KIconButton |
| 155 | + v-if="isTopic" |
| 156 | + :aria-hidden="hover" |
| 157 | + data-test="btn-chevron" |
| 158 | + icon="chevronRight" |
| 159 | + :tooltip="$tr('openTopic')" |
| 160 | + size="small" |
| 161 | + @click="$emit('topicChevronClick')" |
| 162 | + /> |
| 163 | + </VListTileAction> |
| 164 | + <slot name="actions-end" :hover="hover"></slot> |
| 165 | + </template> |
| 166 | + <template v-else> |
| 167 | + <div class="copying"> |
| 168 | + <p class="caption pr-3"> |
| 169 | + <span |
| 170 | + class="grey--text" |
| 171 | + :style="{ 'cursor': hasCopyingErrored ? 'default' : 'progress' }" |
| 172 | + > |
| 173 | + {{ copyingMessage }} |
| 174 | + </span> |
| 175 | + <slot name="copy-fail-retry-action"></slot> |
| 176 | + </p> |
| 177 | + <ContentNodeCopyTaskProgress |
| 178 | + :node="node" |
| 179 | + size="30" |
| 180 | + /> |
| 181 | + <slot name="copy-fail-remove-action"></slot> |
| 182 | + </div> |
| 183 | + <div class="disabled-overlay"></div> |
187 | 184 | </template> |
188 | | - </DraggableHandle> |
| 185 | + <slot v-if="!contextMenuDisabled" name="context-menu"></slot> |
| 186 | + </VListTile> |
| 187 | + </template> |
| 188 | + </DraggableHandle> |
189 | 189 | </template> |
190 | 190 | </VHover> |
191 | 191 |
|
|
204 | 204 | import { RolesNames } from 'shared/leUtils/Roles'; |
205 | 205 | import ImageOnlyThumbnail from 'shared/views/files/ImageOnlyThumbnail'; |
206 | 206 | import ToggleText from 'shared/views/ToggleText'; |
207 | | - import ContextMenuCloak from 'shared/views/ContextMenuCloak'; |
208 | 207 | import DraggableHandle from 'shared/views/draggable/DraggableHandle'; |
209 | 208 | import { titleMixin, metadataTranslationMixin } from 'shared/mixins'; |
210 | 209 | import { EffectAllowed } from 'shared/mixins/draggable/constants'; |
|
214 | 213 | name: 'ContentNodeListItem', |
215 | 214 | components: { |
216 | 215 | DraggableHandle, |
217 | | - ContextMenuCloak, |
218 | 216 | ImageOnlyThumbnail, |
219 | 217 | ContentNodeValidator, |
220 | 218 | ContentNodeChangedIcon, |
|
0 commit comments