Skip to content

Replace "^" for view displays with dropdown menu#369

Merged
tkuhn merged 14 commits intomasterfrom
feature/364-view-display-menu
Mar 4, 2026
Merged

Replace "^" for view displays with dropdown menu#369
tkuhn merged 14 commits intomasterfrom
feature/364-view-display-menu

Conversation

@tkuhn
Copy link
Contributor

@tkuhn tkuhn commented Mar 3, 2026

Closes #364

Summary

  • Adds a new ViewDisplayMenu component that replaces the SourceNanopub ("^") link in the title row of all QueryResult panels (list, table, nanopub set, plain paragraph)
  • The dropdown menu matches the style and behaviour of NanopubItem's action menu (same actionmenu CSS classes)
  • Menu items: show queryQueryPage, updatePublishPage with supersede, see view display declarationExplorePage

Test plan

  • Open a page with view displays (e.g. UserPage, SpacePage)
  • Confirm the "^" button is replaced by a ▼ dropdown in each view display header
  • Check "show query" navigates to the query info page
  • Check "update" opens the publish/supersede form for the view display nanopub
  • Check "see view display declaration" navigates to the view display nanopub in ExplorePage
  • Confirm view displays without a nanopub ID show no menu (same as before)

🤖 Generated with Claude Code

tkuhn and others added 2 commits March 3, 2026 16:05
Adds a ViewDisplayMenu component that replaces the SourceNanopub "^"
link in the header of all QueryResult panels (list, table, nanopub set,
plain paragraph). The menu offers three options: "show query" (links to
QueryPage), "update" (opens PublishPage with supersede), and "see view
display declaration" (links to ExplorePage, the former "^" behaviour).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ic, admin visibility

- Rename "update" menu item to "adjust"
- Use supersede= URL param when the session pubkey matches the view display
  nanopub's signer pubkey; derive= otherwise
- Hide the "adjust" item unless the user is on their own profile page
  (IndividualAgent.isCurrentUser()) or is a space admin
  (Space.isAdminPubkey()) for Space / MaintainedResource pages
- Thread AbstractResourceWithProfile pageResource through all four
  QueryResult builder classes and ViewList so ViewDisplayMenu can
  perform the admin check without page-level knowledge
- Move np button initialisation from each QueryResult subclass
  constructor into QueryResult.onBeforeRender() so pageResource is
  always available at render time; QueryResultNanopubSet keeps its own
  handling inside viewSelector

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@tkuhn tkuhn force-pushed the feature/364-view-display-menu branch from ec10f68 to 0b7362a Compare March 3, 2026 15:06
tkuhn and others added 7 commits March 3, 2026 16:41
…raph builders

setPageResource() was missing from all ApiResultComponent (cache-miss) paths
in QueryResultListBuilder and one path in QueryResultPlainParagraphBuilder.
On first page load queries are uncached, so the async path is always taken,
causing pageResource to remain null and ViewDisplayMenu to hide "adjust".
On second load the responses are cached so the sync path ran correctly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ntent

.view-selector span (specificity 0,1,1) was overriding
.actionmenu-content { display: none } (specificity 0,1,0), causing the
ViewDisplayMenu dropdown to be permanently visible inside QueryResultNanopubSet.

Narrow the selector to .view-selector .list and .view-selector .grid,
which are the only spans that need those icon-button styles.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…-selector

Three issues:
1. Menu entry text right-aligned in NanopubSet: .view-selector inherits
   text-align:right; fix by adding text-align:left to .actionmenu-content.

2. NanopubSet icon spacing: remove excess padding-right (was 20px) from
   .view-selector.with-source, and restore margin-left:10px on .buttons
   (lost when .view-selector span was narrowed to .list/.grid only).

3. Other view types icon too high: old a.source had margin-top:20px to
   sit near the bottom of the title row; add same positioning to
   .paneltitlerow span.buttons .actionmenu.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Without an explicit top value, position:absolute falls back to the static
position — which lands after the <h4> at roughly the bottom border of the
paneltitlerow, causing the menu icon to overlap it.

Add top:0 to .view-selector.with-source so it is anchored to the top of
the header row. Also make .buttons display:inline-block (consistent with
the icon spans) to avoid line-box height side-effects from vertical-align.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…selector

Two problems:
1. .paneltitlerow span.buttons .actionmenu { margin-top: 14px } matched the
   NanopubSet span.buttons (descendant of paneltitlerow via view-selector),
   pushing the icon down into the border. Fix: use > child combinator so it
   only matches the direct-child span.buttons in list/table/paragraph headers.

2. The inline style="margin: 0;" on the NanopubSet buttons span was
   overriding .view-selector.with-source .buttons { margin-left } (inline
   styles win over all CSS). Remove the now-redundant inline style (it was
   only there to counter the old .view-selector span margin-left rule).
   Also increase the left margin to 16px for comfortable spacing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Pass queryparam_<name>=<value> for each entry in queryRef.getParams() so
the QueryPage form is pre-populated with the same values the view display
uses. The user can then press Run to see the exact same results.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@tkuhn tkuhn marked this pull request as ready for review March 3, 2026 16:33
@tkuhn tkuhn requested a review from ashleycaselli March 3, 2026 16:36
@tkuhn tkuhn merged commit 9d41a90 into master Mar 4, 2026
8 checks passed
@tkuhn tkuhn deleted the feature/364-view-display-menu branch March 4, 2026 09:37
@github-actions
Copy link

github-actions bot commented Mar 4, 2026

🎉 This PR is included in version 4.15.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace "^" for view displays with menu

2 participants