Skip to content

feat(display): say how many assertion statements are hidden - #707

Open
ashleycaselli wants to merge 2 commits into
masterfrom
feat/702-show-hidden-statements
Open

ashleycaselli wants to merge 2 commits into
masterfrom
feat/702-show-hidden-statements

Conversation

@ashleycaselli

@ashleycaselli ashleycaselli commented Sep 11, 2026

Copy link
Copy Markdown
Member

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:

110 statements hidden  [v]

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 — StatementItem adds the advanced class only when the form is editable — so the count itself is display-only, as agreed.)

Incidental cleanups in the collapse code

  • Implicit globals (a, n, c) and a stray $ statement are gone; the function now uses named constants for the threshold and the kept-statement count.
  • expandAssertion used to call updateNanopubGraph on .nanopub-graph elements found inside .nanopub-assertion — which is itself the graph, so find never matched and the call never ran. It now calls adjustValueWidths(), which redoes the column alignment for the statements that just appeared. Calling updateNanopubGraph directly would have thrown a ReferenceError on a window narrower than 768px, where the limit global it reads is never assigned.
  • The count row is toggled by a class, not by jQuery's 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:

  1. A jsdom harness driving the real 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.
  2. The running app (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

ashleycaselli and others added 2 commits September 11, 2026 13:24
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Better show that assertion statements are hidden

1 participant