Problem/Motivation
A developer is unable to use custom markup for the throbber element (e.g. when integrating existing solution that already has styles and JavaScript code).
Proposed resolution
Move HTML code for the element to Drupal.theme function and use Drupal theming mechanism for JavaScript code.
| Comment | File | Size | Author |
|---|---|---|---|
| #59 | 480.gif | 6.22 KB | heddn |
| #57 | full-throbber-ux-test.gif | 787.36 KB | Anonymous (not verified) |
| #57 | production-version.patch | 1.27 KB | Anonymous (not verified) |
| #49 | interdiff-44-49.txt | 637 bytes | Anonymous (not verified) |
| #49 | 2407859-49.patch | 13.17 KB | Anonymous (not verified) |
Comments
Comment #1
aprogs commentedAttached the patch.
Comment #2
jwilson3This feels like a super good idea and would bring the ajax throbber code inline with how the progress bar is built which also uses Drupal.theme js functionality.
This needed a re-roll because ajax.js has moved inside core/ folder and the functionality has slightly changed.
This patch also adds the new SMACSS compatibility to the throbber, and improves themability of the "fullscreen" progress indicator, as well as the "message" text that optionally accompanies the throbber in some cases.
Comment #3
jwilson3Ugh, forgot the patch.
Comment #5
jwilson3Test fail seems to be due to unrelated issues around missing schemas. Not sure... maybe try to rerun tests again later.
Comment #8
jwilson3Comment #10
sidharthapA new patch against updated 8.0.x branch. It seems dialog.css is placed inside the theme (classy, seven, stable) and this patch changed all these css files for throbber element.
Comment #13
lauriiiVery nice improvement!
I'm afraid that we are not allowed to make CSS or markup changes for stable or classy and we should keep these changes only for core, Seven and Bartik. What we could do is override the theme functions in Stable and then override them again in Seven and Bartik.
Comment #14
sidharthapComment #18
vprocessor commentedComment #19
vprocessor commentedreroll
Comment #20
vprocessor commentedreroll for 8.4.x
Comment #21
andypostRTBC patch 19
Comment #22
star-szrTo @lauriii's point in #13, we shouldn't be changing markup. While I love the changes to make the markup more SMACSS-y (such as ajax-progress-fullscreen to ajax-progress--fullscreen), they will break sites so we can't allow them.
Comment #23
finnsky commentedHi all!
Modified last patch without css changes. So out of box all will be same. Plus themeable throbbers.
Comment #24
andypostComment #25
lauriiiSome minor changes for the latest patch. Also removed on instance where throbber was being created manually in the Field UI.
Comment #26
amietpatial commented@Laurii I have reviewed your patch and it's working fine for me my site doesn't break
Comment #27
amietpatial commentedComment #28
GrandmaGlassesRopeManNeeds a return type, {string} I think?
This should be a named function or preferably an arrow function.
Template string.
Same comment here about function/arrow.
Same comment here about function/arrow.
Comment #29
GrandmaGlassesRopeMan- cleanup jsdoc
- cleanup coding standards issues.
✌️
Comment #30
lauriiiSorry, I accidentally uploaded wrong patch on my comment #25. The patch in #25 is actually patch from #23. I tried to combine my changes with #29. Interdiff from #29.
Comment #31
GrandmaGlassesRopeManJust some minor feedback ✌️
Here's the docs for marking something as optional, as well as documenting default values. http://usejsdoc.org/tags-param.html#optional-parameters-and-default-values
Could this be simplified to to just an
||operator, and return a multiline template string?Comment #32
lauriii#31.1: Not really. That will add some whitespaces to the rendered markup which will affect how the throbber is rendered when message is visible.
Comment #33
GrandmaGlassesRopeManI think what I was trying to say was something like,
`<div class="ajax-progress ajax-progress-throbber"><div class="throbber"> </div>${(message && Drupal.theme('ajaxProgressMessage', message)) || ''}</div>`edit..
If you're interested in creating multi-line template strings, and your output is whitespace insensitive, you can use the
\to remove the new line characters that are inserted at transpile time.Comment #34
lauriiiUpdated the issue credits
Comment #35
GrandmaGlassesRopeManAlright. I think this looks good. 🎉👍
Comment #36
amietpatial commentedComment #37
lokapujyaNM
Comment #38
markhalliwellThank you! This has been sorely needed for years! RTBC+++
Comment #39
lokapujyaSomeone has to say it: Needs Tests.
Is there a core theme that should use this feature? Found this #2775725: Update the throbber icon.
or a test theme? Also, should this be documented somewhere?
Comment #40
Anonymous (not verified) commentedTo create this test, I took a
hold_testmodule from #2828528-107: Add Quick Edit Functional JS test coverage. Because it help to avoid random fails due to the fact that the throbber will disappear faster than we will check it.Testing takes place on the view page, there are all kinds of throbbers.
Test works with selenium, but with phantomjs too.
test-only is interdiff with #32.
Comment #41
Anonymous (not verified) commented+1 to CR
Comment #44
Anonymous (not verified) commentedHah, Test Bot revealed my brazen copy-paste from namespace of views module :)
Actually, I'm not sure that I chose the right namespace. Throbber more relevant to UI than to AJAX, so feel free to point on namespace.
Comment #46
lokapujyaI don't think it needs a CR because it isn't breaking anything, but was thinking the Theming Guide for the "
Drupal theming mechanism for JavaScript code." : www.drupal.org/docs/8/theming.
Comment #47
lauriii@lokapujya We do change records for API additions and new features as well! It is great way to educate developers of this types of features 🚀
Comment #48
lauriiiThe latest patch looks good for me. Thank you so much @vaplas for the amazing work on adding the test coverage!
I also created a change record for this.
Comment #49
Anonymous (not verified) commented@lauriii, thank you! Added to CR info about
ajaxProgressMessagetoo.Also one nit c/p flaw in test name fixed. So still RTBC.
Comment #51
Anonymous (not verified) commentedComment #52
webchickThis seems to have all the requisite sign-offs, and I pinged @lauriii for confirmation of this fact.
Committed and pushed to 8.x. Thanks!
Comment #53
Anonymous (not verified) commented🎉 Inspiring news! But notcommit?
Comment #54
heddnSuper excited to be able to swap this out. Now it will be much easier to make my client required dancing dog wait icon! Don't ask.
Comment #56
webchickD'oh.
git pushis a whole thing. ;) Thanks, @vaplas!@heddn: Pics or it didn't happen. :D
Comment #57
Anonymous (not verified) commented#56 Great thanks again, @webchick!
#54: Sure, this is the basic requirement to the site!
Comment #58
lauriii#57: amazing! 😂🐾
Comment #59
heddn