Laravel-Backpack / CRUD

Build custom admin panels. Fast!
https://backpackforlaravel.com
MIT License
3.15k stars 891 forks source link

[Bug] Default bottom-margin vs CrudField size method difference #5676

Closed howest-ward closed 1 month ago

howest-ward commented 1 month ago

Bug report

What I did

When using the size() method on a CrudField the classes added to the fields are

'form-group col-md-'.$numberOfColumns

If you don't use size the default in the wrapper_start_blade is

form-group col-sm-12 mb-3

Adding a default bottom-margin

What I expected to happen

All fields should be spaced evenly with the same bottom margin.

What happened

Fields in columns set bij size() method are closer to each other

What I've already tried to fix it

Modify CrudField size method

$this->attributes['wrapper']['class'] = 'form-group col-md-'.$numberOfColumns;

Into this

$this->attributes['wrapper']['class'] = 'form-group col-md-'.$numberOfColumns.' mb-3';

Backpack, Laravel, PHP, DB version

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

PHP VERSION:

8.3.8

PHP EXTENSIONS:

Core, date, libxml, openssl, pcre, zlib, filter, hash, json, pcntl, random, Reflection, SPL, session, standard, sodium, mysqlnd, PDO, xml, calendar, ctype, curl, dom, mbstring, FFI, fileinfo, ftp, gd, gettext, iconv, exif, mysqli, pdo_dblib, pdo_mysql, Phar, posix, readline, shmop, SimpleXML, sockets, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, xmlreader, xmlwriter, xsl, zip, mailparse, pdo_sqlsrv, Zend OPcache

LARAVEL VERSION:

11.21.0.0

BACKPACK PACKAGE VERSIONS:

backpack/basset: 1.3.6 backpack/crud: 6.7.33 backpack/generators: v4.0.5 backpack/pro: 2.2.17 backpack/theme-tabler: 1.2.12

jcastroa87 commented 1 month ago

Hello @howest-ward

Thanks for reporting this, is there a chance you can provide a screenshot about this, and if you have a way to solve, would you like to create a PR?

Cheers.

howest-ward commented 1 month ago

Before (size() not applied to Vat number, the margin below date of birth and Vat number are not the same)

image

There are 2 options, the mb-3 can be added to the default, or the mb-3 can be removed when using size.

Option 1 (mb-3 added to the default, margins are the same)

image

Option 2 (mb-3 removed from the wrapper_start, margins are the same but fields are closer to each other)

image

Because adding mb-3 to the default will have a visual change in all backpack installations.

jcastroa87 commented 1 month ago

Hello @howest-ward

Thanks for your details, here is the PR to fix it, can you test it and we will merge it ASAP.

I will close the issue to continue discussion in PR.

Cheers.

howest-ward commented 3 weeks ago

This has been tested and averything work fine! thanks!