diff --git a/app/assets/stylesheets/legacy_sass/main.sass b/app/assets/stylesheets/legacy_sass/main.sass index 6ebe76b7fe..8e02b84ae9 100644 --- a/app/assets/stylesheets/legacy_sass/main.sass +++ b/app/assets/stylesheets/legacy_sass/main.sass @@ -363,9 +363,6 @@ tr.even td :background #1C3F94 :color white -.preview_search_form - :margin-bottom 10px - #make_live_button :display inline form, div diff --git a/app/assets/stylesheets/sites/_preview.less b/app/assets/stylesheets/sites/_preview.less deleted file mode 100644 index fa52de9639..0000000000 --- a/app/assets/stylesheets/sites/_preview.less +++ /dev/null @@ -1,5 +0,0 @@ -#preview { - ul { - .unstyled(); - } -} diff --git a/app/assets/stylesheets/sites/index.less b/app/assets/stylesheets/sites/index.less index c9bf0e8b2b..3ec9c869b6 100644 --- a/app/assets/stylesheets/sites/index.less +++ b/app/assets/stylesheets/sites/index.less @@ -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'; diff --git a/app/controllers/sites/previews_controller.rb b/app/controllers/sites/previews_controller.rb deleted file mode 100644 index 6541db6df8..0000000000 --- a/app/controllers/sites/previews_controller.rb +++ /dev/null @@ -1,4 +0,0 @@ -class Sites::PreviewsController < Sites::SetupSiteController - def show - end -end diff --git a/app/helpers/sites_helper.rb b/app/helpers/sites_helper.rb index d448308514..e6a15e3ca1 100644 --- a/app/helpers/sites_helper.rb +++ b/app/helpers/sites_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module SitesHelper def site_data { @@ -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' @@ -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 @@ -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 @@ -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]}]" @@ -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 } diff --git a/app/views/layouts/sites.html.haml b/app/views/layouts/sites.html.haml index 79f9c7b3ba..d0d0fb5ecb 100644 --- a/app/views/layouts/sites.html.haml +++ b/app/views/layouts/sites.html.haml @@ -36,7 +36,4 @@ .modal-body = modal_close_button .modal-content - - if @site && !@site.force_mobile_format? - #preview-container.modal.fade(data-no-turbolink){ 'aria-hidden' => 'true' } - = render partial: 'sites/shared/modal' = javascript_include_tag 'font-awesome-grunticon-rails' diff --git a/app/views/sites/previews/show.html.haml b/app/views/sites/previews/show.html.haml deleted file mode 100644 index da5c1f5aab..0000000000 --- a/app/views/sites/previews/show.html.haml +++ /dev/null @@ -1,10 +0,0 @@ -= content_for_site_page_title @site, 'RSS Feed' -.sub-nav-heading - %h2 Preview - .action-bar -.l-inner-content - #preview - %ul - = list_item_with_link_to_preview_serp 'View Staged Page', @site, { staged: true } - = list_item_with_link_to_preview_serp 'View Current Page', @site - = list_item_with_link_to_preview_serp 'View Redesigned Page', @site, { m: true } diff --git a/app/views/sites/shared/_site_nav.html.haml b/app/views/sites/shared/_site_nav.html.haml index b4e09324b0..d5d4f8a7e4 100644 --- a/app/views/sites/shared/_site_nav.html.haml +++ b/app/views/sites/shared/_site_nav.html.haml @@ -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? diff --git a/config/routes.rb b/config/routes.rb index 687386012d..53c6946c80 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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, diff --git a/features/admin_center_dashboard.feature b/features/admin_center_dashboard.feature index 4081cb35f6..f902c86d56 100644 --- a/features/admin_center_dashboard.feature +++ b/features/admin_center_dashboard.feature @@ -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 "john@agency.gov" - 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" diff --git a/features/support/selectors.rb b/features/support/selectors.rb index 3042d43ea8..ef5e7a8c6d 100644 --- a/features/support/selectors.rb +++ b/features/support/selectors.rb @@ -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/ diff --git a/spec/helpers/sites_helper_spec.rb b/spec/helpers/sites_helper_spec.rb index cf74ac8e9a..a15bd75f76 100644 --- a/spec/helpers/sites_helper_spec.rb +++ b/spec/helpers/sites_helper_spec.rb @@ -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') } @@ -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 @@ -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 @@ -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) }