I suggest adding an option to set the progress indicator on ajax links/buttons, targeted with classes .use-ajax and .use-ajax-submit like it is possible to set dialog-type and dialog-options:
element_settings.dialogType = $(this).data('dialog-type');
element_settings.dialog = $(this).data('dialog-options');
My suggestions is to keep the throbber default (seems obvious) and then add an option to override it with a data attribute named data-progress-type:
// Provide clicked links with a throbber as the default indicator,
// instead of the progress bar, since it looks better.
var progress_type = $(this).data('progress-type');
element_settings.progress = {type: progress_type ? progress_type : 'throbber'};
We're basically just providing the options to set the indicator to ex: fullscreen like we do in the Form API.
So I guess all the cases that made it relevant for #ajax in Form API also applies here. But let me know if you want some actual cases.
| Comment | File | Size | Author |
|---|---|---|---|
| #42 | 2818463-42.patch | 561 bytes | eugene.brit |
| #38 | 2818463-38.patch | 1.09 KB | idebr |
Issue fork drupal-2818463
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:
- 9.3.x
changes, plain diff MR !1528
Comments
Comment #2
droplet commentedMy first thoughts, I like it but we need to document what we're supporting there. We won't want to see any new issue about `progress bar` doesn't work in above code. :)
Comment #7
waspper commented+1. It would be great to allow setting it as an option. I've provided a smaller patch, which will look for the "data-progress-type" attribute. It will fallback to the "throbber" type if not provided.
This will change only 2 lines into the function "Drupal.ajax.bindAjaxLinks".
Comment #8
waspper commentedComment #9
waspper commentedTypo in filename. Attached good one.
Comment #10
waspper commentedEven smaller version
Comment #11
seanbPatch in #10 looks nice and elegant. Work like a charm. +1
Comment #12
ckidowPatch #10 is nice. Thx for that.
Regarding the 'fullscreen' progress indicator, there is a "message" option. Would be nice to implement a "data-progress-message" attribute to fully support all progress types. Is this possible inside this issue?
Comment #15
seanbReroll for 9.1.x
Comment #16
nathandentzau+1 Reroll for 9.1 works.
Comment #17
nathandentzauComment #18
catchThe patch doesn't apply, and this still needs some automated test coverage added.
Comment #19
kapilv commentedComment #20
ilya.no commentedAttaching patch for latest 8.9 version in case anyone else needs it.
Comment #22
bhumikavarshney commentedHi @ilya.no,
The #20 patch while applying throws error.
Please let me know if am doing anything wrong.
Thanks
Comment #23
neslee canil pintoUpdated patch #20 to the latest version (9.3.x)
Comment #24
mitthukumawat commented@Neslee Canil Pinto
Thanks for the updated patch. I have applied it cleanly for drupal 9.3.x-dev version.
I reviewed the changed files and found the
data-progress-typeattribute added properly.Adding screenshots of resulting changes.
Comment #25
Madhu kumar commentedPatch #23 applied cleanly and option to set the progress indicator on ajax links/buttons, Sharing screenshot for the reference.
Comment #26
gauravvvv commentedRe-rolled patch, attached interdiff for same.
Comment #27
gauravvvv commentedComment #28
vikashsoni commented@Neslee Canil Pinto Thanks for the patch applied successfully in drupal-9.3.x-dev
After patch data-progress-type attribute added properly
Thanks for the patch
Comment #32
seanbReroll for 9.3.x
Comment #33
Zsuffa Dávid commented#32 Works for me with core 9.3.7.
thx
Comment #34
ranjith_kumar_k_u commentedFixed CS errors.
Comment #37
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #38
idebr commentedReroll for 9.5.x
Comment #39
idebr commented#3026636: Allow AJAX links to replace a specific selector implements a similar feature, but uses the data-ajax-progress attribute
Comment #40
idebr commentedComment #42
eugene.britRe-roll for 10.0.x