Custom Forms

This commit is contained in:
witzig 2017-03-19 13:36:57 +01:00
parent 5332c81739
commit 2e50fbc8ae
67 changed files with 3335 additions and 34834 deletions

View file

@ -0,0 +1,143 @@
{{#each customFields}}
{{#if typeSubsciptionEmail}}
<div class="form-group email">
<label for="email">{{#translate}}Email Address{{/translate}}</label>
{{#if ../isManagePreferences}}
<div class="input-group">
<input type="email" name="email" id="email" placeholder="" value="{{../email}}" readonly>
<div class="input-group-addon"><a href="/subscription/{{../lcid}}/manage-address/{{../cid}}">{{#translate}}want to change it?{{/translate}}</a></div>
</div>
{{else}}
<input type="email" name="email" id="email" placeholder="" value="{{../email}}" required>
{{/if}}
</div>
{{/if}}
{{#if typeFirstName}}
<div class="form-group first-name">
<label for="first-name">{{#translate}}First Name{{/translate}}</label>
<input type="text" name="first-name" id="first-name" placeholder="" value="{{../firstName}}">
</div>
{{/if}}
{{#if typeLastName}}
<div class="form-group last-name">
<label for="last-name">{{#translate}}Last Name{{/translate}}</label>
<input type="text" name="last-name" id="last-name" placeholder="" value="{{../lastName}}">
</div>
{{/if}}
{{#if typeText}}
<div class="form-group text {{column}}">
<label for="{{column}}">{{name}}</label>
<input type="text" name="{{column}}" value="{{value}}">
</div>
{{/if}}
{{#if typeNumber}}
<div class="form-group number {{column}}">
<label for="{{column}}">{{name}}</label>
<input type="number" name="{{column}}" value="{{value}}">
</div>
{{/if}}
{{#if typeWebsite}}
<div class="form-group url {{column}}">
<label for="{{column}}">{{name}}</label>
<input type="url" name="{{column}}" value="{{value}}">
</div>
{{/if}}
{{#if typeLongtext}}
<div class="form-group longtext {{column}}">
<label for="{{column}}">{{name}}</label>
<textarea rows="3" name="{{column}}">{{value}}</textarea>
</div>
{{/if}}
{{#if typeJson}}
<div class="form-group json {{column}}">
<label for="{{column}}">{{name}}</label>
<textarea class="gpg-text" rows="3" name="{{column}}" placeholder="{&quot;data&quot;:&quot;value&quot;}">{{value}}</textarea>
</div>
{{/if}}
{{#if typeGpg}}
<div class="form-group gpg {{column}}">
<label for="{{column}}">{{name}}</label>
{{#if ../hasPubkey}}
<button class="btn-download-pubkey" type="submit" form="download-pubkey">{{#translate}}Download signature verification key{{/translate}}</button>
{{/if}}
<textarea class="form-control gpg-text" rows="4" name="{{column}}" placeholder="{{#translate}}Begins with{{/translate}} &#39;-----BEGIN PGP PUBLIC KEY BLOCK-----&#39;">{{value}}</textarea>
<span class="help-block">
{{#translate}}Insert your GPG public key here to encrypt messages sent to your address{{/translate}} <em>({{#translate}}optional{{/translate}})</em>
</span>
</div>
{{/if}}
{{#if typeDateUs}}
<div class="form-group date fm-date-us {{column}}">
<label for="{{column}}">{{name}}</label>
<input type="text" name="{{column}}" placeholder="MM/DD/YYYY" value="{{value}}">
</div>
{{/if}}
{{#if typeDateEur}}
<div class="form-group date fm-date-eur {{column}}">
<label for="{{column}}">{{name}}</label>
<input type="text" name="{{column}}" placeholder="DD/MM/YYYY" value="{{value}}">
</div>
{{/if}}
{{#if typeBirthdayUs}}
<div class="form-group date fm-birthday-us {{column}}">
<label for="{{column}}">{{name}}</label>
<input type="text" name="{{column}}" placeholder="MM/DD" value="{{value}}">
</div>
{{/if}}
{{#if typeBirthdayEur}}
<div class="form-group date fm-birthday-eur {{column}}">
<label for="{{column}}">{{name}}</label>
<input type="text" name="{{column}}" placeholder="DD/MM" value="{{value}}">
</div>
{{/if}}
{{#if typeDropdown}}
<div class="form-group dropdown {{key}}">
<label for="{{key}}">{{name}}</label>
<select name="{{key}}" class="form-control">
<option value="">
{{#translate}}Select{{/translate}}
</option>
{{#each options}}
<option value="{{column}}" {{#if value}} selected {{/if}}>{{name}}</option>
{{/each}}
</select>
</div>
{{/if}}
{{#if typeRadio}}
<div class="form-group radio {{key}}">
<label for="{{key}}">{{name}}</label>
{{#each options}}
<label class="label-radio">
<input type="radio" name="{{../key}}" value="{{column}}" {{#if value}} checked {{/if}}> {{name}}
</label>
{{/each}}
</div>
{{/if}}
{{#if typeCheckbox}}
<div class="form-group checkbox">
<label>{{name}}</label>
{{#each options}}
<label class="label-checkbox">
<input type="checkbox" name="{{column}}" value="1" {{#if value}} checked {{/if}}> {{name}}
</label>
{{/each}}
</div>
{{/if}}
{{/each}}

View file

@ -0,0 +1,20 @@
{{{flashMessages}}}
{{#if isConfirmNotice}}
<div class="alert alert-warning js-warning" role="alert">
<strong>{{#translate}}Warning!{{/translate}}</strong> {{#translate}}If JavaScript was not enabled then no confirmation message was sent{{/translate}}
</div>
{{/if}}
{{#if needsJsWarning}}
<div class="alert alert-danger js-warning" role="alert">
<strong>{{#translate}}Warning!{{/translate}}</strong>
{{#translate}}JavaScript must be enabled in order for this form to work{{/translate}}
</div>
{{/if}}
<script>
document.querySelectorAll('.js-warning').forEach(function(el) {
el.style.display = 'none';
});
</script>

View file

@ -0,0 +1,22 @@
<form id="main-form" method="post" action="/subscription/{{lcid}}/manage-address">
<input type="hidden" name="_csrf" value="{{csrfToken}}">
<input type="hidden" name="cid" value="{{cid}}">
<div class="form-group">
<label for="email">{{#translate}}Existing Email Address{{/translate}}</label>
<input type="email" name="email" id="email" placeholder="" value="{{email}}" readonly>
</div>
<div class="form-group">
<label for="email-new">{{#translate}}New Email Address{{/translate}}</label>
<input type="email" name="email-new" id="email-new" placeholder="{{#translate}}Your new email address{{/translate}}" value="{{email}}">
</div>
<p>
{{#translate}}You will receive a confirmation request to your new email address that you need to accept before your email is actually changed{{/translate}}
</p>
<button type="submit" style="position: absolute; top: -9999px; left: -9999px;">{{#translate}}Update Email Address{{/translate}}</button>
</form>

View file

@ -0,0 +1,19 @@
{{#if hasPubkey}}
<form method="post" id="download-pubkey" action="/subscription/publickey" style="display: none;">
<input type="hidden" name="_csrf" value="{{csrfToken}}">
<input type="hidden" name="cid" value="{{cid}}">
</form>
{{/if}}
<form id="main-form" method="post" action="/subscription/{{lcid}}/manage">
<input type="hidden" name="_csrf" value="{{csrfToken}}">
<input type="hidden" name="cid" value="{{cid}}">
<input type="hidden" class="tz-detect" name="tz" id="tz" value="{{tz}}">
{{> subscription_custom_fields}}
<button type="submit" style="position: absolute; top: -9999px; left: -9999px;">{{#translate}}Update Profile{{/translate}}</button>
</form>
<script src="/moment/moment.min.js"></script>
<script src="/moment/moment-timezone-with-data.min.js"></script>

View file

@ -0,0 +1,24 @@
{{#if hasPubkey}}
<form method="post" id="download-pubkey" action="/subscription/publickey" style="display: none;">
<input type="hidden" name="_csrf" value="{{csrfToken}}">
<input type="hidden" name="cid" value="{{cid}}">
</form>
{{/if}}
<form id="main-form" method="post" action="/subscription/{{cid}}/subscribe">
<input type="hidden" name="_csrf" value="{{csrfToken}}">
<input type="hidden" class="tz-detect" name="tz" id="tz" value="{{tz}}">
<input type="hidden" name="address" value="">
<input type="hidden" name="sub" id="sub" value="">
{{> subscription_custom_fields}}
<button type="submit" style="position: absolute; top: -9999px; left: -9999px;">{{#translate}}Subscribe to list{{/translate}}</button>
</form>
<script>
document.getElementById('sub').value = new Date().getTime();
</script>
<script src="/moment/moment.min.js"></script>
<script src="/moment/moment-timezone-with-data.min.js"></script>

View file

@ -0,0 +1,20 @@
<form method="post" id="main-form" action="/subscription/{{lcid}}/unsubscribe">
<input type="hidden" name="_csrf" value="{{csrfToken}}">
<input type="hidden" name="campaign" value="{{campaign}}">
<input type="hidden" name="cid" value="{{cid}}">
<div class="form-group">
<label for="email">{{#translate}}Email address{{/translate}}</label>
<input type="email" name="email" id="email" placeholder="" value="{{email}}" autofocus required>
</div>
<button type="submit" style="position: absolute; top: -9999px; left: -9999px;">{{#translate}}Unsubscribe{{/translate}}</button>
</form>
{{#if email}}
{{#if autosubmit}}
<script>
document.getElementById('main-form').submit();
</script>
{{/if}}
{{/if}}