Jump to content

Template:GalleryWidget

From LovedForever

Drop {{GalleryWidget}} on a memorial's "Gallery" subpage. Renders a Photo/Video/Audio sub-tab switcher -- UI and tab-switching state only (Request 9b, the second slice of Devin's larger Gallery estimate). There is no upload mechanism yet, so each panel shows a placeholder until the upload-flow piece is built and priced separately.

The tab buttons and panels are built entirely by MediaWiki:Common.js (renderGalleryWidget()), not written directly in this template's wikitext -- a raw <button> tag placed in wikitext gets HTML-escaped by MediaWiki's Sanitizer (confirmed directly against this wiki, the same class of issue already documented for raw <svg> in Template:Tribute), so this template is just an empty, JS-hydrated container -- the same pattern {{TributeWidget}} uses.

Active tab state is synced to the URL hash (#photo/ #video/#audio) via history.replaceState so a link can deep-link directly to one sub-tab, and the browser's back/ forward buttons move between previously-visited tabs -- the "state handling" half of this task's scope, not just visual toggling. Clicking a tab itself doesn't push a new history entry (would make back/forward annoying to use for anything other than deliberate deep links), only an incoming hash on page load or an actual hashchange does.

Auto-added to every brand-new PersonName/Gallery subpage via the EditFormPreloadText hook in LocalSettings.php, the same pattern as {{GuestbookWidget}}/ {{TributeWidget}}. Existing /Gallery pages created before this feature need this template call added manually.