Skip to content

Commit

Permalink
Create a date snippet
Browse files Browse the repository at this point in the history
This appears in more than one place, create a snippet to keep both
examples up-to-date.
Also create a date pattern page.
  • Loading branch information
Gemma Leigh committed Dec 1, 2014
1 parent 7ae9ca1 commit bb6f759
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 87 deletions.
4 changes: 2 additions & 2 deletions routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ module.exports = {
});

// Date pattern
app.get('/patterns/form-date', function (req, res) {
res.render('patterns/form_date', {'assetPath' : assetPath });
app.get('/patterns/date', function (req, res) {
res.render('patterns/date', {'assetPath' : assetPath });
});

// Radio and checkbox pattern
Expand Down
24 changes: 1 addition & 23 deletions views/examples/forms.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,29 +46,7 @@ <h1 class="form-title heading-large">
</div>

<!-- Date of birth -->
<div class="form-group">
<fieldset>
<legend class="form-label-bold">Date of birth</legend>

<div class="form-date">
<p class="form-hint">For example, 08 04 2014</p>

<div class="form-group form-group-day">
<label for="dob-day">Day</label>
<input class="form-control" id="dob-day" type="number" pattern="[0-9]*" min="0" max="31">
</div>
<div class="form-group form-group-month">
<label for="dob-month">Month</label>
<input class="form-control" id="dob-month" type="number" pattern="[0-9]*" min="0" max="12">
</div>
<div class="form-group form-group-year">
<label for="dob-year">Year</label>
<input class="form-control" id="dob-year" type="number" pattern="[0-9]*" min="0" max="2014">
</div>
</div>

</fieldset>
</div>
{{> form_date }}

<!-- Primary buttons, secondary links -->
<div class="form-group">
Expand Down
35 changes: 35 additions & 0 deletions views/patterns/date.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

{{<govuk_template}}

{{$cookieMessage}}
{{>cookie_message}}
{{/cookieMessage}}

{{$head}}
{{>head}}
{{/head}}

{{$propositionHeader}}
{{>propositional_navigation}}
{{/propositionHeader}}

{{$headerClass}}with-proposition{{/headerClass}}

{{$content}}
<main id="content" role="main">

<a href="/" class="example-back-link">Back to GOV.UK elements</a>

<h1 class="heading-xlarge">Date test page</h1>

<!-- Date of birth -->
{{> form_date }}

</main><!-- /#content -->
{{/content}}

{{$bodyEnd}}
{{>scripts}}
{{/bodyEnd}}

{{/govuk_template}}
62 changes: 0 additions & 62 deletions views/patterns/form_date.html

This file was deleted.

26 changes: 26 additions & 0 deletions views/snippets/form_date.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<div class="form-group">
<fieldset>
<legend class="form-label-bold">Date of birth</legend>

<div class="form-date">

<p class="form-hint">For example, 08 04 2014</p>

<div class="form-group form-group-day">
<label for="dob-day">Day</label>
<input class="form-control" id="dob-day" type="number" pattern="[0-9]*" min="0" max="31">
</div>

<div class="form-group form-group-month">
<label for="dob-month">Month</label>
<input class="form-control" id="dob-month" type="number" pattern="[0-9]*" min="0" max="12">
</div>

<div class="form-group form-group-year">
<label for="dob-year">Year</label>
<input class="form-control" id="dob-year" type="number" pattern="[0-9]*" min="0" max="2014">
</div>
</div>

</fieldset>
</div>

0 comments on commit bb6f759

Please sign in to comment.