blacklight 3.4.2 → 3.5.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.
- data/Gemfile +4 -0
- data/VERSION +1 -1
- data/app/assets/javascripts/blacklight/blacklight.js +15 -474
- data/app/assets/javascripts/blacklight/bookmark_toggle.js +21 -0
- data/app/assets/javascripts/blacklight/checkbox_submit.js +126 -0
- data/app/assets/javascripts/blacklight/core.js +2 -0
- data/app/assets/javascripts/blacklight/facet_expand_contract.js +40 -0
- data/app/assets/javascripts/blacklight/folder_toggle.js +24 -0
- data/app/assets/javascripts/blacklight/lightbox_dialog.js +15 -0
- data/app/assets/javascripts/blacklight/more_facets.js +15 -0
- data/app/assets/javascripts/blacklight/search_context.js +26 -0
- data/app/assets/javascripts/blacklight/select_submit.js +18 -0
- data/app/assets/javascripts/blacklight/zebra_stripe.js +13 -0
- data/app/assets/javascripts/jquery.uiExt.ajaxyDialog.js +180 -0
- data/app/controllers/bookmarks_controller.rb +9 -9
- data/app/controllers/feedback_controller.rb +3 -3
- data/app/controllers/folder_controller.rb +3 -3
- data/app/controllers/saved_searches_controller.rb +7 -7
- data/app/controllers/search_history_controller.rb +2 -2
- data/app/helpers/blacklight/blacklight_helper_behavior.rb +6 -10
- data/app/helpers/blacklight/catalog_helper_behavior.rb +8 -11
- data/app/helpers/blacklight/facets_helper_behavior.rb +2 -2
- data/app/helpers/blacklight/search_history_constraints_helper_behavior.rb +2 -2
- data/app/models/bookmark.rb +5 -0
- data/app/models/record_mailer.rb +5 -11
- data/app/views/_user_util_links.html.erb +6 -6
- data/app/views/bookmarks/index.html.erb +8 -8
- data/app/views/catalog/_bookmark_control.html.erb +2 -2
- data/app/views/catalog/_bookmark_form.html.erb +3 -3
- data/app/views/catalog/_citation.html.erb +3 -3
- data/app/views/catalog/_constraints.html.erb +1 -1
- data/app/views/catalog/_constraints_element.html.erb +2 -2
- data/app/views/catalog/_did_you_mean.html.erb +2 -7
- data/app/views/catalog/_document.html.erb +1 -1
- data/app/views/catalog/_email_form.html.erb +4 -4
- data/app/views/catalog/_facet_limit.html.erb +1 -1
- data/app/views/catalog/_facet_pagination.html.erb +7 -7
- data/app/views/catalog/_facets.html.erb +1 -1
- data/app/views/catalog/_folder_control.html.erb +1 -1
- data/app/views/catalog/_home_text.html.erb +1 -1
- data/app/views/catalog/_marc_view.html.erb +2 -2
- data/app/views/catalog/_refworks_form.html.erb +2 -2
- data/app/views/catalog/_results_pagination.html.erb +1 -1
- data/app/views/catalog/_search_form.html.erb +5 -5
- data/app/views/catalog/_show_tools.html.erb +6 -6
- data/app/views/catalog/_sms_form.html.erb +5 -5
- data/app/views/catalog/_sort_and_per_page.html.erb +6 -9
- data/app/views/catalog/index.atom.builder +3 -3
- data/app/views/catalog/index.html.erb +2 -2
- data/app/views/catalog/index.rss.builder +3 -3
- data/app/views/catalog/show.html.erb +2 -2
- data/app/views/feedback/complete.html.erb +2 -2
- data/app/views/feedback/show.html.erb +5 -5
- data/app/views/folder/_tools.html.erb +4 -4
- data/app/views/folder/index.html.erb +1 -1
- data/app/views/layouts/blacklight.html.erb +1 -1
- data/app/views/record_mailer/email_record.text.erb +2 -2
- data/app/views/record_mailer/sms_record.text.erb +1 -1
- data/app/views/saved_searches/index.html.erb +6 -6
- data/app/views/search_history/index.html.erb +6 -6
- data/config/locales/blacklight.en.yml +227 -0
- data/lib/blacklight.rb +0 -2
- data/lib/blacklight/catalog.rb +11 -13
- data/lib/blacklight/configurable.rb +0 -3
- data/lib/blacklight/configuration.rb +0 -42
- data/lib/blacklight/configuration/fields.rb +2 -0
- data/lib/blacklight/routes.rb +14 -2
- data/lib/blacklight/search_fields.rb +1 -1
- data/lib/blacklight/solr/document/email.rb +6 -6
- data/lib/blacklight/solr/document/sms.rb +4 -4
- data/lib/blacklight/solr_helper.rb +1 -3
- data/lib/generators/blacklight/blacklight_generator.rb +3 -0
- data/lib/railties/blacklight_cucumber.rake +12 -3
- data/lib/railties/blacklight_rspec.rake +9 -2
- data/test_support/alternate_controller.rb +4 -0
- data/test_support/bin/test.sh +13 -1
- data/test_support/features/bookmarks.feature +1 -1
- data/test_support/features/librarian_view.feature +2 -1
- data/test_support/features/record_view.feature +1 -0
- data/test_support/features/search.feature +1 -0
- data/test_support/features/step_definitions/general_steps.rb +4 -0
- data/test_support/features/support/env.rb +12 -1
- data/test_support/features/support/paths.rb +2 -1
- data/test_support/spec/helpers/blacklight_helper_spec.rb +8 -2
- data/test_support/spec/helpers/search_history_constraints_helper_spec.rb +6 -18
- data/test_support/spec/lib/search_fields_spec.rb +18 -25
- data/test_support/spec/models/record_mailer_spec.rb +5 -4
- data/test_support/spec/requests/alternate_controller_spec.rb +15 -0
- data/test_support/spec/spec_helper.rb +12 -0
- data/test_support/spec/views/catalog/_index_default.erb_spec.rb +6 -17
- data/test_support/spec/views/catalog/_show_default.erb_spec.rb +7 -17
- metadata +19 -8
- data/config/locales/kaminari.yml +0 -10
- data/lib/blacklight/global_configurable.rb +0 -46
- data/test_support/spec/lib/global_configurable_spec.rb +0 -98
|
@@ -87,6 +87,8 @@ module Blacklight
|
|
|
87
87
|
field_config.normalize!(self)
|
|
88
88
|
field_config.validate!
|
|
89
89
|
|
|
90
|
+
raise "A #{config_key} with the key #{field_config.field} already exists." if self[config_key.pluralize][field_config.field].present?
|
|
91
|
+
|
|
90
92
|
self[config_key.pluralize][ field_config.field ] = field_config
|
|
91
93
|
end
|
|
92
94
|
|
data/lib/blacklight/routes.rb
CHANGED
|
@@ -24,7 +24,7 @@ module Blacklight
|
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
def default_route_sets
|
|
27
|
-
[:bookmarks, :folders, :search_history, :saved_searches, :catalog, :feedback]
|
|
27
|
+
[:bookmarks, :folders, :search_history, :saved_searches, :catalog, :solr_document, :feedback]
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
module RouteSets
|
|
@@ -71,10 +71,22 @@ module Blacklight
|
|
|
71
71
|
match 'catalog/endnote', :as => "endnote_catalog"
|
|
72
72
|
match 'catalog/send_email_record', :as => "send_email_record_catalog"
|
|
73
73
|
match "catalog/facet/:id", :to => 'catalog#facet', :as => 'catalog_facet'
|
|
74
|
-
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
match "catalog", :to => 'catalog#index', :as => 'catalog_index'
|
|
77
|
+
|
|
75
78
|
match 'catalog/:id/librarian_view', :to => "catalog#librarian_view", :as => "librarian_view_catalog"
|
|
76
79
|
end
|
|
77
80
|
end
|
|
81
|
+
|
|
82
|
+
def solr_document
|
|
83
|
+
add_routes do |options|
|
|
84
|
+
resources :solr_document, :path => 'catalog', :controller => 'catalog', :only => [:show, :update]
|
|
85
|
+
|
|
86
|
+
# :show and :update are for backwards-compatibility with catalog_url named routes
|
|
87
|
+
resources :catalog, :only => [:show, :update]
|
|
88
|
+
end
|
|
89
|
+
end
|
|
78
90
|
|
|
79
91
|
|
|
80
92
|
# Feedback
|
|
@@ -5,12 +5,12 @@ module Blacklight::Solr::Document::Email
|
|
|
5
5
|
# Return a text string that will be the body of the email
|
|
6
6
|
def to_email_text
|
|
7
7
|
semantics = self.to_semantic_values
|
|
8
|
-
body =
|
|
9
|
-
body <<
|
|
10
|
-
body <<
|
|
11
|
-
body <<
|
|
12
|
-
body <<
|
|
13
|
-
return body unless body.
|
|
8
|
+
body = []
|
|
9
|
+
body << I18n.t('blacklight.email.text.title', :value => semantics[:title].join(" ")) unless semantics[:title].blank?
|
|
10
|
+
body << I18n.t('blacklight.email.text.author', :value => semantics[:author].join(" ")) unless semantics[:author].blank?
|
|
11
|
+
body << I18n.t('blacklight.email.text.title', :value => semantics[:title].join(" ")) unless semantics[:title].blank?
|
|
12
|
+
body << I18n.t('blacklight.email.text.language', :value => semantics[:language].join(" ")) unless semantics[:language].blank?
|
|
13
|
+
return body.join("\n") unless body.empty?
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
end
|
|
@@ -5,10 +5,10 @@ module Blacklight::Solr::Document::Sms
|
|
|
5
5
|
# Return a text string that will be the body of the email
|
|
6
6
|
def to_sms_text
|
|
7
7
|
semantics = self.to_semantic_values
|
|
8
|
-
body =
|
|
9
|
-
body << semantics[:title].first unless semantics[:title].blank?
|
|
10
|
-
body <<
|
|
11
|
-
return body unless body.
|
|
8
|
+
body = []
|
|
9
|
+
body << I18n.t('blacklight.sms.text.title', :value => semantics[:title].first) unless semantics[:title].blank?
|
|
10
|
+
body << I18n.t('blacklight.sms.text.author', :value => semantics[:author].first) unless semantics[:author].blank?
|
|
11
|
+
return body.join unless body.empty?
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
end
|
|
@@ -251,9 +251,7 @@ module Blacklight::SolrHelper
|
|
|
251
251
|
|
|
252
252
|
solr_parameters[:fq] ||= []
|
|
253
253
|
f_request_params.each_pair do |facet_field, value_list|
|
|
254
|
-
value_list
|
|
255
|
-
value_list = [value_list] unless value_list.respond_to? :each
|
|
256
|
-
value_list.each do |value|
|
|
254
|
+
Array(value_list).each do |value|
|
|
257
255
|
solr_parameters[:fq] << facet_value_to_fq_string(facet_field, value)
|
|
258
256
|
end
|
|
259
257
|
end
|
|
@@ -24,6 +24,8 @@ This generator makes the following changes to your application:
|
|
|
24
24
|
10. Creates a blacklight catalog controller in your /app/controllers directory
|
|
25
25
|
11. Creates a blacklight document in your /app/models directory
|
|
26
26
|
12. Adds Blacklight routes to your ./config/routes.rb
|
|
27
|
+
13. Enables internationalization.
|
|
28
|
+
|
|
27
29
|
Thank you for Installing Blacklight.
|
|
28
30
|
"""
|
|
29
31
|
|
|
@@ -174,5 +176,6 @@ EOF
|
|
|
174
176
|
puts " \e[1m\e[34mMigrations\e[0m " + $!.message
|
|
175
177
|
end
|
|
176
178
|
end
|
|
179
|
+
|
|
177
180
|
end
|
|
178
181
|
|
|
@@ -30,6 +30,12 @@ begin
|
|
|
30
30
|
t.binary = vendored_cucumber_bin # If nil, the gem's binary is used.
|
|
31
31
|
t.fork = true # You may get faster startup if you set this to false
|
|
32
32
|
t.profile = 'default'
|
|
33
|
+
ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : "ruby"
|
|
34
|
+
if ENV['COVERAGE'] and RUBY_VERSION =~ /^1.8/ and ruby_engine != "jruby"
|
|
35
|
+
t.rcov = true
|
|
36
|
+
t.rcov_opts = %w{--rails --exclude osx\/objc,gems\/,spec\/,features\/ --aggregate blacklight-coverage.data}
|
|
37
|
+
t.rcov_opts << %[-o "../../coverage/rcov"]
|
|
38
|
+
end
|
|
33
39
|
end
|
|
34
40
|
|
|
35
41
|
Cucumber::Rake::Task.new({:wip => 'db:test:prepare'}, 'Run features that are being worked on') do |t|
|
|
@@ -62,9 +68,12 @@ begin
|
|
|
62
68
|
t.binary = vendored_cucumber_bin # If nil, the gem's binary is used.
|
|
63
69
|
t.fork = true # You may get faster startup if you set this to false
|
|
64
70
|
t.profile = 'default'
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
71
|
+
ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : "ruby"
|
|
72
|
+
if ENV['COVERAGE'] and RUBY_VERSION =~ /^1.8/ and ruby_engine != "jruby"
|
|
73
|
+
t.rcov = true
|
|
74
|
+
t.rcov_opts = %w{--rails --exclude osx\/objc,gems\/,spec\/,features\/ --aggregate blacklight-coverage.data}
|
|
75
|
+
t.rcov_opts << %[-o "../../coverage/rcov"]
|
|
76
|
+
end
|
|
68
77
|
end
|
|
69
78
|
end
|
|
70
79
|
|
|
@@ -54,6 +54,13 @@ begin
|
|
|
54
54
|
|
|
55
55
|
# pattern directory name defaults to ./**/*_spec.rb, but has a more concise command line echo
|
|
56
56
|
t.pattern = "#{blacklight_spec}/#{sub}"
|
|
57
|
+
|
|
58
|
+
ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : "ruby"
|
|
59
|
+
if ENV['COVERAGE'] and RUBY_VERSION =~ /^1.8/ and ruby_engine != "jruby"
|
|
60
|
+
t.rcov = true
|
|
61
|
+
t.rcov_opts = %w{--rails -I../../app -I../../lib --exclude osx\/objc,gems\/,spec\/,features\/ --aggregate blacklight-coverage.data}
|
|
62
|
+
t.rcov_opts << %[-o "../../coverage/rcov"]
|
|
63
|
+
end
|
|
57
64
|
end
|
|
58
65
|
end
|
|
59
66
|
|
|
@@ -62,8 +69,8 @@ begin
|
|
|
62
69
|
t.rcov = true
|
|
63
70
|
# pattern directory name defaults to ./**/*_spec.rb, but has a more concise command line echo
|
|
64
71
|
t.pattern = File.join(blacklight_spec, "/**/*_spec.rb")
|
|
65
|
-
|
|
66
|
-
t.rcov_opts = '-o "
|
|
72
|
+
t.rspec_opts = "--colour"
|
|
73
|
+
t.rcov_opts = '-o "../../coverage/rcov" --exclude /gems/,/Library/,/usr/,lib/tasks,.bundle,config,/lib/rspec/,/lib/rspec-'
|
|
67
74
|
end
|
|
68
75
|
|
|
69
76
|
# Blacklight. Solr wrapper. for now just for blacklight:spec, plan to
|
data/test_support/bin/test.sh
CHANGED
|
@@ -63,6 +63,7 @@ if ! gem query -n bundler -v ">=1.0" --installed > /dev/null; then
|
|
|
63
63
|
fi
|
|
64
64
|
|
|
65
65
|
rails new test_app
|
|
66
|
+
|
|
66
67
|
cd test_app
|
|
67
68
|
rm public/index.html
|
|
68
69
|
|
|
@@ -76,7 +77,7 @@ platforms :jruby do
|
|
|
76
77
|
end
|
|
77
78
|
|
|
78
79
|
platforms :ruby do
|
|
79
|
-
gem 'sqlite3
|
|
80
|
+
gem 'sqlite3'
|
|
80
81
|
gem 'execjs'
|
|
81
82
|
gem 'therubyracer'
|
|
82
83
|
end
|
|
@@ -98,6 +99,9 @@ group :development, :test do
|
|
|
98
99
|
gem 'cucumber-rails'
|
|
99
100
|
gem 'database_cleaner'
|
|
100
101
|
gem 'capybara'
|
|
102
|
+
gem 'rcov', :platform => :mri_18
|
|
103
|
+
gem 'simplecov', :platform => :mri_19
|
|
104
|
+
gem 'simplecov-rcov', :platform => :mri_19
|
|
101
105
|
end
|
|
102
106
|
|
|
103
107
|
gem 'jettywrapper', '>= 1.2.0'
|
|
@@ -115,6 +119,14 @@ check_errs $? "Rake Migration failed"
|
|
|
115
119
|
|
|
116
120
|
rails g cucumber:install &> /dev/null
|
|
117
121
|
|
|
122
|
+
cp ../../test_support/alternate_controller.rb app/controllers/
|
|
123
|
+
# add routing for the alternate_controller:
|
|
124
|
+
# resources :alternate do
|
|
125
|
+
# member do
|
|
126
|
+
# get :facet
|
|
127
|
+
# end
|
|
128
|
+
# end
|
|
129
|
+
ruby -pi.bak -e 'gsub(/devise_for :users/, "devise_for :users\n resources :alternate do\n member do\n get :facet\n end\n end")' config/routes.rb
|
|
118
130
|
|
|
119
131
|
jetty_zip=$( echo $JETTY_URL | awk '{split($0,a,"/"); print "/tmp/blacklight_jetty_"a[length(a)]}')
|
|
120
132
|
if [ ! -f $jetty_zip ]
|
|
@@ -6,7 +6,8 @@ Feature: Librarian view
|
|
|
6
6
|
Scenario: MARC
|
|
7
7
|
Given I am on the document page for id 2009373513
|
|
8
8
|
When I follow "Librarian View"
|
|
9
|
-
Then I should see "
|
|
9
|
+
Then I should see "Librarian View"
|
|
10
|
+
And I should see "LEADER 01213nam a22003614a 4500"
|
|
10
11
|
And I should see "100"
|
|
11
12
|
And I should see "Lin, Xingzhi."
|
|
12
13
|
And I should see "6|"
|
|
@@ -22,6 +22,7 @@ Feature: Record View
|
|
|
22
22
|
And I should see "Call number:"
|
|
23
23
|
And I should see "E99.D2 H437 2008"
|
|
24
24
|
And I should see link rel=alternate tags
|
|
25
|
+
And the page title should be ""Strong Medicine speaks" - Blacklight"
|
|
25
26
|
|
|
26
27
|
Scenario: Blank titles do not show up
|
|
27
28
|
Given I am on the document page for id 2008305903
|
|
@@ -11,6 +11,7 @@ Feature: Search
|
|
|
11
11
|
And I should see a "search" button
|
|
12
12
|
And I should not see the "startOverLink" element
|
|
13
13
|
And I should see "Welcome!"
|
|
14
|
+
And the page title should be "Blacklight Search Results"
|
|
14
15
|
And I should see a stylesheet
|
|
15
16
|
|
|
16
17
|
Scenario: Search Page's type of search ("fielded search") choices
|
|
@@ -9,6 +9,10 @@ Then /^I should see a stylesheet/ do
|
|
|
9
9
|
page.should have_selector("link[rel=stylesheet]")
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
+
Then /^the page title should be "([^"]*)"$/i do |title|
|
|
13
|
+
page.should have_selector("title", :content => title)
|
|
14
|
+
end
|
|
15
|
+
|
|
12
16
|
Then /I should see "(.*)" (at least|at most|exactly) (.*) times?$/i do |target, comparator, expected_num|
|
|
13
17
|
actual_num = page.split(target).length - 1
|
|
14
18
|
case comparator
|
|
@@ -17,7 +17,18 @@
|
|
|
17
17
|
# * http://benmabey.com/2008/05/19/imperative-vs-declarative-scenarios-in-user-stories.html
|
|
18
18
|
# * http://dannorth.net/2011/01/31/whose-domain-is-it-anyway/
|
|
19
19
|
# * http://elabs.se/blog/15-you-re-cuking-it-wrong
|
|
20
|
-
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : "ruby"
|
|
23
|
+
if ENV['COVERAGE'] and RUBY_VERSION =~ /^1.9/ and ruby_engine != "jruby"
|
|
24
|
+
require 'simplecov'
|
|
25
|
+
require 'simplecov-rcov'
|
|
26
|
+
|
|
27
|
+
SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
|
|
28
|
+
SimpleCov.start do
|
|
29
|
+
root File.expand_path(File.dirname(__FILE__) + "../../../..")
|
|
30
|
+
end
|
|
31
|
+
end
|
|
21
32
|
|
|
22
33
|
require 'cucumber/rails'
|
|
23
34
|
|
|
@@ -93,7 +93,7 @@ describe BlacklightHelper do
|
|
|
93
93
|
|
|
94
94
|
describe "link_back_to_catalog" do
|
|
95
95
|
before(:all) do
|
|
96
|
-
@query_params = {:q => "query", :f => "facets", :per_page => "10", :page => "2"}
|
|
96
|
+
@query_params = {:q => "query", :f => "facets", :per_page => "10", :page => "2", :controller=>'catalog'}
|
|
97
97
|
end
|
|
98
98
|
it "should build a link tag to catalog using session[:search] for query params" do
|
|
99
99
|
session[:search] = @query_params
|
|
@@ -211,6 +211,9 @@ describe BlacklightHelper do
|
|
|
211
211
|
end
|
|
212
212
|
|
|
213
213
|
describe "document_partial_name" do
|
|
214
|
+
it "should default to 'default' when a format blank" do
|
|
215
|
+
document_partial_name({}).should == "default"
|
|
216
|
+
end
|
|
214
217
|
it "should handle normal formats correctly" do
|
|
215
218
|
document_partial_name({"format" => "myformat"}).should == "myformat"
|
|
216
219
|
end
|
|
@@ -294,6 +297,9 @@ describe BlacklightHelper do
|
|
|
294
297
|
def export_as_weird_dup ; "weird_dup" ; end
|
|
295
298
|
end
|
|
296
299
|
MockDocumentAppHelper.use_extension(MockExtension)
|
|
300
|
+
def mock_document_app_helper_url *args
|
|
301
|
+
solr_document_url(*args)
|
|
302
|
+
end
|
|
297
303
|
before(:each) do
|
|
298
304
|
@doc_id = "MOCK_ID1"
|
|
299
305
|
@document = MockDocumentAppHelper.new(:id => @doc_id)
|
|
@@ -310,7 +316,7 @@ describe BlacklightHelper do
|
|
|
310
316
|
tag = matches[0]
|
|
311
317
|
tag.attributes["rel"].value.should == "alternate"
|
|
312
318
|
tag.attributes["title"].value.should == format.to_s
|
|
313
|
-
tag.attributes["href"].value.should ===
|
|
319
|
+
tag.attributes["href"].value.should === mock_document_app_helper_url(@document, :format =>format)
|
|
314
320
|
end
|
|
315
321
|
end
|
|
316
322
|
end
|
|
@@ -4,24 +4,12 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
|
|
4
4
|
describe SearchHistoryConstraintsHelper do
|
|
5
5
|
|
|
6
6
|
before(:all) do
|
|
7
|
-
@config = Blacklight::Configuration.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
:field_names => [
|
|
14
|
-
'some_facet',
|
|
15
|
-
'other_facet'
|
|
16
|
-
],
|
|
17
|
-
:labels => {
|
|
18
|
-
'some_facet' => 'Some',
|
|
19
|
-
'other_facet' => 'Other'
|
|
20
|
-
},
|
|
21
|
-
:limits => {
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
})
|
|
7
|
+
@config = Blacklight::Configuration.new do |config|
|
|
8
|
+
config.add_search_field 'default_search_field', :label => 'Default'
|
|
9
|
+
|
|
10
|
+
config.add_facet_field 'some_facet', :label => 'Some'
|
|
11
|
+
config.add_facet_field 'other_facet', :label => 'Other'
|
|
12
|
+
end
|
|
25
13
|
end
|
|
26
14
|
|
|
27
15
|
|
|
@@ -8,15 +8,15 @@ describe Blacklight::SearchFields do
|
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
before(:all) do
|
|
11
|
-
@config = Blacklight::Configuration.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
@config = Blacklight::Configuration.new do |config|
|
|
12
|
+
config.default_solr_params = { :qt => 'search' }
|
|
13
|
+
|
|
14
|
+
config.add_search_field 'all_fields', :label => 'All Fields'
|
|
15
|
+
config.add_search_field 'title', :qt => 'title_search'
|
|
16
|
+
config.add_search_field 'author', :qt => 'author_search'
|
|
17
|
+
config.add_search_field 'subject', :qt => 'subject_search'
|
|
18
|
+
config.add_search_field 'no_display', :qt => 'something', :include_in_simple_select => false
|
|
19
|
+
end
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
before(:each) do
|
|
@@ -24,14 +24,6 @@ describe Blacklight::SearchFields do
|
|
|
24
24
|
@search_field_obj.stub!(:blacklight_config).and_return(@config)
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
-
it 'should convert legacy Array config to Hash properly' do
|
|
28
|
-
hash = @search_field_obj.search_field_def_for_key('legacy_qt')
|
|
29
|
-
|
|
30
|
-
hash.should be_kind_of(Blacklight::Configuration::SearchField)
|
|
31
|
-
hash.key.should == hash.qt
|
|
32
|
-
hash.label.should == 'Legacy Config'
|
|
33
|
-
end
|
|
34
|
-
|
|
35
27
|
it "should return search field list with calculated :label when needed" do
|
|
36
28
|
@search_field_obj.search_field_list.each do |hash|
|
|
37
29
|
hash.label.should_not be_blank
|
|
@@ -81,10 +73,10 @@ describe Blacklight::SearchFields do
|
|
|
81
73
|
@bad_config = MockConfig.new
|
|
82
74
|
end
|
|
83
75
|
it "should raise exception on #search_field_list" do
|
|
84
|
-
lambda { @bad_config.stub(:blacklight_config).and_return(Blacklight::Configuration.
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
76
|
+
lambda { @bad_config.stub(:blacklight_config).and_return(Blacklight::Configuration.new { |config|
|
|
77
|
+
config.add_search_field :label => 'All Fields', :qt => 'all_fields'
|
|
78
|
+
config.add_search_field 'title', :qt => 'title_search'
|
|
79
|
+
}) }.should raise_error
|
|
88
80
|
end
|
|
89
81
|
end
|
|
90
82
|
|
|
@@ -93,10 +85,11 @@ describe Blacklight::SearchFields do
|
|
|
93
85
|
@bad_config = MockConfig.new
|
|
94
86
|
end
|
|
95
87
|
it "should raise on #search_field_list" do
|
|
96
|
-
lambda { @bad_config.stub(:blacklight_config).and_return(Blacklight::Configuration.
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
88
|
+
lambda { @bad_config.stub(:blacklight_config).and_return(Blacklight::Configuration.new { |config|
|
|
89
|
+
config.add_search_field 'my_key', :label => 'All Fields'
|
|
90
|
+
config.add_search_field 'my_key', :label => 'title'
|
|
91
|
+
|
|
92
|
+
}) }.should raise_error
|
|
100
93
|
end
|
|
101
94
|
end
|
|
102
95
|
|
|
@@ -4,6 +4,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
|
|
4
4
|
|
|
5
5
|
describe RecordMailer do
|
|
6
6
|
before(:each) do
|
|
7
|
+
RecordMailer.stub(:default) { { :from => 'no-reply@projectblacklight.org' } }
|
|
7
8
|
SolrDocument.use_extension( Blacklight::Solr::Document::Email )
|
|
8
9
|
SolrDocument.use_extension( Blacklight::Solr::Document::Sms )
|
|
9
10
|
document = SolrDocument.new({:id=>"123456", :format=>["book"], :title_display => "The horn", :language_facet => "English", :author_display => "Janetzky, Kurt"})
|
|
@@ -12,7 +13,7 @@ describe RecordMailer do
|
|
|
12
13
|
describe "email" do
|
|
13
14
|
before(:each) do
|
|
14
15
|
details = {:to => 'test@test.com', :message => "This is my message"}
|
|
15
|
-
@email = RecordMailer.email_record(@documents,details,
|
|
16
|
+
@email = RecordMailer.email_record(@documents,details,{:host =>'projectblacklight.org', :protocol => 'https'})
|
|
16
17
|
end
|
|
17
18
|
it "should receive the TO paramater and send the email to that address" do
|
|
18
19
|
@email.to.should == ['test@test.com']
|
|
@@ -33,7 +34,7 @@ describe RecordMailer do
|
|
|
33
34
|
end
|
|
34
35
|
it "should use https URLs when protocol is set" do
|
|
35
36
|
details = {:to => 'test@test.com', :message => "This is my message"}
|
|
36
|
-
@https_email = RecordMailer.email_record(@documents,details,
|
|
37
|
+
@https_email = RecordMailer.email_record(@documents,details,{:host =>'projectblacklight.org', :protocol => 'https'})
|
|
37
38
|
@https_email.body.should =~ %r|https://projectblacklight.org/|
|
|
38
39
|
end
|
|
39
40
|
end
|
|
@@ -41,7 +42,7 @@ describe RecordMailer do
|
|
|
41
42
|
describe "SMS" do
|
|
42
43
|
before(:each) do
|
|
43
44
|
details = {:to => '5555555555', :carrier => 'att'}
|
|
44
|
-
@sms = RecordMailer.sms_record(@documents,details,
|
|
45
|
+
@sms = RecordMailer.sms_record(@documents,details,{:host =>'projectblacklight.org:3000'})
|
|
45
46
|
end
|
|
46
47
|
it "should create the correct TO address for the SMS email" do
|
|
47
48
|
@sms.to.should == ['5555555555@txt.att.net']
|
|
@@ -59,7 +60,7 @@ describe RecordMailer do
|
|
|
59
60
|
end
|
|
60
61
|
it "should use https URL when protocol is set" do
|
|
61
62
|
details = {:to => '5555555555', :carrier => 'att'}
|
|
62
|
-
@https_sms = RecordMailer.sms_record(@documents,details,
|
|
63
|
+
@https_sms = RecordMailer.sms_record(@documents,details,{:host =>'projectblacklight.org', :protocol => 'https'})
|
|
63
64
|
@https_sms.body.should =~ %r|https://projectblacklight.org/|
|
|
64
65
|
end
|
|
65
66
|
end
|