Skip to content

Fix #24: keep nav menu and Ask AI button in single policy view#26

Closed
r00bbert wants to merge 3 commits into
mainfrom
fix/policy-view-nav-missing
Closed

Fix #24: keep nav menu and Ask AI button in single policy view#26
r00bbert wants to merge 3 commits into
mainfrom
fix/policy-view-nav-missing

Conversation

@r00bbert
Copy link
Copy Markdown
Collaborator

@r00bbert r00bbert commented May 14, 2026

Summary

The single policy view rendered a brand-only nav bar — the section menu (Policies, Certifications, …) and the Ask AI CTA were missing, so visitors lost navigation the moment they opened a policy.

Changes

  • Extracted the nav into a shared partial templates/partials/nav.php, used by both the main page and the single policy view.
  • Single policy view now renders the full menu + Ask AI button. Section links point back to the main trust center page ({base}#ot-section) since those sections don't exist on the policy page.
  • Scroll-spy (data-ot-nav) stays wired only on the main page, where the target sections live.
  • Nav-item list is built once in trust-center.php and shared across both views.

Net result: no behaviour change on the main page, consistent nav on the policy page.

Test plan

  • Main trust center page: nav menu, scroll-spy highlighting, and Ask AI button work as before.
  • Single policy view: nav menu and Ask AI button are present.
  • Clicking a section link from a policy page returns to the main page and jumps to the section.
  • AI disabled: Ask AI button is absent in both views.

Closes #24

Summary by CodeRabbit

  • New Features

    • Added an “Ask AI” call-to-action in the navigation when AI is enabled
    • Optional scrollspy-enabled section links for in-page navigation
  • Refactor

    • Consolidated navigation into a shared component and unified nav item construction for reuse across templates
  • Documentation

    • Regenerated translation template with updated source references and timestamps

Review Change Stack

Extract the nav into a shared partial so the single policy view renders
the full menu and Ask AI CTA instead of a brand-only bar. Section links
on the policy page point back to the main trust center page.
@r00bbert r00bbert added this to the 1.2.0 milestone May 14, 2026
@r00bbert r00bbert added bug Something isn't working enhancement New feature or request labels May 14, 2026
@r00bbert r00bbert requested a review from nolderoos May 14, 2026 15:52
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 14, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: cab56301-abb7-428d-baee-854cdfbebc65

📥 Commits

Reviewing files that changed from the base of the PR and between 4f770f6 and b32eb86.

📒 Files selected for processing (2)
  • languages/opentrust.pot
  • templates/partials/nav.php
✅ Files skipped from review due to trivial changes (1)
  • languages/opentrust.pot
🚧 Files skipped from review as they are similar to previous changes (1)
  • templates/partials/nav.php

📝 Walkthrough

Walkthrough

A new navigation partial consolidates brand, section links, and Ask AI CTA rendering. The trust-center template builds $ot_nav_items once and includes the partial with scrollspy enabled. The policy-single partial includes the same partial with scrollspy disabled to preserve its menu and CTA.

Changes

Shared Navigation and Trust Center Integration

Layer / File(s) Summary
Shared navigation partial
templates/partials/nav.php
New partial renders a navigation bar with brand link (logo image or text fallback), optional section links with scrollspy support, and conditional Ask AI CTA with inline SVG icon. Initializes missing variables and guards against direct file access.
Trust center navigation items and main view
templates/trust-center.php
Navigation items map is built once at template scope for policies, certifications, subprocessors, data practices, contact, and FAQs. Main view now delegates navigation rendering to the shared partial with scrollspy enabled instead of inline markup.
Policy single view navigation
templates/partials/policy-single.php
Policy single partial replaces hardcoded navigation with an include of the shared nav partial, setting anchor base from $ot_base_url and explicitly disabling scrollspy.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐇 A partial stitched with careful art,

Hops into templates, plays its part.
Menus return, Ask AI stands tall,
Trust center and policy answer the call.
Hooray — one nav to rule them all.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main fix: restoring navigation menu and Ask AI button visibility in single policy view.
Linked Issues check ✅ Passed All coding requirements from issue #24 are met: navigation menu and Ask AI button are restored and visible in single policy view.
Out of Scope Changes check ✅ Passed All changes directly address the linked issue #24; there are no unrelated modifications or out-of-scope alterations.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/policy-view-nav-missing

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@templates/partials/nav.php`:
- Around line 25-29: The img alt for the logo may be empty when $ot_company_name
is not set; update the alt to fall back to the site name (e.g.
get_bloginfo('name')) so screen readers always have an accessible label. In
templates/partials/nav.php change the alt expression for the ot-nav__brand-logo
to use esc_attr( $ot_company_name ?: get_bloginfo('name') ) (or equivalent) so
it never renders an empty alt attribute.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1f700017-4255-472d-a0b0-9232163264c7

📥 Commits

Reviewing files that changed from the base of the PR and between 1e8f78d and 4f770f6.

📒 Files selected for processing (3)
  • templates/partials/nav.php
  • templates/partials/policy-single.php
  • templates/trust-center.php

Comment thread templates/partials/nav.php
@r00bbert
Copy link
Copy Markdown
Collaborator Author

Superseded by #32. This branch predates the namespace rename (#28) and edits files/identifiers that no longer exist on main (opentrust.pot, ot- classes, data-ot-nav, OPENTRUST_PLUGIN_DIR), so it can't be merged. #32 re-applies the same fix (shared nav partial + full menu/Ask AI on the policy view) onto the current templates.

@r00bbert r00bbert closed this May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Menu items and 'Ask AI' button disappears when in single policy view

1 participant