Skip to content

Instantly share code, notes, and snippets.

@tomdavies
Created August 18, 2016 14:28
Show Gist options
  • Save tomdavies/2b796d54ac2f0c2eae391f2748632c48 to your computer and use it in GitHub Desktop.
Save tomdavies/2b796d54ac2f0c2eae391f2748632c48 to your computer and use it in GitHub Desktop.
application form
<div class="island island--light">
<div class="wrapper">
<div class="cell-v30">
<div class="g">
<div class="g__col
g__col--12
g__col--7--medium g__col--center--medium">
<div class="island cell-40 rule rule--all rule--grey">
{% include '_includes/body' %}
</div>
</div>
</div>
</div>
</div>
</div>
{% import "_includes/forms" as forms %}
{% macro applicationField(config) %}
{% set config = config | merge({'name': 'fields[' ~ config.id ~ ']'})%}
{% set incType = (config.incType is defined) ? config.incType : 'text' %}
{% if config.entry is not null %}
{% if (config.entry.getError(config.id) is not null) %}
{% set error = config.entry.getError(config.id) %}
{% endif %}
{% if (config.entry[config.id] is defined) and incType != 'checkbox' %}
{% set config = config | merge({'value': config.entry[config.id] })%}
{% endif %}
{% elseif config.defaultValue ?? false %}
{% set config = config | merge({'value': config.defaultValue })%}
{% endif %}
<div class="control cell-b10 is--{{ incType }} {% if error is defined and error %} has--error {% endif %} {{ config.controlClass|default }}"
{% if config.flowValues is defined %} data-form-flow data-form-flow-values="{{ config.flowValues }}" {% endif %}
{% spaceless %}
{{ (config.disabled is defined and config.disabled) ? 'disabled' }}
{% for d in config.dataAttrs|default %} {{ d.attr }}="{{ d.value }}"{% endfor %}
{% endspaceless %}>
{% if incType != 'checkbox' %}
{% if incType == 'radioGroup' or incType == 'checkboxGroup' %}
<p class="label">{{ config.label }} {% if config.required | default(false) %}<b class="u-text-color--pink">(required)</b>{% endif %}</p>
{% else %}
<label for="{{ config.id }}" class="label">{{ config.label }} {% if config.required | default(false) %}<b class="u-text-color--pink">(required)</b>{% endif %}</label>
{% endif %}
{% endif %}
{% if config.wrapperClass is defined %}
<div class="{{ config.wrapperClass }}">
{% endif %}
{% include "_includes/forms/" ~ incType with config only %}
{% if config.wrapperClass is defined %}
</div>
{% endif %}
{% if error is defined and error %}
<label for="{{ config.id }}" class="error">{{ config.entry.getError(config.id) }}</label>
{% endif %}
</div>
{% endmacro %}
{% macro applicationBooleanField(config, entry) %}
{% set config = config | merge({
incType: 'radioGroup',
options: [
{label: 'Yes', value: 'yes', id: config.id ~ '_Yes'},
{label: 'No', value: 'no', id: config.id ~ '_No'},
]
})%}
{{ _self.applicationField(config) }}
{% endmacro %}
<div class="island island--xlight">
<div class="wrapper">
<div class="cell-v30">
<div class="g">
<div class="g__col g__col--12
g__col--10--medium g__col--center--medium
g__col--7--large">
{# Manual breadcrumb as entry is defined on submit #}
<nav class="m-breadcrumb" aria-label="You are here:">
<ol>
<li class="m-breadcrumb__item m-breadcrumb__item--home">
<a href="/">
<b class="icon icon--home icon--mid icon--mini" data-grunticon-embed aria-hidden="true" role="presentation"></b>
Home
</a>
</li>
<li class="m-breadcrumb__item m-breadcrumb__item--current">
<b class="icon icon--angle-right icon--mid icon--mini" data-grunticon-embed aria-hidden="true" role="presentation"></b>
<span class="is--hidden">Current: </span>
Apply
</li>
</ol>
</nav>
<form method="post" action="" accept-charset="UTF-8" class="form" novalidate>
{# {{ getCsrfInput() }} #}
<input type="hidden" name="action" value="guestEntries/saveEntry">
<input type="hidden" name="redirect" value="apply/thanks">
<input type="hidden" name="sectionId" value="23">
<input type="hidden" name="postDate" value="{{ now|date("Y-m-j H:i:s") }}">
<input type="hidden" name="title" value="New application">
{% if entry is defined %}
<div class="wrapper">
<div class="error">
There was an issue with your application, please check the highlighted fields below.
</div>
</div>
{% endif %}
<fieldset>
<legend class="legend--large">Personal details</legend>
{# TITLE #}
{% set titleOptions = defaultOption | merge(craft.fields.getFieldbyHandle('applicationTitle').settings.options) %}
{{ _self.applicationField( {
label: 'Title',
id: 'applicationTitle',
incType: 'select',
wrapperClass: 'select__wrapper',
options: titleOptions,
hasIcon: true,
required: true,
entry: (entry is defined) ? entry : null
}) }}
{# FIRST NAME #}
{{ _self.applicationField( {
label: 'First name',
id: 'applicationFirstName',
class: 'input',
required: true,
entry: (entry is defined) ? entry : null
}) }}
{# SURNAME #}
{{ _self.applicationField( {
label: 'Surname',
id: 'applicationSurname',
class: 'input',
required: true,
entry: (entry is defined) ? entry : null
}) }}
{# DOB #}
{{ _self.applicationField( {
label: 'Date of Birth',
id: 'applicationDateOfBirth',
incType: 'date',
placeholder: 'e.g. 14/04/2000',
required: true,
entry: (entry is defined) ? entry : null
}) }}
{# ADDRESS #}
{{ _self.applicationField( {
label: 'Address',
id: 'applicationAddress',
incType: 'textarea',
class: 'input',
required: true,
entry: (entry is defined) ? entry : null
}) }}
{# POSTCODE #}
{{ _self.applicationField( {
label: 'Postcode',
id: 'applicationPostcode',
class: 'input',
required: true,
entry: (entry is defined) ? entry : null
}) }}
{# EMAIL ADDRESS #}
{{ _self.applicationField( {
label: 'Email address',
id: 'applicationEmailAddress',
type: 'email',
class: 'input',
required: true,
entry: (entry is defined) ? entry : null
}) }}
{# CONTACT NUMBER #}
{{ _self.applicationField( {
label: 'Contact Number',
id: 'applicationContactNumber',
class: 'input',
placeholder: 'Enter a landline or mobile number',
required: true,
entry: (entry is defined) ? entry : null
}) }}
{# PARENT/CARER CONTACT NUMBER #}
{{ _self.applicationField( {
label: 'Parent/Carer contact number (if applicant under 18)',
id: 'applicationParentCarerContactNumber',
class: 'input',
entry: (entry is defined) ? entry : null,
}) }}
{# LIVED IN EU #}
{{ _self.applicationBooleanField( {
label: 'Have you lived in the UK or other EU Country for the whole of the last 3 years?',
id: 'applicationLivedEU',
required: true,
entry: (entry is defined) ? entry : null
}) }}
{# EU NATIONAL #}
{{ _self.applicationBooleanField( {
label: 'Are you a British or EU National?',
id: 'applicationEUNational',
required: true,
entry: (entry is defined) ? entry : null
}) }}
{# NATIONALITY #}
{{ _self.applicationField( {
label: 'If not, please state your nationality',
id: 'applicationNationality',
class: 'input',
entry: (entry is defined) ? entry : null,
}) }}
</fieldset>
<fieldset>
<legend class="legend--large">Special conditions</legend>
<p class="label u-text-size--xsmall"><strong>Please note: A fee assessment may be required and Home Office papers may be requested.</strong></p>
{# ASYLUM SEEKER #}
{{ _self.applicationBooleanField( {
label: 'Are you an Asylum Seeker?',
id: 'applicationAsylumSeeker',
required: true,
entry: (entry is defined) ? entry : null
}) }}
{# REFUGEE STATUS #}
{{ _self.applicationBooleanField( {
label: 'Do you have Refugee status',
id: 'applicationRefugeeStatus',
required: true,
entry: (entry is defined) ? entry : null
}) }}
{# MEDICAL CONDITION #}
{{ _self.applicationBooleanField( {
label: 'Do you have any health or medical condition that we should be aware of?',
id: 'applicationMedicalCondition',
required: true,
entry: (entry is defined) ? entry : null
}) }}
{# MEDICAL CONDITION DETAILS #}
{{ _self.applicationField( {
label: 'If yes, please state',
id: 'applicationMedicalConditionDetails',
class: 'input',
entry: (entry is defined) ? entry : null,
}) }}
{# MEDICAL CONDITION SUPPORT #}
{{ _self.applicationBooleanField( {
label: 'If so do you require support for this need?',
id: 'applicationMedicalConditionSupport',
entry: (entry is defined) ? entry : null
}) }}
{# LEARNING NEEDS #}
{{ _self.applicationBooleanField( {
label: 'Do you have any learning needs?',
id: 'applicationLearningNeeds',
required: true,
entry: (entry is defined) ? entry : null
}) }}
{# LEARNING NEEDS DETAILS #}
{{ _self.applicationField( {
label: 'If yes, please state',
id: 'applicationLearningNeedsDetails',
class: 'input',
entry: (entry is defined) ? entry : null,
}) }}
{# LEARNING NEEDS SUPPORT #}
{{ _self.applicationBooleanField( {
label: 'If so, do you require support for this need?',
id: 'applicationLearningNeedsSupport',
entry: (entry is defined) ? entry : null
}) }}
{# LEARNING NEEDS SUPPORT RECEIVED #}
{{ _self.applicationField( {
label: 'If you have received support for this need, please give the name and contact details of the person(s) who has supported you?',
id: 'applicationLearningNeedsSupporterContact',
incType: 'textarea',
class: 'input',
entry: (entry is defined) ? entry : null
}) }}
{# IN CARE #}
{{ _self.applicationBooleanField( {
label: 'Are you in care of the local authority or with the leaving care team?',
id: 'applicationInCare',
required: true,
entry: (entry is defined) ? entry : null
}) }}
{# ORDERS #}
{{ _self.applicationBooleanField( {
label: 'Are you currently on any orders, eg SOPO, ASBO?',
id: 'applicationOrders',
required: true,
entry: (entry is defined) ? entry : null
}) }}
{# CONVICTIONS ETC #}
{{ _self.applicationBooleanField( {
label: 'Have you any unspent criminal convictions or are you currently on probation or serving a non-custodial sentence or awaiting any court cases?',
id: 'applicationConvictions',
required: true,
entry: (entry is defined) ? entry : null
}) }}
<p class="label u-text-size--xsmall"><strong>Please note: If yes, you will be contacted to discuss any issues or support required.</strong></p>
</fieldset>
<fieldset>
<legend class="legend--large">Education history</legend>
{# IN EDUCATION #}
{{ _self.applicationBooleanField( {
label: 'Have you been in education, either at school or college within the last three years or are you still in education?',
id: 'applicationInEducation',
required: true,
entry: (entry is defined) ? entry : null
}) }}
{# LEARNING NEEDS DETAILS #}
{{ _self.applicationField( {
label: 'If yes, please state your most recent school/college',
id: 'applicationRecentSchool',
class: 'input',
entry: (entry is defined) ? entry : null,
}) }}
{# CONVICTIONS ETC #}
{{ _self.applicationBooleanField( {
label: 'Would you like to apply for one of the programmes with the Sports Academy?',
id: 'applicationSportsAcademy',
required: true,
entry: (entry is defined) ? entry : null
}) }}
</fieldset>
<fieldset>
<legend class="legend--large">What do you want to study?</legend>
{% set studyOptions = defaultOption %}
{% set feCat = craft.categories.title('FE').first %}
{% for opt in craft.entries.section('subjectAreas').relatedTo(feCat).order('title asc') %}
{% set studyOptions = studyOptions | merge([{label: opt.title, value: opt.id}]) %}
{% endfor %}
{# FIRST CHOICE #}
{{ _self.applicationField( {
label: 'What would you like to Study (1st Choice)?',
id: 'applicationSubject1',
incType: 'select',
wrapperClass: 'select__wrapper',
options: studyOptions,
hasIcon: true,
required: true,
entry: (entry is defined) ? entry : null,
dataAttrs: [
{attr: "data-chain", value: ""},
{attr: "data-chain-endpoint", value: "/subject-area-courses/"},
{attr: "data-chain-suffix", value: ".json"},
{attr: "data-chain-target", value: "#applicationCourse1"},
]
}) }}
<div class="is--hidden" data-form-flow data-form-flow-values="{{ { '#applicationSubject1': 'any'} | json_encode }}">
{{ _self.applicationField( {
label: 'Course',
id: 'applicationCourse1',
incType: 'select',
wrapperClass: 'select__wrapper',
options: defaultOption,
hasIcon: true,
required: true,
entry: (entry is defined) ? entry : null,
dataAttrs: [
{attr: "data-chain", value: ""},
{attr: "data-chain-endpoint", value: "/course-occurrences/"},
{attr: "data-chain-suffix", value: ".json"},
{attr: "data-chain-target", value: "#applicationOccurrence1"},
],
}) }}
{{ _self.applicationField( {
label: 'Course location & date',
id: 'applicationOccurrence1',
incType: 'select',
wrapperClass: 'select__wrapper',
controlClass: 'is--hidden',
options: defaultOption,
hasIcon: true,
required: true,
entry: (entry is defined) ? entry : null,
flowValues: '{ "#applicationCourse1": "any" }'
}) }}
</div><!--//[data-form-flow]-->
{# SECOND CHOICE #}
{{ _self.applicationField( {
label: 'What would you like to Study (2nd Choice)?',
id: 'applicationSubject2',
incType: 'select',
wrapperClass: 'select__wrapper',
options: studyOptions,
hasIcon: true,
required: true,
entry: (entry is defined) ? entry : null,
dataAttrs: [
{attr: "data-chain", value: ""},
{attr: "data-chain-endpoint", value: "/subject-area-courses/"},
{attr: "data-chain-suffix", value: ".json"},
{attr: "data-chain-target", value: "#applicationCourse2"},
]
}) }}
<div class="is--hidden" data-form-flow data-form-flow-values="{{ { '#applicationSubject2': 'any'} | json_encode }}">
{{ _self.applicationField( {
label: 'Course',
id: 'applicationCourse2',
incType: 'select',
wrapperClass: 'select__wrapper',
options: defaultOption,
hasIcon: true,
required: true,
entry: (entry is defined) ? entry : null,
dataAttrs: [
{attr: "data-chain", value: ""},
{attr: "data-chain-endpoint", value: "/course-occurrences/"},
{attr: "data-chain-suffix", value: ".json"},
{attr: "data-chain-target", value: "#applicationOccurrence2"},
],
}) }}
{{ _self.applicationField( {
label: 'Course location & date',
id: 'applicationOccurrence2',
incType: 'select',
wrapperClass: 'select__wrapper',
controlClass: 'is--hidden',
options: defaultOption,
hasIcon: true,
required: true,
entry: (entry is defined) ? entry : null,
flowValues: '{ "#applicationCourse2": "any" }'
}) }}
</div><!--//[data-form-flow]-->
{# ALSO INTERESTED IN #}
{{ _self.applicationField( {
label: 'I am also interested in (if applicable)',
id: 'applicationAlsoInterested',
class: 'input',
entry: (entry is defined) ? entry : null,
}) }}
{# ALSO INTERESTED IN #}
{{ _self.applicationField( {
label: 'I am not sure what I would like to study',
id: 'applicationSubjectUnsure',
incType: 'checkbox',
entry: (entry is defined) ? entry : null,
checked: (entry is defined and entry.applicationSubjectUnsure)
}) }}
</fieldset>
<fieldset>
<legend class="legend--large">Achieved or predicted qualifications</legend>
<p class="label u-text-size--xsmall">Please list all qualifications below including non UK.</p>
<p class="label u-text-size--xsmall"><strong>Still at school?</strong><br>
Please insert your predicted grades if you haven&rsquo;t taken your exams or got your results yet.</p>
{# QUALIFICATIONS #}
<div class="cell-b20">
<table class="table m-qualifications">
<thead>
<tr>
<th>Qualification e.g: GCSEs, BTECs, A Levels, others</th>
<th>Subject</th>
<th>Grade Predicted</th>
<th>Grade Achieved</th>
<th>Year</th>
</tr>
</thead>
<tbody id="qualifications">
{% set noOfQualRows = (craft.request.getPost('fields.applicationQualifications') | length > 1) ? craft.request.getPost('fields.applicationQualifications') | length : 1 %}
{% for i in 1..noOfQualRows %}
<tr>
<td>
<input type="hidden" name="fields[applicationQualifications][new{{ i }}][type]" value="qualification" id="type_{{ i }}" data-persist-value="true">
<label for="qualification_1" class="table__header">Qualification e.g: GCSEs, BTECs, A Levels, others</label>
<input type="text" name="fields[applicationQualifications][new{{ i }}][fields][qualificationType]" class="input" id="qualification_{{ i }}"
{%- if entry is defined %} value="{{ craft.request.getPost('fields.applicationQualifications.new' ~ i ~ '.fields.qualificationType') }}"{% endif -%}>
</td>
<td>
<label for="subject_{{ i }}" class="table__header">Subject</label>
<input type="text" name="fields[applicationQualifications][new{{ i }}][fields][subject]" class="input" id="subject_{{ i }}"
{%- if entry is defined %} value="{{ craft.request.getPost('fields.applicationQualifications.new' ~ i ~ '.fields.subject') }}"{% endif -%}>
</td>
<td>
<label for="gradePredicted_{{ i }}" class="table__header">Grade Predicted</label>
<input type="text" name="fields[applicationQualifications][new{{ i }}][fields][gradePredicted]" class="input" id="gradePredicted_{{ i }}"
{%- if entry is defined %} value="{{ craft.request.getPost('fields.applicationQualifications.new' ~ i ~ '.fields.gradePredicted') }}"{% endif -%}>
</td>
<td>
<label for="gradeAchieved_{{ i }}" class="table__header">Grade Achieved</label>
<input type="text" name="fields[applicationQualifications][new{{ i }}][fields][gradeAchieved]" class="input" id="gradeAchieved_{{ i }}"
{%- if entry is defined %} value="{{ craft.request.getPost('fields.applicationQualifications.new' ~ i ~ '.fields.gradeAchieved') }}"{% endif -%}>
</td>
<td>
<label for="year_{{ i }}" class="table__header">Year</label>
<input type="text" name="fields[applicationQualifications][new{{ i }}][fields][year]" class="input" id="year_{{ i }}"
{%- if entry is defined %} value="{{ craft.request.getPost('fields.applicationQualifications.new' ~ i ~ '.fields.year') }}"{% endif -%}>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<a href="#" class="btn btn--block" data-add-row data-target="#qualifications">Add another row</a>
</div>
{# NO FORMAL QUALIFICATIONS #}
{{ _self.applicationField( {
label: 'I have no formal qualifications',
id: 'applicationNoFormalQualifications',
incType: 'checkbox',
value: 1,
entry: (entry is defined) ? entry : null,
checked: (entry is defined and entry.applicationNoFormalQualifications)
}) }}
</fieldset>
<fieldset>
<legend class="legend--large">Further information</legend>
{# REFERRER #}
{% set referrerOptions = craft.fields.getFieldbyHandle('applicationReferrer').settings.options %}
{{ _self.applicationField( {
label: 'How did you find out about the college?',
id: 'applicationReferrer',
incType: 'checkboxGroup',
options: referrerOptions,
entry: (entry is defined) ? entry : null,
values: (entry is defined) ? entry['applicationReferrer']
}) }}
{# REFERRER OTHER #}
{{ _self.applicationField( {
label: 'Other - please specify',
id: 'applicationReferrerOther',
class: 'input',
entry: (entry is defined) ? entry : null,
}) }}
</fieldset>
<fieldset>
<legend class="legend--large">Declaration</legend>
<p class="label u-text-size--xsmall"><strong>Central College Nottingham positively welcomes students from all communities. Our equality and diversity policy is designed to ensure everyone is treated with respect, irrespective of race, gender, disability, sexual orientation, age or social class.</strong></p>
<p class="label u-text-size--xsmall"><strong>The information given on this form is covered by the Data Protection Act and may be used for statistical purposes. It will be passed onto Futures, Government and Funding agencies but no other third party.</strong></p>
<p class="label u-text-size--xsmall"><strong>We will also use this information to keep you up to date about the College, if you do not wish to receive this information please send an email to <a href="mailto:unsubscribe@centralnottingham.ac.uk">unsubscribe@centralnottingham.ac.uk</a>.</strong></p>
{# DECLARATION #}
<div class="cell-t20">
{{ _self.applicationField( {
label: 'By ticking this box I declare that the information given on this form is correct',
id: 'applicationDeclaration',
incType: 'checkbox',
required: true,
entry: (entry is defined) ? entry : null,
checked: (entry is defined and entry.applicationDeclaration),
excludeUnchecked: true,
}) }}
</div>
<p class="label u-text-size--xsmall"><strong>Once you click submit, your application form will be sent to our admissions department and a copy sent for your records to the email address you have provided on this form. Please double check your email address is correct before submitting.</strong></p>
</fieldset>
<div class="wrapper cell-t40">
<input type="submit" value="Submit application" class="btn btn--pink btn--block">
</div>
</form>
</div>
</div>
</div>
</div><!--//.wrapper-->
</div><!--//.island-->
{% extends '_layouts/application' %}
{% block content %}
{% include '_includes/hero' with {hero: entry.hero} only %}
{% if siteSettings.enableApplications == true %}
{% include 'apply/_form' %}
{% else %}
{% include 'apply/_disabled' %}
{% endif %}
{% endblock %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment