Show the ABC branding grade only when the book has a level (BL-16775) - #8257
Draft
hatton wants to merge 1 commit into
Draft
Show the ABC branding grade only when the book has a level (BL-16775)#8257hatton wants to merge 1 commit into
hatton wants to merge 1 commit into
Conversation
In a collection with an ABC branding, every book showed a grade circle, and the circle often showed the wrong grade. A book that had never been given a level showed "Grade 1". A book whose "This book is leveled" switch the user had just turned off went on showing its old grade. The back cover, which should read "Kindergarten" for a book with no level, showed a number instead. The stylesheet drew the grade from data-leveledreaderlevel on the page body alone. The Leveled Reader tool keeps its level after the switch goes off, so the attribute outlived the level. The server did not clear the number either: a substring test read "leveled-reader-off" as "leveled-reader", and the routine that clears the number ran after the number had already gone out to the pages. ABC-Reader-XMatter.less now shows a grade only when the book has one. The grade rules require the leveled-reader class, and the number and its "Grade " label appear only when the value is not empty. The back-cover "Kindergarten" rule now names the class the ABC xmatter really emits, so it applies at all. Book records the level and the stage on the body only while the book is of that kind, and writes them as soon as the user flips either switch. BookData tests the body classes as whole words, and clears the number before the data goes out to the pages rather than after. The Leveled Reader and Decodable Reader controls put the level, the stage, and the displayed number onto the page as the user changes them, so the circle follows the switch with no page change. Where a book is both kinds, the decodable stage wins, which is what the server does. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
|
| Filename | Overview |
|---|---|
| src/BloomBrowserUI/bookEdit/toolbox/readers/ReaderToolSwitch.tsx | Updates the editable page’s reader class and displayed number immediately when either reader switch changes. |
| src/BloomBrowserUI/bookEdit/toolbox/readers/readerToolPageState.ts | Centralizes synchronization of reader attributes and the displayed level-or-stage value on the iframe body. |
| src/BloomBrowserUI/bookEdit/toolbox/readers/readerToolsModel.ts | Refreshes page-level branding data whenever the selected reader level or stage changes. |
| src/BloomExe/Book/Book.cs | Records level and stage body attributes only while their corresponding reader modes are active. |
| src/BloomExe/Book/BookData.cs | Uses whole-word reader-class checks and corrects reader data before propagating the dataset through the document. |
| src/BloomExe/Edit/EditingModel.cs | Reuses the active-reader-aware level calculation when correcting saved body attributes. |
| src/content/templates/xMatter/project-specific/ABC-Reader-XMatter/ABC-Reader-XMatter.less | Hides grade presentation for empty reader values, fixes the Kindergarten selector, and scopes higher-grade overrides to active leveled readers. |
| src/BloomTests/Book/BookDataTests.cs | Adds regression tests for clearing stale numbers and falling back to a decodable stage. |
| src/BloomTests/Book/BookTests.cs | Verifies disabling leveled-reader mode clears the level recorded on the book body. |
Reviews (1): Last reviewed commit: "Show the ABC branding grade only when th..." | Re-trigger Greptile
hatton
commented
Aug 28, 2026
Member
Author
|
[Claude Opus 5 from Hatton's machine during preflight] Consulted Devin on 2026-08-28 20:45 UTC up to commit It reported no bugs and one Investigate flag, about whether the |
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.
Problem
In a collection that uses an ABC branding (ABC-BARMM and its siblings), every book showed a grade circle on the cover, the title page and the back cover, and the circle often showed the wrong grade. A book that had never been given a level showed "Grade 1". A book whose "This book is leveled" switch the user had just turned off went on showing the grade it had before, and kept it after a restart. The back cover, which is meant to read "Kindergarten" for a book with no level, showed a number instead.
Cause
The stylesheet drew the grade from
data-leveledreaderlevelon the page body alone. The Leveled Reader tool keeps its level after the switch goes off, so that attribute outlived the level the book actually had. The server did not clear the number either: a substring test readleveled-reader-offasleveled-reader, and the routine that clears the number ran after the number had already gone out to the pages.Fix
ABC-Reader-XMatter.lessshows a grade only when the book has one. The grade rules now require theleveled-readerclass, and the number and its "Grade " label appear only when the value is not empty. A book with no level gets an invisible circle, which is how it behaved before 2022..backCoverRow), so it applies at all. It never did.Bookrecords the level and the stage on the body only while the book is of that kind, and writes them as soon as the user flips either switch.BookDatatests the body classes as whole words, and clears the number before the data goes out to the pages rather than after.Ref: https://issues.bloomlibrary.org/youtrack/issue/BL-16775
Devin review
This change is