Skip to content

Commit

Permalink
Merge pull request #3140 from bitzesty/pb/fix-inline-checkboxes-and-r…
Browse files Browse the repository at this point in the history
…adio-buttons

govuk-toolkit upgrade fixes
  • Loading branch information
phil-l-brockwell authored Nov 12, 2024
2 parents 10e7cf1 + 4919967 commit 592c65c
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ class window.FinancialSummaryTableBase

row.find("td:eq(#{i + 1})").text(value)


renderTableGrowth: () =>
turnoverGrowthRow = @tableGrowth.find("tr[data-type='fs-turnover-growth']")

Expand All @@ -70,11 +69,12 @@ class window.FinancialSummaryTableBase
@showFinancials = false
turnoverGrowthRow.find("td:gt(0)").text("-")
else
presentPercentageValue = @._presentPercentageValue
turnoverValues.each (i, value) ->
if i > 0
previousValue = turnoverValues[i - 1]
growth = ((value - previousValue) / previousValue) * 100
turnoverGrowthRow.find("td:eq(#{i + 1})").text(parseInt(growth).toLocaleString())
turnoverGrowthRow.find("td:eq(#{i + 1})").text(presentPercentageValue(parseInt(growth)).toLocaleString())
else
turnoverGrowthRow.find("td:eq(#{i + 1})").text("-")

Expand All @@ -98,4 +98,8 @@ class window.FinancialSummaryTableBase
lastYear = turnoverValues[turnoverValues.length - 1]
diff = lastYear - firstYear
totalTurnoverGrowth.text(diff.toLocaleString())
totalTurnoverGrowthPercentage.text(parseInt(diff / firstYear * 100).toLocaleString())
totalTurnoverGrowthPercentageValue = @._presentPercentageValue(parseInt(diff / firstYear * 100)).toLocaleString()
totalTurnoverGrowthPercentage.text(totalTurnoverGrowthPercentageValue)

_presentPercentageValue: (value) ->
if isNaN(value) then "-" else value
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,12 @@ class FinancialSummaryTableTrade extends FinancialSummaryTableBase
@showFinancials = false
salesGrowthRow.find("td:gt(0)").text("-")
else
presentPercentageValue = @._presentPercentageValue
salesOverseasValues.each (i, value) ->
if i > 0
previousValue = salesOverseasValues[i - 1]
growth = ((value - previousValue) / previousValue) * 100
salesGrowthRow.find("td:eq(#{i + 1})").text(parseInt(growth).toLocaleString())
growth = presentPercentageValue(parseInt(((value - previousValue) / previousValue) * 100))
salesGrowthRow.find("td:eq(#{i + 1})").text(growth.toLocaleString())
else
salesGrowthRow.find("td:eq(#{i + 1})").text("-")

Expand All @@ -67,13 +68,14 @@ class FinancialSummaryTableTrade extends FinancialSummaryTableBase
@showFinancials = false
salesPercentRow.find("td:gt(0)").text("-")
else
presentPercentageValue = @._presentPercentageValue
salesOverseasValues.each (i, value) ->
if turnoverValues[i] > 0
value = (value / turnoverValues[i] * 100)
value = presentPercentageValue(parseInt(value / turnoverValues[i] * 100))
else
value = "-"

salesPercentRow.find("td:eq(#{i + 1})").text(parseInt(value).toLocaleString())
salesPercentRow.find("td:eq(#{i + 1})").text(value.toLocaleString())

renderTableSummary: () ->
totalOverseasGrowth = @tableSummary.find("td[data-type='fs-overall-overseas-sales-growth']")
Expand All @@ -95,7 +97,8 @@ class FinancialSummaryTableTrade extends FinancialSummaryTableBase
lastYear = overseasSalesValues[overseasSalesValues.length - 1]
diff = lastYear - firstYear
totalOverseasGrowth.text(diff.toLocaleString())
totalOverseasGrowthPercentage.text(parseInt(diff / firstYear * 100).toLocaleString())
totalOverseasGrowthPercentageValue = @._presentPercentageValue(parseInt(diff / firstYear * 100)).toLocaleString()
totalOverseasGrowthPercentage.text(totalOverseasGrowthPercentageValue)

$(document).ready ->
if $(".financial-summary-tables-trade").length > 0
Expand Down
12 changes: 12 additions & 0 deletions app/assets/stylesheets/frontend/forms.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
$black-true: #000;

.govuk-label {
max-width: calc(100% - 84px);
}

legend {
margin: 0 !important;

Expand Down Expand Up @@ -52,6 +56,10 @@ legend.body-font-size {
}
}

.govuk-radios__item .question-context {
margin-left: 44px;
}

.add-collaborator-box .question-context {
@include core-19;
}
Expand Down Expand Up @@ -849,6 +857,10 @@ input[type="file"] {
}
}

.govuk-form-group {
display: grid;
}

.field-with-errors .error,
.smart-answer article .error,
.govuk-form-group--error:not(.js-question-disabled) .errors-container li,
Expand Down
38 changes: 38 additions & 0 deletions app/assets/stylesheets/helpers/_header.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,41 @@
.govuk-header__link--homepage {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
display: inline-block;
font-family: GDS Transport, arial, sans-serif;
font-size: 30px;
font-weight: 700;
line-height: 1;
margin-right: 10px;
}

.govuk-header__logotype-crown {
fill: currentColor;
margin-right: 1px;
position: relative;
top: -1px;
vertical-align: top;
}

.govuk-header__link--service-name {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
display: inline-block;
font-family: GDS Transport, arial, sans-serif;
font-size: 18px;
font-size: 1.125rem;
font-weight: 700;
line-height: 1.1111111111;
margin-bottom: 10px;
}

@media (min-width: 40.0625em) {
.govuk-header__link--service-name {
font-size: 24px;
font-size: 1.5rem;
line-height: 1.25;
}
}

// #global-header {
// .header-wrapper .header-global .site-search {
Expand Down
2 changes: 1 addition & 1 deletion app/views/account/collaborators/index.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ h1.govuk-heading-xl
span.govuk-warning-text__icon aria-hidden="true"
| !
strong.govuk-warning-text__text
span.govuk-warning-text__assistive
span.govuk-visually-hidden
| Warning
| Please check if collaborators' details are up to date.
- else
Expand Down
2 changes: 1 addition & 1 deletion app/views/form_award_eligibilities/_answers.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
- if question != step
- if (final_eligibility_page?(step) && !@already_has_invalid_questions) || answer.present?
.govuk-summary-list__row
dt.govuk-summary-list__key class="govuk-!-width-three-quarters"
dt.govuk-summary-list__key class="govuk-!-width-one-half"
= eligibility.class.label(question).html_safe
- if final_eligibility_page?(step) && !@already_has_invalid_questions && !eligibility.answer_valid?(question, answer)
- @already_has_invalid_questions = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
= y
- if y == 3
' (most recent)
span.js-year-text.hide-if-empty
span.js-year-text.hide-if-empty.govuk-label
span.govuk-body
span.currency-unit
' £
Expand Down
1 change: 1 addition & 0 deletions forms/award_years/v2025/innovation/innovation_step4.rb
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ def innovation_step4
end

options :innovation_part_of, "How would the innovation that forms the basis of this application fit within the overall business?" do
classes "question-context govuk-hint"
ref "D 5"
required
option "it's integral to the whole business", "It's integral to the whole business"
Expand Down

0 comments on commit 592c65c

Please sign in to comment.