diff --git a/app/assets/javascripts/modules/track-links.js b/app/assets/javascripts/modules/track-links.js deleted file mode 100644 index 6dc2f097c..000000000 --- a/app/assets/javascripts/modules/track-links.js +++ /dev/null @@ -1,31 +0,0 @@ -window.GOVUK = window.GOVUK || {} -window.GOVUK.Modules = window.GOVUK.Modules || {}; - -(function (Modules) { - function TrackLinks () { } - - TrackLinks.prototype.start = function ($element) { - $element = $element[0] - var category = $element.getAttribute('data-track-links-category') - var links = $element.querySelectorAll('a') - - for (var i = 0; i < links.length; i++) { - links[i].addEventListener('click', function (event) { - this.sendLinkClickEvent(event, category) - }.bind(this)) - } - } - - TrackLinks.prototype.sendLinkClickEvent = function (event, category) { - window.GOVUK.analytics.trackEvent( - category, - event.target.innerText, - { - transport: 'beacon', - label: event.target.getAttribute('href') - } - ) - } - - Modules.TrackLinks = TrackLinks -})(window.GOVUK.Modules) diff --git a/app/controllers/content_items_controller.rb b/app/controllers/content_items_controller.rb index 00e373c73..3dcbd998d 100644 --- a/app/controllers/content_items_controller.rb +++ b/app/controllers/content_items_controller.rb @@ -117,16 +117,11 @@ def format_banner_links(links, type) end def content_item_template - return "briefing" if is_briefing? return "guide_single" if @content_item.render_guide_as_single_page? @content_item.schema_name end - def is_briefing? - @content_item.content_id == "3d66e959-72d2-417d-89c1-00cd72eea30f" - end - def render_template if @content_item.requesting_a_part? && !@content_item.has_valid_part? redirect_to @content_item.base_path diff --git a/app/views/content_items/briefing.html.erb b/app/views/content_items/briefing.html.erb deleted file mode 100644 index 8c2cd02e3..000000000 --- a/app/views/content_items/briefing.html.erb +++ /dev/null @@ -1,28 +0,0 @@ -
-
- <%= render 'govuk_publishing_components/components/title', title: @content_item.title %> -
-
- <%= render 'govuk_publishing_components/components/lead_paragraph', text: @content_item.description %> -
-
- -
-
-
- <%= render "govuk_publishing_components/components/govspeak", { - direction: page_text_direction, - } do %> - <%= raw(@content_item.body) %> - <% end %> -
- -
- <%= render 'govuk_publishing_components/components/share_links', - links: @content_item.share_links, - track_as_sharing: true, - title: t('components.share_links.share_this_page') - %> -
-
-
diff --git a/spec/javascripts/modules/track-links.js b/spec/javascripts/modules/track-links.js deleted file mode 100644 index ba6eaa663..000000000 --- a/spec/javascripts/modules/track-links.js +++ /dev/null @@ -1,66 +0,0 @@ -var GOVUK = window.GOVUK - -describe('Track Links', function () { - var tracker - var element - - beforeEach(function () { - spyOn(GOVUK.analytics, 'trackEvent') - }) - - afterEach(function () { - if (GOVUK.analytics.trackEvent.calls) { - GOVUK.analytics.trackEvent.calls.reset() - } - }) - - describe('Single link', function () { - beforeEach(function () { - element = document.createElement('div') - element.setAttribute('data-track-links-category', 'Content page 1') - element.innerHTML = 'Blahh' - - tracker = new GOVUK.Modules.TrackLinks() - tracker.start($(element)) - }) - - it('sends a ga event when link is clicked', function () { - element.querySelector('a').dispatchEvent(new window.Event('click')) - - expect(GOVUK.analytics.trackEvent).toHaveBeenCalledWith( - 'Content page 1', 'Blahh', { transport: 'beacon', label: '/blah/blahhhh' } - ) - }) - }) - - describe('Multiple links', function () { - beforeEach(function () { - element = document.createElement('div') - element.setAttribute('data-track-links-category', 'Content page 2') - element.innerHTML = 'Blahh' - element.innerHTML += 'Blahh2' - element.innerHTML += 'External link blahhh' - - tracker = new GOVUK.Modules.TrackLinks() - tracker.start($(element)) - }) - - it('sends ga events for all links clicked', function () { - element - .querySelectorAll('a') - .forEach(function (link) { - link.dispatchEvent(new window.Event('click')) - }) - - expect(GOVUK.analytics.trackEvent).toHaveBeenCalledWith( - 'Content page 2', 'Blahh', { transport: 'beacon', label: '/blah/blahhhh' } - ) - expect(GOVUK.analytics.trackEvent).toHaveBeenCalledWith( - 'Content page 2', 'Blahh2', { transport: 'beacon', label: '/blah/blahhhh2' } - ) - expect(GOVUK.analytics.trackEvent).toHaveBeenCalledWith( - 'Content page 2', 'External link blahhh', { transport: 'beacon', label: 'https://www.external-link.com' } - ) - }) - }) -}) diff --git a/test/controllers/content_items_controller_test.rb b/test/controllers/content_items_controller_test.rb index 150316118..73fe1b2ca 100644 --- a/test/controllers/content_items_controller_test.rb +++ b/test/controllers/content_items_controller_test.rb @@ -366,25 +366,6 @@ class ContentItemsControllerTest < ActionController::TestCase assert_equal response.headers["Access-Control-Allow-Origin"], "*" end - test "renders briefing view correctly" do - content_item = content_store_has_schema_example("news_article", "news_article") - content_item["content_id"] = "3d66e959-72d2-417d-89c1-00cd72eea30f" - stub_content_store_has_item(content_item["base_path"], content_item) - - get :show, params: { path: path_for(content_item) } - assert_response :success - assert_select ".gem-c-title", content_item["title"] - assert_select ".gem-c-lead-paragraph", content_item["description"] - assert_select ".gem-c-govspeak" - assert_select ".gem-c-share-links" - assert_select ".gem-c-title .gem-c-title__context", false - assert_select ".metadata-logo-wrapper", false - assert_select ".app-c-figure", false - assert_select ".gem-c-contextual-sidebar", false - assert_select ".gem-c-metadata__definition", false - assert_select ".gem-c-contextual-footer", false - end - def path_for(content_item, locale = nil) base_path = content_item["base_path"].sub(/^\//, "") base_path.gsub!(/\.#{locale}$/, "") if locale