Fold ohm-inspector into ohm-website (issue #1058)#402
Closed
jeffreyameyer wants to merge 1 commit into
Closed
Conversation
… ohm-website
Replaces the GitHub Pages-hosted ohm-inspector bundle with an in-tree
implementation. The feature panel is now rendered server-side as a Rails
partial with client-side JS only for SimpleLightbox initialization,
Wikipedia excerpt fetching, and (future) Wikidata lookup. SimpleLightbox
is consumed from npm rather than vendored.
Changes:
- app/views/browse/_ohm_details.html.erb: server-side panel (image
slideshow, date range, Wikipedia/Wikidata excerpt placeholder,
more-info links). All strings localized via t(".key").
- app/assets/javascripts/index/ohm_inspector.js: SimpleLightbox init,
slideshow nav, async Wikipedia excerpt fetch, Wikidata->Wikipedia
fallback (openstreetmap#584). Replaces the CDN-loaded bundle.
- app/helpers/ohm_inspector_helper.rb: ohm_inspector_wikipedia_url and
ohm_inspector_date_range. Wikipedia URL helper detects lang:Title
prefix correctly (openstreetmap#859). Date range uses existing DateRange class
which has no 1000000/-1000000 special-casing (openstreetmap#747).
- app/assets/stylesheets/_ohm_inspector.scss: panel styles.
- app/assets/stylesheets/ohm-inspector-all.scss: Sprockets manifest
for SimpleLightbox CSS from npm.
- config/locales/en.yml: browse.ohm_details.* and
javascripts.ohm_inspector.* keys.
- package.json: simplelightbox ^2.1.0 (run npm install to update
the lockfile).
Upstream files touched (kept minimal for merge maintainability):
- app/views/layouts/_head.html.erb: removed two CDN tags, added one
stylesheet_link_tag.
- app/views/elements/show.html.erb: render the new partial.
- app/assets/javascripts/index.js: two new //= require lines.
- app/assets/javascripts/index/element.js: replaced inline
addOpenHistoricalMapInspector body with a call to the new global
function, passing map for future openstreetmap#1323 use.
- app/assets/stylesheets/common.scss: @import "ohm_inspector".
Tests:
- test/helpers/ohm_inspector_helper_test.rb: 15 unit tests including
regression coverage for openstreetmap#859 and openstreetmap#747.
- test/controllers/ohm_inspector_test.rb: 15 integration tests
exercising the partial via the nodes controller.
Intentionally not ported:
- followed_by:name / followed_by tag display: per openstreetmap#748, this should
consult the chronology relation rather than these undocumented tags.
- Feature name and bottom Wikipedia/Wikidata/LoC links: redundant with
the existing sidebar header and tag table.
- The two-DOM-structure injection polyfill from the old inspector.
Layout/visual design and remaining inspector-labeled issues are
deferred per the project plan.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Member
Author
|
Closing — opened prematurely. The branch |
Generated by 🚫 Danger |
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.
Summary
Closes the request in openhistoricalmap/issues#1058 by replacing the GitHub-Pages-hosted
ohm-inspectorbundle with an in-tree implementation.The feature inspector panel is now rendered server-side as a Rails partial, with client-side JS only for SimpleLightbox initialization, Wikipedia excerpt fetching, and (future) Wikidata lookup. SimpleLightbox is consumed from npm rather than vendored.
This PR has only been verified via the new automated tests; it has not been exercised end-to-end in a running dev environment yet (local Docker setup hit several environmental issues during this work). Before merging, please:
DEVELOPMENT.mdand verify/node/<id>,/way/<id>,/relation/<id>pages render the new panel for features that have any ofimage:N,start_date/end_date,wikipedia,wikidata,more_info:Ntags.npm installcommit if asset compile fails onsimplelightbox.What's included
New files (OHM-only, no upstream merge risk):
app/views/browse/_ohm_details.html.erb— server-side panel: image slideshow, date range, Wikipedia/Wikidata excerpt placeholder, more-info links. All strings localized viat(\".key\").app/assets/javascripts/index/ohm_inspector.js—addOpenHistoricalMapInspector(map): SimpleLightbox init, slideshow nav, Wikipedia excerpt fetch, Wikidata→Wikipedia fallback.app/helpers/ohm_inspector_helper.rb—ohm_inspector_wikipedia_urlandohm_inspector_date_range.app/assets/stylesheets/_ohm_inspector.scss— panel styles.app/assets/stylesheets/ohm-inspector-all.scss— Sprockets manifest pulling in SimpleLightbox CSS from npm.app/assets/images/ohm-inspector-chevron-{left,right}.svg— slideshow nav icons.test/helpers/ohm_inspector_helper_test.rb— 15 unit tests.test/controllers/ohm_inspector_test.rb— 15 integration tests.Upstream files touched (kept minimal for merge maintainability):
app/views/layouts/_head.html.erb— removed two CDN tags, added onestylesheet_link_tag.app/views/elements/show.html.erb— added onerendercall.app/assets/javascripts/index.js— added two//= requirelines.app/assets/javascripts/index/element.js— replaced inlineaddOpenHistoricalMapInspectorbody with a call to the new global function.app/assets/stylesheets/common.scss— added@import \"ohm_inspector\".config/locales/en.yml— addedbrowse.ohm_details.*andjavascripts.ohm_inspector.*keys.package.json— addedsimplelightbox ^2.1.0.Bugs fixed in passing
lang:Titleprefix correctly instead of always usingen.1000001 BCEand1000000 CEwere treated as null dates. The new server-side path uses the existingDateRangeclass which has no such special-casing.wikidatabut nowikipediatag, the JS now looks up the Wikipedia article via the Wikidata API.Intentionally not ported
followed_by:name/followed_bytag display — per openhistoricalmap/issues#748, this was practically unused (zerofollowed_byURLs in the wild) and should be replaced with chronology-relation lookup instead. Stub for that future feature is left inohm_inspector.js.<h2>title and the tag table'sformat_valuelinkification.Deferred for follow-up issues
wikimedia_commons=File:…) image display.start_date/end_dateto advance the timeslider. The dates render withdata-start-date/data-end-dateattributes ready to be wired up.inspector-labeled issues.Test plan
DEVELOPMENT.mdon this branch and confirm Puma starts cleanly.npm installlocally, commit the resulting lockfile./node/<id>for a node withimage:1tags — slideshow renders, prev/next buttons appear if multiple images, clicking an image opens SimpleLightbox.start_date/end_date— date range renders correctly, including BCE features and very-large-year features (regression check for OpenStreetMap Map key is not working in STANDARD LAYER openstreetmap/openstreetmap-website#747).wikipedia=pt:Article— Portuguese Wikipedia excerpt loads (regression check for Update geocoder.search_osm_nominatim.prefix.aerialway openstreetmap/openstreetmap-website#859).wikidata=Q…and nowikipediatag — Wikipedia excerpt loads via Wikidata sitelink (Obtain changeset comment for /api/[node|way|relation](/history) openstreetmap/openstreetmap-website#584).more_info:1tags — links render under "More info" with appropriate fallback when name is missing.span.translation_missingmarkers appear on any of the above..ohm-inspector-panelwrapper.🤖 Generated with Claude Code