Browse Source

remove scheme toggle

pull/1700/head
Arthur Campbell 3 years ago
parent
commit
5d950e0b89
  1. 5
      app/helpers/schemes_helper.rb
  2. 4
      app/services/feature_toggle.rb
  3. 22
      app/views/schemes/_scheme_list.html.erb
  4. 7
      app/views/schemes/show.html.erb
  5. 8
      spec/helpers/schemes_helper_spec.rb

5
app/helpers/schemes_helper.rb

@ -14,12 +14,9 @@ module SchemesHelper
{ name: "Level of support given", value: scheme.support_type },
{ name: "Intended length of stay", value: scheme.intended_stay },
{ name: "Availability", value: scheme_availability(scheme) },
{ name: "Status", value: status_tag(scheme.status) },
]
if FeatureToggle.scheme_toggle_enabled?
base_attributes.append({ name: "Status", value: status_tag(scheme.status) })
end
if user.data_coordinator?
base_attributes.delete_if { |item| item[:name] == "Housing stock owned by" }
end

4
app/services/feature_toggle.rb

@ -12,10 +12,6 @@ class FeatureToggle
Rails.env.production? || Rails.env.test? || Rails.env.staging? || Rails.env.review?
end
def self.scheme_toggle_enabled?
true
end
def self.location_toggle_enabled?
true
end

22
app/views/schemes/_scheme_list.html.erb

@ -5,20 +5,10 @@
<% end %>
<%= table.head do |head| %>
<%= head.row do |row| %>
<% row.cell(header: true, text: "Scheme", html_attributes: {
scope: "col",
}) %>
<% row.cell(header: true, text: "Code", html_attributes: {
scope: "col",
}) %>
<% row.cell(header: true, text: "Locations", html_attributes: {
scope: "col",
}) %>
<% if FeatureToggle.scheme_toggle_enabled? %>
<% row.cell(header: true, text: "Status", html_attributes: {
scope: "col",
}) %>
<% end %>
<% row.cell(header: true, text: "Scheme", html_attributes: { scope: "col" }) %>
<% row.cell(header: true, text: "Code", html_attributes: { scope: "col" }) %>
<% row.cell(header: true, text: "Locations", html_attributes: { scope: "col" }) %>
<% row.cell(header: true, text: "Status", html_attributes: { scope: "col" }) %>
<% end %>
<% end %>
<% @schemes.each do |scheme| %>
@ -27,9 +17,7 @@
<% row.cell(text: simple_format(scheme_cell(scheme), { class: "govuk-!-font-weight-bold" }, wrapper_tag: "div")) %>
<% row.cell(text: scheme.id_to_display) %>
<% row.cell(text: scheme.locations&.count) %>
<% if FeatureToggle.scheme_toggle_enabled? %>
<% row.cell(text: status_tag(scheme.status)) %>
<% end %>
<% row.cell(text: status_tag(scheme.status)) %>
<% end %>
<% end %>
<% end %>

7
app/views/schemes/show.html.erb

@ -13,6 +13,7 @@
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds-from-desktop">
<% end %>
<%= render SubNavigationComponent.new(items: scheme_items(request.path, @scheme.id, "Locations")) %>
<h2 class="govuk-visually-hidden">Scheme</h2>
@ -34,8 +35,6 @@
</div>
<% end %>
<% if FeatureToggle.scheme_toggle_enabled? %>
<% if SchemePolicy.new(current_user, @scheme).deactivate? %>
<%= toggle_scheme_link(@scheme) %>
<% end %>
<% if SchemePolicy.new(current_user, @scheme).deactivate? %>
<%= toggle_scheme_link(@scheme) %>
<% end %>

8
spec/helpers/schemes_helper_spec.rb

@ -195,14 +195,6 @@ RSpec.describe SchemesHelper do
expect(display_scheme_attributes(scheme, coordinator_user)).to eq(attributes)
end
context "when the scheme toggle is disabled" do
it "doesn't show the scheme status" do
allow(FeatureToggle).to receive(:scheme_toggle_enabled?).and_return(false)
attributes = display_scheme_attributes(scheme, support_user).find { |x| x[:name] == "Status" }
expect(attributes).to be_nil
end
end
context "when the managing organisation is the owning organisation" do
it "doesn't show the organisation providing support" do
attributes = display_scheme_attributes(scheme_where_managing_organisation_is_owning_organisation, support_user).find { |x| x[:name] == "Organisation providing support" }

Loading…
Cancel
Save