Skip to content

Commit

Permalink
Merge pull request #3029 from bitzesty/main
Browse files Browse the repository at this point in the history
Staging < main
  • Loading branch information
TheDancingClown authored Aug 2, 2024
2 parents c65cfc7 + b5ec408 commit 9deb671
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 123 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,10 @@ jobs:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
run: |
npm install -g yarn
curl -v -L -o cf-cli_amd64.deb 'https://cli.run.pivotal.io/stable?release=debian64&source=github'
sudo dpkg -i cf-cli_amd64.deb
wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo apt-key add -
echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list
sudo apt-get update
sudo apt-get install cf7-cli
cf -v
cf add-plugin-repo CF-Community https://plugins.cloudfoundry.org
cf install-plugin blue-green-deploy -r CF-Community -f
Expand Down
13 changes: 13 additions & 0 deletions app/assets/javascripts/admin/applications-filter.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,17 @@ filterApplicationsDropdowns = () ->
dropdownWrapper.removeClass("hide")
dropdown = dropdownWrapper.find(".dropdown-toggle")
dropdown.focus().click()
$(this).prop('disabled', true);
else
selected_year = $(this).val()
$(this).closest(".input__award-years").find("select option[value='#{selected_year}']").attr('selected', true).change()
$(this).prop('disabled', true);
$(this).closest('form').submit()

# If other option is selected on page load, disable the radio button
if $(".applications-filter .input__award-years input[type='radio']:checked").attr('id') == "other"
$(".applications-filter .input__award-years input[type='radio']:checked").prop('disabled', true);

# On clicking the award year from the other year dropdown
$(document).on "click", ".applications-filter .other-years-dropdown .dropdown-menu li", (e) ->
e.stopPropagation()
Expand All @@ -146,4 +152,11 @@ filterApplicationsDropdowns = () ->
$(this).closest(".input__award-years").find("select option[value='#{selected_year}']").attr('selected', true).change()
$(this).closest('form').submit()

# On clicking the search button disable the radio button input
$(document).on "click", ".applications-filter .search-input input.search-submit", (e) ->
e.stopPropagation()
e.preventDefault()
$(".applications-filter .input__award-years input[type='radio']:checked").prop('disabled', true);
$(this).closest('form').submit()

$(document).ready(ready)
110 changes: 26 additions & 84 deletions app/assets/stylesheets/admin/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1583,9 +1583,9 @@ label.govuk-label.govuk-checkboxes__label.boolean.optional.govuk-label {
}

.btn-rag {
position: absolute;
right: 0;
top: pxToRem(-5);
padding-right: pxToRem(5);

@include screen-xs-max {
display: block;
Expand All @@ -1598,6 +1598,25 @@ label.govuk-label.govuk-checkboxes__label.boolean.optional.govuk-label {
}
}

.btn {
padding-left: pxToRem(5) !important;

&.rag-positive {
background-color: #CCE1D8;
color: #015A30 !important;
}

&.rag-average {
background-color: #C0D3E8;
color: #152C48 !important;
}

&.rag-negative {
background-color: #F6D7D2;
color: #942415 !important;
}
}

.strengths-section & {
@include screen-lg-max {
display: block;
Expand All @@ -1624,7 +1643,7 @@ label.govuk-label.govuk-checkboxes__label.boolean.optional.govuk-label {
.caret {
position: absolute;
top: 50%;
right: 0;
right: pxToRem(5);
margin-top: pxToRem(-2);
}

Expand All @@ -1635,7 +1654,7 @@ label.govuk-label.govuk-checkboxes__label.boolean.optional.govuk-label {
}

.dropdown-toggle {
padding-right: pxToRem(25);
padding-right: pxToRem(20);
padding-left: 0;

@include screen-xs-max {
Expand All @@ -1655,10 +1674,6 @@ label.govuk-label.govuk-checkboxes__label.boolean.optional.govuk-label {
}
}

&.rag-editable .dropdown-toggle {
padding-right: pxToRem(40);
}

.dropdown-menu {
&.pull-right {
@include screen-xs-max {
Expand Down Expand Up @@ -1692,88 +1707,14 @@ label.govuk-label.govuk-checkboxes__label.boolean.optional.govuk-label {
color: #a94442 !important;
}

.rag-blank {
&,
a,
a:hover,
a:focus {
color: $black;
}

.icon-rag {
background-image: image-url("icon-grade-blank.png");

@include is-retina {
background-image: image-url("[email protected]");
}
}
}

.rag-neutral {
.rag-blank, .rag-neutral, .rag-positive, .rag-average, .rag-negative {
&,
a,
a:hover,
a:focus {
color: $black;
}

.icon-rag {
background-image: image-url("icon-grade-neutral.png");

@include is-retina {
background-image: image-url("[email protected]");
}
}
}

.rag-positive {
&,
a,
a:hover,
a:focus {
color: $green;
}

.icon-rag {
background-image: image-url("icon-grade-green.png");

@include is-retina {
background-image: image-url("[email protected]");
}
}
}

.rag-average {
&,
a,
a:hover,
a:focus {
color: $amber;
}

.icon-rag {
background-image: image-url("icon-grade-amber.png");

@include is-retina {
background-image: image-url("[email protected]");
}
}
}

.rag-negative {
&,
a,
a:hover,
a:focus {
color: $red;
}

.icon-rag {
background-image: image-url("icon-grade-red.png");

@include is-retina {
background-image: image-url("[email protected]");
}
text-decoration: none;
font: normal pxToRem(16) 'Arial', sans-serif;
}
}

Expand All @@ -1785,6 +1726,7 @@ label.govuk-label.govuk-checkboxes__label.boolean.optional.govuk-label {
a:hover,
a:focus {
text-decoration: none;
font-weight: normal;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/form_award_eligibilities_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def show
@award_eligibility.force_validate_now = true
@award_eligibility.valid?

step = @award_eligibility.errors.keys.first
step = @award_eligibility.errors.try(:keys).try(:first)
end

if step
Expand Down
8 changes: 4 additions & 4 deletions app/pdf_generators/case_summary_pdfs/general/data_pointer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ module CaseSummaryPdfs::General::DataPointer
"sustainable_development" => "Sustainable Development" }

COLOR_LABELS = %w[positive average negative neutral]
POSITIVE_COLOR = "6B8E23"
AVERAGE_COLOR = "DAA520"
NEGATIVE_COLOR = "FF0000"
POSITIVE_COLOR = "017E44"
AVERAGE_COLOR = "2C5C96"
NEGATIVE_COLOR = "B72C1A"
NEUTRAL_COLOR = "ECECEC"
LINK_REGEXP = /((?:https?:\/\/|www\d{0,3}[.]|[a-z0-9.-]+[.][a-z]{2,4}\/)(?:[^\s()<>`!{}:;'"\[\]]*))/im

Expand Down Expand Up @@ -186,9 +186,9 @@ def render_items
end

pdf_doc.text entry[0], header_text_properties
pdf_doc.move_down 3.mm

pdf_doc.text entry[2], header_text_properties.merge({ color: color_by_value(entry[2], year) })

pdf_doc.move_down 5.mm

pdf_doc.text entry[1], header_text_properties.merge({ style: :normal })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,28 @@

.form-group.rag-section[class="#{'form-edit' if f.object.public_send(section.desc).blank? && editable} form-#{section.label.parameterize}" data-controller="element-focus"]
.form-container
label.form-label.form-label-rag for="#{f.object.position}_#{section.desc}_comment"
span.rag_section_label
= section.label

= f.input section.rate,
as: :select,
label: false,
collection: form.options,
input_html: { class: "if-js-hide", "data-updated-section" => section.rate, id: "#{f.object.position}_#{section.desc}_select" }

label.form-label.form-label-rag for="#{f.object.position}_#{section.desc}_comment"
span.rag_section_label
= section.label
.btn-group.btn-rag class="#{'rag-editable' if editable}"
button.btn.btn-link.dropdown-toggle type="button" data-toggle="dropdown" aria-expanded="false" class="rag-#{form.option[1]}"
span.rag-text= form.option[0]
span.glyphicon.icon-rag
- if editable
span.caret
.btn-group.btn-rag.if-no-js-hide class="#{'rag-editable' if editable}"
button.btn.dropdown-toggle type="button" data-toggle="dropdown" aria-expanded="false" class="rag-#{form.option[1]} rag_#{f.object.public_send(section.rate)}"
span.rag-text= form.option[0]
- if editable
ul.dropdown-menu.pull-right role="menu"
- form.options.each do |opt|
li class="rag-#{opt[1]}"
= link_to "#"
span.icon-rag
span.rag-text= opt[0]
span.caret
- if editable
ul.dropdown-menu role="menu"
- form.options.each do |opt|
li class="rag-#{opt[1]}"
= link_to "#"
span.icon-rag
span.rag-text= opt[0]

.form-value
p
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@

.form-group.verdict-section[class="#{'form-edit' if f.object.public_send(section.desc).blank? && editable} form-#{section.label.parameterize}" data-controller="element-focus"]
.form-container
label.form-label.form-label-rag for="#{f.object.position}_verdict"
= section.label

= f.input section.rate,
as: :select,
label: false,
collection: form.options,
input_html: { class: "if-js-hide", "data-updated-section" => section.desc, id: "#{f.object.position}_#{section.desc}_select"}

label.form-label.form-label-rag for="#{f.object.position}_verdict"
= section.label
.btn-group.btn-rag class="#{'rag-editable' if rag_editable}"
.btn-group.btn-rag.if-no-js-hide class="#{'rag-editable' if rag_editable}"
button.btn.btn-link.dropdown-toggle class="#{'non-editable' if !rag_editable}" type="button" data-toggle="dropdown" aria-expanded="false" class="rag-#{form.option[1]}"
span.rag-text= form.option[0]
span.glyphicon.icon-rag
Expand Down
10 changes: 5 additions & 5 deletions app/views/shared/form_answers/_admin_award_year.html.slim
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
- current_year = AwardYear.current.year
- selected_year = params[:year] ? params[:year].to_i : current_year
- selected_year = params[:year] ? params[:year].to_i : namespace_name == :admin ? 'all_years' : 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)))
input type="radio" id="current_year" name="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)))
input type="radio" id="all_years" name="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))
input type="radio" id="other" name="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 = params[:year].to_s == "all_years" || !params[:year] || !other_years.include?(params[:year].to_i) || selected_year == "all_years" ? "All Years" : "#{selected_year - 1} - #{selected_year}"

= current_year_text
span.caret-container
Expand Down
8 changes: 4 additions & 4 deletions forms/appraisal_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ class AppraisalForm
]

RAG_OPTIONS_2025 = [
%w[Red negative],
%w[Amber average],
%w[Green positive],
["Does not meet expectations", "negative"],
["Meets expectations", "average"],
["Exceeds expectations", "positive"],
]

CSR_RAG_OPTIONS_2016 = [
Expand Down Expand Up @@ -263,7 +263,7 @@ def self.rag_options_for(object, section)

option = options.detect do |opt|
opt[1] == object.public_send(section.rate)
end || ["Select RAG", "blank"]
end || ["Select evaluation", "blank"]

OpenStruct.new(
options: options,
Expand Down
10 changes: 5 additions & 5 deletions spec/support/shared_contexts/appraisal_form_context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ def assert_rag_change(section_id, header_id)

expect(page).to have_css(section_id) # Forces capybara to wait for the section to become visible
within section_id do
expect(page).to have_selector(rag, text: "Select RAG", count: 4)
expect(page).to have_selector(rag, text: "Select evaluation", count: 4)
expect(page).to have_selector(rag, text: "Select verdict", count: 1)

first(".btn-rag").click
find(".dropdown-menu .rag-negative").click
wait_for_ajax
expect(page).to have_selector(rag, text: "Select RAG", count: 3)
expect(page).to have_selector(rag, text: "Red", count: 1)
expect(page).to have_selector(rag, text: "Select evaluation", count: 3)
expect(page).to have_selector(rag, text: "Does not meet expectations", count: 1)
expect(page).to have_selector(rag, text: "Select verdict", count: 1)
end

Expand All @@ -89,8 +89,8 @@ def assert_rag_change(section_id, header_id)
take_a_nap

within section_id do
expect(page).to have_selector(rag, text: "Select RAG", count: 3)
expect(page).to have_selector(rag, text: "Red", count: 1)
expect(page).to have_selector(rag, text: "Select evaluation", count: 3)
expect(page).to have_selector(rag, text: "Does not meet expectations", count: 1)
expect(page).to have_selector(rag, text: "Select verdict", count: 1)
end
visit show_path
Expand Down

0 comments on commit 9deb671

Please sign in to comment.