Jump to content

Template:GuestbookWidget: Difference between revisions

From LovedForever
m 1 revision imported
Replace VisualEditor entry link with the new custom single-form Guestbook widget
Line 4: Line 4:
}}
}}


[{{fullurl:{{FULLPAGENAME}}/Guestbook|veaction=edit&preload=Template:Memory_Preload}} '''➕ Add 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> into any memorial page's
Guestbook section. It works on whichever page it's placed on — no page name to
Guestbook section. It works on whichever page it's placed on — no page name to
fill in — by transcluding "&lt;This page&gt;/Guestbook" and linking to a
fill in — by transcluding "&lt;This page&gt;/Guestbook" and rendering a native
VisualEditor edit of that same subpage.
submission form (built by <code>MediaWiki:Common.js</code>) instead of linking
out to a VisualEditor edit.


Important: do NOT pre-create the "PersonName/Guestbook" subpage. VisualEditor's
Important: do NOT pre-create the "PersonName/Guestbook" subpage — leave it to
preload only fires for a page that doesn't exist yet — if the subpage already
be created by the first real submission. The {{#ifexist:}} above shows a
exists (even blank), the first visitor loses the pre-filled form. The
friendly placeholder instead of a redlink until then.
{{#ifexist:}} above shows a friendly placeholder instead of a redlink until
the first memory is saved.


The first memory on a page opens pre-filled via preload. After that, the page
The visible form (name / message / a tribute-icon row / photo upload / submit)
already has content, so VisualEditor can no longer preload it automatically —
is rendered client-side by <code>MediaWiki:Common.js</code> into the empty
later visitors use VisualEditor's Insert > Template > Memory dialog instead
<code>.guestbook-form-widget</code> div above, and submits via the Action API
(TemplateData gives it labeled fields and a real photo picker).
(<code>action=edit</code>, <code>appendtext</code>) directly onto this page's
"/Guestbook" subpage as a <code>{{Memory|...}}</code> entry — the same storage
format the old VisualEditor-based flow used, so this only changes how entries
are submitted, not how they're stored or rendered.
 
Posting requires being logged in — logged-out visitors see a "log in or
create an account" prompt instead of the form fields.
</noinclude>
</noinclude>

Revision as of 06:33, 14 September 2026

Be the first to share a memory.

Drop {{GuestbookWidget}} into any memorial page's Guestbook section. It works on whichever page it's placed on — no page name to fill in — by transcluding "<This page>/Guestbook" and rendering a native submission form (built by MediaWiki:Common.js) instead of linking out to a VisualEditor edit.

Important: do NOT pre-create the "PersonName/Guestbook" subpage — leave it to be created by the first real submission. The above shows a friendly placeholder instead of a redlink until then.

The visible form (name / message / a tribute-icon row / photo upload / submit) is rendered client-side by MediaWiki:Common.js into the empty .guestbook-form-widget div above, and submits via the Action API (action=edit, appendtext) directly onto this page's

"/Guestbook" subpage as a

A Visitor



entry — the same storage format the old VisualEditor-based flow used, so this only changes how entries are submitted, not how they're stored or rendered.

Posting requires being logged in — logged-out visitors see a "log in or create an account" prompt instead of the form fields.