navbar url open in new tab parameter

This commit is contained in:
Yurii
2026-02-21 12:53:07 +02:00
parent 3321bf1020
commit f9d0f3bcaf
4 changed files with 18 additions and 3 deletions

View File

@@ -242,7 +242,8 @@
"aclScope": "ACL Scope",
"onlyAdmin": "Only for Admin",
"notStorable": "Not Storable",
"itemsEditable": "Items Editable"
"itemsEditable": "Items Editable",
"openInNewTab": "Open in new tab"
},
"strings" : {
"rebuildRequired": "Rebuild is required"

View File

@@ -27,6 +27,7 @@
{{#if link}}href="{{link}}"{{else}}role="button"{{/if}}
class="{{aClassName}}"
{{#if color}}style="border-color: {{color}}"{{/if}}
{{#if openInNewTab}} target="_blank" {{/if}}
{{#if isGroup}}
id="nav-tab-group-{{name}}"
data-toggle="dropdown"
@@ -69,6 +70,7 @@
id="nav-tab-group-{{name}}"
data-toggle="dropdown"
{{/if}}
{{#if openInNewTab}} target="_blank" {{/if}}
>
<span class="short-label"{{#if color}} style="color: {{color}}"{{/if}}>
{{#if iconClass}}
@@ -116,6 +118,7 @@
id="nav-tab-group-{{name}}"
data-toggle="dropdown"
{{/if}}
{{#if openInNewTab}} target="_blank" {{/if}}
>
<span class="short-label"{{#if color}} style="color: {{color}}"{{/if}}>
{{#if iconClass}}
@@ -155,6 +158,7 @@
id="nav-tab-group-{{name}}"
data-toggle="dropdown"
{{/if}}
{{#if openInNewTab}} target="_blank" {{/if}}
>
<span class="short-label"{{#if color}} style="color: {{color}}"{{/if}}>
{{#if iconClass}}

View File

@@ -94,7 +94,10 @@ class SettingsEditTabUrlModalView extends Modal {
name: 'onlyAdmin',
labelText: this.translate('onlyAdmin', 'fields', 'Admin'),
},
false
{
name: 'openInNewTab',
labelText: this.translate('openInNewTab', 'fields', 'Admin'),
},
]
]
}
@@ -130,6 +133,9 @@ class SettingsEditTabUrlModalView extends Modal {
onlyAdmin: {
type: 'bool',
},
openInNewTab: {
type: 'bool',
},
},
});

View File

@@ -1260,7 +1260,8 @@ class NavbarSiteView extends View {
* label: string,
* isGroup: boolean,
* aClassName: string,
* iconClass: null
* iconClass: null,
* openInNewTab: boolean,
* }}
*/
prepareTabItemDefs(params, tab, i, vars) {
@@ -1273,6 +1274,7 @@ class NavbarSiteView extends View {
let isUrl = false;
let name = tab;
let aClassName = 'nav-link';
let openInNewTab = false;
const label = this.tabsHelper.getTranslatedTabLabel(tab);
@@ -1290,6 +1292,7 @@ class NavbarSiteView extends View {
link = tab.url || '#';
color = tab.color;
iconClass = tab.iconClass;
openInNewTab = tab.openInNewTab ?? false;
this.urlList.push({name: name, url: link});
} else if (this.tabsHelper.isTabGroup(tab)) {
@@ -1336,6 +1339,7 @@ class NavbarSiteView extends View {
aClassName: aClassName,
isGroup: isGroup,
isDivider: isDivider,
openInNewTab,
};
if (isGroup) {