-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #175 from ministryofjustice/ie-fixes
IE fixes
- Loading branch information
Showing
11 changed files
with
188 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,103 @@ | ||
'use strict'; | ||
|
||
window.moj.Modules.SelectionButtonsModule = { | ||
selectedClass: 'selected', | ||
focusedClass: 'focused', | ||
|
||
init: function() { | ||
var $buttons = $("label input[type='radio'], label input[type='checkbox']"), | ||
selectionButtons = new GOVUK.SelectionButtons($buttons); | ||
var self = this, | ||
$buttons = $("label input[type='radio'], label input[type='checkbox']"); | ||
|
||
if($buttons.length) { | ||
self.bindButtonEvents($buttons); | ||
$buttons.filter(':checked').each(function(n, el) { | ||
self.selectElement($(el)); | ||
}); | ||
} | ||
}, | ||
|
||
bindButtonEvents: function($els) { | ||
var self = this; | ||
|
||
$els.on('click', function(e) { | ||
var $el = $(e.target); | ||
|
||
if($el.attr('type') === 'checkbox') { | ||
self.clickCheckbox($el); | ||
} else { | ||
self.clickRadio($el); | ||
} | ||
}).on('focus blur', function(e) { | ||
self.focusBlurElement(e); | ||
}); | ||
}, | ||
|
||
clickCheckbox: function($el) { | ||
var self = this; | ||
|
||
if($el.is(':checked')) { | ||
self.selectElement($el, true); | ||
} else { | ||
self.deselectCheckbox($el); | ||
} | ||
}, | ||
|
||
clickRadio: function($el) { | ||
var self = this, | ||
group = $el.attr('name'); | ||
|
||
self.deselectRadio($('input[name="' + group + '"]')); | ||
self.selectElement($el, true); | ||
}, | ||
|
||
focusBlurElement: function(e) { | ||
var self = this, | ||
$el = $(e.target), | ||
type = e.type; | ||
|
||
if(type === 'focus') { | ||
self.focusElement($el); | ||
} else { | ||
self.blurElement($el); | ||
} | ||
}, | ||
|
||
deselectCheckbox: function($el) { | ||
var self = this; | ||
|
||
$el.closest('label').removeClass(self.selectedClass); | ||
self.focusElement($el); | ||
}, | ||
|
||
deselectRadio: function($els) { | ||
var self = this; | ||
|
||
$els.each(function(n, el) { | ||
var $el = $(el); | ||
|
||
$el.closest('label').removeClass(self.selectedClass); | ||
self.blurElement($el); | ||
}); | ||
}, | ||
|
||
selectElement: function($el, focus) { | ||
var self = this; | ||
|
||
$el.closest('label').addClass(self.selectedClass); | ||
if(focus) { | ||
self.focusElement($el); | ||
} | ||
}, | ||
|
||
focusElement: function($el) { | ||
var self = this; | ||
|
||
$el.closest('label').addClass(self.focusedClass); | ||
}, | ||
|
||
blurElement: function($el) { | ||
var self = this; | ||
|
||
$el.closest('label').removeClass(self.focusedClass); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#content { | ||
margin: 0 auto; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#content { | ||
margin: 0 auto; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,20 @@ | ||
.phase-banner { | ||
@include phase-banner($state: beta); | ||
max-width: 960px; | ||
margin: 0 15px; | ||
max-width: 1020px; | ||
margin: 0 auto; | ||
border-bottom: none; | ||
|
||
@media (min-width: 640px) { | ||
p { | ||
margin: 0 30px; | ||
} | ||
border-bottom: 1px solid $grey-3; | ||
padding-bottom: 10px; | ||
|
||
@media (min-width: 0px) { | ||
margin: 0 15px; | ||
} | ||
|
||
@media (min-width: 1020px) { | ||
margin: 0 auto; | ||
@media (min-width: 640px) { | ||
margin: 0 30px; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
fieldset | ||
legend.visuallyhidden =t('text', scope: @form.i18n_scope) | ||
.form-group class=('error' if @form.errors.any?) | ||
label.form-label for='dob_date_of_birth' | ||
span.visuallyhidden =t('date_of_birth', scope: @form.i18n_scope) | ||
span.hint = t('hint', scope: @form.i18n_scope) | ||
span.error-message#date_of_birth = @form.errors[:date_of_birth].join(' ') if @form.errors[:date_of_birth].any? | ||
= f.text_field :date_of_birth, class: 'form-control' | ||
legend.visuallyhidden =t('text', scope: @form.i18n_scope) | ||
.form-group class=('error' if @form.errors.any?) | ||
label.form-label for='dob_date_of_birth' | ||
span.visuallyhidden =t('date_of_birth', scope: @form.i18n_scope) | ||
span.hint = t('hint', scope: @form.i18n_scope) | ||
span.error-message#date_of_birth = @form.errors[:date_of_birth].join(' ') if @form.errors[:date_of_birth].any? | ||
= f.text_field :date_of_birth, class: 'form-control' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters