-
Notifications
You must be signed in to change notification settings - Fork 11
Update versionwarning.js #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The only disadvantage I see to the separate JS version idea is that in the future if we want to update the JS redirect code, we not only have to do it in two places ( |
Hmm good point. Now that I think about it, we could actually stick with just this file and assign the proper class conditionally based on the value of |
If this works @drammock I think this would be the best solution. We want to be prepared to support different styles per version and not forced to stick with stuff that we needed 10 versions ago. |
+1 for styling based on version >= 0.23 or not |
That is not feasible since the sentence sometimes has 2 links in it:
Here's how that looks (spacing is pretty badly compromised): |
I guess we can't try it on CircleCI because it depends on the URL being mne.tools? I actually don't like how it looks with buttons, and I'm also fine with linking "stable version" and "development version". However, you could remove the comma before "or", right? |
I've been testing it on the live site by going to old version of docs, using browser inspector to delete the existing node, then copy/pasting this script into the console to re-generate the node based on the new code. I've found a button-based version that I'm OK with, will push another commit. |
😅 I can have a look later tonight to experiment a little, if that's alright with you? Or are you in a hurry to get this merged? |
I'm happy to have you take over @hoechenberger. I actually am about to be off work until friday morning. I worked around the horizontal spacing issue by making them each separate clauses, but using buttons affects vertical alignment of the text too (even with FYI, when this goes in, there should be a corresponding PR to mne-python that removes the devbar block from |
Thanks @drammock, let's see how far I'll get until Friday, so we can maybe make a final decision during or after the Office Hour :) |
Looks nice! Can you show how it looks with two buttons when you are on the site of an old version? Then it shows links to stable and unstable. IMO, we could just show a link to stable if two buttons don't work. |
Oh, thanks for asking, I hadn't thought of that. I'm currently AFK, will look into this once I get back home! |
Per discussion during office hours, @hoechenberger will edit the JS to have the button, using BS4 classes |
I managed to resolve the issue with the unpleasant vertical misalignment between warning message and button text. (it's still not 100% perfect but I think it's good!) With 95ad385 it would look like this: Current devViewing 0.23 docs after 0.24 has been releasedViewing docs of versions <0.23 (constraining us to Bootstrap 3) |
- removed `d-md` and `text-dark` (not clear why needed?) - removed `alert-link` (not needed for buttons) - simplified margin CSS on BS3 version - fixed: no `font-weight-*` classes in BS3 - refactored single-use constant "style"
Nice, thanks @drammock! |
Co-authored-by: Richard Höchenberger <[email protected]>
Must not be merged before mne-tools/mne-tools.github.io#23
Must not be merged before mne-tools/mne-tools.github.io#23
thanks @hoechenberger ! |
Thanks for your help & support, @drammock, I appreciate it |
This is such a useful change! Best feature ever! Now I can quickly switch from dev to stable! 🚀 🔥 💯 |
As mentioned in mne-tools/mne-python#8876 (comment) there is a problem with unchecked linking, I just for example tried to get to stable for this: https://mne.tools/0.19/generated/mne.preprocessing.mark_flat.html @hoechenberger do you want to try https://stackoverflow.com/questions/3922989/how-to-check-if-page-exists-using-javascript#answer-3924998 ? |
I can have a look later today. Wanted to address some a11y things first |
What do you think should happen if the page doesn't exist? Link to root/index.html of stable? |
Yes |
You think this could be sth for the sprint? |
I wouldn't make people mess with this repo for the sprint, I think it's easier just to stick with |
Good point. |
Dang it, I thought this was already handled. Either I'm bad at JavaScript or bad at testing 🙁 |
You're already ahead of me if that's an exclusive "or" :) |
OK, appears to be fixed now by #24 |
…s#8889) Must not be merged before mne-tools/mne-tools.github.io#23
versionwarning.js
script also generate the "unstable" warning bar on the development versiondrawbacks:
I'm opening this mostly for discussion purposes, so y'all can see what this solution would look like. I think the actual right way to fix this is:
versionwarning.js
to do the linking to the corresponding page (but keep the olddevbar_style
stuff)mne.tools
) that uses BS4 classes instead of hardcoded stylesdoc/_templates/layout.html
that inserts the devbar, and update it to load a new version of thisversionwarning
function that lives indoc/_static/
somewhere.That way, old docs use the old script here (which has appropriate styling) and new docs will use the new function (which has appropriate classes for the new theme), and will continue to work well once they become no longer the current
dev
version.