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

Staging release #2994

Merged
merged 25 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
5aedd59
updates to latest cf buildpack version
TheDancingClown Jul 1, 2024
67c47b0
Merge pull request #2987 from bitzesty/buildpack
TheDancingClown Jul 2, 2024
ef51217
adds radio buttons to switch award year
TheDancingClown Jul 1, 2024
f744692
Change default scope for form answer index for admins
TheDancingClown Jul 2, 2024
1ab09c8
Fix stylings on award year filter
TheDancingClown Jul 2, 2024
424adb4
Add award year radios for assessors
TheDancingClown Jul 2, 2024
0766c0c
Merge pull request #2988 from bitzesty/applications-filter
TheDancingClown Jul 2, 2024
0aacdf2
upgrade ckeditor
TheDancingClown Jul 2, 2024
2325f41
Upgrade ckeditor to v5
TheDancingClown Jul 2, 2024
2a70ad4
Add financial year question to SD and Mob awards
TheDancingClown Jul 2, 2024
e262381
Merge pull request #2989 from bitzesty/ckeditor
TheDancingClown Jul 2, 2024
825f7e1
Disable version check on ckeditor
TheDancingClown Jul 2, 2024
5b91e16
Merge pull request #2990 from bitzesty/ck
TheDancingClown Jul 2, 2024
7f7c36d
Set value for other radio button to use params
TheDancingClown Jul 2, 2024
d17a117
Display text when user has been deleted in updated column
TheDancingClown Jul 2, 2024
3e00432
Pass search results in params when changing year
TheDancingClown Jul 3, 2024
a0ad480
Apply styles to fix positions
TheDancingClown Jul 3, 2024
8220eb0
Add search query to url
TheDancingClown Jul 3, 2024
dcb3e46
Merge pull request #2991 from bitzesty/filter-qa
TheDancingClown Jul 3, 2024
8348a69
Copy changes to section D
TheDancingClown Jul 3, 2024
2a1d721
Use id instead of class as selector
TheDancingClown Jul 3, 2024
8f65a05
Merge pull request #2992 from bitzesty/financial-year
TheDancingClown Jul 3, 2024
eb427bb
Pass search query if entered but not submitted
TheDancingClown Jul 3, 2024
a41dcc0
Change award year switch to submit form
TheDancingClown Jul 4, 2024
4960b38
Merge pull request #2993 from bitzesty/year-filter-qa-2
TheDancingClown Jul 4, 2024
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
Binary file added app/assets/images/icon-search-white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions app/assets/javascripts/admin/applications-filter.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,27 @@ filterApplicationsDropdowns = () ->
.length
$(this).closest(".applications-filter").find("label[data-value='select_all'] input").prop("checked", unselected is 0)

# On clicking the award year radios
$(document).on "click", ".applications-filter .input__award-years input[type='radio']", (e) ->
e.stopPropagation()
# if other selected, show dropdown of years, otherwise submit form
if $(this).attr('id') == "other"
dropdownWrapper = $(this).closest(".applications-filter").find(".other-years-dropdown")
dropdownWrapper.removeClass("hide")
dropdown = dropdownWrapper.find(".dropdown-toggle")
dropdown.focus().click()
else
selected_year = $(this).val()
$(this).closest(".input__award-years").find("select option[value='#{selected_year}']").attr('selected', true).change()
$(this).closest('form').submit()

# On clicking the award year from the other year dropdown
$(document).on "click", ".applications-filter .other-years-dropdown .dropdown-menu li", (e) ->
e.stopPropagation()
e.preventDefault()
# Set value of other radio button to selected year and submit
selected_year = $(this).attr('id')
$(this).closest(".input__award-years").find("select option[value='#{selected_year}']").attr('selected', true).change()
$(this).closest('form').submit()

$(document).ready(ready)
1 change: 1 addition & 0 deletions app/assets/javascripts/application.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -1249,6 +1249,7 @@ jQuery ->
height: 200
wordcount:
maxWordCount: $(this).data('word-max')
versionCheck: false

CKEDITOR.on 'instanceCreated', (event) ->
editor = event.editor
Expand Down
13 changes: 9 additions & 4 deletions app/assets/stylesheets/admin/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -929,11 +929,11 @@ label.govuk-label.govuk-checkboxes__label.boolean.optional.govuk-label {
margin: 0;
padding: 0;
border: none;
background: transparent;
background-image: image-url("icon-search.png");
background: #1C1C1B;
background-image: image-url("icon-search-white.png");
background-repeat: no-repeat;
background-position: center center;
background-size: pxToRem(15) pxToRem(21);
background-size: pxToRem(18) pxToRem(18);
text-align: left !important;
text-indent: -9999px;
white-space: nowrap;
Expand All @@ -943,7 +943,7 @@ label.govuk-label.govuk-checkboxes__label.boolean.optional.govuk-label {
z-index: 1000;

@include is-retina {
background-image: image-url("icon-search@2.png");
background-image: image-url("icon-search-white.png");
}

.lte-ie7 & {
Expand Down Expand Up @@ -2000,6 +2000,11 @@ label.govuk-label.govuk-checkboxes__label.boolean.optional.govuk-label {
}
}

.award-year-radios {
padding-left: 15px;
margin-top: pxToRem(20);
}

.award-year-container {
position: relative;

Expand Down
34 changes: 33 additions & 1 deletion app/assets/stylesheets/admin/page-applications.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,38 @@
}
}

.search-input__hint {
padding-bottom: pxToRem(20);
}

.search-input__hint + .search-input {
top: pxToRem(10);
}

.input__award-years {
min-height: pxToRem(33);
display: inline-block;

input {
margin-right: pxToRem(10);
width: 20px;
height: 20px;
margin-top: -2px;
vertical-align: middle;
}

label {
margin-right: pxToRem(20);
font-weight: normal;
padding-bottom: pxToRem(1);
padding-top: pxToRem(4);
}

.dropdown {
width: pxToRem(200);
}
}

.dropdown {
position: relative;
display: inline-block;
Expand Down Expand Up @@ -557,7 +589,7 @@
display: inline;
}
}

.alert ~ form > .form-edit-link {
display: flex;
float: right;
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/admin/form_answers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ class Admin::FormAnswersController < Admin::BaseController
end

expose(:target_scope) do
if params[:year].to_s == "all_years"
FormAnswer.all
else
if AwardYear.admin_switch.key?(params[:year].to_i)
@award_year.form_answers
else
FormAnswer.all
end
end

Expand Down
8 changes: 7 additions & 1 deletion app/decorators/form_answer_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,13 @@ def last_updated_at
end

def last_updated_by
latest_update && latest_update.subject.full_name
if latest_update
if latest_update.subject
latest_update.subject.full_name
else
"Deleted user"
end
end
end

private
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/form_answers/index.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ h1.admin-page-heading
.col-md-4.col-sm-5.col-xs-12
.applications-filter
= f.label :query, "Search", class: "search-input__label"
= f.hint "By company name, reference number or category", class: "search-input__hint"
.form-group.search-input
= text_field_tag :year, params[:year] || @award_year.year, class: "visuallyhidden", aria: { hidden: true }
= f.input :query, label: false, input_html: { class: "form-control", type: "search", aria: { label: 'Search applications' }}
= submit_tag :submit, class: 'search-submit'

Expand Down
2 changes: 1 addition & 1 deletion app/views/assessor/form_answers/index.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ h1.admin-page-heading
.col-md-4.col-sm-5.col-xs-12
.applications-filter
= f.label :query, "Search", class: "search-input__label"
= f.hint "By company name, reference number or category", class: "search-input__hint"
.form-group.search-input
= text_field_tag :year, params[:year] || @award_year.year, class: "visuallyhidden", aria: { hidden: true }, id: "award_year", tabindex: "-1"
= text_field_tag :award_type, params[:award_type], class: "visuallyhidden", aria: { hidden: true }, tabindex: "-1"
= f.input :query, label: false, input_html: { class: "form-control", type: "search", aria: {label: 'Search applications'} }
= submit_tag :submit, class: 'search-submit'
Expand Down
42 changes: 42 additions & 0 deletions app/views/shared/form_answers/_admin_award_year.html.slim
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
- current_year = AwardYear.current.year
- selected_year = params[:year] ? params[:year].to_i : current_year
- other_years = AwardYear.admin_switch.keys.select{ |year| year <= current_year }

fieldset.award-year-z-index.applications-filter.award-year-radios
label.applications-filter__label
' Award year
.input__award-years
.if-no-js-hide
input type="radio" id="current_year" name="award_year" value="#{current_year}" checked=(current_year == params[:year].to_i || (namespace_name == :assessor && other_years.exclude?(params[:year].to_i)))
label for="current_year"
| Current year
input type="radio" id="all_years" name="award_year" value="all_years" checked=(params[:year].to_s == 'all_years' || (namespace_name == :admin && other_years.exclude?(params[:year].to_i)))
label for="all_years"
| All years
input type="radio" id="other" name="award_year" value="#{selected_year}" checked=(current_year != selected_year && other_years.include?(params[:year].to_i))
label for="other"
| Other

.dropdown.other-years-dropdown class="#{(current_year != selected_year && other_years.include?(params[:year].to_i) ? '' : 'hide')}"
a.dropdown-toggle.btn.btn-block.btn-default href="#" data-toggle="dropdown" role="button" aria-expanded="false"
- current_year_text = params[:year].to_s == "all_years" || !params[:year] || !other_years.include?(params[:year].to_i) ? "All Years" : "#{selected_year - 1} - #{selected_year}"

= current_year_text
span.caret-container
span.caret
ul.dropdown-menu.dropdown-menu-right
li class="#{'active' if params[:year].to_s == 'all_years' || !params[:year]}" id="all_years"
= link_to "All Years", "#"

- AwardYear.admin_switch.each do |year, label|
- if year <= current_year
li class="#{'active' if label == current_year_text}" id="#{year}"
= link_to label, "#"

select name="year" id="award_year" class="form-control if-js-hide"
option value="all_years" selected=(params[:year].to_s == 'all_years' || (namespace_name == :admin && other_years.exclude?(params[:year].to_i)))
| All years
- AwardYear.admin_switch.each do |year, label|
- if year <= current_year
option value="#{year}" selected=(year == selected_year)
= label
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.row
= render "layouts/vertical_admin_award_year"
= render "shared/form_answers/admin_award_year"
.row
.col-lg-4.col-md-5.col-sm-7.applications-filter.status-filter
= f.simple_fields_for [:filters, @search.filters] do |g|
= g.input :status,
Expand Down
2 changes: 1 addition & 1 deletion bin/deploy
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ curl -X POST \
$SLACK_WEBHOOK

# Pin ruby buildpack
export CF_BUILDPACK="https://github.com/cloudfoundry/ruby-buildpack.git#v1.10.11"
export CF_BUILDPACK="https://github.com/cloudfoundry/ruby-buildpack.git#v1.10.16"

cf create-app-manifest "$CF_APP"-worker
cf set-env "$CF_APP"-worker APP_REVISION $git_hash
Expand Down
2 changes: 1 addition & 1 deletion config/initializers/ckeditor.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Ckeditor.setup do |config|
config.cdn_url = "//cdn.ckeditor.com/4.16.2/full/ckeditor.js"
config.cdn_url = "//cdn.ckeditor.com/4.22.1/full/ckeditor.js"
end
26 changes: 12 additions & 14 deletions forms/award_years/v2025/social_mobility/social_mobility_step4.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,36 +51,34 @@ def mobility_step4
financial_date_pointer
end

trade_most_recent_financial_year_options :most_recent_financial_year, "Which year would you like to be your most recent financial year that you will submit figures for?" do
ref "D 2.1"
required
option (AwardYear.current.year - 2).to_s, (AwardYear.current.year - 2).to_s
option (AwardYear.current.year - 1).to_s, (AwardYear.current.year - 1).to_s
classes "js-most-recent-financial-year fs-trackable fs-two-trackable"
end

options :financial_year_date_changed, "Did your year-end date change during your three most recent financial years that you will be providing figures for?" do
classes "sub-question js-financial-year-change fs-trackable"
sub_ref "D 2.1"
sub_ref "D 2.2"
required
context %(
<p>
For the purpose of this application, your most recent financial year is your last financial year ending before the #{Settings.current.deadlines.where(kind: "submission_end").first.decorate.formatted_trigger_date("with_year")} - the submission deadline.
</p>
)
yes_no
default_option "no"
end

one_option_by_years_label :financial_year_changed_dates, "Enter your year-end dates for each financial year." do
classes "sub-question one-option-by-years fs-trackable"
sub_ref "D 2.2"
sub_ref "D 2.3"
required
context %(
<p>
For the purpose of this application, your most recent financial year is your last financial year ending before the #{Settings.current.deadlines.where(kind: "submission_end").first.decorate.formatted_trigger_date("with_year")} - the submission deadline.
</p>
)
type :date
label ->(y) { "Financial year #{y}" }
conditional :financial_year_date_changed, :yes
end

textarea :financial_adjustments_explanation, "Explain adjustments to figures." do
classes "sub-question word-max-strict"
sub_ref "D 2.3"
sub_ref "D 2.4"
required
context %(
<p>
Expand All @@ -94,7 +92,7 @@ def mobility_step4

textarea :financial_year_date_changed_explaination, "Explain why your year-end date changed." do
classes "sub-question word-max-strict"
sub_ref "D 2.4"
sub_ref "D 2.5"
required
rows 2
words_max 100
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,27 +51,25 @@ def development_step4
financial_date_pointer
end

trade_most_recent_financial_year_options :most_recent_financial_year, "Which year would you like to be your most recent financial year that you will submit figures for?" do
ref "D 2.1"
required
option (AwardYear.current.year - 2).to_s, (AwardYear.current.year - 2).to_s
option (AwardYear.current.year - 1).to_s, (AwardYear.current.year - 1).to_s
classes "js-most-recent-financial-year fs-trackable fs-two-trackable"
end

options :financial_year_date_changed, "Did your year-end date change during your <span class='js-entry-period-subtext'>three</span> most recent financial years that you will be providing figures for?" do
classes "sub-question js-financial-year-change fs-trackable"
sub_ref "D 2.1"
sub_ref "D 2.2"
required
yes_no
context %(
<p>
For the purpose of this application, your most recent financial year is your last financial year ending before the #{Settings.current.deadlines.where(kind: "submission_end").first.decorate.formatted_trigger_date("with_year")} - (the submission deadline).
</p>
)
default_option "no"
end

one_option_by_years_label :financial_year_changed_dates, "Enter your year-end dates for each financial year." do
classes "sub-question one-option-by-years fs-trackable"
sub_ref "D 2.2"
context %(
<p>
For the purpose of this application, your most recent financial year is your last financial year ending before the #{Settings.current.deadlines.where(kind: "submission_end").first.decorate.formatted_trigger_date("with_year")} - (the submission deadline).
</p>
)
sub_ref "D 2.3"
required
type :date
label ->(y) { "Financial year #{y}" }
Expand All @@ -80,7 +78,7 @@ def development_step4

textarea :financial_adjustments_explanation, "Explain adjustments to figures." do
classes "sub-question word-max-strict"
sub_ref "D 2.3"
sub_ref "D 2.4"
context %(
<p>
If your financial year-end has changed, you will need to agree with your accountants on how to allocate your figures in all section D questions so that they show three 12-month periods (36 months). This allows for a comparison between years. Please explain what approach you will take to adjust the figures.
Expand All @@ -94,7 +92,7 @@ def development_step4

textarea :financial_year_date_changed_explaination, "Explain why your year-end date changed." do
classes "sub-question"
sub_ref "D 2.4"
sub_ref "D 2.5"
required
rows 2
words_max 100
Expand Down
3 changes: 1 addition & 2 deletions forms/qae_form_builder/about_section_question.rb
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,7 @@ def financial_periods
header: "Periods the figures are required for",
context: [
"You must provide financial figures for your three most recent financial years, covering 36 months.",
"If you have changed your year-end during the period of your application, see D2.3 for an explanation of how this must be dealt with.",
"For the purpose of this application, your most recent financial year is your last financial year ending before the #{Settings.current.deadlines.where(kind: "submission_end").first.decorate.formatted_trigger_date("with_year")} - the application submission deadline.",
"If you have changed your year-end during the period of your application, see D2.4 for an explanation of how this must be dealt with.",
],
)
end
Expand Down
3 changes: 2 additions & 1 deletion spec/fixtures/form_answer_development.json
Original file line number Diff line number Diff line change
Expand Up @@ -238,5 +238,6 @@
"agree_to_provide_actual_figures": "on",
"received_grant": "no",
"strong_esg_record": "on",
"major_issues_overcome": "test"
"major_issues_overcome": "test",
"most_recent_financial_year": "2024"
}
3 changes: 2 additions & 1 deletion spec/fixtures/form_answer_mobility.json
Original file line number Diff line number Diff line change
Expand Up @@ -697,5 +697,6 @@
"disadvantaged_groups_opportunities_numbers": "",
"received_grant": "no",
"strong_esg_record": "on",
"major_issues_overcome": "test"
"major_issues_overcome": "test",
"most_recent_financial_year": "2024"
}
Loading