add target _blank when the option is enabled
This commit is contained in:
parent
e287e27375
commit
f133932884
|
@ -54,6 +54,7 @@ class JsController extends Controller
|
|||
{
|
||||
$user = OC::$server[IUserSession::class]->getUser();
|
||||
$topMenuApps = (array) json_decode($this->config->getAppValue('side_menu', 'top-menu-apps', '[]'), true);
|
||||
$targetBlank = (bool) $this->config->getAppValue('side_menu', 'target-blank', '0');
|
||||
|
||||
if ($user) {
|
||||
$userTopMenuApps = (array) json_decode($this->config->getUserValue($user->getUid(), 'side_menu', 'top-menu-apps', '[]'), true);
|
||||
|
@ -61,8 +62,15 @@ class JsController extends Controller
|
|||
if (!empty($userTopMenuApps)) {
|
||||
$topMenuApps = $userTopMenuApps;
|
||||
}
|
||||
|
||||
$userTargetBlank = (int) $this->config->getUserValue($user->getUid(), 'side_menu', 'target-blank', '-1');
|
||||
|
||||
if ($userTargetBlank !== -1) {
|
||||
$targetBlank = (bool) $userTargetBlank;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$parameters = [
|
||||
'opener-position' => $this->config->getAppValue('side_menu', 'opener-position', 'before'),
|
||||
'opener-hover' => (bool) $this->config->getAppValue('side_menu', 'opener-hover', '0'),
|
||||
|
@ -73,6 +81,7 @@ class JsController extends Controller
|
|||
'always-displayed' => (bool) $this->config->getAppValue('side_menu', 'always-displayed', '0'),
|
||||
'big-menu' => (bool) $this->config->getAppValue('side_menu', 'big-menu', '0'),
|
||||
'top-menu-apps' => $topMenuApps,
|
||||
'target-blank' => $targetBlank,
|
||||
];
|
||||
|
||||
$response = new TemplateResponse('side_menu', 'js/script', $parameters, 'blank');
|
||||
|
|
|
@ -26,7 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
<ul class="side-menu-apps-list">
|
||||
<li v-for="app in apps" v-bind:class="{'side-menu-app': true, 'active': app.active}">
|
||||
<a v-bind:href="app.href" v-bind:title="app.name">
|
||||
<a v-bind:href="app.href" :target="targetBlank ? '_blank' : undefined" v-bind:title="app.name">
|
||||
<span class="side-menu-app-icon" v-html="app.icon"></span>
|
||||
<span class="side-menu-app-text" v-html="app.name"></span>
|
||||
</a>
|
||||
|
@ -45,6 +45,7 @@ export default {
|
|||
apps: [],
|
||||
logo: null,
|
||||
forceLightIcon: false,
|
||||
targetBlank: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -119,6 +120,7 @@ export default {
|
|||
this.retrieveApps()
|
||||
this.retrieveLogo()
|
||||
this.forceLightIcon = document.querySelector('#side-menu-container').getAttribute('data-forcelighticon') == 1;
|
||||
this.targetBlank = document.querySelector('#side-menu-container').getAttribute('data-targetblank') == 1;
|
||||
|
||||
const menu = document.querySelector('#appmenu')
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
<ul class="side-menu-apps-list">
|
||||
<li v-bind:class="{'side-menu-app': true, 'active': activeApp === appId}" v-for="(app, appId) in category.apps">
|
||||
<a v-bind:href="app.href" v-bind:title="app.name">
|
||||
<a v-bind:href="app.href" :target="targetBlank ? '_blank' : undefined" v-bind:title="app.name">
|
||||
<img class="side-menu-app-icon" v-bind:src="app.icon"></span>
|
||||
<span class="side-menu-app-text" v-html="app.name"></span>
|
||||
</a>
|
||||
|
@ -50,6 +50,7 @@ export default {
|
|||
return {
|
||||
items: [],
|
||||
activeApp: null,
|
||||
targetBlank: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -79,6 +80,8 @@ export default {
|
|||
},
|
||||
},
|
||||
mounted() {
|
||||
this.targetBlank = document.querySelector('#side-menu-container').getAttribute('data-targetblank') == 1;
|
||||
|
||||
this.retrieveApps()
|
||||
this.retrieveActiveApp()
|
||||
}
|
||||
|
|
|
@ -14,6 +14,10 @@
|
|||
sideMenuContainer.attr('data-forcelighticon', '1')
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($_['target-blank']): ?>
|
||||
sideMenuContainer.attr('data-targetblank', '1')
|
||||
<?php endif; ?>
|
||||
|
||||
body.on('side-menu.apps', function(e, apps) {
|
||||
<?php if ($_['hide-when-no-apps']): ?>
|
||||
sideMenu = jQuery('#side-menu')
|
||||
|
|
Loading…
Reference in a new issue