Skip to content

Commit 27d3422

Browse files
committed
Replace contentNodeOPtions with KDropdown
1 parent 0a6342c commit 27d3422

5 files changed

Lines changed: 74 additions & 75 deletions

File tree

contentcuration/contentcuration/frontend/channelEdit/components/ContentNodeEditListItem.vue

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -49,30 +49,28 @@
4949
<template #actions-end>
5050
<VListTileAction class="action-icon px-1" @click.stop>
5151
<transition name="fade">
52-
<IconButton
52+
<KIconButton
5353
icon="rename"
5454
size="small"
55-
:text="$tr('editTooltip')"
55+
:tooltip="$tr('editTooltip')"
5656
:disabled="copying"
5757
@click.stop
5858
@click="editTitleDescription()"
5959
/>
6060
</transition>
6161
</VListTileAction>
6262
<VListTileAction :aria-hidden="!active" class="action-icon px-1">
63-
<Menu v-model="activated">
64-
<template #activator="{ on }">
65-
<IconButton
66-
icon="optionsVertical"
67-
:text="$tr('optionsTooltip')"
68-
size="small"
69-
:disabled="copying"
70-
v-on="on"
71-
@click.stop
72-
/>
63+
<KIconButton
64+
icon="optionsVertical"
65+
size="small"
66+
:tooltip="$tr('optionsTooltip')"
67+
:disabled="copying"
68+
@click.stop
69+
>
70+
<template #menu>
71+
<ContentNodeOptions v-if="!copying" :nodeId="nodeId" />
7372
</template>
74-
<ContentNodeOptions v-if="!copying && activated" :nodeId="nodeId" />
75-
</Menu>
73+
</KIconButton>
7674
</VListTileAction>
7775
</template>
7876

@@ -94,6 +92,7 @@
9492

9593
<template #context-menu="{ showContextMenu, positionX, positionY }">
9694
<ContentNodeContextMenu
95+
v-if="false"
9796
:show="showContextMenu"
9897
:positionX="positionX"
9998
:positionY="positionY"
@@ -164,11 +163,6 @@
164163
default: false,
165164
},
166165
},
167-
data() {
168-
return {
169-
activated: false,
170-
};
171-
},
172166
computed: {
173167
...mapGetters('currentChannel', ['canEdit']),
174168
...mapGetters('contentNode', [
@@ -186,7 +180,7 @@
186180
},
187181
},
188182
active() {
189-
return this.selected || this.activated || this.previewing;
183+
return this.selected || this.previewing;
190184
},
191185
contentNode() {
192186
return this.getContentNode(this.nodeId);

contentcuration/contentcuration/frontend/channelEdit/components/ContentNodeOptions.vue

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
<template>
22

3-
<div
3+
<KDropdownMenu
4+
:options="menuOptions"
5+
@select="onSelect"
6+
/>
7+
<!-- <div
48
style="max-height: 80vh"
59
>
610
<VList ref="optionsList">
@@ -37,7 +41,7 @@
3741
:moveNodeIds="[nodeId]"
3842
@target="moveNode"
3943
/>
40-
</div>
44+
</div> -->
4145

4246
</template>
4347

@@ -197,6 +201,14 @@
197201
.filter(group => group.some(option => option.condition))
198202
.map(group => group.filter(option => option.condition));
199203
},
204+
menuOptions() {
205+
return this.groupedOptions.reduce((acc, group, idx) => {
206+
if (idx > 0) {
207+
acc.push({ type: 'divider' });
208+
}
209+
return acc.concat(group);
210+
});
211+
},
200212
editLink() {
201213
return {
202214
name: RouteNames.CONTENTNODE_DETAILS,
@@ -243,13 +255,13 @@
243255
]),
244256
...mapActions('clipboard', ['copy']),
245257
async focusFirstOption() {
246-
const { optionsList } = this.$refs;
247-
const firstOption = optionsList.$el.querySelector('a');
248-
let tries = 0;
249-
while (document.activeElement !== firstOption && tries++ < 20) {
250-
await new Promise(resolve => setTimeout(resolve, 0));
251-
firstOption.focus();
252-
}
258+
// const { optionsList } = this.$refs;
259+
// const firstOption = optionsList.$el.querySelector('a');
260+
// let tries = 0;
261+
// while (document.activeElement !== firstOption && tries++ < 20) {
262+
// await new Promise(resolve => setTimeout(resolve, 0));
263+
// firstOption.focus();
264+
// }
253265
},
254266
checkTabBoundaries($event) {
255267
const optionsList = this.$refs.optionsList;
@@ -264,6 +276,14 @@
264276
this.$destroy();
265277
}
266278
},
279+
onSelect(option) {
280+
if (option.onClick) {
281+
option.onClick();
282+
}
283+
if (option.to) {
284+
this.$router.push(option.to);
285+
}
286+
},
267287
newTopicNode() {
268288
this.trackAction('New topic');
269289
const nodeData = {
@@ -309,8 +329,7 @@
309329
return () => {};
310330
},
311331
quickEditModalFactory(modal) {
312-
return $event => {
313-
$event.preventDefault();
332+
return () => {
314333
this.setQuickEditModal({
315334
modal,
316335
nodeIds: [this.nodeId],

contentcuration/contentcuration/frontend/channelEdit/components/StudioTree/StudioTree.vue

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -121,24 +121,19 @@
121121
size="15"
122122
width="2"
123123
/>
124-
<Menu
124+
<KIconButton
125125
v-else
126-
v-model="showMenu"
127-
data-test="editMenu"
126+
icon="optionsVertical"
127+
:tooltip="$tr('optionsTooltip')"
128+
@click.stop
128129
>
129-
<template #activator="{ on }">
130-
<IconButton
131-
icon="optionsVertical"
132-
:text="$tr('optionsTooltip')"
133-
v-on="on"
134-
@click.stop
135-
/>
130+
<template #menu>
131+
<ContentNodeOptions :nodeId="nodeId" />
136132
</template>
137-
<ContentNodeOptions v-if="showMenu" :nodeId="nodeId" />
138-
</Menu>
133+
</KIconButton>
139134
</VFlex>
140135
<ContentNodeContextMenu
141-
v-if="allowEditing && !copying"
136+
v-if="allowEditing && !copying && false"
142137
:show="showContextMenu"
143138
:positionX="positionX"
144139
:positionY="positionY"
@@ -258,7 +253,6 @@
258253
draggableSize: 5,
259254
draggableExpanded: false,
260255
debouncedLoad: null,
261-
showMenu: false,
262256
};
263257
},
264258
computed: {

contentcuration/contentcuration/frontend/channelEdit/views/CurrentTopicView.vue

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,15 @@
1111
<VFlex class="font-weight-bold text-truncate" shrink :class="getTitleClass(item)">
1212
{{ getTitle(item) }}
1313
</VFlex>
14-
<Menu v-if="item.displayNodeOptions" v-model="breadcrumbsMenu">
15-
<template #activator="{ on }">
16-
<IconButton
17-
icon="dropdown"
18-
:text="$tr('optionsButton')"
19-
v-on="on"
20-
/>
14+
<KIconButton
15+
v-if="item.displayNodeOptions"
16+
icon="dropdown"
17+
:tooltip="$tr('optionsButton')"
18+
>
19+
<template #menu>
20+
<ContentNodeOptions v-if="node" :nodeId="topicId" />
2121
</template>
22-
<ContentNodeOptions v-if="node && breadcrumbsMenu" :nodeId="topicId" />
23-
</Menu>
22+
</KIconButton>
2423
</VLayout>
2524
<span v-else class="grey--text" :class="getTitleClass(item)">
2625
{{ getTitle(item) }}
@@ -195,23 +194,18 @@
195194
:text="$tr('editButton')"
196195
@click="editNodes([detailNodeId])"
197196
/>
198-
<Menu v-model="resourceDrawerMenu">
199-
<template #activator="{ on }">
200-
<IconButton
201-
size="small"
202-
icon="optionsVertical"
203-
:text="$tr('optionsButton')"
204-
v-on="on"
197+
<KIconButton
198+
icon="optionsVertical"
199+
:tooltip="$tr('optionsButton')"
200+
>
201+
<template #menu>
202+
<ContentNodeOptions
203+
hideEditLink
204+
hideDetailsLink
205+
:nodeId="detailNodeId"
205206
/>
206207
</template>
207-
<ContentNodeOptions
208-
v-if="resourceDrawerMenu"
209-
:nodeId="detailNodeId"
210-
hideDetailsLink
211-
hideEditLink
212-
@removed="closePanel"
213-
/>
214-
</Menu>
208+
</KIconButton>
215209
</template>
216210
<template v-else #actions>
217211
<IconButton
@@ -287,8 +281,6 @@
287281
loadingAncestors: false,
288282
elevated: false,
289283
moveModalOpen: false,
290-
breadcrumbsMenu: false,
291-
resourceDrawerMenu: false,
292284
};
293285
},
294286
computed: {

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3496,17 +3496,17 @@ anymatch@^3.0.3, anymatch@~3.1.2:
34963496
normalize-path "^3.0.0"
34973497
picomatch "^2.0.4"
34983498

3499-
"aphrodite@git+https://github.com/learningequality/aphrodite.git":
3499+
"aphrodite@https://github.com/learningequality/aphrodite.git":
35003500
version "2.2.3"
3501-
resolved "git+https://github.com/learningequality/aphrodite.git#fdc8d7be8912a5cf17f74ff10f124013c52c3e32"
3501+
resolved "https://github.com/learningequality/aphrodite.git#fdc8d7be8912a5cf17f74ff10f124013c52c3e32"
35023502
dependencies:
35033503
asap "^2.0.3"
35043504
inline-style-prefixer "^4.0.2"
35053505
string-hash "^1.1.3"
35063506

3507-
"aphrodite@https://github.com/learningequality/aphrodite.git":
3507+
"aphrodite@https://github.com/learningequality/aphrodite/":
35083508
version "2.2.3"
3509-
resolved "https://github.com/learningequality/aphrodite.git#fdc8d7be8912a5cf17f74ff10f124013c52c3e32"
3509+
resolved "https://github.com/learningequality/aphrodite/#fdc8d7be8912a5cf17f74ff10f124013c52c3e32"
35103510
dependencies:
35113511
asap "^2.0.3"
35123512
inline-style-prefixer "^4.0.2"

0 commit comments

Comments
 (0)