Skip to content

Commit

Permalink
Tidy code (#2000)
Browse files Browse the repository at this point in the history
  • Loading branch information
threedaymonk authored Dec 4, 2024
2 parents df1ddda + 61f3418 commit daf1c70
Show file tree
Hide file tree
Showing 14 changed files with 613 additions and 1,258 deletions.
6 changes: 2 additions & 4 deletions app/services/content/connector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,15 @@ def self.reset!
def self.create_client(space_id:, access_token:, preview: false)
api_url = preview ? "preview.contentful.com" : "cdn.contentful.com"

options = {
::Contentful::Client.new(
api_url:,
space: space_id,
access_token:,
environment: ENV["CONTENTFUL_ENVIRONMENT"],
raise_errors: true,
application_name: "DfE: Buy For Your School",
application_version: "1.0.0",
}

::Contentful::Client.new(options)
)
end

# @param api [Symbol, String]
Expand Down
25 changes: 1 addition & 24 deletions app/views/support/cases/additional_contacts/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,10 @@
<%= form.govuk_text_field :phone_number, width: 'one-quarter', label: { text: I18n.t("support.case_contact_details.label.phone") } %>
<%= form.govuk_text_field :extension_number, width: 'one-quarter', label: { text: I18n.t("support.case_contact_details.label.extension_number") } %>

<%

=begin%>
#below code is commented because it can be used later. It is a field for organisation selection.
<%= render "components/autocomplete",
container_id: "case-contacts-organisation-field",
label_text: I18n.t("support.case_additional_contact.organisation.header"),
label_class: "govuk_text_field",
element_id: "additional_contacts-autocomplete",
element_name: "organisation_name",
template_suggestion: "{{autocomplete_template}}",
value_field: :name,
default_value: form.object.organisation&.name,
hidden_fields: {
'support_case_additional_contact[organisation_id]' => [:id, form.object.organisation&.id],
# 'case_request[organisation_type]' => [:source, form.object.organisation.class&.name],
},
query_url: support_establishments_path(format: :json, q: "{{QUERY}}") %>
<%
=end%>
<div class="govuk_text_field">
<%= form.govuk_collection_check_boxes :role, role_options, :id, :title, legend: { text: "Roles" } %>
</div>

<%= form.hidden_field :support_case_id, value: @current_case.id %>

<div class="actions">
Expand Down
19 changes: 0 additions & 19 deletions app/views/support/cases/contact_details/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,7 @@
<%= form.govuk_text_field :phone_number, width: 'one-quarter', label: { text: I18n.t("support.case_contact_details.label.phone") } %>
<%= form.govuk_text_field :extension_number, width: 'one-quarter', label: { text: I18n.t("support.case_contact_details.label.extension_number") } %>
<%= form.govuk_text_field :email, width: 'one-half', label: { text: I18n.t("support.case_contact_details.label.email") } %>
<%

=begin%>
#below code is commented because it can be used later. It is a field for organisation selection.
<%= render "components/autocomplete",
container_id: "case-contacts-organisation-field",
label_text: I18n.t("support.case_additional_contact.organisation.header"),
label_class: "govuk_text_field",
element_id: "additional_contacts-autocomplete",
element_name: "organisation_name",
template_suggestion: "{{autocomplete_template}}",
value_field: :name,
default_value: @current_case&.organisation&.name,
hidden_fields: {
'case_contact_details_form[organisation_id]' => :id,
'case_contact_details_form[organisation_type]' => :source,
},
query_url: support_establishments_path(format: :json, q: "{{QUERY}}") %>
<%
=end%>
<legend class="govuk-fieldset__legend govuk-fieldset__legend--m">Roles</legend>

<div class="govuk-form-group">
Expand Down
20 changes: 0 additions & 20 deletions app/views/support/cases/school_details/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -113,26 +113,6 @@
</div>
<% end %>

<%
=begin%>
# This is temporarily removed, will be used later.
<% if @current_case.eligible_for_school_picker? %>
<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">
<%= I18n.t("support.case.label.non_participating_schools") %>
</dt>
<dd class="govuk-summary-list__value">
<%= @current_case.other_school_urns.size %>
</dd>
<dd class="govuk-summary-list__actions">
<%= link_to I18n.t("support.generic.view"), non_beneficiery_schools_support_case_school_details_other_schools_path(@current_case), class: "govuk-link", target: "_top"%>
</dd>
</div>
<% end %>
</dl>
<%
=end%>
<% if @current_case.organisation.present? %>
<ul class="govuk-list">
<% if @current_case.organisation_gias_url.present? %>
Expand Down
Loading

0 comments on commit daf1c70

Please sign in to comment.