google-nomulus/java/google/registry/ui/soy/registrar/Contact.soy
mcilwain b5fb62c984 Change all foreach loops in Soy templates to use the for loop syntax
This also updates to a newer version of Closure Rules and fixes a protobuf dep
compile issue.

Full description of the change:

Soy supports 2 kinds of loops:
* foreach- for iterating over items in a collection, e.g.
  {foreach $item in $list}...{/foreach}
* for - for indexed iteration, e.g. {for $i in range(0, 10)}...{/for}

The reason Soy has two different loops is an accident of history; Soy didn’t use
to have a proper grammar for expressions and so the alternate ‘for...range’
syntax was added to make it possible to write indexed loops.  As the grammar has
improved having the two syntaxes is no longer necessary and so we are
eliminating one of them.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=182843207
2018-01-23 16:16:53 -05:00

177 lines
6.2 KiB
Text

// Copyright 2017 The Nomulus Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
{namespace registry.soy.registrar.contact}
/**
* Set view for contacts.
*/
{template .set}
<div class="{css('set')} {css('contact')}">
<p>Please enter a query for a single contact in the form "contact/[contact id]".
</div>
{/template}
/**
* Item view for contact.
* @param? item
* @param? readonly passed through to field rendering.
*/
{template .item}
<form name="item" class="{css('item')} {css('contact')}">
<h1>
{if isNonnull($item['contact:id'])}
{$item['contact:id']['keyValue']}
{else}
New Contact
{/if}
</h1>
<table>
<tr class="{css('section-lead')}">
<th colspan="2"><h2>Authentication</h2></th>
</tr>
{if not isNonnull($item['contact:id'])}
{call registry.soy.forms.inputFieldRow data="all"}
{param label: 'Contact ID *' /}
{param name: 'contact:id' /}
{/call}
{/if}
{call registry.soy.forms.inputFieldRowWithValue data="all"}
{param label: 'Password *' /}
{param name: 'contact:authInfo.contact:pw' /}
{param value: isNonnull($item['contact:authInfo']) ?
$item['contact:authInfo']['contact:pw'] : '' /}
{/call}
<tr class="{css('section-lead')}">
<th colspan="2"><h2>Contacts</h2></th>
</tr>
{call registry.soy.forms.inputFieldRowWithValue data="all"}
{param label: 'Email *' /}
{param name: 'contact:email' /}
{param value: $item['contact:email'] /}
{/call}
{call registry.soy.forms.inputFieldRowWithValue data="all"}
{param label: 'Phone' /}
{param name: 'contact:voice' /}
{param value: $item['contact:voice'] /}
{param placeholder: 'e.g. +1.6508675309' /}
{/call}
{call registry.soy.forms.inputFieldRowWithValue data="all"}
{param label: 'Fax' /}
{param name: 'contact:fax' /}
{param value: $item['contact:fax'] /}
{param placeholder: 'e.g. +1.2125552638' /}
{/call}
<tr class="{css('section-lead')} {css('subsection')}">
<th id="contact-postalInfoHeader" colspan="2">
<h3>Postal address(es)</h3>
<button id="domain-contact-postalInfo-add-button" type="button"
class="{css('kd-button')} {css('reg-add')}"
{if $readonly}disabled{/if}>
Add Localized Address
</button>
</th>
</tr>
<tr>
<td colspan="2">
<div id="contact-postalInfo">
{if isNonnull($item['contact:postalInfo'])}
{for $pi in $item['contact:postalInfo']}
{call .postalInfo data="all"}
{param localized: index($pi) == 1 /}
{param item: $pi/}
{param namePrefix: 'contact:postalInfo[' + index($pi) + '].contact:' /}
{/call}
{/for}
{else}
{call .postalInfo data="all"}
{param namePrefix: 'contact:postalInfo[0].contact:' /}
{/call}
{/if}
<table id="domain-contact-postalInfos-footer"></table>
</div>
</td>
</tr>
</table>
{if isNonnull($item['contact:id'])}
<input type="hidden" name="contact:id" value="{$item['contact:id']['keyValue']}"/>
{/if}
</form>
{/template}
/**
* Postal info.
* @param item
* @param namePrefix
* @param? localized if true, this is the second, localized postalInfo.
*/
{template .postalInfo}
<table>
<tr><th colspan=2>
{if $localized}
<strong>Localized address</strong><br>
<span class="{css('info')}">Full UTF-8 charsets allowed</span>
{else}
<strong>Internationalized address</strong><br>
<span class="{css('info')}">Only 7-bit ASCII allowed</span>
{/if}
</th></tr>
{call registry.soy.forms.inputFieldRowWithValue data="all"}
{param label: 'Name *' /}
{param name: 'name' /}
{param value: $item['contact:name']/}
{/call}
{call registry.soy.forms.inputFieldRowWithValue data="all"}
{param label: 'Organization' /}
{param name: 'org' /}
{param value: $item['contact:org'] /}
{/call}
{call registry.soy.forms.textareaFieldRowWithValue data="all"}
{param label: 'Street' /}
{param name: 'street' /}
{param namePrefix: $namePrefix + 'addr.contact:' /}
{param value: isNonnull($item['contact:addr']) ? $item['contact:addr']['contact:street'] : '' /}
{/call}
{call registry.soy.forms.inputFieldRowWithValue data="all"}
{param label: 'City *' /}
{param name: 'city' /}
{param namePrefix: $namePrefix + 'addr.contact:' /}
{param value: isNonnull($item['contact:addr']) ? $item['contact:addr']['contact:city'] : '' /}
{/call}
{call registry.soy.forms.inputFieldRowWithValue data="all"}
{param label: 'State / Region' /}
{param name: 'sp' /}
{param namePrefix: $namePrefix + 'addr.contact:' /}
{param value: isNonnull($item['contact:addr']) ? $item['contact:addr']['contact:sp'] : '' /}
{param placeholder: 'e.g. CA' /}
{/call}
{call registry.soy.forms.inputFieldRowWithValue data="all"}
{param label: 'Zip / Postal code' /}
{param name: 'pc' /}
{param namePrefix: $namePrefix + 'addr.contact:' /}
{param value: isNonnull($item['contact:addr']) ? $item['contact:addr']['contact:pc'] : '' /}
{param placeholder: 'e.g. 10282' /}
{/call}
{call registry.soy.forms.inputFieldRowWithValue data="all"}
{param label: 'Country code *' /}
{param name: 'cc' /}
{param namePrefix: $namePrefix + 'addr.contact:' /}
{param value: isNonnull($item['contact:addr']) ? $item['contact:addr']['contact:cc'] : '' /}
{param placeholder: 'e.g. US' /}
{/call}
</table>
{/template}