Skip to content

Commit

Permalink
SRCH-2059 remove admin center legacy/search consumer SERP previews (#721
Browse files Browse the repository at this point in the history
)
  • Loading branch information
MothOnMars authored May 4, 2021
1 parent 1043861 commit efb7b8b
Show file tree
Hide file tree
Showing 12 changed files with 11 additions and 95 deletions.
3 changes: 0 additions & 3 deletions app/assets/stylesheets/legacy_sass/main.sass
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,6 @@ tr.even td
:background #1C3F94
:color white

.preview_search_form
:margin-bottom 10px

#make_live_button
:display inline
form, div
Expand Down
5 changes: 0 additions & 5 deletions app/assets/stylesheets/sites/_preview.less

This file was deleted.

1 change: 0 additions & 1 deletion app/assets/stylesheets/sites/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
@import 'sites/modules/_type.less';
@import 'sites/modules/_tables.less';

@import 'sites/_preview.less';
@import 'sites/_site_navbar.less';
@import 'sites/_site_header.less';
@import 'sites/_site_nav.less';
Expand Down
4 changes: 0 additions & 4 deletions app/controllers/sites/previews_controller.rb

This file was deleted.

31 changes: 4 additions & 27 deletions app/helpers/sites_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module SitesHelper
def site_data
{
Expand All @@ -22,7 +24,7 @@ def daily_snapshot_toggle(membership)
return if membership.nil?
description_class = 'description label off-screen-text'
if membership.gets_daily_snapshot_email?
description_class << ' label-warning'
description_class += ' label-warning'
verb = 'Stop sending'
else
verb = 'Send'
Expand Down Expand Up @@ -94,16 +96,6 @@ def main_nav_css_class_hash(nav_controllers)
nav_controllers.include?(controller_name) ? {class: 'active'} : {}
end

def preview_main_nav_item(site, title)
if site.search_consumer_search_enabled
main_nav_item title, search_consumer_search_url(affiliate: site.name), 'fa-eye', [], target: '_blank'
elsif site.force_mobile_format?
main_nav_item title, search_url(affiliate: site.name), 'fa-eye', [], target: '_blank'
else
main_nav_item title, site_preview_path(site), 'fa-eye', [], preview_serp_link_options
end
end

def site_activate_search_controllers
%w[api_access_keys
api_instructions
Expand Down Expand Up @@ -152,15 +144,6 @@ def supported_locale_options
special_treatment + others
end

def list_item_with_link_to_preview_serp(title, site, options = {})
return if options[:staged].present? and !site.has_staged_content?

content_tag :li do
link_options = { affiliate: site.name, query: 'gov' }.merge options
link_to title, search_url(link_options), target: '_blank'
end
end

def link_to_add_new_boosted_content_keyword(title, site, boosted_content)
instrumented_link_to title, new_keyword_site_best_bets_texts_path(site), boosted_content.boosted_content_keywords.length, 'keyword'
end
Expand All @@ -169,13 +152,6 @@ def link_to_add_new_featured_collection_keyword(title, site, featured_collection
instrumented_link_to title, new_keyword_site_best_bets_graphics_path(site), featured_collection.featured_collection_keywords.length, 'keyword'
end

def preview_serp_link_options
{ class: 'modal-page-viewer-link',
'data-modal-container' => '#preview-container',
'data-modal-content-selector' => '#preview',
'data-modal-title' => content_tag(:h1, 'Preview Search Results') }
end

def query_times(top_query, sees_filtered_totals)
index = sees_filtered_totals ? 2 : 1
"#{top_query[0]} [#{top_query[index]}]"
Expand All @@ -193,6 +169,7 @@ def user_row_css_class_hash(user)
row_class ? { class: row_class } : {}
end

# deprecated - Search Consumer
def generate_jwt(site)
expiration = Time.now.to_i + 4 * 3600
payload = {affiliateName: site.name, :expiration => expiration }
Expand Down
3 changes: 0 additions & 3 deletions app/views/layouts/sites.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,4 @@
.modal-body
= modal_close_button
.modal-content
- if @site && [email protected]_mobile_format?
#preview-container.modal.fade(data-no-turbolink){ 'aria-hidden' => 'true' }
= render partial: 'sites/shared/modal'
= javascript_include_tag 'font-awesome-grunticon-rails'
10 changes: 0 additions & 10 deletions app/views/sites/previews/show.html.haml

This file was deleted.

2 changes: 1 addition & 1 deletion app/views/sites/shared/_site_nav.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
= main_nav_item 'Analytics', new_site_queries_path(@site), 'fa-bar-chart', site_analytics_controllers
= main_nav_item 'Content', site_content_path(@site), 'fa-file', site_manage_content_controllers
= main_nav_item 'Display', edit_site_display_path(@site), 'fa-desktop', site_manage_display_controllers
= preview_main_nav_item @site, 'Preview'
= main_nav_item 'Preview', search_path(affiliate: @site.name), 'fa-eye', [], target: '_blank'
= main_nav_item 'Activate', site_embed_code_path(@site), 'fa-code', site_activate_search_controllers
.l-site-nav.sub
- if @site.nil? || @site.new_record?
Expand Down
1 change: 0 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@
end
end
resource :monthly_reports, only: [:show]
resource :preview, only: [:show]
resource :setting, only: [:edit, :update]
resource :clone, only: [:new, :create]
resource :supplemental_feed,
Expand Down
11 changes: 2 additions & 9 deletions features/admin_center_dashboard.feature
Original file line number Diff line number Diff line change
Expand Up @@ -190,16 +190,9 @@ Feature: Dashboard
@javascript
Scenario: Preview
Given the following Affiliates exist:
| display_name | name | contact_email | first_name | last_name | has_staged_content | uses_managed_header_footer | staged_uses_managed_header_footer | header | staged_header | website | force_mobile_format |
| agency site | legacy.agency.gov | john@agency.gov | John | Bar | true | false | false | live header text | staged header text | http://www.agency.gov | false |
| agency site | www.agency.gov | john@agency.gov | John | Bar | true | false | false | live header text | staged header text | http://www.agency.gov | true |
| display_name | name | contact_email | first_name | last_name | website |
| agency site | www.agency.gov | john@agency.gov | John | Bar | http://www.agency.gov |
And I am logged in with email "[email protected]"
When I go to the legacy.agency.gov's Dashboard page
And I follow "Preview" within the Admin Center main navigation list
Then I should find "View Staged Page" in the Preview modal
And I should find "View Current Page" in the Preview modal
And I should find "View Redesigned Page" in the Preview modal

When I go to the www.agency.gov's Dashboard page
And I follow "Preview"
Then I should see a link to "Preview" with url that ends with "/search?affiliate=www.agency.gov"
Expand Down
2 changes: 0 additions & 2 deletions features/support/selectors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ def selector_for(locator)
'#url-prefixes .modal-body .url-prefixes'
when /the RSS URLs modal/
'#urls .modal-body .urls'
when /the Preview modal/
'#preview-container .modal-body #preview'
when /the RSS URL last crawl status error message/
'.urls .error .last-crawl-status.in'
when /the Supplemental URL last crawl status error message/
Expand Down
33 changes: 4 additions & 29 deletions spec/helpers/sites_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require 'spec_helper'
# frozen_string_literal: true

describe SitesHelper do

describe '#site_select' do
let(:active_affiliate) { mock_model(Affiliate, display_name: 'Active', name: 'active') }
let(:inactive_affiliate) { mock_model(Affiliate, display_name: 'Inactive', name: 'Inactive') }
Expand All @@ -11,7 +10,8 @@

before do
allow(helper).to receive(:current_user).and_return(user)
allow(user).to receive(:affiliates).and_return([active_affiliate,inactive_affiliate])
allow(user).to receive(:affiliates).
and_return([active_affiliate, inactive_affiliate])
end

it 'returns a drop-down for all affiliates' do
Expand All @@ -36,7 +36,7 @@

describe '#daily_snapshot_toggle(membership)' do
context 'when membership is nil' do
it 'should return nil' do
it 'returns nil' do
expect(helper.daily_snapshot_toggle(nil)).to be_nil
end
end
Expand All @@ -56,31 +56,6 @@
end
end

describe 'preview_main_nav_item' do
let(:affiliate) { mock_model(Affiliate, name: 'somename', search_consumer_search_enabled: dese, force_mobile_format?: fmf) }
let(:subject) { helper.preview_main_nav_item(affiliate, 'sometitle') }

context 'when the search_consumer_search_enabled flag is true' do
let(:dese) { true }
let(:fmf) { false }
specify { expect(subject).to eq(main_nav_item 'sometitle', search_consumer_search_url(affiliate: affiliate.name), 'fa-eye', [], target: '_blank') }
end

context 'when the search_consumer_search_enabled flag is false' do
let(:dese) { false }

context 'when the force_mobile_format flag is true' do
let(:fmf) { true }
specify { expect(subject).to eq(main_nav_item 'sometitle', search_url(affiliate: affiliate.name), 'fa-eye', [], target: '_blank') }
end

context 'when the force_mobile_format flag is false' do
let(:fmf) { false }
specify { expect(subject).to eq(main_nav_item 'sometitle', site_preview_path(affiliate), 'fa-eye', [], preview_serp_link_options) }
end
end
end

describe '#generate_jwt' do
let(:affiliate) { mock_model(Affiliate, id: 491, name: 'somename', display_name: 'Somename Displayed', api_access_key: 'somekey') }
let(:subject) { helper.generate_jwt(affiliate) }
Expand Down

0 comments on commit efb7b8b

Please sign in to comment.