CRUD icon indicating copy to clipboard operation
CRUD copied to clipboard

[Bug] Custom Theme default.blade.php Not Loading with Custom View Namespace

Open azeddine-hf opened this issue 1 year ago • 11 comments
trafficstars

this ui config : WhatsApp Image 2024-10-17 à 12 52 16_132273d3 this default blade path : WhatsApp Image 2024-10-17 à 12 55 25_dd8d8644 When accessing the admin panel, it should use my custom theme's default.blade.php as the main layout file. it take my sidebar and main_hearder but default no ?

azeddine-hf avatar Oct 17 '24 13:10 azeddine-hf

Hey @azeddine-hf thanks for the question, there is an issue in the docs.

Please create a file blank.blade.php at the root of your theme folder, similar to https://github.com/Laravel-Backpack/theme-coreuiv4/blob/main/resources/views/blank.blade.php

change the top line to import your default instead of top_left.

I will ask @jcastroa87 to submit a PR to docs to fix the issue 👍

Let me know if that works for you. Cheers

pxpm avatar Oct 17 '24 14:10 pxpm

@pxpm it show me error 500

azeddine-hf avatar Oct 17 '24 14:10 azeddine-hf

@pxpm sasasasasaas sazsasz

azeddine-hf avatar Oct 17 '24 15:10 azeddine-hf

Hey @azeddine-hf try clearing the caches with php artisan view:clear. Also make sure your .env file has APP_ENV=local and APP_DEBUG=true so you should get a nicer error message like:

The view: [backpack.ui::inc.main_header] was not found in any of the following view paths: [theme.inc.main_header ], [ backpack.theme-tabler::inc.main_header ], [ backpack.ui::inc.main_header]

So that you know what files are you missing.

I've just tested it out and it's working: image

Cheers

pxpm avatar Oct 17 '24 15:10 pxpm

@pxpm thank you it works the error was in @include(backpack_view('inc.bottom')) not exist

azeddine-hf avatar Oct 17 '24 15:10 azeddine-hf

@pxpm where data didn't load after set my custom them and i set fallback_theme core_ui2

image

styles of datatable also not loaded ?? i'm i missed something !

azeddine-hf avatar Oct 18 '24 09:10 azeddine-hf

Hey @azeddine-hf most likely your template is missing the @stacks and @yields where backpack pushes the scripts needed for stuff to work, datatables, fields etc.

Make sure your template include those 👍

pxpm avatar Oct 18 '24 09:10 pxpm

i have respected the docummentation instrection : `

@include(backpack_view('inc.head'))
@include(backpack_view('inc.main_header'))
@include(backpack_view('inc.sidebar'))
        <!--begin::Main-->
        <div class="app-main flex-column flex-row-fluid" id="kt_app_main">
            <!--begin::Content wrapper-->
            <div class="d-flex flex-column flex-column-fluid">
                @yield('before_breadcrumbs_widgets')
                @includeWhen(isset($breadcrumbs), backpack_view('inc.breadcrumbs'))
                @yield('after_breadcrumbs_widgets')


                @yield('header')

                <!--begin::Content-->
                <div id="kt_app_content" class="app-content flex-column-fluid">
                    <!--begin::Content container-->
                    <div id="kt_app_content_container" class="app-container container-fluid">
                        @yield('before_content_widgets')
                        @yield('content')
                        @yield('after_content_widgets')

                    </div>
                    <!--end::Content container-->
                </div>
                <!--end::Content-->
            </div>
            <!--end::Content wrapper-->
            <!--begin::Footer-->
            <div id="kt_app_footer" class="app-footer {{ backpack_theme_config('classes.footer') }}">
                <!--begin::Footer container-->
                <div class="app-container container-fluid d-flex flex-column flex-md-row flex-center flex-md-stack py-3">
                    @include(backpack_view('inc.footer'))
                </div>
                <!--end::Footer container-->
            </div>
            <!--end::Footer-->
        </div>
        <!--end::Main-->
    </div>
</div>

@include(backpack_view('inc.bottom'))

@include(backpack_view('inc.theme_scripts'))

`

azeddine-hf avatar Oct 18 '24 09:10 azeddine-hf

Like I told you, it's missing @stacks and @yields.

https://github.com/Laravel-Backpack/theme-coreuiv2/blob/11ec0cbaecefd3272601a7fb0d32457533a09ce6/resources/views/layouts/top_left.blade.php#L46

pxpm avatar Oct 18 '24 09:10 pxpm

@pxpm after i set this scripts it still refresh without loading the data : image

azeddine-hf avatar Oct 18 '24 09:10 azeddine-hf

Check Browser developer tools for possible errors in console/network, I hope you know that just saying "this doesn't work" with an image does not help me much to help you.

Always try to provide any errors that are relevant for the reported bug. 👍

pxpm avatar Oct 18 '24 10:10 pxpm