Problem/Motivation
- Bug with drupal 10, because jquery once is removed.
- The decimal does not work
- Code standard has many bugs
Proposed resolution
this patch will fixed
- Drupal 10 compatible
- Code standard when we run "phpcs --standard=Drupal,DrupalPractice range_slider"
- Add a step in the widget field settings (if the step is not defined, it will take the step = 1). If not decimal field doesn't work
- Fixed #output__field_prefix, #output__field_suffix is not defined in the widget
- Add feature if suffix or prefix is % it will convert output to %
- Add composer.json
Sorry I confused the patch file for a personal project in last post. this patch is good
| Comment | File | Size | Author |
|---|---|---|---|
| #32 | Screenshot 2023-08-26 153456.png | 28.71 KB | lazzyvn |
| #27 | Screenshot 2023-08-25 at 20.17.12.png | 39.45 KB | baikho |
| #26 | Fixed_step_Code_standard_suffix_prefix_v2.patch | 14.48 KB | rhiss |
| #22 | Fixed_step_Code_standard_suffix_prefix.patch | 14.49 KB | lazzyvn |
Issue fork range_slider-3346027
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 8.x-1.x
changes, plain diff MR !5 /
changes, plain diff MR !4
- 3346027-fixed-drupal-10
changes, plain diff MR !3
Comments
Comment #2
lazzyvn commentedComment #3
lazzyvn commentedjust change slector .js-form-type--range-slider (not .js-form-type-range-slider)
Comment #4
metasimThe patch applies successfully, except on the .info.yml file at line #5 on
,
range_slider.info.yml.rej:
Also while testing the patch I get a js error
on `range_slider/js/range-slider.js:59`
The new replacement for the same is once.filter() as per this
Based on this I think the findOnce() can be replaced with the following line of code by making use of the once.filter()
Comment #5
baikho commentedThanks all for your work on this. Could we please apply the changes via a fork merge request to ensure the tests run?
Moving back to "Needs work" as per #4.
Comment #6
lazzyvn commented@metasim
should i remove core 8.x in info?
line 59 can we make ? like this? $(context).find('.js-form-type--range-slider input').once.filter('rangeSlider').rangeslider('destroy');
i dont know how to test
be aware that the input class is now js-form-type--range-slider (double --) and no longer js-form-type-range-slider (maybe work with jquery )
@baikho I commit but git is not allowed to make a merge request. Another module I can make a merge request
Comment #7
lazzyvn commentednew patch fixed js once
Comment #10
bbombachiniComment #11
metasim@lazzyvn I tried testing the new MR, for some reason the diff.patch still fails on .info.yml file
After manually changing the core_version_requirement and adding ^10 to it I tested it.
Findings:
Drupal Test Version: 10
Browsers Tested on: Chrome and Firefox
The module seems to work fine on both, see the attached screenshots.
However If you look at the element classes I did not find the class mentioned by you with double dash i.e
js-form-type--range-sliderI found 2 classes namely
js-form-type-range-slider&form-type--range-sliderBased on the screenshots when I click the submit button the value seems to update fine based on the position of the slider.
Comment #12
lazzyvn commentedI check claro theme core/themes/claro/templates/form-element.html.twig
there is 'form-item--' ~ name|clean_class, on line 23
so i think it's better if we take 'js-form-type-'~type as selector
I add option use library, if we don't want to use rangeslider.js library, we can use original type range html5, it will be easy to customize with css.
I create a new merge request
I also add a patch
Please merge and release new version for drupal 10
Comment #13
lazzyvn commentedComment #14
metasim@lazzyvn I tested this patch on Drupal core version 9.5.9
The patch applies successfully,
On testing this range slider on a custom form,
There were no errors on console or php.
On submit the range slider returns the values as expected .
Comment #15
lazzyvn commented@baikho: please release new version
Comment #16
baikho commentedSorry but the tests are still failing in the Merge Requests, so this can't be merged yet.
WRT #13 please apply changes onto a Merge Request as a Patch will fail to apply on Composer as you can see in both #3 and #13.
Comment #17
baikho commentedBumping version given CR Remove jQuery dependency from the once feature, and we are to discard Core
8.x/core_version_requirement: ^8compatibility in.info.ymlComment #19
lazzyvn commentedPardon my ignorance, but why are we changing the class to .js-form-type--range-slider input? This will likely break any JS or CSS in existing projects. What theme are you using?
No it doesn't.
I checked all theme you can find in
\web\core\themes\[theme]\templates\form-element.html.twig
or another theme admin like Bootstrap 5 admin, Gin ...
it uses always
'js-form-type-' ~ type|clean_class,
'form-item-' ~ name|clean_class,
Only claro theme have
'js-form-type-' ~ type|clean_class,
'form-type--' ~ type|clean_class,
'form-item--' ~ name|clean_class,
So the best selector for all of theme is
'js-form-type-' ~ type|clean_class,
Comment #20
baikho commented#19 Thanks for clarifying.
Sorry, I see now that the selector in patch #13 is correct, I was looking at Merge request !4
Comment #21
raunak.singh commented@baikho thanks for maintaining this module well. I have query there is any timeline when we are able to see stable version of range_slider for drupal 10?
Comment #22
lazzyvn commentedOh i forgot to add \range_slider\config\schema\range_slider.schema.yml
use_library:
type: string
label: 'Use library'
step:
type: string
label: 'Step'
that's why it fails the test. With this patch i think it will pass all test
Comment #23
raunak.singh commented@lazzyvn Test fail to apply this patch.
Comment #24
lazzyvn commentedNo, It says pass, there is a problem with git on Jenkins because branch 2.x is not release
Patch Failed to Apply - View results on dispatcher
fatal: git apply: bad git-diff - expected /dev/null on line 349
range_slider 2.0.x-dev branch result
PHP 8.1 & MySQL 5.7, D9.5 1 pass most recent, 10 Jun 2023 at 17:06 CEST
History
Updated Result
11 Aug 2023 at 11:14 CEST
PHP 8.1 & MySQL 5.7, D9.5 Patch Failed to Apply
11 Aug 2023 at 11:12 CEST
PHP 8.1 & MySQL 5.7, D10.0.7 Patch Failed to Apply
Comment #25
baikho commented#21, once my review remarks in Merge request !4 have been resolved and the tests pass. Thank you
Comment #26
rhiss commentedHi, just a little change to the patch because of "The 'core_version_requirement' constraint (^9.2 || ^10) requires the 'core' key not be set ..."
Comment #27
baikho commentedI manually tested updated Merge request !4, but it doesn't work and the slider doesn't render. In the meantime I'm going to take the changes only needed for D10 compatibility, please raise the other changes in a new issue as they need more work. Thank you
Comment #29
baikho commentedComment #31
baikho commentedComment #32
lazzyvn commentedOh you are right i forgot commit file Element/RangeSlider.php
I recommit right nows
It must show like this