Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Production] Cherry pick accessibility changes #2554

Merged
merged 2 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,36 @@ window.WonInternationalTradeAwardQuestion = init: ->
do maybeDisplayAwardHelp = ->
container = $("[data-container~=#{identifier}]")

conditionFulfilled = false
currentHolder = false
recentWinner = false

rows = container.find("li")

$.each rows, (_idx, row) ->
validations = $.map ["category", "year", "outcome"], (type) ->
validations = $.map ["category", "outcome"], (type) ->
input = $(row).find("select[data-input-value~=#{type}]")
input.val() == container.data("#{type}-value").toString()
if (validations.every(Boolean))
conditionFulfilled = true
return false

helpBlock = container.closest("fieldset").find(".question-block")

if helpBlock
if conditionFulfilled
helpBlock.show()
else
helpBlock.hide()
yearInput = $(row).find("select[data-input-value~=year]")
if yearInput.val() == container.data("year-value").toString()
currentHolder = true
return false
else if yearInput.val() < container.data("year-value").toString() && yearInput.val() > (container.data("year-value")-5).toString()
recentWinner = true
return false

currentHolderHelpBlock = $(".help-block #current-holder")
recentWinnerHelpBlock = $(".help-block #recent-winner")

if currentHolder
currentHolderHelpBlock.removeClass("hide")
recentWinnerHelpBlock.addClass("hide")
else if recentWinner
recentWinnerHelpBlock.removeClass("hide")
currentHolderHelpBlock.addClass("hide")
else
currentHolderHelpBlock.addClass("hide")
recentWinnerHelpBlock.addClass("hide")

$(document).on "change", "[data-container~=#{identifier}] select", ->
maybeDisplayAwardHelp()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ a.govuk-button.govuk-button--secondary.js-button-add.if-no-js-hide href="#" aria
"data-entity" => "award"


.question-block style="display: none;"
.question-block.help-block
.govuk-form-group
p class="govuk-body govuk-!-font-weight-bold"
p class="govuk-body govuk-!-font-weight-bold hide" id="current-holder"
| As you currently hold a King's Award for International Trade, you cannot apply for another Award. You may apply in future years but can only use one year's financial performance from your Award winning application.
p class="govuk-body govuk-!-font-weight-bold hide" id="recent-winner"
| As you currently hold a King's Award in International Trade, you can only apply for the Outstanding Achievement Award (3 years).