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

Make changes to farming grant finder #2528

Merged
merged 2 commits into from
Feb 21, 2024
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
4 changes: 0 additions & 4 deletions app/models/farming_grant_option.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
class FarmingGrantOption < Document
validates :open_or_closed, presence: true
validates :funding_types, presence: true
validates :grant_schemes, presence: true
validates :payment_types, presence: true

FORMAT_SPECIFIC_FIELDS = %i[
open_or_closed
areas_of_interest
land_types
funding_types
grant_schemes
payment_types
].freeze
Expand Down
36 changes: 4 additions & 32 deletions app/views/metadata_fields/_farming_grant_options.html.erb
Original file line number Diff line number Diff line change
@@ -1,31 +1,3 @@
<%= render layout: "shared/form_group", locals: { f: f, field: :open_or_closed } do %>
<%= f.select :open_or_closed,
f.object.facet_options(:open_or_closed),
{},
{
class: 'select2 form-control',
multiple: true,
data: {
placeholder: 'Select open or closed'
}
}
%>
<% end %>

<%= render layout: "shared/form_group", locals: { f: f, field: :areas_of_interest } do %>
<%= f.select :areas_of_interest,
f.object.facet_options(:areas_of_interest),
{},
{
class: 'select2 form-control',
multiple: true,
data: {
placeholder: 'Select areas of interest'
}
}
%>
<% end %>

<%= render layout: "shared/form_group", locals: { f: f, field: :land_types } do %>
<%= f.select :land_types,
f.object.facet_options(:land_types),
Expand All @@ -40,15 +12,15 @@
%>
<% end %>

<%= render layout: "shared/form_group", locals: { f: f, field: :funding_types } do %>
<%= f.select :funding_types,
f.object.facet_options(:funding_types),
<%= render layout: "shared/form_group", locals: { f: f, field: :areas_of_interest } do %>
<%= f.select :areas_of_interest,
f.object.facet_options(:areas_of_interest),
{},
{
class: 'select2 form-control',
multiple: true,
data: {
placeholder: 'Select funding types'
placeholder: 'Select areas of interest'
}
}
%>
Expand Down
56 changes: 2 additions & 54 deletions lib/documents/schemas/farming_grant_options.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,16 @@
},
"organisations": [
"de4e9dc6-cca4-43af-a594-682023b84d6c",
"e8fae147-6232-4163-a3f1-1c15b755a8a4",
"8bf5624b-dec2-44fa-9b6c-daed166333a5"
"e8fae147-6232-4163-a3f1-1c15b755a8a4"
],
"show_summaries": true,
"signup_content_id": "2cd12e92-3b68-4cb1-bafe-fde6a7939afb",
"signup_copy": "You'll get an email each time a grant is updated or a new grant is published.",
"subscription_list_title_prefix": "Farming grant options",
"summary": "<p>Find out about grant options, items and actions in the Farming and Countryside Programme. This is for land or farms in England.</p><div class='application-notice info-notice'><p>This tool does not confirm your eligibility.</p></div><p>For information on grant schemes and funding see <a href=\"https://www.gov.uk/guidance/funding-for-farmers\">Funding for farmers, growers and land managers</a>.</p>",
"summary": "<p>Find out about grant options, items and actions in the Farming and Countryside Programme. This is for land or farms in England. We will add more grants when they open.</p><div class='application-notice info-notice'><p>This tool does not confirm your eligibility. To get a grant for an option, item or action, you must meet the criteria of the grant scheme it belongs to.</p></div><p>You can search by keyword or the name of a grant. Use the filters to narrow your search.</p>",

"document_noun": "grant",
"facets": [
{
"key": "open_or_closed",
"name": "Open or closed",
"type": "text",
"preposition": "which are",
"display_as_result_metadata": true,
"filterable": true,
"allowed_values": [
{
"label": "Open",
"value": "open"},
{
"label": "Closed",
"value": "closed"
}
]
},
{
"key": "areas_of_interest",
"name": "Areas of interest",
Expand Down Expand Up @@ -166,28 +148,6 @@
}
]
},
{
"key": "funding_types",
"name": "Funding types",
"type": "text",
"preposition": "is",
"display_as_result_metadata": true,
"filterable": true,
"allowed_values": [
{
"label": "Option",
"value": "option"
},
{
"label": "Item",
"value": "item"
},
{
"label": "Action",
"value": "action"
}
]
},
{
"key": "grant_schemes",
"name": "Grant schemes",
Expand All @@ -196,22 +156,10 @@
"display_as_result_metadata": true,
"filterable": true,
"allowed_values": [
{
"label": "Combined Offer",
"value": "combined-offer"
},
{
"label": "Countryside Stewardship",
"value": "countryside-stewardship"
},
{
"label": "Farming Equipment and Technology Fund",
"value": "farming-equipment-and-technology-fund"
},
{
"label": "Slurry Infrastructure grant",
"value": "slurry-infrastructure-grant"
},
{
"label": "Sustainable Farming Incentive",
"value": "sustainable-farming-incentive"
Expand Down
2 changes: 0 additions & 2 deletions spec/fixtures/factories.rb
Original file line number Diff line number Diff line change
Expand Up @@ -771,10 +771,8 @@
transient do
default_metadata do
{
"open_or_closed" => %w[open],
"areas_of_interest" => %w[air-quality],
"land_types" => %w[arable-land],
"funding_types" => %w[option],
"grant_schemes" => %w[countryside-stewardship],
"payment_types" => %w[capital],
}
Expand Down
10 changes: 0 additions & 10 deletions spec/models/farming_grant_option_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,6 @@
expect(farming_grant_option).to be_valid
end

it "is invalid if the open or closed field is missing" do
farming_grant_option.open_or_closed = nil
expect(farming_grant_option).not_to be_valid
end

it "is invalid if the funding types field is missing" do
farming_grant_option.funding_types = nil
expect(farming_grant_option).not_to be_valid
end

it "is invalid if the grant schemes field is missing" do
farming_grant_option.grant_schemes = nil
expect(farming_grant_option).not_to be_valid
Expand Down
Loading