Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
azeddine-hf opened this issue Oct 17, 2024 · 11 comments
Assignees
Labels
Bug documentation Improvements or additions to documentation Priority: MUST

Comments

@azeddine-hf
Copy link

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 ?

@pxpm
Copy link
Contributor

pxpm commented Oct 17, 2024

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 pxpm added Bug Priority: MUST documentation Improvements or additions to documentation and removed triage labels Oct 17, 2024
@pxpm pxpm moved this to Todo in This week Oct 17, 2024
@azeddine-hf
Copy link
Author

@pxpm it show me error 500

@azeddine-hf
Copy link
Author

azeddine-hf commented Oct 17, 2024

@pxpm
sasasasasaas
sazsasz

@pxpm
Copy link
Contributor

pxpm commented Oct 17, 2024

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

@azeddine-hf
Copy link
Author

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

@pxpm pxpm closed this as completed Oct 17, 2024
@github-project-automation github-project-automation bot moved this from Todo to Done in This week Oct 17, 2024
@pxpm pxpm reopened this Oct 17, 2024
@azeddine-hf
Copy link
Author

@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 !

@pxpm
Copy link
Contributor

pxpm commented Oct 18, 2024

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 👍

@azeddine-hf
Copy link
Author

i have respected the docummentation instrection :
`

@include(backpack_view('inc.head')) <script>var defaultThemeMode = "light"; var themeMode; if ( document.documentElement ) { if ( document.documentElement.hasAttribute("data-bs-theme-mode")) { themeMode = document.documentElement.getAttribute("data-bs-theme-mode"); } else { if ( localStorage.getItem("data-bs-theme") !== null ) { themeMode = localStorage.getItem("data-bs-theme"); } else { themeMode = defaultThemeMode; } } if (themeMode === "system") { themeMode = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"; } document.documentElement.setAttribute("data-bs-theme", themeMode); }</script>
@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'))

`

@pxpm
Copy link
Contributor

pxpm commented Oct 18, 2024

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

@azeddine-hf
Copy link
Author

azeddine-hf commented Oct 18, 2024

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

@pxpm
Copy link
Contributor

pxpm commented Oct 18, 2024

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. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug documentation Improvements or additions to documentation Priority: MUST
Projects
Status: Done
Development

No branches or pull requests

3 participants