Runway 1.0.1
This commit is contained in:
1 parent
dcf819146b
commit
ce217fc952
259 files changed
+22226
-206
No files matched your search
@@ -0,0 +1,75 @@
|
||||
<!-- Admin fragment — rendered below this plugin's per-tenant settings form. Bare fragment; binding in .th.xml.
|
||||
First card: the ready-made "Contact page" — install it (once) or see where it lives (it becomes a normal,
|
||||
editable site page). Then the SMTP readiness + a self-test button, and the recent submissions (a th:each row
|
||||
template) so a site manager reads messages in the console. -->
|
||||
<div class="card mt-3">
|
||||
<div class="card-header"><h3 class="card-title" id="cp-title">Contact page</h3></div>
|
||||
<div class="card-body">
|
||||
<!-- Not yet installed: explain + a one-click install action. A POST carrying the console's CSRF token (it
|
||||
creates a page, so a cross-site link must not be able to trigger it); the plain-text result opens in
|
||||
a new tab. -->
|
||||
<div id="cp-install">
|
||||
<p class="text-secondary" id="cp-desc">Install a ready-made contact page carrying the form. It becomes
|
||||
a normal site page — edit, restyle, move or rename it from Pages.</p>
|
||||
<form id="cp-install-form" method="post" action="/contact/install-page" target="_blank" rel="noopener"
|
||||
class="m-0">
|
||||
<input id="cp-csrf" type="hidden" name="_csrf" value="">
|
||||
<button id="cp-install-btn" type="submit" class="btn btn-primary">
|
||||
<i class="fa-solid fa-file-circle-plus me-1"></i><span id="cp-install-label">Install contact page</span></button>
|
||||
</form>
|
||||
</div>
|
||||
<!-- Already installed: show the live path (from PageStore — follows moves) + where to edit it. -->
|
||||
<div id="cp-installed" class="d-flex align-items-center">
|
||||
<span class="badge bg-success-lt me-2" id="cp-badge">Installed</span>
|
||||
<span id="cp-at">Installed at</span> <code id="cp-path" class="ms-1">/contact</code>
|
||||
<span class="text-secondary ms-2" id="cp-edit">— edit it under Pages.</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card mt-3">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title" id="cn-title">Contact submissions</h3>
|
||||
<span class="ms-auto text-secondary"><span id="cn-count">0</span></span>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<!-- SMTP readiness row + operator-only self-test: a POST carrying the console's CSRF token (it sends an
|
||||
email); the plain-text result opens in a new tab. -->
|
||||
<div class="d-flex align-items-center mb-3" id="cn-smtp">
|
||||
<span class="me-2" id="cn-smtp-label">SMTP relay</span>
|
||||
<span id="cn-smtp-ok" class="badge bg-success-lt">Configured</span>
|
||||
<span id="cn-smtp-missing" class="badge bg-red-lt">Not configured</span>
|
||||
<form id="cn-smtp-test-form" method="post" action="/contact/smtp-test" target="_blank" rel="noopener"
|
||||
class="m-0 ms-auto">
|
||||
<input id="cn-csrf" type="hidden" name="_csrf" value="">
|
||||
<button id="cn-smtp-test" type="submit" class="btn btn-sm btn-outline-secondary">
|
||||
<i class="fa-solid fa-paper-plane me-1"></i><span id="cn-smtp-test-label">Send a test email</span></button>
|
||||
</form>
|
||||
</div>
|
||||
<p class="text-secondary mb-0" id="cn-empty">No submissions yet.</p>
|
||||
<div class="table-responsive" id="cn-table">
|
||||
<table class="table table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th id="cn-h-when">When</th>
|
||||
<th id="cn-h-name">Name</th>
|
||||
<th id="cn-h-email">Email</th>
|
||||
<th id="cn-h-msg">Message</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr id="cn-row">
|
||||
<td class="cn-when text-nowrap">time</td>
|
||||
<td class="cn-name">name</td>
|
||||
<td class="cn-email">email</td>
|
||||
<td class="cn-excerpt">excerpt</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<a id="cn-help" href="/__plugin/contact/static/contact-help.html" target="_blank" rel="noopener">
|
||||
<i class="fa-solid fa-circle-question me-1"></i><span id="cn-help-label">Contact help & reference</span></a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Admin fragment logic. The recent-submissions table repeats #cn-row over ${@contactAdminModel.recent(...)};
|
||||
nested cells use '//' descendant selectors (pitfall #8). The empty note and the table are mutually exclusive
|
||||
via th:if on the count. The SMTP readiness row shows exactly one of the two badges via th:if. -->
|
||||
<thlogic>
|
||||
<!-- "Contact page" card: exactly one of the two blocks shows, gated on the live install status. The install
|
||||
form's action is the constant /contact/install-page in the static markup (no th:action: the restricted
|
||||
URL/attr context forbids ${@bean}); the live path is bound with th:text (which permits @bean). The hidden
|
||||
field carries the console session's CSRF token (the request attribute _csrf, never a bean), which the
|
||||
kernel's tenant chain demands on this non-anonymous POST. -->
|
||||
<attr sel="#cp-title" th:text="#{contact.page.card.title}"/>
|
||||
<attr sel="#cp-install" th:if="${!@contactAdminModel.pageInstalled(tenantSiteId)}"/>
|
||||
<attr sel="#cp-desc" th:text="#{contact.page.card.desc}"/>
|
||||
<attr sel="#cp-csrf"
|
||||
th:attr="name=${_csrf != null ? _csrf.parameterName : '_csrf'},value=${_csrf != null ? _csrf.token : ''}"/>
|
||||
<attr sel="#cp-install-btn" th:title="#{contact.page.card.install.tip}"/>
|
||||
<attr sel="#cp-install-label" th:text="#{contact.page.card.install}"/>
|
||||
<attr sel="#cp-installed" th:if="${@contactAdminModel.pageInstalled(tenantSiteId)}"/>
|
||||
<attr sel="#cp-badge" th:text="#{contact.page.card.badge}"/>
|
||||
<attr sel="#cp-at" th:text="#{contact.page.card.at}"/>
|
||||
<attr sel="#cp-path" th:text="${@contactAdminModel.pagePath(tenantSiteId)}"/>
|
||||
<attr sel="#cp-edit" th:text="#{contact.page.card.edit}"/>
|
||||
|
||||
<attr sel="#cn-title" th:text="#{contact.admin.title}"/>
|
||||
<attr sel="#cn-count" th:text="${@contactAdminModel.count(tenantSiteId)}"/>
|
||||
|
||||
<!-- SMTP readiness: exactly one badge; the self-test link's label. -->
|
||||
<attr sel="#cn-smtp-label" th:text="#{contact.admin.smtp}"/>
|
||||
<attr sel="#cn-smtp-ok" th:if="${@contactAdminModel.smtpConfigured(tenantSiteId)}"
|
||||
th:text="#{contact.admin.smtp.ok}"/>
|
||||
<attr sel="#cn-smtp-missing" th:if="${!@contactAdminModel.smtpConfigured(tenantSiteId)}"
|
||||
th:text="#{contact.admin.smtp.missing}"/>
|
||||
<!-- No th:action: the action is the constant /contact/smtp-test already in the static markup, and BOTH
|
||||
th:attr AND the dedicated URL processors (th:href/th:action) evaluate in a RESTRICTED context that forbids
|
||||
${@bean} access (unlike th:text/th:if/th:value) — binding the URL from the bean here would 500 this
|
||||
fragment. The CSRF field reads the _csrf request attribute (not a bean), and the title is a message. -->
|
||||
<attr sel="#cn-csrf"
|
||||
th:attr="name=${_csrf != null ? _csrf.parameterName : '_csrf'},value=${_csrf != null ? _csrf.token : ''}"/>
|
||||
<attr sel="#cn-smtp-test" th:title="#{contact.admin.smtp.test.tip}"/>
|
||||
<attr sel="#cn-smtp-test-label" th:text="#{contact.admin.smtp.test}"/>
|
||||
|
||||
<attr sel="#cn-empty" th:if="${@contactAdminModel.count(tenantSiteId) == 0}" th:text="#{contact.admin.empty}"/>
|
||||
<attr sel="#cn-table" th:if="${@contactAdminModel.count(tenantSiteId) > 0}"/>
|
||||
|
||||
<attr sel="#cn-h-when" th:text="#{contact.admin.when}"/>
|
||||
<attr sel="#cn-h-name" th:text="#{contact.form.name}"/>
|
||||
<attr sel="#cn-h-email" th:text="#{contact.form.email}"/>
|
||||
<attr sel="#cn-h-msg" th:text="#{contact.form.message}"/>
|
||||
|
||||
<attr sel="#cn-row" th:each="s : ${@contactAdminModel.recent(tenantSiteId)}"/>
|
||||
<attr sel="#cn-row//.cn-when" th:text="${s.time()}"/>
|
||||
<attr sel="#cn-row//.cn-name" th:text="${s.name()}"/>
|
||||
<attr sel="#cn-row//.cn-email" th:text="${s.email()}"/>
|
||||
<attr sel="#cn-row//.cn-excerpt" th:text="${s.excerpt()}"/>
|
||||
|
||||
<attr sel="#cn-help-label" th:text="#{contact.admin.help}"/>
|
||||
</thlogic>
|
||||
@@ -0,0 +1,15 @@
|
||||
<!-- Tenant dashboard card fragment — __plugin__/contact/dashboard. Bare fragment; binding in .th.xml. -->
|
||||
<div class="card">
|
||||
<div class="card-status-start bg-teal"></div>
|
||||
<div class="card-body">
|
||||
<div class="d-flex align-items-center">
|
||||
<span class="bg-teal-lt avatar"><i class="fa-solid fa-envelope"></i></span>
|
||||
<div class="ms-3">
|
||||
<div class="fw-bold" id="cd-title">Contact</div>
|
||||
<div class="text-secondary small">
|
||||
<span id="cd-count">0</span> <span id="cd-count-lbl">submissions</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Dashboard card logic. Values from ${@contactAdminModel...(tenantSiteId)}. -->
|
||||
<thlogic>
|
||||
<attr sel="#cd-title" th:text="#{contact.card.title}"/>
|
||||
<attr sel="#cd-count" th:text="${@contactAdminModel.count(tenantSiteId)}"/>
|
||||
<attr sel="#cd-count-lbl" th:text="#{contact.card.submissions}"/>
|
||||
</thlogic>
|
||||
Reference in new issue
Block a user