Skip to content

Commit

Permalink
AdminLTE IFrame (#921)
Browse files Browse the repository at this point in the history
* Update page.blade.php

* Update page.blade.php

* Update adminlte.php

* Update page.blade.php

With fallback

* Delete adminlte.php

a better approach was taken

* Update page.blade.php

A better approach was taken

* Update page.blade.php

* Revert "Delete adminlte.php"

This reverts commit 6ab619d.

* [Config]: Revert config file to original state.

* Update page.blade.php

* Update LayoutHelper.php

* Create iframe-base.blade.php

* Add files via upload

* Update adminlte.php

* Update adminlte.php

* Update adminlte.php

Remove spaces on last implementation.

* fix LayoutHelper

Co-authored-by: Diego Smania <diego.smania@gmail.com>
Co-authored-by: Florian Ressel <florian@genxtreme.de>
  • Loading branch information
3 people committed Jun 9, 2021
1 parent a325af0 commit 15e3d93
Show file tree
Hide file tree
Showing 5 changed files with 129 additions and 20 deletions.
28 changes: 28 additions & 0 deletions config/adminlte.php
Expand Up @@ -89,6 +89,34 @@
'layout_fixed_navbar' => null,
'layout_fixed_footer' => null,
'layout_dark_mode' => null,
'layout_iframe' => [
'active' => false,
'url-default' => [
'url' => '',
'title' => 'Dashboard',
],
'buttons' => [
'close'=> [
'active' => true,
'caption' => 'Close',
],
'close-all'=> [
'active' => true,
'caption' => 'Close All',
],
'close-all-other'=> [
'active' => true,
'caption' => 'Close All Other',
],
'scroll-left'=> true,
'scroll-right'=> true,
'fullscreen'=> true,
],
'captions' => [
'no-tab' => 'No tab selected!',
'loading' => 'Tab is loading',
],
],

/*
|--------------------------------------------------------------------------
Expand Down
26 changes: 6 additions & 20 deletions resources/views/page.blade.php
Expand Up @@ -32,26 +32,12 @@
@include('adminlte::partials.sidebar.left-sidebar')
@endif

{{-- Content Wrapper --}}
<div class="content-wrapper {{ config('adminlte.classes_content_wrapper') ?? '' }}">

{{-- Content Header --}}
@hasSection('content_header')
<div class="content-header">
<div class="{{ config('adminlte.classes_content_header') ?: $def_container_class }}">
@yield('content_header')
</div>
</div>
@endif

{{-- Main Content --}}
<div class="content">
<div class="{{ config('adminlte.classes_content') ?: $def_container_class }}">
@yield('content')
</div>
</div>

</div>
{{-- Body of the Page --}}
@if(!$layoutHelper->isLayoutIFrameEnabled())
@include('adminlte::partials.common.content-base')
@else
@include('adminlte::partials.iframe.iframe-base')
@endif

{{-- Footer --}}
@hasSection('footer')
Expand Down
19 changes: 19 additions & 0 deletions resources/views/partials/common/content-base.blade.php
@@ -0,0 +1,19 @@
{{-- Content Wrapper --}}
<div class="content-wrapper {{ config('adminlte.classes_content_wrapper') ?? '' }}">
{{-- Content Header --}}
@hasSection('content_header')
<div class="content-header">
<div class="{{ config('adminlte.classes_content_header') ?: $def_container_class }}">
@yield('content_header')
</div>
</div>
@endif

{{-- Main Content --}}
<div class="content">
<div class="{{ config('adminlte.classes_content') ?: $def_container_class }}">
@yield('content')
</div>
</div>
</div>
{{-- /.Content Wrapper--}}
66 changes: 66 additions & 0 deletions resources/views/partials/iframe/iframe-base.blade.php
@@ -0,0 +1,66 @@
{{-- Content Wrapper. Contains page content --}}
<div class="content-wrapper iframe-mode" data-widget="iframe" data-loading-screen="750">
<div class="nav navbar navbar-expand navbar-white navbar-light border-bottom p-0">
<div class="nav-item dropdown">
@if(config('adminlte.layout_iframe.buttons.close.active'))
@if(config('adminlte.layout_iframe.buttons.close-all.active') || config('adminlte.layout_iframe.buttons.close-all-other.active'))
<a class="nav-link bg-danger dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">{{ config('adminlte.layout_iframe.buttons.close.caption') }}</a>
@else
<a class="nav-link bg-danger" href="#" data-widget="iframe-close">Close</a>
@endif
@endif
@if(config('adminlte.layout_iframe.buttons.close-all.active') || config('adminlte.layout_iframe.buttons.close-all-other.active'))
<div class="dropdown-menu mt-0">
@if(config('adminlte.layout_iframe.buttons.close-all.active'))
<a class="dropdown-item" href="#" data-widget="iframe-close" data-type="all">{{ config('adminlte.layout_iframe.buttons.close-all.caption') }}</a>
@endif
@if(config('adminlte.layout_iframe.buttons.close-all-other.active'))
<a class="dropdown-item" href="#" data-widget="iframe-close" data-type="all-other">{{ config('adminlte.layout_iframe.buttons.close-all-other.caption') }}</a>
@endif
</div>
@endif
</div>

{{-- Render button left --}}
@if(config('adminlte.layout_iframe.buttons.scroll-left'))
<a class="nav-link bg-light" href="#" data-widget="iframe-scrollleft"><i class="fas fa-angle-double-left"></i></a>
@endif

<ul class="navbar-nav" role="tablist">
{{-- Starting a page by default --}}
@if(!empty(config('adminlte.layout_iframe.url-default.url')))
<li class="nav-item active" role="presentation">
<a class="nav-link active" data-toggle="row" id="tab-index" href="#panel-index" role="tab" aria-controls="panel-index" aria-selected="true">
{{ config('adminlte.layout_iframe.url-default.title') ?: 'Dashboard' }}
</a>
</li>
@endif
</ul>

{{-- Render button Right --}}
@if(config('adminlte.layout_iframe.buttons.scroll-right'))
<a class="nav-link bg-light" href="#" data-widget="iframe-scrollright"><i class="fas fa-angle-double-right"></i></a>
@endif

{{-- Render button Fullscreen --}}
@if(config('adminlte.layout_iframe.buttons.fullscreen'))
<a class="nav-link bg-light" href="#" data-widget="iframe-fullscreen"><i class="fas fa-expand"></i></a>
@endif
</div>
<div class="tab-content">
@if(!empty(config('adminlte.layout_iframe.url-default.url')))
<div class="tab-pane fade active show" id="panel-index" role="tabpanel" aria-labelledby="tab-index">
<iframe src=" {{ config('adminlte.layout_iframe.url-default.url') }}" style="height: 671px;"></iframe>
</div>
@endif
<div class="tab-empty">
<h2 class="display-4">{{ config('adminlte.layout_iframe.captions.no-tab') ?: 'No tab selected!' }}</h2>
</div>
<div class="tab-loading">
<div>
<h2 class="display-4">{{ config('adminlte.layout_iframe.captions.loading') ?: 'Tab is loading' }} <i class="fa fa-sync fa-spin"></i></h2>
</div>
</div>
</div>
</div>
{{-- /.content-wrapper --}}
10 changes: 10 additions & 0 deletions src/Helpers/LayoutHelper.php
Expand Up @@ -40,6 +40,16 @@ public static function isLayoutBoxedEnabled()
return config('adminlte.layout_boxed') || View::getSection('layout_boxed');
}

/**
* Check if layout IFrame is enabled.
*
* @return bool
*/
public static function isLayoutIFrameEnabled()
{
return config('adminlte.layout_iframe.active') || View::getSection('layout_iframe.active');
}

/**
* Make and return the set of classes related to the body tag.
*
Expand Down

0 comments on commit 15e3d93

Please sign in to comment.