Jump to content

Template:GuestbookWidget: Difference between revisions

From LovedForever
Replace VisualEditor entry link with the new custom single-form Guestbook widget
Restructure for "Stories" tab relocation: now placed directly on the PersonName/Stories page itself instead of the parent page, so no more ifexist/transclusion indirection is needed
Line 1: Line 1:
{{#ifexist:{{FULLPAGENAME}}/Guestbook
<div class="guestbook-form-widget" data-guestbook-subpage="{{FULLPAGENAME}}"></div>
|{{:{{FULLPAGENAME}}/Guestbook}}
|''Be the first to share a memory.''
}}
 
<div class="guestbook-form-widget" data-guestbook-subpage="{{FULLPAGENAME}}/Guestbook"></div>
<noinclude>
<noinclude>
Drop <code><nowiki>{{GuestbookWidget}}</nowiki></code> into any memorial page's
Drop <code><nowiki>{{GuestbookWidget}}</nowiki></code> at the top of a memorial's own
Guestbook section. It works on whichever page it's placed on — no page name to
"PersonName/Stories" subpage -- not the main memorial page. It renders a native
fill in — by transcluding "&lt;This page&gt;/Guestbook" and rendering a native
submission form (built by <code>MediaWiki:Common.js</code>) that posts new entries
submission form (built by <code>MediaWiki:Common.js</code>) instead of linking
directly onto *this* page via the Action API (<code>action=edit</code>,
out to a VisualEditor edit.
<code>appendtext</code>); they then appear below as <code>{{Memory|...}}</code>
 
entries, since the existing entries on the page are simply the rest of its
Important: do NOT pre-create the "PersonName/Guestbook" subpage — leave it to
wikitext -- there is no separate storage subpage any more.
be created by the first real submission. The {{#ifexist:}} above shows a
friendly placeholder instead of a redlink until then.


The visible form (name / message / a tribute-icon row / photo upload / submit)
A "Stories" tab pointing at this subpage is added automatically to the parent
is rendered client-side by <code>MediaWiki:Common.js</code> into the empty
memorial page (see the <code>SkinTemplateNavigation::Universal</code> hook in
<code>.guestbook-form-widget</code> div above, and submits via the Action API
<code>LocalSettings.php</code>) for any page whose "/Stories" subpage
(<code>action=edit</code>, <code>appendtext</code>) directly onto this page's
transcludes this template -- so this page needs to exist and contain
"/Guestbook" subpage as a <code>{{Memory|...}}</code> entry — the same storage
<code><nowiki>{{GuestbookWidget}}</nowiki></code> before the tab will appear on
format the old VisualEditor-based flow used, so this only changes how entries
its parent.
are submitted, not how they're stored or rendered.


Posting requires being logged in — logged-out visitors see a "log in or
Posting is open to anyone, logged in or not -- anonymous visitors can post
create an account" prompt instead of the form fields.
text, but the photo-upload button is disabled for them (MediaWiki's default
permissions don't grant anonymous users the "upload" right).
</noinclude>
</noinclude>

Revision as of 00:24, 16 September 2026

Drop {{GuestbookWidget}} at the top of a memorial's own "PersonName/Stories" subpage -- not the main memorial page. It renders a native submission form (built by MediaWiki:Common.js) that posts new entries directly onto *this* page via the Action API (action=edit,

appendtext); they then appear below as

A Visitor



entries, since the existing entries on the page are simply the rest of its wikitext -- there is no separate storage subpage any more.

A "Stories" tab pointing at this subpage is added automatically to the parent memorial page (see the SkinTemplateNavigation::Universal hook in LocalSettings.php) for any page whose "/Stories" subpage transcludes this template -- so this page needs to exist and contain {{GuestbookWidget}} before the tab will appear on its parent.

Posting is open to anyone, logged in or not -- anonymous visitors can post text, but the photo-upload button is disabled for them (MediaWiki's default permissions don't grant anonymous users the "upload" right).