blacklight 4.1.0 → 4.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.gitignore +2 -3
- data/{test_support/.rspec → .rspec} +0 -0
- data/.travis.yml +4 -4
- data/Rakefile +8 -0
- data/VERSION +1 -1
- data/app/assets/javascripts/blacklight/checkbox_submit.js +1 -1
- data/app/controllers/bookmarks_controller.rb +2 -2
- data/app/helpers/blacklight/facets_helper_behavior.rb +17 -15
- data/app/views/layouts/blacklight.html.erb +0 -1
- data/blacklight.gemspec +2 -1
- data/config/jetty.yml +4 -0
- data/{test_support/features → features}/bookmarks.feature +0 -0
- data/{test_support/features → features}/did_you_mean.feature +0 -0
- data/{test_support/features → features}/librarian_view.feature +0 -0
- data/{test_support/features → features}/record_view.feature +0 -0
- data/{test_support/features → features}/saved_searches.feature +0 -0
- data/{test_support/features → features}/search.feature +0 -0
- data/{test_support/features → features}/search_filters.feature +0 -0
- data/{test_support/features → features}/search_history.feature +0 -0
- data/{test_support/features → features}/search_pagination.feature +0 -0
- data/{test_support/features → features}/search_results.feature +0 -0
- data/{test_support/features → features}/search_sort.feature +0 -0
- data/{test_support/features → features}/step_definitions/bookmarks_steps.rb +0 -0
- data/{test_support/features → features}/step_definitions/error_steps.rb +0 -0
- data/{test_support/features → features}/step_definitions/general_steps.rb +0 -0
- data/{test_support/features → features}/step_definitions/record_view_steps.rb +0 -0
- data/{test_support/features → features}/step_definitions/saved_searches_steps.rb +0 -0
- data/{test_support/features → features}/step_definitions/search_facets_steps.rb +0 -0
- data/{test_support/features → features}/step_definitions/search_history_steps.rb +0 -0
- data/{test_support/features → features}/step_definitions/search_pagination_steps.rb +0 -0
- data/{test_support/features → features}/step_definitions/search_result_steps.rb +0 -0
- data/{test_support/features → features}/step_definitions/search_steps.rb +0 -0
- data/{test_support/features → features}/step_definitions/user_steps.rb +0 -0
- data/{test_support/features → features}/step_definitions/web_steps.rb +0 -0
- data/{test_support/features → features}/support/env.rb +0 -0
- data/{test_support/features → features}/support/paths.rb +0 -0
- data/{test_support/features → features}/support/selectors.rb +0 -0
- data/lib/railties/blacklight_cucumber.rake +1 -1
- data/{test_support/spec → spec}/controllers/application_controller_spec.rb +0 -0
- data/spec/controllers/bookmarks_controller_spec.rb +42 -0
- data/{test_support/spec → spec}/controllers/catalog_controller_spec.rb +0 -0
- data/{test_support/spec → spec}/controllers/search_history_controller_spec.rb +0 -0
- data/{test_support/spec → spec}/data/sample_docs.yml +0 -0
- data/{test_support/spec → spec}/data/test_data.utf8.mrc +0 -0
- data/{test_support/spec → spec}/helpers/blacklight_helper_spec.rb +0 -0
- data/{test_support/spec → spec}/helpers/catalog_helper_spec.rb +0 -0
- data/{test_support/spec → spec}/helpers/facets_helper_spec.rb +31 -4
- data/{test_support/spec → spec}/helpers/hash_as_hidden_fields_spec.rb +0 -0
- data/{test_support/spec → spec}/helpers/html_head_helper_spec.rb +0 -0
- data/{test_support/spec → spec}/helpers/render_constraints_helper_spec.rb +0 -0
- data/{test_support/spec → spec}/helpers/search_history_constraints_helper_spec.rb +0 -0
- data/{test_support/spec → spec}/lib/blacklight_configurable_spec.rb +0 -0
- data/{test_support/spec → spec}/lib/blacklight_configuration_spec.rb +0 -0
- data/{test_support/spec → spec}/lib/blacklight_email_spec.rb +0 -0
- data/{test_support/spec → spec}/lib/blacklight_sms_spec.rb +0 -0
- data/{test_support/spec → spec}/lib/blacklight_solr_document_dublin_core_spec.rb +0 -0
- data/{test_support/spec → spec}/lib/blacklight_solr_document_marc_spec.rb +0 -0
- data/{test_support/spec → spec}/lib/blacklight_solr_document_more_like_this_spec.rb +0 -0
- data/{test_support/spec → spec}/lib/blacklight_solr_document_spec.rb +0 -0
- data/{test_support/spec → spec}/lib/blacklight_solr_response_spec.rb +0 -0
- data/{test_support/spec → spec}/lib/blacklight_spec.rb +1 -1
- data/{test_support/spec → spec}/lib/blacklight_user_spec.rb +0 -0
- data/{test_support/spec → spec}/lib/facet_paginator_spec.rb +0 -0
- data/{test_support/spec → spec}/lib/marc_export_spec.rb +0 -0
- data/{test_support/spec → spec}/lib/search_fields_spec.rb +0 -0
- data/{test_support/spec → spec}/lib/solr_helper_spec.rb +0 -0
- data/{test_support/spec → spec}/lib/tasks/blacklight_task_spec.rb +0 -0
- data/{test_support/spec → spec}/lib/tasks/solr_marc_task_spec.rb +0 -0
- data/{test_support/spec → spec}/lib/utils_spec.rb +0 -0
- data/{test_support/spec → spec}/models/bookmark_spec.rb +0 -0
- data/{test_support/spec → spec}/models/record_mailer_spec.rb +0 -0
- data/{test_support/spec → spec}/models/search_spec.rb +0 -0
- data/{test_support/spec → spec}/models/solr_docment_spec.rb +0 -0
- data/{test_support/spec → spec}/rcov.opts +0 -0
- data/{test_support/spec → spec}/requests/alternate_controller_spec.rb +0 -0
- data/{test_support/spec → spec}/routing/catalog_routing_spec.rb +0 -0
- data/{test_support/spec → spec}/spec.opts +0 -0
- data/{test_support/spec → spec}/spec_helper.rb +2 -3
- data/{test_support/spec → spec}/support/assert_difference.rb +0 -0
- data/{test_support/spec → spec}/support/include_text.rb +0 -0
- data/spec/test_app_templates/Gemfile.extra +38 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +40 -0
- data/spec/test_app_templates/lib/tasks/rspec.rake +8 -0
- data/{test_support/spec → spec}/views/catalog/_constraints_element.html.erb_spec.rb +0 -0
- data/{test_support/spec → spec}/views/catalog/_document_list.html.erb_spec.rb +0 -0
- data/{test_support/spec → spec}/views/catalog/_facets.html.erb_spec.rb +0 -0
- data/{test_support/spec → spec}/views/catalog/_index_default.erb_spec.rb +0 -0
- data/{test_support/spec → spec}/views/catalog/_show_default.erb_spec.rb +0 -0
- data/{test_support/spec → spec}/views/catalog/_show_sidebar.erb_spec.rb +0 -0
- data/{test_support/spec → spec}/views/catalog/index.atom.builder_spec.rb +0 -0
- data/tasks/blacklight.rake +97 -0
- metadata +178 -83
- metadata.gz.sig +0 -0
- data/test_support/bin/run-tests.sh +0 -56
- data/test_support/bin/setup-test-app.sh +0 -119
- data/test_support/bin/test.sh +0 -147
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64ee8019553f491ded8b0186b6d9d30358c2ca25
|
4
|
+
data.tar.gz: d4935e93a6fa56fb5ae42f32f0140e61bb1b0032
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e75097a23a6c9e685bf6c7924ae387ee47e14ef1723f43660d5597591dae6d0b6a3c50120fddb18dfe9373609215966623c33eae70ff7bf89d8db8c7a36b284
|
7
|
+
data.tar.gz: 011cc55da8d2cc401dbb59450545b3b120e75e2919d960abe8c24c3c25d42c645f14c29d4efa77000101539b506c89af8e2feb9e493b7e1aaf27d59537fd3f50
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/.gitignore
CHANGED
@@ -4,8 +4,7 @@ coverage.data
|
|
4
4
|
coverage/
|
5
5
|
db/*.sqlite3
|
6
6
|
db/schema.rb
|
7
|
-
jetty
|
8
|
-
jetty/solr/data/*
|
7
|
+
jetty
|
9
8
|
log/*
|
10
9
|
webrat-*
|
11
10
|
config/SolrMarc/*.log*
|
@@ -15,7 +14,7 @@ tmp/*
|
|
15
14
|
*.log
|
16
15
|
.bundle
|
17
16
|
Gemfile.lock
|
18
|
-
|
17
|
+
spec/internal
|
19
18
|
.rvmrc
|
20
19
|
pkg/*
|
21
20
|
*.sw[pon]
|
File without changes
|
data/.travis.yml
CHANGED
@@ -10,13 +10,13 @@ gemfile:
|
|
10
10
|
- gemfiles/rails3.gemfile
|
11
11
|
- gemfiles/rails4.gemfile
|
12
12
|
|
13
|
-
script:
|
14
|
-
|
13
|
+
# script:
|
14
|
+
# - test_support/bin/test.sh
|
15
15
|
|
16
16
|
notifications:
|
17
17
|
irc: "irc.freenode.org#blacklight"
|
18
18
|
email:
|
19
19
|
- blacklight-commits@googlegroups.com
|
20
20
|
|
21
|
-
before_install:
|
22
|
-
|
21
|
+
# before_install:
|
22
|
+
# - gem install bundler
|
data/Rakefile
CHANGED
@@ -8,3 +8,11 @@ end
|
|
8
8
|
|
9
9
|
require 'rake'
|
10
10
|
Bundler::GemHelper.install_tasks
|
11
|
+
|
12
|
+
# load rake tasks defined in lib/tasks that are not loaded in lib/active_fedora.rb
|
13
|
+
load "tasks/blacklight.rake"
|
14
|
+
|
15
|
+
task :default => [:ci]
|
16
|
+
task :spec => ['blacklight:spec']
|
17
|
+
task :clean => ['blacklight:clean']
|
18
|
+
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
4.
|
1
|
+
4.2.0
|
@@ -52,7 +52,7 @@ class BookmarksController < CatalogController
|
|
52
52
|
end
|
53
53
|
|
54
54
|
if request.xhr?
|
55
|
-
|
55
|
+
success ? head(:no_content) : render(:text => "", :status => "500")
|
56
56
|
else
|
57
57
|
if @bookmarks.length > 0 && success
|
58
58
|
flash[:notice] = I18n.t('blacklight.bookmarks.add.success', :count => @bookmarks.length)
|
@@ -80,7 +80,7 @@ class BookmarksController < CatalogController
|
|
80
80
|
redirect_to :back
|
81
81
|
else
|
82
82
|
# ajaxy request needs no redirect and should not have flash set
|
83
|
-
|
83
|
+
success ? head(:no_content) : render(:text => "", :status => "500")
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
@@ -103,7 +103,7 @@ module Blacklight::FacetsHelperBehavior
|
|
103
103
|
# options consist of:
|
104
104
|
# :suppress_link => true # do not make it a link, used for an already selected value for instance
|
105
105
|
def render_facet_value(facet_solr_field, item, options ={})
|
106
|
-
(link_to_unless(options[:suppress_link], item
|
106
|
+
(link_to_unless(options[:suppress_link], facet_display_value(facet_solr_field, item), add_facet_params_and_redirect(facet_solr_field, item), :class=>"facet_select") + " " + render_facet_count(item.hits)).html_safe
|
107
107
|
end
|
108
108
|
|
109
109
|
# Standard display of a SELECTED facet value, no link, special span
|
@@ -215,24 +215,26 @@ module Blacklight::FacetsHelperBehavior
|
|
215
215
|
end
|
216
216
|
|
217
217
|
def facet_display_value field, item
|
218
|
-
|
219
|
-
value = facet_value_for_facet_item(item)
|
220
|
-
|
221
218
|
facet_config = facet_configuration_for_field(field)
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
219
|
+
|
220
|
+
value = if item.respond_to? :label
|
221
|
+
value = item.label
|
222
|
+
else
|
223
|
+
facet_value_for_facet_item(item)
|
227
224
|
end
|
228
225
|
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
226
|
+
display_label = case
|
227
|
+
when facet_config.helper_method
|
228
|
+
display_label = send facet_config.helper_method, value
|
229
|
+
when (facet_config.query and facet_config.query[value])
|
230
|
+
display_label = facet_config.query[value][:label]
|
231
|
+
when facet_config.date
|
232
|
+
localization_options = {}
|
233
|
+
localization_options = facet_config.date unless facet_config.date === true
|
234
|
+
display_label = l(value.to_datetime, localization_options)
|
235
|
+
else
|
236
|
+
value
|
233
237
|
end
|
234
|
-
|
235
|
-
display_label
|
236
238
|
end
|
237
239
|
|
238
240
|
private
|
@@ -26,7 +26,6 @@
|
|
26
26
|
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
27
27
|
<![endif]-->
|
28
28
|
|
29
|
-
<%= favicon_link_tag asset_path('favicon.ico') %>
|
30
29
|
</head>
|
31
30
|
<% onload_text = "$('input#q').focus();" if params[:q].to_s.empty? and params[:f].to_s.empty? and params[:id].nil? %>
|
32
31
|
<body onload="<%= onload_text %>" class="<%= render_body_class %>">
|
data/blacklight.gemspec
CHANGED
@@ -29,5 +29,6 @@ Gem::Specification.new do |s|
|
|
29
29
|
s.add_dependency "kaminari", "~> 0.13" # the pagination (page 1,2,3, etc..) of our search results
|
30
30
|
s.add_dependency "sass-rails"
|
31
31
|
s.add_dependency "bootstrap-sass", "~> 2.2.0"
|
32
|
-
s.add_development_dependency "jettywrapper", ">= 1.
|
32
|
+
s.add_development_dependency "jettywrapper", ">= 1.4.1"
|
33
|
+
s.add_development_dependency "rspec-rails"
|
33
34
|
end
|
data/config/jetty.yml
ADDED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -10,7 +10,7 @@
|
|
10
10
|
ENV['RAILS_ROOT'] = Rails.root.to_s
|
11
11
|
|
12
12
|
# blacklight_features, where to find features inside blacklight source?
|
13
|
-
blacklight_features = File.expand_path("
|
13
|
+
blacklight_features = File.expand_path("features", Blacklight.root)
|
14
14
|
|
15
15
|
unless ARGV.any? {|a| a =~ /^gems/} # Don't load anything when running the gems:* tasks
|
16
16
|
|
File without changes
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
3
|
+
|
4
|
+
describe BookmarksController do
|
5
|
+
include Devise::TestHelpers
|
6
|
+
|
7
|
+
# jquery 1.9 ajax does error callback if 200 returns empty body. so use 204 instead.
|
8
|
+
describe "update" do
|
9
|
+
it "has a 204 status code when creating a new one" do
|
10
|
+
xhr :put, :update, :id => '2007020969', :format => :js
|
11
|
+
response.should be_success
|
12
|
+
response.code.should == "204"
|
13
|
+
end
|
14
|
+
|
15
|
+
it "has a 500 status code when fails is success" do
|
16
|
+
@controller.stub_chain(:current_or_guest_user, :existing_bookmark_for).and_return(false)
|
17
|
+
@controller.stub_chain(:current_or_guest_user, :persisted?).and_return(true)
|
18
|
+
@controller.stub_chain(:current_or_guest_user, :bookmarks, :create).and_return(false)
|
19
|
+
xhr :put, :update, :id => 'iamabooboo', :format => :js
|
20
|
+
response.code.should == "500"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "delete" do
|
25
|
+
it "has a 204 status code when delete is success" do
|
26
|
+
xhr :delete, :destroy, :id => '2007020969', :format => :js
|
27
|
+
response.should be_success
|
28
|
+
response.code.should == "204"
|
29
|
+
end
|
30
|
+
|
31
|
+
it "has a 500 status code when delete is not success" do
|
32
|
+
bm = mock(Bookmark)
|
33
|
+
@controller.stub_chain(:current_or_guest_user, :existing_bookmark_for).and_return(bm)
|
34
|
+
@controller.stub_chain(:current_or_guest_user, :bookmarks, :delete).and_return(false)
|
35
|
+
|
36
|
+
xhr :delete, :destroy, :id => 'pleasekillme', :format => :js
|
37
|
+
#
|
38
|
+
response.code.should == "500"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -364,24 +364,51 @@ describe FacetsHelper do
|
|
364
364
|
|
365
365
|
end
|
366
366
|
|
367
|
+
describe "render_facet_value" do
|
368
|
+
it "should use facet_display_value" do
|
369
|
+
helper.stub(:facet_configuration_for_field).with('simple_field').and_return(mock(:query => nil, :date => nil, :helper_method => nil, :single => false))
|
370
|
+
|
371
|
+
helper.should_receive(:facet_display_value).and_return('Z')
|
372
|
+
helper.should_receive(:add_facet_params_and_redirect).and_return('link')
|
373
|
+
helper.render_facet_value('simple_field', mock(:value => 'A', :hits => 10)).should == "<a href=\"link\" class=\"facet_select\">Z</a> <span class=\"count\">10</span>"
|
374
|
+
end
|
375
|
+
|
376
|
+
|
377
|
+
it "should suppress the link" do
|
378
|
+
helper.stub(:facet_configuration_for_field).with('simple_field').and_return(mock(:query => nil, :date => nil, :helper_method => nil, :single => false))
|
379
|
+
|
380
|
+
helper.should_receive(:facet_display_value).and_return('Z')
|
381
|
+
helper.should_receive(:add_facet_params_and_redirect).and_return('link')
|
382
|
+
helper.render_facet_value('simple_field', mock(:value => 'A', :hits => 10), :suppress_link => true).should == "Z <span class=\"count\">10</span>"
|
383
|
+
end
|
384
|
+
end
|
385
|
+
|
367
386
|
describe "#facet_display_value" do
|
368
387
|
it "should just be the facet value for an ordinary facet" do
|
369
|
-
helper.stub(:facet_configuration_for_field).with('simple_field').and_return(mock(:query => nil, :date => nil))
|
388
|
+
helper.stub(:facet_configuration_for_field).with('simple_field').and_return(mock(:query => nil, :date => nil, :helper_method => nil))
|
370
389
|
helper.facet_display_value('simple_field', 'asdf').should == 'asdf'
|
371
390
|
end
|
372
391
|
|
392
|
+
it "should allow you to pass in a :helper_method argument to the configuration" do
|
393
|
+
helper.stub(:facet_configuration_for_field).with('helper_field').and_return(mock(:query => nil, :date => nil, :helper_method => :my_facet_value_renderer))
|
394
|
+
|
395
|
+
helper.should_receive(:my_facet_value_renderer).with('qwerty').and_return('abc')
|
396
|
+
|
397
|
+
helper.facet_display_value('helper_field', 'qwerty').should == 'abc'
|
398
|
+
end
|
399
|
+
|
373
400
|
it "should extract the configuration label for a query facet" do
|
374
|
-
helper.stub(:facet_configuration_for_field).with('query_facet').and_return(mock(:query => { 'query_key' => { :label => 'XYZ'}}, :date => nil))
|
401
|
+
helper.stub(:facet_configuration_for_field).with('query_facet').and_return(mock(:query => { 'query_key' => { :label => 'XYZ'}}, :date => nil, :helper_method => nil))
|
375
402
|
helper.facet_display_value('query_facet', 'query_key').should == 'XYZ'
|
376
403
|
end
|
377
404
|
|
378
405
|
it "should localize the label for date-type facets" do
|
379
|
-
helper.stub(:facet_configuration_for_field).with('date_facet').and_return(mock('date' => true, :query => nil))
|
406
|
+
helper.stub(:facet_configuration_for_field).with('date_facet').and_return(mock('date' => true, :query => nil, :helper_method => nil))
|
380
407
|
helper.facet_display_value('date_facet', '2012-01-01').should == 'Sun, 01 Jan 2012 00:00:00 +0000'
|
381
408
|
end
|
382
409
|
|
383
410
|
it "should localize the label for date-type facets with the supplied localization options" do
|
384
|
-
helper.stub(:facet_configuration_for_field).with('date_facet').and_return(mock('date' => { :format => :short }, :query => nil))
|
411
|
+
helper.stub(:facet_configuration_for_field).with('date_facet').and_return(mock('date' => { :format => :short }, :query => nil, :helper_method => nil))
|
385
412
|
helper.facet_display_value('date_facet', '2012-01-01').should == '01 Jan 00:00'
|
386
413
|
end
|
387
414
|
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -20,7 +20,7 @@ describe Blacklight do
|
|
20
20
|
context 'root' do
|
21
21
|
|
22
22
|
before(:all) do
|
23
|
-
@blroot = File.expand_path(File.join(__FILE__, '..', '..', '..'
|
23
|
+
@blroot = File.expand_path(File.join(__FILE__, '..', '..', '..' ))
|
24
24
|
end
|
25
25
|
|
26
26
|
it 'should return the full path to the BL plugin' do
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|