Skip to content

Commit 8a20813

Browse files
authored
Merge pull request #5401 from marcellamaki/fix-form-scroll
Fix bug in 'scroll into view' for storage form
2 parents b223a55 + 3ec8083 commit 8a20813

File tree

5 files changed

+18
-30
lines changed

5 files changed

+18
-30
lines changed

contentcuration/contentcuration/frontend/channelEdit/views/ImportFromChannels/SearchFilters.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
v-model="channel_id__in"
2626
:label="$tr('channelSourceLabel')"
2727
:items="channelOptions"
28-
item-text="name"
29-
item-value="id"
3028
:disabled="loadingChannels"
3129
notranslate
3230
useEllipsis
@@ -64,7 +62,6 @@
6462
v-model="kinds"
6563
:items="kindFilterOptions"
6664
:label="$tr('kindLabel')"
67-
item-text="text"
6865
/>
6966

7067
<!-- Language -->
@@ -78,7 +75,6 @@
7875
v-model="licenses"
7976
:items="licenseOptions"
8077
:label="$tr('licensesLabel')"
81-
item-text="text"
8278
/>
8379

8480
<!-- Created after -->
@@ -210,7 +206,11 @@
210206
this.channel_id__in = [];
211207
}
212208
213-
this.channelOptions = channels.filter(c => c.id !== this.currentChannelId);
209+
const filteredChannels = channels.filter(c => c.id !== this.currentChannelId);
210+
this.channelOptions = filteredChannels.map(channel => ({
211+
value: channel.id,
212+
text: channel.name,
213+
}));
214214
this.loadingChannels = false;
215215
});
216216
},

contentcuration/contentcuration/frontend/channelList/views/Channel/CatalogFilters.vue

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,13 @@
6060
v-model="licenses"
6161
:items="licenseOptions"
6262
:label="$tr('licenseLabel')"
63-
item-text="text"
6463
/>
6564

6665
<!-- Formats (attach to self to keep in notranslate class) -->
6766
<MultiSelect
6867
v-model="kinds"
6968
:items="kindOptions"
7069
:label="$tr('formatLabel')"
71-
item-text="text"
7270
/>
7371

7472
<!-- Starred -->

contentcuration/contentcuration/frontend/settings/pages/Storage/RequestForm.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,6 @@
114114
v-model="publicChannels"
115115
:label="$tr('selectAllThatApplyPlaceholder')"
116116
:items="publicChannelOptions"
117-
:item-value="channelName"
118-
item-text="name"
119117
notranslate
120118
:box="false"
121119
/>
@@ -365,7 +363,11 @@
365363
];
366364
},
367365
publicChannelOptions() {
368-
return sortBy(this.channels, c => c.name.toLowerCase()).filter(c => !c.public);
366+
const options = sortBy(this.channels, c => c.name.toLowerCase()).filter(c => !c.public);
367+
return options.map(option => ({
368+
text: option.name,
369+
value: this.channelName(option),
370+
}));
369371
},
370372
},
371373
methods: {

contentcuration/contentcuration/frontend/settings/pages/Storage/index.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@
9898
<KTransition kind="component-vertical-slide-out-in">
9999
<RequestForm
100100
v-show="showRequestForm"
101+
ref="requestform"
101102
@submitted="showRequestForm = false"
102103
/>
103104
</KTransition>
@@ -156,12 +157,11 @@
156157
this.showRequestForm = !this.showRequestForm;
157158
if (this.showRequestForm) {
158159
this.$nextTick(() => {
159-
if (window.scroll) {
160-
window.scroll({
161-
top: this.$refs.requestheader.offsetTop - 24,
162-
behavior: 'smooth',
163-
});
164-
}
160+
this.$nextTick(() => {
161+
// Wait for the form to be visible
162+
// then scroll to the top of the form
163+
this.$refs.requestform.$el.scrollIntoView({ behavior: 'smooth', block: 'start' });
164+
});
165165
});
166166
}
167167
},

contentcuration/contentcuration/frontend/shared/views/form/MultiSelect.vue

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
>
1919
<template #selection="{ item }">
2020
<VChip :class="{ notranslate }">
21-
{{ getText(item) }}
21+
{{ item.text }}
2222
</VChip>
2323
</template>
2424
<template #item="{ item }">
@@ -33,7 +33,7 @@
3333
:style="getEllipsisStyle()"
3434
dir="auto"
3535
>
36-
{{ getText(item) }}
36+
{{ item.text }}
3737
</span>
3838
</Checkbox>
3939
</template>
@@ -67,10 +67,6 @@
6767
return [];
6868
},
6969
},
70-
itemText: {
71-
type: [String, Function],
72-
required: true,
73-
},
7470
notranslate: {
7571
type: Boolean,
7672
default: false,
@@ -109,14 +105,6 @@
109105
}
110106
: {};
111107
},
112-
getText(item) {
113-
if (typeof this.itemText === 'string') {
114-
return item[this.itemText];
115-
} else if (typeof this.itemText === 'function') {
116-
return this.itemText(item);
117-
}
118-
return item.text || item;
119-
},
120108
resetScroll() {
121109
const [{ value: firstItemValue } = {}] = this.items || [];
122110
if (!firstItemValue) {

0 commit comments

Comments
 (0)