Operator review of the Account page: two sections with two different save buttons, one stuck to the next card and one beside a squeezed hint. - Account: time zone and Email are one form; POST /account/ saves both, nothing unless all of it is valid. /account/email is gone. - Users › account: Name and Email are one form; the rename route also saves the email switches. /settings/users/<id>/email is gone. - The Email section is a plain section now (email_section); its hint sits under the switches, names the zone as the picker does, and links Notifications only for an admin. - apply_email_form leaves a switch the form doesn't carry as it is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
37 lines
2.2 KiB
HTML
37 lines
2.2 KiB
HTML
{# The Email section for one account (milestone 495): its address, and whether
|
||
it gets alert emails and the weekly report. A section of the page's one
|
||
form, saved by that form's Save: the Account page (your own) and an
|
||
account's page in Settings › Users (an admin's view, whose address sits
|
||
with its name). `defaults` is {kind: bool}, the account's role defaults;
|
||
`zone_note` says whose zone the emails' times are in. #}
|
||
{% macro email_section(user, defaults, zone_note, with_address=true, unreachable=false) -%}
|
||
<section class="card form-section" aria-labelledby="email-title" id="email">
|
||
<h2 id="email-title" class="section-title">Email</h2>
|
||
{% if with_address %}
|
||
<div class="field">
|
||
<label class="field-label" for="email-address">Address</label>
|
||
<input class="input" id="email-address" type="email" name="email" maxlength="255" value="{{ user.email }}" required>
|
||
{% if user.auth_source != "local" %}<span class="field-hint">Your sign-in provider set this first; change it if mail doesn't reach it.</span>{% endif %}
|
||
</div>
|
||
{% elif unreachable %}
|
||
<p class="field-hint tone-warn">{{ user.email }} isn't an address mail can reach, so this account gets no email. Set a real one above.</p>
|
||
{% endif %}
|
||
<div class="form-pair">
|
||
{% for kind, label in (("alerts", "Alert emails"), ("report", "Weekly report")) %}
|
||
{% set choice = user["notify_" ~ kind] %}
|
||
<div class="field">
|
||
<label class="field-label" for="email-{{ kind }}">{{ label }}</label>
|
||
<select class="input" id="email-{{ kind }}" name="notify_{{ kind }}">
|
||
<option value=""{% if choice is none %} selected{% endif %}>As for {{ user.role.value }}s ({{ "on" if defaults[kind] else "off" }})</option>
|
||
<option value="on"{% if choice is sameas true %} selected{% endif %}>On</option>
|
||
<option value="off"{% if choice is sameas false %} selected{% endif %}>Off</option>
|
||
</select>
|
||
</div>
|
||
{% endfor %}
|
||
</div>
|
||
<p class="field-hint">Times in these emails are in {{ zone_note }}.
|
||
{% if session.user_role == "admin" %}Each role's default is set in Settings › <a href="/settings/notifications/">Notifications</a>.
|
||
{%- else %}An admin sets each role's default.{% endif %}</p>
|
||
</section>
|
||
{%- endmacro %}
|