Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
templates: Extract realm creation form html in new template file.
Sahil Batra18744911786b
diff --git a/templates/zerver/realm_creation_form.html b/templates/zerver/realm_creation_form.htmlnew file mode 100644index 00000000000..f335a31e9b4--- /dev/null+++ b/templates/zerver/realm_creation_form.html@@ -0,0 +1,66 @@+<div class="input-box">+ <div class="inline-block relative">+ <input id="id_team_name" class="required" type="text"+ placeholder="Acme or Ακμή"+ value="{% if form.realm_name.value() %}{{ form.realm_name.value() }}{% endif %}"+ name="realm_name" maxlength="{{ MAX_REALM_NAME_LENGTH }}" required />+ </div>+ <label for="id_team_name" class="inline-block label-title">{{ _('Organization name') }}</label>+ {% if form.realm_name.errors %}+ {% for error in form.realm_name.errors %}+ <p class="help-inline text-error">{{ error }}</p>+ {% endfor %}+ {% endif %}++ <div class="help-text">+ {{ _('Shorter is better than longer.') }}+ </div>+</div>++<div class="input-box">+ <div class="inline-block relative">+ <select name="realm_type" id="realm_type">+ {% for realm_type in sorted_realm_types %}+ {% if not realm_type.hidden %}+ <option value="{{ realm_type.id }}">{{ _(realm_type.name) }}</option>+ {% endif %}+ {% endfor %}+ </select>+ </div>++ <label for="realm_type" class="inline-block label-title">{{ _('Organization type') }}</label>+</div>++<div class="input-box">+ <label class="static org-url">+ {{ _('Organization URL') }}+ </label>+ {% if root_domain_available %}+ <label class="checkbox static" for="realm_in_root_domain">+ <input type="checkbox" name="realm_in_root_domain" id="realm_in_root_domain"+ {% if not form.realm_subdomain.value() and not form.realm_subdomain.errors %}checked="checked"{% endif %}/>+ <span></span>+ {% trans %}Use {{ external_host }}{% endtrans %}+ </label>+ {% endif %}++ <div id="subdomain_section" {% if root_domain_available and+ not form.realm_subdomain.errors and not form.realm_subdomain.value() %}style="display: none;"{% endif %}>+ <div class="or"><span>{{ _('OR') }}</span></div>+ <div class="inline-block relative">+ <input id="id_team_subdomain"+ class="{% if root_domain_landing_page %}required{% endif %} subdomain" type="text"+ placeholder="acme"+ value="{% if form.realm_subdomain.value() %}{{ form.realm_subdomain.value() }}{% endif %}"+ name="realm_subdomain" maxlength="{{ MAX_REALM_SUBDOMAIN_LENGTH }}"+ {% if root_domain_landing_page %}required{% endif %} />+ <label for="id_team_subdomain" class="realm_subdomain_label">.{{ external_host }}</label>+ <p id="id_team_subdomain_error_client" class="error help-inline text-error"></p>+ </div>+ {% if form.realm_subdomain.errors %}+ {% for error in form.realm_subdomain.errors %}+ <p class="error help-inline text-error team_subdomain_error_server">{{ error }}</p>+ {% endfor %}+ {% endif %}+ </div>+</div>diff --git a/templates/zerver/register.html b/templates/zerver/register.htmlindex fcec3374d04..11aaa25f8ba 100644--- a/templates/zerver/register.html+++ b/templates/zerver/register.html@@ -34,72 +34,7 @@ Form is validated both client-side using jquery-validation (see signup.js) and s<fieldset class="org-registration">{% if creating_new_realm %}<legend>{{ _('Your organization') }}</legend>- <div class="input-box">- <div class="inline-block relative">- <input id="id_team_name" class="required" type="text"- placeholder="Acme or Ακμή"- value="{% if form.realm_name.value() %}{{ form.realm_name.value() }}{% endif %}"- name="realm_name" maxlength="{{ MAX_REALM_NAME_LENGTH }}" required />- </div>- <label for="id_team_name" class="inline-block label-title">{{ _('Organization name') }}</label>- {% if form.realm_name.errors %}- {% for error in form.realm_name.errors %}- <p class="help-inline text-error">{{ error }}</p>- {% endfor %}- {% endif %}-- <div class="help-text">- {{ _('Shorter is better than longer.') }}- </div>- </div>-- <div class="input-box">- <div class="inline-block relative">- <select name="realm_type" id="realm_type">- {% for realm_type in sorted_realm_types %}- {% if not realm_type.hidden %}- <option value="{{ realm_type.id }}">{{ _(realm_type.name) }}</option>- {% endif %}- {% endfor %}- </select>- </div>-- <label for="realm_type" class="inline-block label-title">{{ _('Organization type') }}</label>- </div>-- <div class="input-box">- <label class="static org-url">- {{ _('Organization URL') }}- </label>- {% if root_domain_available %}- <label class="checkbox static" for="realm_in_root_domain">- <input type="checkbox" name="realm_in_root_domain" id="realm_in_root_domain"- {% if not form.realm_subdomain.value() and not form.realm_subdomain.errors %}checked="checked"{% endif %}/>- <span></span>- {% trans %}Use {{ external_host }}{% endtrans %}- </label>- {% endif %}-- <div id="subdomain_section" {% if root_domain_available and- not form.realm_subdomain.errors and not form.realm_subdomain.value() %}style="display: none;"{% endif %}>- <div class="or"><span>{{ _('OR') }}</span></div>- <div class="inline-block relative">- <input id="id_team_subdomain"- class="{% if root_domain_landing_page %}required{% endif %} subdomain" type="text"- placeholder="acme"- value="{% if form.realm_subdomain.value() %}{{ form.realm_subdomain.value() }}{% endif %}"- name="realm_subdomain" maxlength="{{ MAX_REALM_SUBDOMAIN_LENGTH }}"- {% if root_domain_landing_page %}required{% endif %} />- <label for="id_team_subdomain" class="realm_subdomain_label">.{{ external_host }}</label>- <p id="id_team_subdomain_error_client" class="error help-inline text-error"></p>- </div>- {% if form.realm_subdomain.errors %}- {% for error in form.realm_subdomain.errors %}- <p class="error help-inline text-error team_subdomain_error_server">{{ error }}</p>- {% endfor %}- {% endif %}- </div>- </div>+ {% include 'zerver/realm_creation_form.html' %}{% endif %}</fieldset>diff --git a/tools/linter_lib/custom_check.py b/tools/linter_lib/custom_check.pyindex 5f4d96b759c..aa02f46d3ad 100644--- a/tools/linter_lib/custom_check.py+++ b/tools/linter_lib/custom_check.py@@ -541,8 +541,8 @@ html_rules: List["Rule"] = ["pattern": r'placeholder="[^{#](?:(?!\.com).)+$',"description": "`placeholder` value should be translatable.","exclude_line": {- ("templates/zerver/register.html", 'placeholder="acme"'),- ("templates/zerver/register.html", 'placeholder="Acme or Ακμή"'),+ ("templates/zerver/realm_creation_form.html", 'placeholder="acme"'),+ ("templates/zerver/realm_creation_form.html", 'placeholder="Acme or Ακμή"'),},"exclude": {"templates/analytics/support.html",