mirror of
https://github.com/directus/directus.git
synced 2026-02-07 10:55:15 -05:00
Fix module bar relative links from opening externally (#8130)
* Fix module bar relative links from opening externally * Remove conditional logic from vue template * Cleanup link rendering Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
icon
|
||||
x-large
|
||||
:to="modulePart.to"
|
||||
:href="modulePart.url"
|
||||
:href="modulePart.href"
|
||||
tile
|
||||
:style="
|
||||
modulePart.color
|
||||
@@ -35,6 +35,7 @@ import ModuleBarAvatar from './module-bar-avatar/';
|
||||
import { useSettingsStore } from '@/stores/';
|
||||
import { translate } from '@/utils/translate-object-values';
|
||||
import { MODULE_BAR_DEFAULT } from '@/constants';
|
||||
import { omit } from 'lodash';
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
@@ -57,7 +58,15 @@ export default defineComponent({
|
||||
})
|
||||
.map((modulePart) => {
|
||||
if (modulePart.type === 'link') {
|
||||
return translate(modulePart);
|
||||
const link = omit<Record<string, any>>(modulePart, ['url']);
|
||||
|
||||
if (modulePart.url.startsWith('http')) {
|
||||
link.href = modulePart.url;
|
||||
} else {
|
||||
link.to = modulePart.url;
|
||||
}
|
||||
|
||||
return translate(link);
|
||||
}
|
||||
|
||||
const module = registeredModules.value.find((module) => module.id === modulePart.id)!;
|
||||
|
||||
Reference in New Issue
Block a user