Skip to content

Commit

Permalink
Merge pull request #612 from sul-dlss/widget-restrict
Browse files Browse the repository at this point in the history
Restrict search results widget on home page and to a single instance elsewhere
  • Loading branch information
cbeer committed Apr 6, 2014
2 parents c974a13 + 514e66d commit aa2d0a4
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/assets/javascripts/spotlight/pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ Spotlight.onLoad(function(){
el: instance,
onEditorRender: function() {
serializeObservedForms(observedForms());
},
blockTypeLimits: {
"SearchResults": 1
}
});
}
Expand Down
6 changes: 6 additions & 0 deletions app/assets/stylesheets/spotlight/_sir-trevor.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,10 @@
padding: 5px;
margin-bottom: 10px;
border-bottom: 1px solid #D4D4D4;
}

.blacklight-home_pages-edit {
[data-type="search_results"] {
display: none;
}
}
18 changes: 18 additions & 0 deletions spec/features/javascript/home_page_edit_spec.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit aa2d0a4

Please sign in to comment.