-
-
Notifications
You must be signed in to change notification settings - Fork 311
Bug/sc 39280/ library notes preexisting pre mdl notes on a #2926
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
Bug/sc 39280/ library notes preexisting pre mdl notes on a #2926
Conversation
…ria-Project into modularization-main
…reexisting-pre-mdl-notes-on-a
static/js/NoteListing.jsx
Outdated
| let path, noteURL; | ||
| const module = isSheet ? Sefaria.VOICES_MODULE : Sefaria.LIBRARY_MODULE; | ||
| if (isSheet) { | ||
| const parsedRef = Sefaria.parseRef(ref); | ||
| path = `/sheets/${parsedRef.sections.join('.')}`; | ||
| noteURL = new URL(path, Sefaria.getModuleURL(module)); | ||
| } | ||
| else { | ||
| path = `/${ref}`; | ||
| noteURL = new URL(path, Sefaria.getModuleURL(module)); | ||
| noteURL.searchParams.set('with', 'Notes'); // side panel should only open to show notes in Library module | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can insert the module into the if-else blocks to avoid checking isSheet twice.
it still will have noteURL = new URL(path, Sefaria.getModuleURL(module)); twich which i really don't like, but i didn't find the right way to do it. it's worth to give it another think. maybe some of the logic here can be generalized to a separate helper function in Sefaria.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK I just pushed again. Let me know what you think of my re-factor. I used a helper function we already had with some changes.
…reexisting-pre-mdl-notes-on-a
Co-authored-by: YishaiGlasner <60393023+YishaiGlasner@users.noreply.github.com>
Co-authored-by: YishaiGlasner <60393023+YishaiGlasner@users.noreply.github.com>
Description
If there is a note on a sheet, link it to voices module. The previous functionality was actually wrong. I've now added a function
getNoteURLbecause the behavior is quite different. This comment explains:// This helper function returns the a tag linking to the given ref of the note When the URL is to a ref in the library,
// returning the appropriate a tag is very simple, but when the ref is to a sheet, we need to modify the ref and set the data-target-module attribute to the voices module.
// If the ref is to a sheet, the ref will be something like "Sheet 3.4" but it needs to link to "/sheets/3.4" in the voices module.