From 8a37797d800585da0d98220a7fa268cd102f4a6e Mon Sep 17 00:00:00 2001 From: Jessie Keck Date: Fri, 4 Apr 2014 16:47:35 -0700 Subject: [PATCH 1/2] Don't allow the search results widget to be on the home page. --- .../stylesheets/spotlight/_sir-trevor.css.scss | 6 ++++++ .../features/javascript/home_page_edit_spec.rb | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 spec/features/javascript/home_page_edit_spec.rb diff --git a/app/assets/stylesheets/spotlight/_sir-trevor.css.scss b/app/assets/stylesheets/spotlight/_sir-trevor.css.scss index f805714e1..ecba39210 100644 --- a/app/assets/stylesheets/spotlight/_sir-trevor.css.scss +++ b/app/assets/stylesheets/spotlight/_sir-trevor.css.scss @@ -4,4 +4,10 @@ padding: 5px; margin-bottom: 10px; border-bottom: 1px solid #D4D4D4; +} + +.blacklight-home_pages-edit { + [data-type="search_results"] { + display: none; + } } \ No newline at end of file diff --git a/spec/features/javascript/home_page_edit_spec.rb b/spec/features/javascript/home_page_edit_spec.rb new file mode 100644 index 000000000..d3cd91a24 --- /dev/null +++ b/spec/features/javascript/home_page_edit_spec.rb @@ -0,0 +1,18 @@ +require "spec_helper" + +feature "Editing the Home Page", js: true do + let(:exhibit) { FactoryGirl.create(:exhibit) } + let(:admin) { FactoryGirl.create(:exhibit_admin, exhibit: exhibit) } + + before { login_as admin } + + it "should not have a search results widget" do + pending("Passing locally but Travis is throwing intermittent errors") if ENV["CI"] + visit spotlight.edit_exhibit_home_page_path(exhibit) + find("[data-icon='add']").click + within("[data-icon='add']") do + expect(page).to have_css("[data-type='text']") + expect(page).not_to have_css("[data-type='search_results']", visible: true) + end + end +end \ No newline at end of file From 514e66dceee4e1b9a8c0eaf946bae5dcb992632e Mon Sep 17 00:00:00 2001 From: Jessie Keck Date: Fri, 4 Apr 2014 16:48:16 -0700 Subject: [PATCH 2/2] Limit search result block to a single instance on the page. --- app/assets/javascripts/spotlight/pages.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/assets/javascripts/spotlight/pages.js b/app/assets/javascripts/spotlight/pages.js index 7c83a0232..e843aa18c 100644 --- a/app/assets/javascripts/spotlight/pages.js +++ b/app/assets/javascripts/spotlight/pages.js @@ -33,6 +33,9 @@ Spotlight.onLoad(function(){ el: instance, onEditorRender: function() { serializeObservedForms(observedForms()); + }, + blockTypeLimits: { + "SearchResults": 1 } }); }