Needs work
Project:
Drupal core
Version:
main
Component:
theme system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
31 May 2014 at 16:20 UTC
Updated:
20 Apr 2021 at 12:37 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
draganerorTagging...
Comment #2
x3cion commentedHello everyone,
I'm pretty new to this and I've to admit that I read or found no style guide or anything else.
I made up this patch and a patch for #2252485: Improve UI for server/index summary pages to implement it.
I discovered that the animation is not set for anything but -webkit and -moz, so I think it would be a good idea to do that...? However, I removed them for the static progress bar, just in case.
Of course, I have a patch for that already, too and the problem about the animation going in the wrong direction is no big deal either.
Though if I got it right, changing the animation direction is not part of this issue.
If anything's wrong, please specify what and how to do it better, I'm eager to learn... or so.
Comment #3
x3cion commentedComment #4
x3cion commentedI'm sorry for the double post, but I've just read https://drupal.org/coding-standards#indenting and noticed that I used tabs in the CSS, here's the updated patch.
Comment #5
draganerorThanks @x3cion, looks great!
Few more notes:
We don't want to introduce NEW "static" class into core.
Use '.progress__bar--static' selector instead '.progress__bar.static'.
You can see formatting guideline here https://drupal.org/node/1887918#formatting
Also change this into
<div class="progress__track"><div class="{% static ? 'progress__bar--static' : 'progress__bar' %}" style="width: {{ percent }}%"></div></div>Comment #6
x3cion commentedI got a question to that.
https://drupal.org/node/1887918#formatting says
Does that mean I would use
<div class="progress__track"><div class="progress__bar {{ static ? 'progress__bar--static' : '' }}" style="width: {{ percent }}%"></div></div>or something similiar? If i don't use it like this, wouldn't this create duplicate CSS, which probably is not intended?
Comment #7
draganerorSeams you're right, I missed that...
So, then would be just:
<div class="progress__track"><div class="progress__bar {% if static %}progress__bar--static{% endif %}" style="width: {{ percent }}%"></div></div>Comment #8
lewisnymanYep that makes sense.
.progress__bar--staticor even.progress--static .progress__barComment #9
x3cion commentedThis patch should take everything in account. I also added the static argument to the documentation comment.
Comment #10
draganerorLooks prefect :)
Comment #11
draganerorJust one tip for the future: theres is convention for patch naming
[project_name]-[short-description]-[issue-number]-[comment-number].patchThe acceptable one is also
[issue-number]-[short-description]-[comment-number].patchAnd file shouldn't start with hash character (it is strange that testing works at all). Should start with small alphabet character or number.
Cheers! :)
Comment #12
lewisnymanHey, just two points:
We don't need to have both classes in the selector. We can just use the --static class.
This reads a little bit inconsistent compared to the other comments. I would recommend something like "Disable the progress bar animation"
Comment #13
x3cion commentedAbout 1.: Isn't it insecure to rely on the weak precedence of class after class css declaration? .progress__bar--static is a .progress__bar too. If someone changes the order in the css file, it might break the css if we only use .progress__bar--static.
Comment #14
draganeror@x3cion no worries, just place your code after
.progress__bar too, no one will change order. If so, there will be BUG and issue, and will be fixed again. ;)Comment #15
x3cion commentedAbout the convention for patch naming: By "comment-number" you mean the supposed comment number of the post that this patch will be with?
Comment #16
x3cion commentedComment #17
x3cion commentedComment #18
draganerorYes. So, even if same patch (the content of file) is uploaded twice, the file name should be updated.
Comment #19
draganerorFor example, the file name of patch here in this comment should be something like:
2277551-example-patch-name-19.patchComment #20
tstoecklerI'm no Twig expert, but doesn't this leave an empty space in the markup if
staticisFALSE?Comment #21
x3cion commentedHi,
you're right and it might be a cleaner solution to insert the space only if neccessary, so I changed my patch once more and moved the space inside the condition.
Don't be surprised, but for the sake of testing I'll attach an interdiff too.
Comment #22
lewisnymanI think this code is correct now. Thanks!
Comment #24
Anonymous (not verified) commentedI've taken a look why the patch is failing and it looks like the theme.inc has changed in between and now the patch is out of date.
A line has been added on theme.inc:2289
Comment #25
Anonymous (not verified) commentedI've added an re-roll because the patch was failing.
Comment #26
Bojhan commentedLooks like the issues are resolved.
Comment #27
alexpottThis approach feels the wrong way around - like a double negative. How about having an animate variable that defaults to TRUE and then have a class that adds something rather than removes something.
Comment #28
lewisnyman@alexpott I think technically I agree, but I think I always felt that it's important to display the animated progress bar as the 'default recommended progress bar'. Developers should only use the static progress bar in exceptional circumstances.
What do people think?
Comment #29
alexpottWell the current change proposed in #25 doesn't actually work with the ajax form of the progress bar anyway since the html is generated in progress.js.
How about something like this?
Comment #30
lewisnymanOk, this makes sense from an API point of view. I think we can tweak this Javascript to be a little more performant. I'll take a look
Comment #31
star-szrComment #32
x3cion commentedI took the Patch from #29, but it didn't apply properly for theme.inc and batch.inc. I searched and searched why it wouldn't apply properly, but didn't find anything on my side. I patched an up to date working copy and did the rest of the changes manually.
Two little questions:
this.$elementfor example? This would make clear if it's an jQuery object or not. Anyways, from what I see,this.elementis initiated as a jQuery object and will always be. Is there a reason it's re-jquerified all the time?div.progress__barinstead of only.progress__barin the selector? From my understanding of Drupal's Classing Conventions (heh.), it should be clear it can only be this very div.Ok, so I got two patches here. The thing is, I did the renaming of element to $element and changed the usage of it in all of progress.js, mainly using
.find()instead of$(selector, context). I did not change thediv.classselectors, as I don't know if I'm already going too far with this one - especially for a ticket that's about a different issue. Since it's already off-topic, I put it in a second patch.To the real problem that needed work: I integrated the check for
drupalSettings.progressBarAnimateinto the.html()call. The always-adding of an extra string (: '') should be tolerable, since it circumvents a costly.find().Comment #33
x3cion commentedComment #38
jp.stacey commentedUnassigning from previous owner, as it's been left for a year or so; looking at this for Sprint Weekend.
Comment #39
jp.stacey commentedA lot has changed since the patch in #29, so much that it's not really possible to create an interdiff (as it won't apply HEAD any more.) But please find attached an updated patch, that just takes #29 and makes the following changes:
Implementscomment.Drupal.theme('progressBar').[dir=rtl]animation CSS dependent on the new--animateclass.Comment #41
jp.stacey commentedAmong other things, adding of Javascript settings has changed. Re-rolling patch to hopefully deal with that bit (not clear where all the errors are coming from.)
Comment #42
jp.stacey commentedComment #43
droplet commentedAnyone can explain these lines ? Why both in front & backend.
no DIV scoped .progress__bar
missing standard one
standard rule should be the last one in ordering.
no -moz i think
Comment #44
David Hernández commentedComment #45
segi commentedComment #46
segi commentedI think @jp.stacey add the progress__bar--animate class on the backend and the frontend side as well, because he prepared for no-js case.
Comment #47
segi commentedComment #48
jp.stacey commented@segi @droplet I was only re-rolling the patch, so I can't comment on why that was there! But, yes, as @segi says there are already two instances of the progress bar markup, for when Javascript needs to create a progress bar for itself. So that does make sense.
Comment #49
emma.mariaSetting this issue to unassigned to open up @segi's patch for review :)
Comment #51
joachim commentedThis works great. Spoke too soon! The 'available updates' progress bar (at admin/reports/updates) no longer animates with this patch!The attached is a plain reroll of #46.
However... it seems a bit odd to me to have the striping show when the bar is un-animated. It seems to me that their whole purpose is to be part of the animated effect.
Search API's version of a static progress bar removes the background too, with its own CSS.
Comment #52
manjit.singhtriggering the test bot.
Comment #54
joelpittetBack to needs work for #51
Comment #59
vacho commentedComment #60
vacho commentedOnly patch reroll
Comment #62
narendra.rajwar27Comment #63
narendra.rajwar27Comment #64
aleevasOnly re-rolled latest patch onto 9.1 branch
Comment #65
saurabh-2k17 commentedComment #66
saurabh-2k17 commentedI have updated the patch as earlier one failed.
Comment #67
saurabh-2k17 commentedComment #69
narendra.rajwar27Comment #70
narendra.rajwar27Comment #71
joachim commentedThe documentation in the base template in core/modules/system/templates/progress-bar.html.twig needs to be updated too:
Comment #72
bunty badgujar commentedTest case failure fixed.
In #71
Already added in #64
Comment #73
joachim commentedOops, I must have missed that in the patch!
Tests pass, LGTM.
Comment #74
alexpottWe need to change progress.es6.js and then use the js build tools to update this file. See https://www.drupal.org/node/2815083
The css changes are also not compatible with our rules.
Comment #75
bunty badgujar commentedThanks @alexpott for review. Adding suggestion from #74.
Comment #77
bunty badgujar commentedbad test bot :D
Adding correct hash for file.
Comment #78
bunty badgujar commentedComment #79
bunty badgujar commentedComment #81
guilhermevp commentedSince patch applied cleanly, I just queued a retest of #77 for 9.2.x.
Comment #82
nod_:)
Comment #83
ranjith_kumar_k_u commentedtry to fix the custom commands failure
Comment #84
ranjith_kumar_k_u commentedUpdated
Comment #85
atul4drupal commentedFixing the checksum error. Hopefully should be green.
Comment #86
renatog commented// Implement optional animation of progress bar.On this case we should use
// Implements optional animation of progress bar.Comment #87
ayushmishra206 commentedMade the change suggested in #86. Please review.
Comment #88
adalbertov commentedHello, just tried patch #87. Didn't found any more grammar errors, and the patch seems to be working ok, so I'm moving the issue to RTBC
Comment #89
renatog commentedI fully agree. +1 to it
Comment #91
benjifisherPlease do not ask the testbot to try again until #3207086: [HEAD BROKEN] Consistent failure in MonthDatePluginTest is fixed.
Comment #92
spokje#3207086: [HEAD BROKEN] Consistent failure in MonthDatePluginTest was committed. Ordered retest and put this issue back to RTBC per #88.
Comment #93
lauriiiHow about scenarios where multiple progress bars exist on same page?
Is there a way this could be added to
Drupal.theme.progressBarsince the markup should be overridable.This changes the default progress bar to be without animation which doesn't match with the issue summary which says it should be a new variant. This would lead into change of behavior for any template overrides.
Comment #94
alexpott@lauriii nice catch on the multiple bars on the same page. That scenario feels worth adding a test for.