demo icon indicating copy to clipboard operation
demo copied to clipboard

Upgrade bootswatch to version 4

Open bechir opened this issue 3 years ago • 5 comments

Hi,

After comparing changes before and after in #1030 I said to myself It's maybe better to create remake the job with new newly updated Symfony 5.2 (and bootswtach v5.4.3).

I know @javiereguiluz wanted to resolve the conflicts himself but you can still see the work I did here

Comparaison home

Before

home

After

home

Comparaison blog

Before

blog

After

blog

Comparaison show code

Before

show-code

After

show-code

Comparaison pagination

Before

pagination

After

pagination

Comparaison login

Before

login

After

login

Comparaison admin

Before

admin

After

admin

Comparaison edit post

Before

edit

After

edit

Comparaison show post

Before

show-post

After

show-post

Comparaison edit post (tags)

Before

post-tags

After

post-tags

Comparaison post with errors

Before

post-errors

After

post-errors

CHANGELOG

In packages.json

  • Upgraded bootswatch to version 4.5.3
  • Upgraded bootstrap to version 4.5.3
  • Removed eonasdan-bootstrap-datetimepicker dependency (This is not compatible with bootstrap 4)

In scss files

  • Removed the $icon-font-path we no longer need this
  • Moved variables import to new _variables.scss file containg our custom variables
  • Updated imports
  • Replaced hardcoded colors value with custom variables name

In javascript files

  • Replaced deprecated method submit() by trigger('submit')
  • Updated highlightjs imports

In twig files

  • Replaced well class by jumbotron with some changes in the default paddings
  • Replaced label label-* by badge badge-*
  • Replaced pull-right by float-right I d'ont kown if it's the same but we have the same result
  • Updated classes name
  • Added the active route class to active

Tests

  • Beacause the form layout changed, we need to update assertions in App\Tests\Controller\Admin\BlogControllerTest::testAdminNewPost

I didn't added datetimepicker yet because the tempusdominus/bootstrap-4 project is getting rolled back into the orginal repo, but it's still in progress.

This lib is for bootstrap 4 and it's based on the Eonasdan's Bootstrap 3 date/time picker. But flatpickr is more powerful with zero dependencies

I didn't added it yet, I'm juste waiting for feedbacks.

Thanks for your time!

bechir avatar Dec 24 '20 01:12 bechir

Hi @noniagriconomie, Thanks you for your feedbacks

I updated my code but the datetime picker initialization is still missing. You can check flatpickr the design look good and it's about 13KB

bechir avatar Dec 30 '20 01:12 bechir

@bechir i think i am not the person who will decide if or not to replace this lib, for me it does not matter, as the main point of this projetc is showcasing symfony etc, but lets wait main maintainers 👍

noniagriconomie avatar Dec 30 '20 06:12 noniagriconomie

OK thanks you again.

bechir avatar Dec 30 '20 23:12 bechir

@bechir thanks a lot for contributing this!

The proposed changes look fantastic to me! About flatpicker, yes let's use it. I'd prefer to use the browser native datetime-local input widget, but that doesn't work in Firefox yet, so let's use flatpicker. Thanks!

javiereguiluz avatar Jan 28 '21 15:01 javiereguiluz

Thanks for your feedbacks @javiereguiluz and @stof! I definitively need help about integrating flatpickr.

The problem is the date is not parsed correctly in admin.js

$('[data-toggle="datetimepicker"]').flatpickr({
        enableTime: true,
        dateFormat: $('#post_publishedAt').data('date-format'),
        allowInput: true,
        parseDate: (datestr, format) => {
            return moment(datestr, format, true).toDate();
        },
        formatDate: (date, format, locale) => {
            return moment(date).format(format);
        }
});

The calendar widget is shown but when I select a date nothing happen.

bechir avatar Feb 05 '21 00:02 bechir

@see https://github.com/symfony/demo/pull/1412/commits/4a1d48b6967677bee3de30264a51174ed165f8b0#diff-38752f070c2739871db0d206c9862337269e4d635f2e63e37e53c5a248c791bd for a resolution without moment.js which is deprecated

atierant avatar Apr 06 '23 07:04 atierant

Closing as fixed by #1412. Bechir, I'm really sorry we didn't merge this contribution ... but I'm happy that most of your work was reused as the base of #1412. Thanks!

javiereguiluz avatar Apr 17 '23 07:04 javiereguiluz