OBGM-528 Unable to print delivery note#4162
Merged
awalkowiak merged 4 commits intofeature/upgrade-to-grails-3.3.10from Jul 18, 2023
Merged
OBGM-528 Unable to print delivery note#4162awalkowiak merged 4 commits intofeature/upgrade-to-grails-3.3.10from
awalkowiak merged 4 commits intofeature/upgrade-to-grails-3.3.10from
Conversation
kchelstowski
commented
Jul 12, 2023
| script.append("<script src=\"https://code.jquery.com/jquery-3.3.1.slim.min.js\"") | ||
| script.append(" integrity=\"sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo\"") | ||
| script.append(" crossorigin=\"anonymous\">") | ||
| script.append("</script>") |
Collaborator
Author
There was a problem hiding this comment.
I decided to use StringBuilder for a better visibility, instead of either using + or pasting whole script in one line
jmiranda
requested changes
Jul 13, 2023
| <title><warehouse:message code="default.show.label" args="[entityName]"/></title> | ||
| <link rel="stylesheet" href="${resource(dir:'css',file:'buttons.css')}" type="text/css" media="all" /> | ||
| <g:javascript library="jquery" plugin="jquery" /> | ||
| <g:jquery /> |
Member
There was a problem hiding this comment.
We can just explicitly include the jquery library we want to use into the print.gsp layout (grails-app/views/layouts/print.gsp), assuming the use of jquery-3.3.1 doesn't break anything.
So replace this
<g:javascript library="jquery" plugin="jquery" />
with this
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
Collaborator
Author
There was a problem hiding this comment.
@jmiranda could you elaborate on this, because I’m confused?
I’m exactly doing this, but assigned it to a „variable” (a custom tag), so that if we ever need to bump up the version, we’ll just have to change it in the taglib, not in every file
…- remove the custom tag lib for jquery injection
alannadolny
approved these changes
Jul 18, 2023
awalkowiak
approved these changes
Jul 18, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The issue was that the
<g:javascript>implementation changed and it seems not to be invoking jquery anymore.Grails 1:

Grails 3:

The jquery in those places was not working at all, an error like this could be visible on such pages:

It is because those
printpages don't use the layout ofcustom.gsplike:<g:applyLayout name="custom">and because
custom.gspinvokes jquery like this:the jquery is still working on most of pages (because they apply the custom layout, which invokes jquery).
To fix the issue I just invoke the jquery manually here, but not to repeat the same code, I've created a custom tag lib
<g:jquery>for that, so that if we face this issue in more places, we can reuse it.