contact messages: label is the enable switch; single-line settings row
Data.contact_enabled is gone: an empty contact label disables messaging (no buttons, no visitor icon, sends rejected). The settings row is one line — flag selector, label, email, subject as small boxes with tooltip instructions — and saves re-render the page in place so button/dialog strings update without a reload; the open dialog also re-reads its strings on page swaps. The built-in Contact us default survives only as the inert preview placeholder.
This commit is contained in:
1 parent
59fe426e5e
commit
8d577dc56e
8 files changed
+119
-114
No files matched your search
+23
-19
@@ -12,8 +12,8 @@ existing WebSockets; there is no REST polling anywhere.
|
||||
thread store ops, wire payloads, both socket protocols, the admin unread
|
||||
count and the `/_contact/files` upload route.
|
||||
- `pagerite/data.py` — `Data.contact` (`ContactThread`/`ContactMessage`)
|
||||
and the site settings (`contact_enabled`, `contact_label`,
|
||||
`contact_email`, `contact_subject`).
|
||||
and the site settings (`contact_label` — which doubles as the on/off
|
||||
switch — `contact_email`, `contact_subject`).
|
||||
- `pagerite/tracking.py` — the sockets the protocol rides (see below).
|
||||
- `pagerite/api.py` — `/_api/settings` carries `contact_unread` (the admin
|
||||
icon badge seed — the probe runs on every page load, no polling) and the
|
||||
@@ -36,40 +36,44 @@ A lone `{contact: Label}` line in article Markdown (the block-directive
|
||||
machinery of `markdown.py`) renders
|
||||
`<button class="contact-trigger">Label</button>`. An empty label falls
|
||||
back to the configured site label (`Data.contact_label`, localized —
|
||||
below), ultimately the built-in "Contact us". `pagerite.js`
|
||||
below; "Contact us" appears only as the inert preview's placeholder when
|
||||
nothing is configured). `pagerite.js`
|
||||
click-delegates these buttons and lazy-loads
|
||||
the contact bundle; the editor preview renders the same button inert, and
|
||||
description/card mining resolves the tag to nothing. A per-button label
|
||||
lives in the chunk, so translated pages localize it like any other text.
|
||||
Feeds render the tag as its literal source (no directive context). When
|
||||
messaging is disabled the tag renders nothing at all.
|
||||
messaging is disabled (no site label configured) the tag renders nothing
|
||||
at all.
|
||||
|
||||
## Site settings and localization
|
||||
|
||||
The site editor's messaging block holds the feature's configuration
|
||||
(`/_api/settings`): `contact_enabled` (off = no trigger buttons, no
|
||||
visitor corner icon, sends rejected; admins keep the inbox for existing
|
||||
threads), `contact_email` (a mailto link in the visitor dialog, its
|
||||
subject prefilled) and the `contact_label`/`contact_subject` strings
|
||||
(the label doubles as the dialog's title and the buttons' default; the
|
||||
subject defaults to the label).
|
||||
The site editor's messaging row holds the feature's configuration
|
||||
(`/_api/settings`): `contact_label` — the {contact:} buttons' label and
|
||||
the visitor dialog's title, doubling as the on/off switch (empty = no
|
||||
trigger buttons, no visitor corner icon, sends rejected; admins keep the
|
||||
inbox for existing threads) — `contact_email` (a mailto link in the
|
||||
visitor dialog, its subject prefilled) and `contact_subject` (defaults
|
||||
to the label). Saves re-render the page in place, so button and dialog
|
||||
strings update without a reload.
|
||||
|
||||
The two strings localize like titles: translations live in the
|
||||
chunk-keyed `Data.trans` store (`i18n.site_string` looks them up at
|
||||
render time — the *effective* label, so the built-in default localizes
|
||||
too) and the translator service picks them up automatically
|
||||
render time) and the translator service picks them up automatically
|
||||
(`pending_items` emits them as title-kind fragments; nav-mode jobs carry
|
||||
them as extra top-level list items). Manual overrides are edited in the
|
||||
same messaging block: its language selector switches the label/subject
|
||||
fields to a translation, saved via `PUT /_api/settings?lang=` into the
|
||||
same messaging row: the flag selector (the article editor's LangSelect)
|
||||
switches the label/subject fields to a translation, saved via
|
||||
`PUT /_api/settings?lang=` into the
|
||||
same store (`i18n.set_string_translation`; empty or the original's text
|
||||
drops the override). The localized strings reach the client through the
|
||||
page's asset config (`pagerite:contact-label` / `-subject`, absent
|
||||
entirely when disabled — pagerite.js reads that as "visitors get no
|
||||
icon"); `contact-main.js` re-reads them on every open, so a language
|
||||
switch is reflected immediately. The email address itself is never in
|
||||
the config: it is revealed over the messaging socket only after the
|
||||
proof of work is solved.
|
||||
icon"); `contact-main.js` re-reads them on every open and on page swaps,
|
||||
so a language switch or a settings save is reflected immediately. The
|
||||
email address itself is never in the config: it is revealed over the
|
||||
messaging socket only after the proof of work is solved (and only when
|
||||
configured).
|
||||
|
||||
## Visitor side
|
||||
|
||||
|
||||
Reference in new issue
Block a user