blacklight-spotlight 0.10.3 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5a0bdc363611ae794c9f8538a86d7c183e6106fd
4
- data.tar.gz: 6eaa6b1112ae5187727f5d55fe8cc8dafd80aa66
3
+ metadata.gz: 5017845fee1b7aec23f0ca3defacc0f32ad5ee02
4
+ data.tar.gz: 0f84e6b1bac2250f6125a7d299718127b596ee40
5
5
  SHA512:
6
- metadata.gz: 076a0d3486082869865b4adbf54613ed42022236890d6c2b60dcd979a65dbc1b4bb61a5294047c2c31d8f424a3d42798fc6cad267bb37016fd20d59337d10eb5
7
- data.tar.gz: 67e395d6f4c102f7549ca82a54f862d0bd97f252e6c0040a48f8577b67ed91ca9cb3a2b2fc39e6b86add8903e10c1e695dc30c445a6f5fbcc9b418d98fe698aa
6
+ metadata.gz: fd56e28a84ec7f003693cce1c62252986002d850bad13745adc812e55faa288983f28c4cdc2bdcb2de3a1ba6d6f8f3b7ca31e161d54e55a621c8eb5faa86b611
7
+ data.tar.gz: 43163422ed9ae1d38cd4a8b56786effebfc3d3e7a6e9f94a28ee99ef98b756efe5a87417f1d7c6ef0e02f86c8d790de0d4606678bde06034281164c6a548a698
@@ -0,0 +1,18 @@
1
+ .btn.collapse-toggle {
2
+ // adjust as needed, taken from bootstrap.css glyphicons
3
+ &:after {
4
+ // symbol for "opening" panels
5
+ color: $text-muted;
6
+ content: "\e114"; // chevron down
7
+ float: right;
8
+ font-family: "Glyphicons Halflings";
9
+ font-size: 0.8em;
10
+ line-height: 2em;
11
+ padding-left: 1ch;
12
+ }
13
+
14
+ &.collapsed:after {
15
+ // symbol for "collapsed" panels
16
+ content: "\e080"; //chevron right
17
+ }
18
+ }
@@ -42,19 +42,25 @@
42
42
  display: inline-block;
43
43
  padding-top: 0;
44
44
  }
45
- }
46
45
 
47
- .panel-heading {
48
46
  .publish-control {
49
47
  display: inline;
50
48
  .checkbox {
51
49
  padding-top: 0;
52
50
  }
53
51
  }
52
+
54
53
  .main {
55
54
  display: inline-block;
56
55
  vertical-align: text-bottom;
57
56
  }
57
+
58
+ .btn-link.collapse-toggle {
59
+ // removing padding and margins to style this button as a simple link
60
+ // with the expected vertical alignment with the rest of the header.
61
+ margin: 0;
62
+ padding: 0;
63
+ }
58
64
  }
59
65
 
60
66
  .panel-heading.page {
@@ -29,6 +29,7 @@
29
29
  @import "spotlight/blacklight_overrides";
30
30
  @import "spotlight/report_a_problem";
31
31
  @import "spotlight/exhibits_index";
32
+ @import "spotlight/collapse_toggle";
32
33
 
33
34
 
34
35
 
@@ -47,7 +47,7 @@ module Spotlight
47
47
 
48
48
  def exhibit_configuration_facet_params
49
49
  @blacklight_configuration.blacklight_config.facet_fields.keys.each_with_object({}) do |element, result|
50
- result[element] = [:show, :label, :weight]
50
+ result[element] = [:show, :label, :weight, :sort]
51
51
  end
52
52
  end
53
53
 
@@ -15,15 +15,23 @@ module Spotlight
15
15
  end
16
16
 
17
17
  def default_thumbnail_jcrop_options
18
+ w, h = Spotlight::Engine.config.featured_image_thumb_size
19
+
18
20
  {
19
21
  croppable: true,
20
22
  selector: 'featuredimage_image',
21
23
  bg_color: 'black',
22
24
  bg_opacity: '.4',
23
25
  box_width: '600',
24
- aspect_ratio: 4.0 / 3.0,
26
+ aspect_ratio: w.to_f / h.to_f,
25
27
  initial_set_select: '[0, 0, 100000, 100000]'
26
28
  }
27
29
  end
30
+
31
+ def default_site_thumbnail_jcrop_options
32
+ w, h = Spotlight::Engine.config.featured_image_square_size
33
+
34
+ default_thumbnail_jcrop_options.merge(aspect_ratio: w.to_f / h.to_f)
35
+ end
28
36
  end
29
37
  end
@@ -11,7 +11,11 @@ module Spotlight
11
11
  end
12
12
 
13
13
  version :thumb, from_version: :cropped do
14
- process resize_to_fill: [400, 300]
14
+ process resize_to_fill: Spotlight::Engine.config.featured_image_thumb_size
15
+ end
16
+
17
+ version :square, from_version: :cropped do
18
+ process resize_to_fill: Spotlight::Engine.config.featured_image_square_size
15
19
  end
16
20
 
17
21
  def store_dir
@@ -39,7 +39,7 @@
39
39
  <div role="tabpanel" class="tab-pane" id="site-thumbnail">
40
40
  <p class="instructions"><%= t(:'.site_thumbnail.help') %></p>
41
41
  <%= f.fields_for(:thumbnail, current_exhibit.thumbnail || current_exhibit.build_thumbnail) do |m| %>
42
- <%= render '/spotlight/featured_images/form', f: m, jcrop_options: default_thumbnail_jcrop_options %>
42
+ <%= render '/spotlight/featured_images/form', f: m, jcrop_options: default_site_thumbnail_jcrop_options %>
43
43
  <% end %>
44
44
  </div>
45
45
 
@@ -0,0 +1,19 @@
1
+ <div class="panel panel-info index-status">
2
+ <div class="panel-heading">
3
+ <h3 class="panel-title">Reindexing status</h3>
4
+ </div>
5
+ <div class="panel-body">
6
+ <p>
7
+ <span class="text-muted">2015-11-24 at 10:53 am:</span> Began reindexing a total of 55 items.
8
+ </p>
9
+ <p>
10
+ <span class="text-muted">2015-11-24 at 11:04 am:</span> Reindexed 32 of 55 items.
11
+ </p>
12
+
13
+ <div class="progress">
14
+ <div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="58" aria-valuemin="0" aria-valuemax="100" style="width: 58%">58%
15
+ <span class="sr-only">Reindexing 58% complete</span>
16
+ </div>
17
+ </div>
18
+ </div>
19
+ </div>
@@ -1,7 +1,7 @@
1
1
  <div class="col-xs-12 col-sm-4 exhibit-card">
2
2
  <div class="flipper">
3
3
  <div class="card-front card-face">
4
- <%= image_tag(exhibit.thumbnail.image.cropped.url) if exhibit.thumbnail.present? %>
4
+ <%= image_tag(exhibit.thumbnail.image.square.url) if exhibit.thumbnail.present? %>
5
5
  <h2 class="card-title"><%= exhibit.title %></h2>
6
6
  </div>
7
7
  <div class="card-back card-face">
@@ -12,7 +12,7 @@
12
12
  <%= facet.hidden_field :weight, 'data-property' => 'weight' %>
13
13
  <%= facet.check_box :show, checked: config.show, label: "", title: key %>
14
14
  <div class="main row">
15
- <div class="col-sm-7">
15
+ <div class="col-sm-5">
16
16
  <h3 class="panel-title" data-in-place-edit-target=".edit-in-place" data-in-place-edit-field-target="[data-edit-field-target='true']">
17
17
  <a href="#edit-in-place" class="field-label edit-in-place"><%= facet_field_label(key) %></a>
18
18
  <%= facet.hidden_field :label, value: facet_field_label(key), class: 'form-control input-sm', data: {:"edit-field-target" => 'true'} %>
@@ -27,6 +27,19 @@
27
27
  <% end %>
28
28
  <% end %>
29
29
  </div>
30
+ <div class="col-sm-2 pull-right">
31
+ <a class="btn btn-link collapse-toggle collapsed" role="button" data-toggle="collapse" href="#<%= key.parameterize %>_facet_options" aria-expanded="false" aria-controls="<%= key.parameterize %>_facet_options">
32
+ Options
33
+ </a>
34
+ </div>
35
+ </div>
36
+ <div id="<%= key.parameterize %>_facet_options" class="options row collapse">
37
+ <div class="col-sm-12">
38
+ <%= facet.form_group :terms, label_col: 'col-md-2', label: { text: t(:'.sort_by.label') } do %>
39
+ <%= facet.radio_button :sort, 'count', label: t(:'.sort_by.count'), inline: true, checked: (config.sort.to_s == 'count' || config.sort.nil?) %>
40
+ <%= facet.radio_button :sort, 'index', label: t(:'.sort_by.index'), inline: true, checked: (config.sort.to_s == 'index') %>
41
+ <% end %>
42
+ </div>
30
43
  </div>
31
44
  </div>
32
45
  </div>
@@ -186,6 +186,10 @@ en:
186
186
  value_count:
187
187
  one: "%{count} unique value"
188
188
  other: "%{count} unique values"
189
+ sort_by:
190
+ label: "Sort by:"
191
+ count: Frequency
192
+ index: Value
189
193
  sort:
190
194
  header: "Sort fields"
191
195
  help: >
@@ -0,0 +1,5 @@
1
+ class AddReindexingFlagToSpotlightResources < ActiveRecord::Migration
2
+ def up
3
+ add_column :spotlight_resources, :reindexing, :boolean
4
+ end
5
+ end
@@ -91,6 +91,8 @@ module Spotlight
91
91
 
92
92
  # Configure the CarrierWave file storage mechanism
93
93
  Spotlight::Engine.config.uploader_storage = :file
94
+ Spotlight::Engine.config.featured_image_thumb_size = [400, 300]
95
+ Spotlight::Engine.config.featured_image_square_size = [400, 400]
94
96
 
95
97
  initializer 'spotlight-assets.initialize' do
96
98
  Rails.application.config.assets.precompile += %w( Jcrop.gif )
@@ -1,4 +1,4 @@
1
1
  #
2
2
  module Spotlight
3
- VERSION = '0.10.3'
3
+ VERSION = '0.11.0'
4
4
  end
@@ -50,8 +50,6 @@ namespace :spotlight do
50
50
  exhibit.save!
51
51
 
52
52
  exhibit.reindex_later
53
-
54
- puts Spotlight::ExhibitExportSerializer.new(exhibit.reload).to_json
55
53
  end
56
54
 
57
55
  desc 'Export an exhibit as JSON'
@@ -82,6 +82,25 @@ feature 'Search Configuration Administration', js: true do
82
82
  expect(page).not_to have_content('Genre')
83
83
  expect(page).to have_content('Topic')
84
84
  end
85
+
86
+ it 'allows the curator to select a different facet sort order' do
87
+ visit spotlight.edit_exhibit_search_configuration_path(exhibit)
88
+ click_link 'Facets'
89
+
90
+ within '.facet-config-genre_ssim' do
91
+ click_link 'Options'
92
+ expect(find(:css, '#blacklight_configuration_facet_fields_genre_ssim_sort_count')).to be_checked
93
+
94
+ choose 'Value'
95
+ end
96
+
97
+ click_button 'Save changes'
98
+
99
+ expect(page).to have_content('The exhibit was successfully updated.')
100
+
101
+ exhibit.reload
102
+ expect(exhibit.blacklight_config.facet_fields['genre_ssim'].sort).to eq 'index'
103
+ end
85
104
  end
86
105
 
87
106
  describe 'results' do
@@ -0,0 +1,35 @@
1
+ require 'spec_helper'
2
+
3
+ describe Spotlight::JcropHelper do
4
+ describe '.default_thumbnail_jcrop_options' do
5
+ it 'produces a 4:3 aspect ratio by default' do
6
+ expect(helper.default_thumbnail_jcrop_options[:aspect_ratio]).to eq 4.0 / 3.0
7
+ end
8
+
9
+ context 'with a custom thumbnail size' do
10
+ before do
11
+ allow(Spotlight::Engine.config).to receive(:featured_image_thumb_size).and_return([7, 5])
12
+ end
13
+
14
+ it 'produces a 7:5 aspect ratio' do
15
+ expect(helper.default_thumbnail_jcrop_options[:aspect_ratio]).to eq 7.0 / 5.0
16
+ end
17
+ end
18
+ end
19
+
20
+ describe '.default_site_thumbnail_jcrop_options' do
21
+ it 'produces a 1:1 aspect ratio by default' do
22
+ expect(helper.default_site_thumbnail_jcrop_options[:aspect_ratio]).to eq 1
23
+ end
24
+
25
+ context 'with a custom square thumbnail size' do
26
+ before do
27
+ allow(Spotlight::Engine.config).to receive(:featured_image_square_size).and_return([3, 2])
28
+ end
29
+
30
+ it 'produces a 3:2 aspect ratio' do
31
+ expect(helper.default_site_thumbnail_jcrop_options[:aspect_ratio]).to eq 3.0 / 2.0
32
+ end
33
+ end
34
+ end
35
+ end
@@ -68,6 +68,17 @@ describe Spotlight::BlacklightConfiguration, type: :model do
68
68
  expect(subject.blacklight_config.facet_fields.keys).to eq %w(c a b)
69
69
  end
70
70
 
71
+ it 'allows the facet sort to be configured' do
72
+ subject.facet_fields['a'] = { sort: 'count' }
73
+ subject.facet_fields['b'] = { sort: 'index' }
74
+
75
+ blacklight_config.add_facet_field 'a'
76
+ blacklight_config.add_facet_field 'b'
77
+
78
+ expect(subject.blacklight_config.facet_fields['a'].sort).to eq 'count'
79
+ expect(subject.blacklight_config.facet_fields['b'].sort).to eq 'index'
80
+ end
81
+
71
82
  context 'custom fields' do
72
83
  it 'includes any custom fields' do
73
84
  allow(subject).to receive_messages(custom_facet_fields: { 'a' => double(if: nil, :if= => true, merge!: true, validate!: true, normalize!: true) })
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.10.3
4
+ version: 0.11.0
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-03 00:00:00.000000000 Z
14
+ date: 2015-12-07 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
@@ -750,6 +750,7 @@ files:
750
750
  - app/assets/stylesheets/spotlight/_bootstrap_overrides.scss
751
751
  - app/assets/stylesheets/spotlight/_browse.scss
752
752
  - app/assets/stylesheets/spotlight/_catalog.scss
753
+ - app/assets/stylesheets/spotlight/_collapse_toggle.scss
753
754
  - app/assets/stylesheets/spotlight/_croppable.scss
754
755
  - app/assets/stylesheets/spotlight/_curation.scss
755
756
  - app/assets/stylesheets/spotlight/_edit_in_place.scss
@@ -1080,6 +1081,7 @@ files:
1080
1081
  - db/migrate/20151117153210_change_spotlight_exhibit_published_default.rb
1081
1082
  - db/migrate/20151124101123_remove_default_from_spotlight_exhibit.rb
1082
1083
  - db/migrate/20151124105543_update_custom_field_names.rb
1084
+ - db/migrate/20151204093112_add_reindexing_flag_to_spotlight_resources.rb
1083
1085
  - lib/blacklight/spotlight.rb
1084
1086
  - lib/generators/spotlight/install_generator.rb
1085
1087
  - lib/generators/spotlight/templates/catalog_controller.rb
@@ -1188,6 +1190,7 @@ files:
1188
1190
  - spec/helpers/spotlight/application_helper_spec.rb
1189
1191
  - spec/helpers/spotlight/browse_helper_spec.rb
1190
1192
  - spec/helpers/spotlight/crud_link_helpers_spec.rb
1193
+ - spec/helpers/spotlight/jcrop_helper_spec.rb
1191
1194
  - spec/helpers/spotlight/main_app_helpers_spec.rb
1192
1195
  - spec/helpers/spotlight/navbar_helper_spec.rb
1193
1196
  - spec/helpers/spotlight/pages_helper_spec.rb
@@ -1418,6 +1421,7 @@ test_files:
1418
1421
  - spec/helpers/spotlight/application_helper_spec.rb
1419
1422
  - spec/helpers/spotlight/browse_helper_spec.rb
1420
1423
  - spec/helpers/spotlight/crud_link_helpers_spec.rb
1424
+ - spec/helpers/spotlight/jcrop_helper_spec.rb
1421
1425
  - spec/helpers/spotlight/main_app_helpers_spec.rb
1422
1426
  - spec/helpers/spotlight/navbar_helper_spec.rb
1423
1427
  - spec/helpers/spotlight/pages_helper_spec.rb