Laravel-Backpack / theme-tabler

UI for Backpack v6 that uses Tabler and Bootstrap v5.
MIT License
21 stars 12 forks source link

[Bug] overriding specific tabler theme blade files #165

Closed piethonkoop closed 4 months ago

piethonkoop commented 4 months ago

Bug report

Using theme-tabler I want to be able to override blade files like cover.blade.php. Reason: the layout has hardcoded tabler images in there.

What I did

Tried to override by creating the appropriate copy of cover.blade.php in ./resources/vendor/backpack/theme-tabler/resources/views/layouts/auth/login/

What I expected to happen

Newly created blade to be picked up.

What happened

The vendor version keeps being used. Cache cleared etc. all done, no effect.

What I've already tried to fix it

Tried ~20 locations just in case I misinterpreted the location for cover.blade.php. Didn't help :(

At present, I just patch the single blade file. Not ideal, but still.

Alternatively, a config item for the image itself would be even nicer because you don't have to divert from the standard setup. Less overridden blade files is better :)

Is it a bug in the latest version of Backpack?

yes

After I run composer update backpack/crud the bug... is it still there?

yes

Backpack, Laravel, PHP, DB version

When I run php artisan backpack:version the output is:

./artisan backpack:version

PHP VERSION:

PHP 8.3.2-1+ubuntu20.04.1+deb.sury.org+1 (cli) (built: Jan 20 2024 14:16:18) (NTS) Copyright (c) The PHP Group Zend Engine v4.3.2, Copyright (c) Zend Technologies with Zend OPcache v8.3.2-1+ubuntu20.04.1+deb.sury.org+1, Copyright (c), by Zend Technologies

LARAVEL VERSION:

10.43.0.0

BACKPACK PACKAGE VERSIONS:

backpack/basset: 1.2.2 backpack/crud: 6.6.3 backpack/generators: v4.0.3 backpack/permissionmanager: 7.1.1 backpack/pro: 2.1.7 backpack/settings: 3.1.0 backpack/theme-coreuiv2: 1.2.3 backpack/theme-tabler: 1.2.1

karandatwani92 commented 4 months ago

Hey @piethonkoop

The right path to override cover.php is resources/views/vendor/backpack/theme-tabler/auth/login/cover.blade.php.

@pxpm I agree with him on config to change the image. what do you think?

pxpm commented 4 months ago

Hey @piethonkoop thanks for the question, indeed @karandatwani92 is right. I think it was a struck of bad luck or something, because 100% if you place the file in the exact same spot the file is on theme vendor folder, backpack will pick your file instead of the package one.

I also agree that configs are important to don't overwrite stuff, but in this case I disagree that this is a must.

@karandatwani92 I am not 100% sure this is worth it yet, for the simple reason that next you want a config for illustration image, then a config for some thing else, then another config.

If you think this is worth it, open up an issue and we could discuss it further, I think it could be worth if we do a pre assessment of the possible configs we may want/need to introduce and do it at once.

Doing it once a config at a time is usually bad and we endup with bloated config because of lack of organization.

What I mean is, for example instead of storing: auth_cover_image, auth_illustration_image etc, we may group stuff together and make it organized. We have tried the one config at a time previously and it didn't worked that well.

That said, I left the decision to have a look at it on your side if you had time left from your other duties, but I would say this it atmost a COULD, never a MUST.

Cheers