Skip to content

Commit

Permalink
Merge pull request #1088 from alphagov/remove-ab-test
Browse files Browse the repository at this point in the history
Remove content pages AB test
  • Loading branch information
sihugh authored Sep 20, 2018
2 parents 78febe5 + 61c2896 commit 7220dcf
Show file tree
Hide file tree
Showing 39 changed files with 11 additions and 2,498 deletions.
1 change: 0 additions & 1 deletion app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
@import 'helpers/add-title-margin';
@import "helpers/content-bottom-margin";
@import "helpers/publisher-metadata-with-logo";
@import "helpers/taxonomy-navigation";

// Components from this application
@import 'components/*';
Expand Down
53 changes: 0 additions & 53 deletions app/assets/stylesheets/helpers/_taxonomy-navigation.scss

This file was deleted.

58 changes: 0 additions & 58 deletions app/controllers/concerns/content_pages_nav_ab_testable.rb

This file was deleted.

51 changes: 0 additions & 51 deletions app/controllers/content_items_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
class ContentItemsController < ApplicationController
include ContentPagesNavAbTestable

rescue_from GdsApi::HTTPForbidden, with: :error_403
rescue_from GdsApi::HTTPNotFound, with: :error_notfound
Expand All @@ -15,8 +14,6 @@ class ContentItemsController < ApplicationController
def show
load_content_item

load_taxonomy_navigation if show_new_navigation?

set_expiry
set_access_control_allow_origin_header if request.format.atom?
set_guide_draft_access_token if @content_item.is_a?(GuidePresenter)
Expand Down Expand Up @@ -61,54 +58,6 @@ def set_guide_draft_access_token
def load_content_item
content_item = Services.content_store.content_item(content_item_path)
@content_item = PresenterBuilder.new(content_item, content_item_path).presenter
@content_item.include_collections_in_other_publisher_metadata = show_new_navigation?
end

def load_taxonomy_navigation
if @content_item.taxons.present?
current_base_path = @content_item.base_path
taxons = @content_item.taxons.select { |taxon| taxon["phase"] == "live" }
taxon_ids = taxons.map { |taxon| taxon["content_id"] }

@taxonomy_navigation = {}
@content_item.links_out_supergroups.each do |supergroup|
supergroup_taxon_links = "Supergroups::#{supergroup.camelcase}".constantize.new(current_base_path, taxon_ids, filter_content_purpose_subgroup: @content_item.links_out_subgroups(supergroup))
@taxonomy_navigation[supergroup.to_sym] = supergroup_taxon_links.tagged_content
end

@tagged_taxons = taxons.map do |taxon|
{
taxon_id: taxon["content_id"],
taxon_name: taxon["title"],
taxon_link: taxon["base_path"],
}
end

@related_collections = @content_item
.content_item
.dig('links', 'document_collections')
.yield_self { |document_collections| document_collections || [] }
.select { |document_collection| document_collection['document_type'] == 'document_collection' }
.map { |document_collection| document_collection.values_at('base_path', 'title') }

# Fetch link attributes of parent step by steps required to render the top navigation banner
step_by_step_links = @content_item
.content_item
.dig('links', 'part_of_step_navs')
.yield_self { |part_of_step_navs| part_of_step_navs || [] }
.sort_by { |step_by_step_nav| step_by_step_nav['title'] }
.map { |step_by_step_nav| step_by_step_nav.values_at('title', 'base_path') }
@banner_items = format_banner_links(step_by_step_links, "Step by Step")

# Append link attributes of parent taxons to our collections of items for the top navigation banner if the
# content item is tagged to more than one taxon. If there is only one taxon a breadcrumb will be used instead.
if taxons.many?
taxon_links = taxons
.sort_by { |taxon| taxon[:taxon_name] }
.map { |taxon| taxon.values_at('title', 'base_path') }
@banner_items += format_banner_links(taxon_links, "Taxon")
end
end
end

def format_banner_links(links, type)
Expand Down
13 changes: 1 addition & 12 deletions app/helpers/phase_label_helper.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
module PhaseLabelHelper
def render_phase_label(presented_object, message)
if show_new_navigation?
beta_message = <<~BETA_MESSAGE.html_safe
This is a test version of the layout of this page.
<a id=taxonomy-navigation-survey
href='https://www.smartsurvey.co.uk/s/navigationsurvey2018?c=#{current_path_without_query_string}'
target='_blank'
rel='noopener noreferrer'>Take the survey to help us improve it</a>
BETA_MESSAGE

render 'govuk_publishing_components/components/phase_banner', phase: 'beta', message: beta_message

elsif presented_object.respond_to?(:phase) && %w(alpha beta).include?(presented_object.phase)
if presented_object.respond_to?(:phase) && %w(alpha beta).include?(presented_object.phase)
locals = {}
locals[:message] = message if message.present?

Expand Down
5 changes: 0 additions & 5 deletions app/lib/services.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,4 @@ def self.content_store
disable_cache: true,
)
end

def self.rummager
@rummager ||= GdsApi::Rummager.new(Plek.new.find("rummager"),
timeout: 2)
end
end
109 changes: 0 additions & 109 deletions app/presenters/content_item/links_out.rb

This file was deleted.

18 changes: 7 additions & 11 deletions app/presenters/content_item/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,14 @@ def important_metadata
end

def publisher_metadata
{}.tap do |publisher_metadata|
publisher_metadata[:published] = published
publisher_metadata[:last_updated] = updated
publisher_metadata[:link_to_history] = !!updated
publisher_metadata[:other] = {
from: from,
{
published: published,
last_updated: updated,
link_to_history: !!updated,
other: {
from: from
}

if include_collections_in_other_publisher_metadata
publisher_metadata[:other][:collections] = links('document_collections')
end
end
}
end
end
end
1 change: 0 additions & 1 deletion app/presenters/content_item_presenter.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
class ContentItemPresenter
include ContentItem::Withdrawable
include ContentItem::LinksOut

attr_reader :content_item,
:requested_content_item_path,
Expand Down
11 changes: 0 additions & 11 deletions app/presenters/supergroups/guidance_and_regulation.rb

This file was deleted.

Loading

0 comments on commit 7220dcf

Please sign in to comment.