feat(display): say how many assertion statements are hidden - #707
Open
ashleycaselli wants to merge 2 commits into
Open
ashleycaselli wants to merge 2 commits into
ashleycaselli wants to merge 2 commits into
Conversation
An assertion of ten or more statements is shown cut down to its first six, and the only sign of that was a small unlabelled arrow in the corner: nothing said that statements were missing, let alone how many. A shortened assertion therefore read as the whole assertion (issue #702). The arrow is replaced by a note at the bottom of the assertion — "(110 statements hidden, expand)" — whose count comes from what the collapse actually hid, and whose link expands it. Collapsing again brings the note back. The publication info section keeps its own arrow. Advanced statements, which the publish form hides until its "show more" mode, now keep a light rule down their left edge once that mode reveals them, so it stays visible which statements are normally out of the way. A negative margin offsets the rule, so a marked statement still lines up with the others. Rewriting the collapse also cleaned up its implicit globals and a stray statement, and replaced a call that never ran (it looked for .nanopub-graph inside the element that is the graph) with adjustValueWidths, which redoes the column alignment for the statements that just appeared — and, unlike calling updateNanopubGraph directly, sets the width limit it reads instead of throwing a ReferenceError on a narrow window. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NnGpEQkFqCaf4AEQwwhFFn
The note replaced the arrow at the bottom of a collapsed assertion; keeping the arrow and labelling it says the same thing without moving the control readers already know. The count now sits immediately left of the arrow, vertically centred on it, and is itself the expand link. It is shown and hidden by a class rather than by jQuery's show/hide, which would overwrite the flex layout the row needs. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NnGpEQkFqCaf4AEQwwhFFn
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.
Closes #702.
Before
An assertion of ten or more statements is shown cut down to its first six. The only sign of that was a small unlabelled arrow in the bottom-right corner — nothing said statements were missing, let alone how many, so a shortened assertion read as the whole assertion.
After
The arrow stays where it is, and now has the count beside it:
The count is what the collapse actually hid (singular "1 statement hidden" when it is one), it sits immediately left of the arrow and vertically centred on it, and it is itself an expand link. Expanding hides both and reveals the usual collapse arrow; collapsing brings them back. The publication info section is untouched.
Advanced statements, per the issue's second paragraph, now keep a light rule down their left edge once the publish form's "show more" mode reveals them, so it stays visible which statements are normally out of the way. A negative margin offsets the rule, so a marked statement still lines up with the unmarked ones. (Scope note: advanced statements are only ever hidden in the publish form —
StatementItemadds theadvancedclass only when the form is editable — so the count itself is display-only, as agreed.)Incidental cleanups in the collapse code
a,n,c) and a stray$statement are gone; the function now uses named constants for the threshold and the kept-statement count.expandAssertionused to callupdateNanopubGraphon.nanopub-graphelements found inside.nanopub-assertion— which is itself the graph, sofindnever matched and the call never ran. It now callsadjustValueWidths(), which redoes the column alignment for the statements that just appeared. CallingupdateNanopubGraphdirectly would have thrown aReferenceErroron a window narrower than 768px, where thelimitglobal it reads is never assigned.show()/hide(), which would overwrite the flex layout that aligns it with the arrow.Testing
The repo has no JS test infrastructure, so this was verified two ways:
nanodash.js— 17 checks, all passing: a 12-statement assertion keeps 6 and hides 6; the label reads "6 statements hidden"; expanding shows all, hides label and arrow, and reveals the collapse button; collapsing restores all three; a 10-statement assertion says 4 hidden; 7- and 9-statement assertions are left alone with no label.mvnw jetty:run, a template nanopub with 110 hidden statements) — screenshots confirm the label sits next to the arrow, and that the advanced-statement rule keeps its alignment.Java suite on a clean build: 1404 tests, 0 failures. This change touches no Java.
🤖 Generated with Claude Code
https://claude.ai/code/session_01NnGpEQkFqCaf4AEQwwhFFn