Bug 31863 - Advanced cataloging editor no longer auto-resizes
Summary: Advanced cataloging editor no longer auto-resizes
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Lucas Gass
QA Contact: Katrin Fischer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-10-18 20:17 UTC by Lucas Gass
Modified: 2022-11-18 01:17 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.11.00, 22.05.07, 21.11.14


Attachments
Bug 31863: Account for changelanguage element when adjusting editor height (2.13 KB, patch)
2022-10-18 20:58 UTC, Lucas Gass
Details | Diff | Splinter Review
Bug 31863: Account for changelanguage element when adjusting editor height (2.18 KB, patch)
2022-10-18 22:47 UTC, David Nind
Details | Diff | Splinter Review
Bug 31863: Account for changelanguage element when adjusting editor height (2.24 KB, patch)
2022-10-21 15:39 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Lucas Gass 2022-10-18 20:17:39 UTC
The advanced cataloging editor no longer automatically resizes the height of the CodeMirror editor, prior to 22.05 it did.

To recreate:
1. Turn on 'EnableAdvancedCatalogingEditor'
2. Go to a record with enough MARC data that it should take up the entire width of your screen,
3. The CodeMirror editor will only be 300px. 
4. Prior to 22.05 it would dynamically adjust to the height of your screen.
Comment 1 Lucas Gass 2022-10-18 20:49:45 UTC
This is because of how we calculate the adjusted height in the function 'onResize'. If the 'changelanguage' element does not exist then '$('#changelanguage').height()' will be undefined. 

1 + undefined == NaN. 

We cannot change the editor height to NaN. We should check for the existence of the 'changelanguage' and if it is not present change the calculation.
Comment 2 Lucas Gass 2022-10-18 20:58:52 UTC
Created attachment 142101 [details] [review]
Bug 31863: Account for changelanguage element when adjusting editor height

To test:
1. Turn on 'EnableAdvancedCatalogingEditor'
2. Go to a record with enough MARC data that it should take up the entire width of your screen,
3. The CodeMirror editor will only be 300px.
4. Resize your screen, nothing happens to the editor height
5. Apply patch
6. Look at the same record in your editor, the editor should go to the bottom of the page now. Resizing your screen should resize the editor.
7. Have some additional language packs installed, and change the language system pref so the '#changelanguage' option will appear.
8. Make sure the editor height is still being properly set.
Comment 3 David Nind 2022-10-18 22:47:34 UTC
Created attachment 142112 [details] [review]
Bug 31863: Account for changelanguage element when adjusting editor height

To test:
1. Turn on 'EnableAdvancedCatalogingEditor'
2. Go to a record with enough MARC data that it should take up the entire width of your screen,
3. The CodeMirror editor will only be 300px.
4. Resize your screen, nothing happens to the editor height
5. Apply patch
6. Look at the same record in your editor, the editor should go to the bottom of the page now. Resizing your screen should resize the editor.
7. Have some additional language packs installed, and change the language system pref so the '#changelanguage' option will appear.
8. Make sure the editor height is still being properly set.

Signed-off-by: David Nind <david@davidnind.com>
Comment 4 David Nind 2022-10-18 22:51:04 UTC
Thanks Lucas! I had noticed yesterday when testing another bug, but hadn't yet logged a bug.

After installing a language, I noticed that the titles for records aren't displayed in the search results after switching to the language in the staff interface and OPAC (even after a reindex).

I'm sure it hasn't done that in the past... so maybe another staff interface bug?
Comment 5 Lucas Gass 2022-10-19 19:48:08 UTC
(In reply to David Nind from comment #4)
> Thanks Lucas! I had noticed yesterday when testing another bug, but hadn't
> yet logged a bug.
> 
> After installing a language, I noticed that the titles for records aren't
> displayed in the search results after switching to the language in the staff
> interface and OPAC (even after a reindex).
> 
> I'm sure it hasn't done that in the past... so maybe another staff interface
> bug?

Hey David,

Thanks for testing. I am unable to reproduce this problem.
Comment 6 David Nind 2022-10-19 19:56:32 UTC
(In reply to Lucas Gass from comment #5)
> (In reply to David Nind from comment #4)
> > Thanks Lucas! I had noticed yesterday when testing another bug, but hadn't
> > yet logged a bug.
> > 
> > After installing a language, I noticed that the titles for records aren't
> > displayed in the search results after switching to the language in the staff
> > interface and OPAC (even after a reindex).
> > 
> > I'm sure it hasn't done that in the past... so maybe another staff interface
> > bug?
> 
> Hey David,
> 
> Thanks for testing. I am unable to reproduce this problem.

Katrin said on IRC that this sometimes happens with translations (was for fr-CA), so is not a staff interface related bug.
Comment 7 Katrin Fischer 2022-10-21 15:39:23 UTC
Created attachment 142411 [details] [review]
Bug 31863: Account for changelanguage element when adjusting editor height

To test:
1. Turn on 'EnableAdvancedCatalogingEditor'
2. Go to a record with enough MARC data that it should take up the entire width of your screen,
3. The CodeMirror editor will only be 300px.
4. Resize your screen, nothing happens to the editor height
5. Apply patch
6. Look at the same record in your editor, the editor should go to the bottom of the page now. Resizing your screen should resize the editor.
7. Have some additional language packs installed, and change the language system pref so the '#changelanguage' option will appear.
8. Make sure the editor height is still being properly set.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Comment 8 Tomás Cohen Arazi 2022-10-24 13:58:43 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!
Comment 9 Lucas Gass 2022-10-31 16:58:02 UTC
Backported to 22.05.x for upcoming 22.05.07
Comment 10 Arthur Suzuki 2022-11-14 10:58:39 UTC
applied to 21.11.x for 21.11.14
Comment 11 Victor Grousset/tuxayo 2022-11-18 01:17:24 UTC
Not backported to oldoldstable (21.05.x). Feel free to ask if it's needed.

Nothing to document it seems, marking resolved.