jeroennoten / Laravel-AdminLTE

Easy AdminLTE integration with Laravel
MIT License
3.78k stars 1.08k forks source link

[QUESTION] Issue with Iframe and custom Multi-language selector #1252

Closed SMEWebify closed 4 months ago

SMEWebify commented 4 months ago

Hello everyone,

Describe the bug

I wanted to test the Iframe, it turns out that my project uses multi-language with the mcamara/laravel-localization package. on the menu, this gives me a link which sends me to a route, however if the iframe is active, this creates a tab with the name of the language, without changing it.

Can anyone already use both options?

Expected behavior

I can provide code if needed

Screenshots

image

Environment

Item Version
Laravel 10.0
Project 3.9.2
OS Win 10
dfsmania commented 4 months ago

Hi @SMEWebify , I do not use I-Frame mode, but there's an option to enable/disable capturing links from the top navbar. Check config/adminlte.php file:

/*
|--------------------------------------------------------------------------
| IFrame
|--------------------------------------------------------------------------
|
| Here we change the IFrame mode configuration. Note these changes will
| only apply to the view that extends and enable the IFrame mode.
|
| For detailed instructions you can look the iframe mode section here:
| https://github.com/jeroennoten/Laravel-AdminLTE/wiki/IFrame-Mode-Configuration
|
*/

'iframe' => [
    'default_tab' => [
        'url' => null,
        'title' => null,
    ],
    'buttons' => [
        'close' => true,
        'close_all' => true,
        'close_all_other' => true,
        'scroll_left' => true,
        'scroll_right' => true,
        'fullscreen' => true,
    ],
    'options' => [
        'loading_screen' => 1000,
        'auto_show_new_tab' => true,
        'use_navbar_items' => true, // THIS ONE!!!
    ],
],

However, that may not fit your goals, since all the top navbar links won't be captured. Another possible solution may be to use some Javascript to remove all the listeners added to the click event on the multi-language selector, then add your own custom listener to perform the wanted action, I will give this a test when I get some time...

SMEWebify commented 4 months ago

Hi @dfsmania Indeed, it deactivates some links, That does not bother me. It works ! Thx