blacklight-spotlight 0.14.1 → 0.14.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b0aefec4ae05cfb0ff575bc3f774e69f8e949757
4
- data.tar.gz: 2bf34ba4683b051d523cb98e461e96fa2cad2149
3
+ metadata.gz: b22ac299ef75ed65fdbf1db182d8ffdd7c0fb955
4
+ data.tar.gz: 2a309cdf19b962204d101ccb949ee9dc3a9ea5f7
5
5
  SHA512:
6
- metadata.gz: e6e7e9d9b16f7267bb1862edc08be110799329d727cdf4d6e208e70af90442c665733aaa3d750dd26c26215a456dc04c9a22e53d711e2c9358cc385194fef93f
7
- data.tar.gz: 44143ac2594a25f1b191c8117bd986b90d593bb7d95c36d6fe0b04f20d8e89665551ac3ce8373115c2cf1e957fb8b5ff015e34de1bbd6f6de51dcc29592c4381
6
+ metadata.gz: 44cf9fb4a4c7550722d1b3ff8d3d9f5aaa69e515089b55739899cea0fafe93d33f0f413cafa61480dd221d2c60b3d1097fcf316b319ba05122f37a7970d04fb4
7
+ data.tar.gz: 9285521d65457583d865917083633faefc00dd9413120ee6e4182a655964f8fa13cada3f1d1975f404765ee20157b0eb17b39c1165b670ae97e4376d72c1d7d0
@@ -38,10 +38,6 @@ module SirTrevorRails
38
38
  def display_item_counts?
39
39
  send(:'display-item-counts') == 'true'
40
40
  end
41
-
42
- def item_count(category)
43
- solr_helper.search_results(category.query_params, solr_helper.search_params_logic).first['response']['numFound']
44
- end
45
41
  end
46
42
  end
47
43
  end
@@ -12,6 +12,7 @@ module Spotlight
12
12
  extend FriendlyId
13
13
  friendly_id :title, use: [:slugged, :finders]
14
14
  validates :title, presence: true
15
+ validates :slug, uniqueness: true
15
16
 
16
17
  default_scope { order('weight ASC') }
17
18
 
@@ -56,8 +57,6 @@ module Spotlight
56
57
  after_create :initialize_main_navigation
57
58
  include Spotlight::DefaultThumbnailable
58
59
 
59
- scope :published, -> { where(published: true) }
60
-
61
60
  def main_about_page
62
61
  @main_about_page ||= about_pages.published.first
63
62
  end
@@ -7,7 +7,8 @@ module Spotlight
7
7
 
8
8
  belongs_to :masthead, dependent: :destroy
9
9
 
10
- accepts_nested_attributes_for :masthead, :exhibits
10
+ accepts_nested_attributes_for :masthead, update_only: true
11
+ accepts_nested_attributes_for :exhibits
11
12
 
12
13
  def self.instance
13
14
  first || create
@@ -1,6 +1,8 @@
1
1
  <% if can?(:manage, Spotlight::Site.instance) || can?(:create, Spotlight::Exhibit) %>
2
2
  <h4 class="nav-heading"><%=t(:'.header') %></h4>
3
3
  <ul class="nav sidenav">
4
+ <li><%= link_to t('.documentation'), 'https://github.com/sul-dlss/spotlight/wiki/Configuration-settings' %></li>
5
+
4
6
  <% if can? :manage, Spotlight::Site.instance %>
5
7
  <li><%= link_to t(:'spotlight.sites.edit.section'), spotlight.edit_site_path %></li>
6
8
  <% end %>
@@ -2,7 +2,7 @@
2
2
  <div id="content" class="col-md-9">
3
3
  <%= configuration_page_title %>
4
4
 
5
- <%= bootstrap_form_for @exhibit, url: spotlight.exhibit_appearance_path(@exhibit), layout: :horizontal, label_col: 'col-md-3', control_col: 'col-sm-5', html: {data: { autocomplete_exhibit_catalog_index_path: spotlight.autocomplete_exhibit_catalog_index_path(current_exhibit, q: "%QUERY", format: "json") } } do |f| %>
5
+ <%= bootstrap_form_for @exhibit, url: spotlight.exhibit_appearance_path(@exhibit), layout: :horizontal, label_col: 'col-md-3 col-sm-3', control_col: 'col-md-5 col-sm-5', html: {data: { autocomplete_exhibit_catalog_index_path: spotlight.autocomplete_exhibit_catalog_index_path(current_exhibit, q: "%QUERY", format: "json") } } do |f| %>
6
6
  <% if @exhibit.errors.any? %>
7
7
  <div id="error_explanation">
8
8
  <h2><%= pluralize(@exhibit.errors.count, "error") %> prohibited this page from being saved:</h2>
@@ -1,5 +1,5 @@
1
1
  <div id="content" class="col-md-9">
2
- <%= bootstrap_form_for @contact_form, url: spotlight.exhibit_contact_form_path(current_exhibit, @contact_form), layout: :horizontal, label_col: 'col-md-3', control_col: 'col-sm-5' do |f| %>
2
+ <%= bootstrap_form_for @contact_form, url: spotlight.exhibit_contact_form_path(current_exhibit, @contact_form), layout: :horizontal, label_col: 'col-md-3 col-sm-3', control_col: 'col-sm-5 col-md-5' do |f| %>
3
3
  <h1 class="page-title"><%= t(:'.header') %></h1>
4
4
  <div class="row">
5
5
  <%= f.text_field :name %>
@@ -1,7 +1,7 @@
1
1
  <%= render 'spotlight/shared/exhibit_sidebar' %>
2
2
  <div id="content" class="col-md-9">
3
3
  <%= configuration_page_title %>
4
- <%= bootstrap_form_for @blacklight_configuration, url: spotlight.exhibit_metadata_configuration_path(@exhibit), layout: :horizontal, label_col: 'col-md-3', control_col: 'col-sm-5' do |f| %>
4
+ <%= bootstrap_form_for @blacklight_configuration, url: spotlight.exhibit_metadata_configuration_path(@exhibit), layout: :horizontal, label_col: 'col-md-3 col-sm-3', control_col: 'col-md-5 col-sm-5' do |f| %>
5
5
  <h3><%= t(:'.order_header') %></h3>
6
6
 
7
7
  <p class="instructions"><%= t :'.instructions' %></p>
@@ -1,7 +1,7 @@
1
1
  <%= render 'spotlight/shared/exhibit_sidebar' %>
2
2
  <div id="content" class="col-md-9">
3
3
  <%= configuration_page_title %>
4
- <%= bootstrap_form_for @blacklight_configuration, url: spotlight.exhibit_search_configuration_path(@exhibit), layout: :horizontal, label_col: 'col-md-3', control_col: 'col-sm-5' do |f| %>
4
+ <%= bootstrap_form_for @blacklight_configuration, url: spotlight.exhibit_search_configuration_path(@exhibit), layout: :horizontal, label_col: 'col-md-3 col-sm-3', control_col: 'col-md-5 col-sm-5' do |f| %>
5
5
 
6
6
  <div role="tabpanel">
7
7
  <ul class="nav nav-tabs" role="tablist">
@@ -1,4 +1,4 @@
1
- <%= bootstrap_form_for [@search.exhibit, @search], layout: :horizontal, label_col: 'col-md-2', control_col: 'col-sm-7', data: {form_observer: 'true', autocomplete_exhibit_catalog_index_path: spotlight.autocomplete_exhibit_search_path(@search.exhibit, @search, q: "%QUERY", format: "json")}, html: {id: 'edit-search'} do |f| %>
1
+ <%= bootstrap_form_for [@search.exhibit, @search], layout: :horizontal, label_col: 'col-md-2 col-sm-2', control_col: 'col-md-7 col-sm-7', data: {form_observer: 'true', autocomplete_exhibit_catalog_index_path: spotlight.autocomplete_exhibit_search_path(@search.exhibit, @search, q: "%QUERY", format: "json")}, html: {id: 'edit-search'} do |f| %>
2
2
  <% if @search.errors.any? %>
3
3
  <div id="error_explanation">
4
4
  <h2><%= pluralize(@search.errors.count, "error") %> prohibited this page from being saved:</h2>
@@ -12,7 +12,7 @@
12
12
  </p>
13
13
 
14
14
  <% if browse_block.display_item_counts? %>
15
- <span class="item-count"><%= pluralize(browse_block.item_count(search), 'item') %></span>
15
+ <span class="item-count"><%= t(:'.items', count: search.documents.size) %></span>
16
16
  <% end %>
17
17
  </div>
18
18
  </div>
@@ -404,6 +404,12 @@ en:
404
404
  help: >
405
405
  You can select and crop an image to visually represent this page. It will be
406
406
  used as the thumbnail image if you include this page using the 'Highlight Featured Pages' widget.
407
+ sir_trevor:
408
+ blocks:
409
+ browse_block:
410
+ items:
411
+ one: "%{count} item"
412
+ other: "%{count} items"
407
413
  contacts:
408
414
  edit:
409
415
  header: "Edit Contact"
@@ -601,3 +607,4 @@ en:
601
607
  site_sidebar:
602
608
  header: Actions
603
609
  create_exhibit: 'Create a new exhibit'
610
+ documentation: 'Curator documentation'
@@ -1,4 +1,4 @@
1
1
  #
2
2
  module Spotlight
3
- VERSION = '0.14.1'
3
+ VERSION = '0.14.2'
4
4
  end
@@ -44,4 +44,21 @@ describe 'Create a new exhibit', type: :feature do
44
44
  expect(page).to have_content 'The exhibit was created.'
45
45
  expect(Spotlight::Exhibit.last.slug).to eq 'custom-slug'
46
46
  end
47
+
48
+ it 'fails validation if the slug is already used' do
49
+ visit spotlight.new_exhibit_path
50
+
51
+ fill_in 'Title', with: 'My exhibit title'
52
+ fill_in 'URL slug', with: 'custom-slug'
53
+
54
+ click_button 'Save'
55
+
56
+ visit spotlight.new_exhibit_path
57
+
58
+ fill_in 'Title', with: 'My exhibit title'
59
+ fill_in 'URL slug', with: 'custom-slug'
60
+
61
+ click_button 'Save'
62
+ expect(page).to have_content 'has already been taken'
63
+ end
47
64
  end
@@ -26,6 +26,26 @@ describe 'Add and update the site masthead', type: :feature do
26
26
  expect(field_labeled('Show background image in masthead')).to be_checked
27
27
  end
28
28
  end
29
+
30
+ it 'idempotently updates the site masthead options' do
31
+ visit spotlight.edit_site_path
32
+
33
+ click_link 'Site masthead'
34
+
35
+ within '#site-masthead' do
36
+ check 'Show background image in masthead'
37
+ attach_file('site_masthead_attributes_image', File.absolute_path(File.join(FIXTURES_PATH, 'avatar.png')))
38
+ end
39
+
40
+ click_button 'Save changes'
41
+
42
+ expect(page).to have_content('The site was successfully updated.')
43
+
44
+ visit spotlight.edit_site_path
45
+ click_link 'Site masthead'
46
+ click_button 'Save changes'
47
+ expect(page).to have_css('.image-masthead .background-container')
48
+ end
29
49
  it 'displays a masthead image when one is uploaded and configured' do
30
50
  visit spotlight.edit_site_path
31
51
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight-spotlight
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.1
4
+ version: 0.14.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Beer
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2015-12-17 00:00:00.000000000 Z
14
+ date: 2015-12-18 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails