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. 20
      app/views/schemes/_scheme_list.html.erb
  4. 3
      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: "Level of support given", value: scheme.support_type },
{ name: "Intended length of stay", value: scheme.intended_stay }, { name: "Intended length of stay", value: scheme.intended_stay },
{ name: "Availability", value: scheme_availability(scheme) }, { 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? if user.data_coordinator?
base_attributes.delete_if { |item| item[:name] == "Housing stock owned by" } base_attributes.delete_if { |item| item[:name] == "Housing stock owned by" }
end 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? Rails.env.production? || Rails.env.test? || Rails.env.staging? || Rails.env.review?
end end
def self.scheme_toggle_enabled?
true
end
def self.location_toggle_enabled? def self.location_toggle_enabled?
true true
end end

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

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

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

@ -13,6 +13,7 @@
<div class="govuk-grid-row"> <div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds-from-desktop"> <div class="govuk-grid-column-two-thirds-from-desktop">
<% end %> <% end %>
<%= render SubNavigationComponent.new(items: scheme_items(request.path, @scheme.id, "Locations")) %> <%= render SubNavigationComponent.new(items: scheme_items(request.path, @scheme.id, "Locations")) %>
<h2 class="govuk-visually-hidden">Scheme</h2> <h2 class="govuk-visually-hidden">Scheme</h2>
@ -34,8 +35,6 @@
</div> </div>
<% end %> <% end %>
<% if FeatureToggle.scheme_toggle_enabled? %>
<% if SchemePolicy.new(current_user, @scheme).deactivate? %> <% if SchemePolicy.new(current_user, @scheme).deactivate? %>
<%= toggle_scheme_link(@scheme) %> <%= toggle_scheme_link(@scheme) %>
<% end %> <% end %>
<% 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) expect(display_scheme_attributes(scheme, coordinator_user)).to eq(attributes)
end 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 context "when the managing organisation is the owning organisation" do
it "doesn't show the organisation providing support" 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" } attributes = display_scheme_attributes(scheme_where_managing_organisation_is_owning_organisation, support_user).find { |x| x[:name] == "Organisation providing support" }

Loading…
Cancel
Save