templates: Extract html for new user email address visibility.

This commit extracts html for setting new user email address
visibility in the registration page to a separate file.
This new file will then be used to allow imported users set
email visibility during login without having to duplicate the
code.
This commit is contained in:
Sahil Batra 2023-05-03 19:46:39 +05:30 committed by Tim Abbott
parent ff3233fdf1
commit 8ca060531f
2 changed files with 20 additions and 19 deletions

View File

@ -0,0 +1,19 @@
<p id="new-user-email-address-visibility">
<input type="hidden" name="email_address_visibility" id="email_address_visibility"/>
<span class="current-selected-option">
{% if default_email_address_visibility == email_address_visibility_admins_only %}
{% trans %}Administrators of this Zulip organization will be able to see this email address.
{% endtrans %}
{% elif default_email_address_visibility == email_address_visibility_moderators %}
{% trans %}Administrators and moderators of this Zulip organization will be able to see this email address.
{% endtrans %}
{% elif default_email_address_visibility == email_address_visibility_nobody %}
{% trans %}Nobody in this Zulip organization will be able to see this email address.
{% endtrans %}
{% else %}
{% trans %}Other users in this Zulip organization will be able to see this email address.
{% endtrans %}
{% endif %}
</span>
<a target="_blank" class="change_email_address_visibility" rel="noopener noreferrer">{{ _('Change') }}</a>
</p>

View File

@ -76,28 +76,10 @@ Form is validated both client-side using jquery-validation (see signup.js) and s
<div class="input-box no-validation"> <div class="input-box no-validation">
<input type='hidden' name='key' value='{{ key }}' /> <input type='hidden' name='key' value='{{ key }}' />
<input type='hidden' name='timezone' id='timezone'/> <input type='hidden' name='timezone' id='timezone'/>
<input type="hidden" name="email_address_visibility" id="email_address_visibility"/>
<label for="id_email" class="inline-block label-title">{{ _('Email') }}</label> <label for="id_email" class="inline-block label-title">{{ _('Email') }}</label>
<div id="id_email">{{ email }}</div> <div id="id_email">{{ email }}</div>
{% if not creating_new_realm %} {% if not creating_new_realm %}
<p id="new-user-email-address-visibility"> {% include 'zerver/new_user_email_address_visibility.html' %}
<span class="current-selected-option">
{% if default_email_address_visibility == email_address_visibility_admins_only %}
{% trans %}Administrators of this Zulip organization will be able to see this email address.
{% endtrans %}
{% elif default_email_address_visibility == email_address_visibility_moderators %}
{% trans %}Administrators and moderators of this Zulip organization will be able to see this email address.
{% endtrans %}
{% elif default_email_address_visibility == email_address_visibility_nobody %}
{% trans %}Nobody in this Zulip organization will be able to see this email address.
{% endtrans %}
{% else %}
{% trans %}Other users in this Zulip organization will be able to see this email address.
{% endtrans %}
{% endif %}
</span>
<a target="_blank" class="change_email_address_visibility" rel="noopener noreferrer">{{ _('Change') }}</a>
</p>
{% endif %} {% endif %}
</div> </div>