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.
Files changed (95) hide show
  1. data/Gemfile +4 -0
  2. data/VERSION +1 -1
  3. data/app/assets/javascripts/blacklight/blacklight.js +15 -474
  4. data/app/assets/javascripts/blacklight/bookmark_toggle.js +21 -0
  5. data/app/assets/javascripts/blacklight/checkbox_submit.js +126 -0
  6. data/app/assets/javascripts/blacklight/core.js +2 -0
  7. data/app/assets/javascripts/blacklight/facet_expand_contract.js +40 -0
  8. data/app/assets/javascripts/blacklight/folder_toggle.js +24 -0
  9. data/app/assets/javascripts/blacklight/lightbox_dialog.js +15 -0
  10. data/app/assets/javascripts/blacklight/more_facets.js +15 -0
  11. data/app/assets/javascripts/blacklight/search_context.js +26 -0
  12. data/app/assets/javascripts/blacklight/select_submit.js +18 -0
  13. data/app/assets/javascripts/blacklight/zebra_stripe.js +13 -0
  14. data/app/assets/javascripts/jquery.uiExt.ajaxyDialog.js +180 -0
  15. data/app/controllers/bookmarks_controller.rb +9 -9
  16. data/app/controllers/feedback_controller.rb +3 -3
  17. data/app/controllers/folder_controller.rb +3 -3
  18. data/app/controllers/saved_searches_controller.rb +7 -7
  19. data/app/controllers/search_history_controller.rb +2 -2
  20. data/app/helpers/blacklight/blacklight_helper_behavior.rb +6 -10
  21. data/app/helpers/blacklight/catalog_helper_behavior.rb +8 -11
  22. data/app/helpers/blacklight/facets_helper_behavior.rb +2 -2
  23. data/app/helpers/blacklight/search_history_constraints_helper_behavior.rb +2 -2
  24. data/app/models/bookmark.rb +5 -0
  25. data/app/models/record_mailer.rb +5 -11
  26. data/app/views/_user_util_links.html.erb +6 -6
  27. data/app/views/bookmarks/index.html.erb +8 -8
  28. data/app/views/catalog/_bookmark_control.html.erb +2 -2
  29. data/app/views/catalog/_bookmark_form.html.erb +3 -3
  30. data/app/views/catalog/_citation.html.erb +3 -3
  31. data/app/views/catalog/_constraints.html.erb +1 -1
  32. data/app/views/catalog/_constraints_element.html.erb +2 -2
  33. data/app/views/catalog/_did_you_mean.html.erb +2 -7
  34. data/app/views/catalog/_document.html.erb +1 -1
  35. data/app/views/catalog/_email_form.html.erb +4 -4
  36. data/app/views/catalog/_facet_limit.html.erb +1 -1
  37. data/app/views/catalog/_facet_pagination.html.erb +7 -7
  38. data/app/views/catalog/_facets.html.erb +1 -1
  39. data/app/views/catalog/_folder_control.html.erb +1 -1
  40. data/app/views/catalog/_home_text.html.erb +1 -1
  41. data/app/views/catalog/_marc_view.html.erb +2 -2
  42. data/app/views/catalog/_refworks_form.html.erb +2 -2
  43. data/app/views/catalog/_results_pagination.html.erb +1 -1
  44. data/app/views/catalog/_search_form.html.erb +5 -5
  45. data/app/views/catalog/_show_tools.html.erb +6 -6
  46. data/app/views/catalog/_sms_form.html.erb +5 -5
  47. data/app/views/catalog/_sort_and_per_page.html.erb +6 -9
  48. data/app/views/catalog/index.atom.builder +3 -3
  49. data/app/views/catalog/index.html.erb +2 -2
  50. data/app/views/catalog/index.rss.builder +3 -3
  51. data/app/views/catalog/show.html.erb +2 -2
  52. data/app/views/feedback/complete.html.erb +2 -2
  53. data/app/views/feedback/show.html.erb +5 -5
  54. data/app/views/folder/_tools.html.erb +4 -4
  55. data/app/views/folder/index.html.erb +1 -1
  56. data/app/views/layouts/blacklight.html.erb +1 -1
  57. data/app/views/record_mailer/email_record.text.erb +2 -2
  58. data/app/views/record_mailer/sms_record.text.erb +1 -1
  59. data/app/views/saved_searches/index.html.erb +6 -6
  60. data/app/views/search_history/index.html.erb +6 -6
  61. data/config/locales/blacklight.en.yml +227 -0
  62. data/lib/blacklight.rb +0 -2
  63. data/lib/blacklight/catalog.rb +11 -13
  64. data/lib/blacklight/configurable.rb +0 -3
  65. data/lib/blacklight/configuration.rb +0 -42
  66. data/lib/blacklight/configuration/fields.rb +2 -0
  67. data/lib/blacklight/routes.rb +14 -2
  68. data/lib/blacklight/search_fields.rb +1 -1
  69. data/lib/blacklight/solr/document/email.rb +6 -6
  70. data/lib/blacklight/solr/document/sms.rb +4 -4
  71. data/lib/blacklight/solr_helper.rb +1 -3
  72. data/lib/generators/blacklight/blacklight_generator.rb +3 -0
  73. data/lib/railties/blacklight_cucumber.rake +12 -3
  74. data/lib/railties/blacklight_rspec.rake +9 -2
  75. data/test_support/alternate_controller.rb +4 -0
  76. data/test_support/bin/test.sh +13 -1
  77. data/test_support/features/bookmarks.feature +1 -1
  78. data/test_support/features/librarian_view.feature +2 -1
  79. data/test_support/features/record_view.feature +1 -0
  80. data/test_support/features/search.feature +1 -0
  81. data/test_support/features/step_definitions/general_steps.rb +4 -0
  82. data/test_support/features/support/env.rb +12 -1
  83. data/test_support/features/support/paths.rb +2 -1
  84. data/test_support/spec/helpers/blacklight_helper_spec.rb +8 -2
  85. data/test_support/spec/helpers/search_history_constraints_helper_spec.rb +6 -18
  86. data/test_support/spec/lib/search_fields_spec.rb +18 -25
  87. data/test_support/spec/models/record_mailer_spec.rb +5 -4
  88. data/test_support/spec/requests/alternate_controller_spec.rb +15 -0
  89. data/test_support/spec/spec_helper.rb +12 -0
  90. data/test_support/spec/views/catalog/_index_default.erb_spec.rb +6 -17
  91. data/test_support/spec/views/catalog/_show_default.erb_spec.rb +7 -17
  92. metadata +19 -8
  93. data/config/locales/kaminari.yml +0 -10
  94. data/lib/blacklight/global_configurable.rb +0 -46
  95. data/test_support/spec/lib/global_configurable_spec.rb +0 -98
@@ -0,0 +1,15 @@
1
+ # -*- encoding : utf-8 -*-
2
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
3
+
4
+ describe "controllers that are not catalog controller" do
5
+
6
+ it "should have the correct search form" do
7
+ visit alternate_index_path
8
+ page.should have_selector("form[action='#{alternate_index_path}']")
9
+ fill_in "q", :with=>"history"
10
+ click_button 'search'
11
+ page.should have_link("startOverLink", :href=>alternate_index_path)
12
+ page.should have_selector("form.per_page[action='#{alternate_index_path}']")
13
+ page.should have_selector("form#sort_form[action='#{alternate_index_path}']")
14
+ end
15
+ end
@@ -5,11 +5,23 @@
5
5
 
6
6
  ENV["RAILS_ENV"] ||= 'test'
7
7
 
8
+ ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : "ruby"
9
+ if ENV['COVERAGE'] and RUBY_VERSION =~ /^1.9/ and ruby_engine != "jruby"
10
+ require 'simplecov'
11
+ require 'simplecov-rcov'
12
+
13
+ SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
14
+ SimpleCov.start do
15
+ root File.expand_path(File.dirname(__FILE__) + "../../..")
16
+ end
17
+ end
18
+
8
19
  #require File.expand_path("../../config/environment", __FILE__)
9
20
  # version that works with our blacklight:spec stuff that calls specs
10
21
  # in a remote directory.
11
22
  require File.expand_path("config/environment", ENV['RAILS_ROOT'] || File.expand_path("../..", __FILE__))
12
23
  require 'rspec/rails'
24
+ require 'capybara/rspec'
13
25
 
14
26
  # Requires supporting ruby files with custom matchers and macros, etc,
15
27
  # in spec/support/ and its subdirectories.
@@ -9,23 +9,12 @@ describe "/catalog/_index_default.erb" do
9
9
  include CatalogHelper
10
10
 
11
11
  before(:each) do
12
- @config = Blacklight::Configuration.from_legacy_configuration({
13
- :show => {
14
- :display_type => 'asdf'
15
- },
16
- :index_fields => {
17
- :field_names => [
18
- 'one_field',
19
- 'empty_field',
20
- 'four_field'
21
- ],
22
- :labels => {
23
- 'one_field' => 'One:',
24
- 'empty_field' => 'Three:',
25
- 'four_field' => 'Four:'
26
- }
27
- }
28
- })
12
+ @config = Blacklight::Configuration.new do |config|
13
+ config.show.display_type = 'asdf'
14
+ config.add_index_field 'one_field', :label => 'One:'
15
+ config.add_index_field 'empty_field', :label => 'Three:'
16
+ config.add_index_field 'four_field', :label => 'Four:'
17
+ end
29
18
 
30
19
  @fname_1 = "one_field"
31
20
  @fname_2 = "solr_field_not_in_config"
@@ -11,23 +11,13 @@ describe "/catalog/_show_default.html.erb" do
11
11
 
12
12
 
13
13
  before(:each) do
14
- @config = Blacklight::Configuration.from_legacy_configuration({
15
- :show => {
16
- :display_type => 'asdf'
17
- },
18
- :show_fields => {
19
- :field_names => [
20
- 'one_field',
21
- 'empty_field',
22
- 'four_field'
23
- ],
24
- :labels => {
25
- 'one_field' => 'One:',
26
- 'empty_field' => 'Three:',
27
- 'four_field' => 'Four:'
28
- }
29
- }
30
- })
14
+ @config = Blacklight::Configuration.new do |config|
15
+ config.show.display_type = 'asdf'
16
+ config.add_show_field 'one_field', :label => 'One:'
17
+ config.add_show_field 'empty_field', :label => 'Three:'
18
+ config.add_show_field 'four_field', :label => 'Four:'
19
+ end
20
+
31
21
  @fname_1 = "one_field"
32
22
  @fname_2 = "solr_field_not_in_config"
33
23
  @fname_3 = "empty_field"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.2
4
+ version: 3.5.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -17,7 +17,7 @@ authors:
17
17
  autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
- date: 2012-05-17 00:00:00.000000000 Z
20
+ date: 2012-06-25 00:00:00.000000000 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: rails
@@ -229,8 +229,19 @@ files:
229
229
  - app/assets/images/blacklight/start_over.gif
230
230
  - app/assets/images/favicon.ico
231
231
  - app/assets/javascripts/blacklight/blacklight.js
232
+ - app/assets/javascripts/blacklight/bookmark_toggle.js
233
+ - app/assets/javascripts/blacklight/checkbox_submit.js
234
+ - app/assets/javascripts/blacklight/core.js
235
+ - app/assets/javascripts/blacklight/facet_expand_contract.js
236
+ - app/assets/javascripts/blacklight/folder_toggle.js
237
+ - app/assets/javascripts/blacklight/lightbox_dialog.js
238
+ - app/assets/javascripts/blacklight/more_facets.js
239
+ - app/assets/javascripts/blacklight/search_context.js
240
+ - app/assets/javascripts/blacklight/select_submit.js
241
+ - app/assets/javascripts/blacklight/zebra_stripe.js
232
242
  - app/assets/javascripts/jquery-1.4.2.min.js
233
243
  - app/assets/javascripts/jquery-ui-1.8.1.custom.min.js
244
+ - app/assets/javascripts/jquery.uiExt.ajaxyDialog.js
234
245
  - app/assets/stylesheets/blacklight/_blacklight_base.css.scss
235
246
  - app/assets/stylesheets/blacklight/_catalog.css.scss
236
247
  - app/assets/stylesheets/blacklight/_facets.css.scss
@@ -347,7 +358,7 @@ files:
347
358
  - app/views/search_history/index.html.erb
348
359
  - blacklight.gemspec
349
360
  - config.ru
350
- - config/locales/kaminari.yml
361
+ - config/locales/blacklight.en.yml
351
362
  - config/routes.rb
352
363
  - db/seeds.rb
353
364
  - install.rb
@@ -364,7 +375,6 @@ files:
364
375
  - lib/blacklight/controller.rb
365
376
  - lib/blacklight/engine.rb
366
377
  - lib/blacklight/exceptions.rb
367
- - lib/blacklight/global_configurable.rb
368
378
  - lib/blacklight/kaminari_relevant_pages_patch.rb
369
379
  - lib/blacklight/routes.rb
370
380
  - lib/blacklight/search_fields.rb
@@ -416,6 +426,7 @@ files:
416
426
  - lib/railties/solr_marc.rake
417
427
  - tasks/blacklight_tasks.rake
418
428
  - test_support/.rspec
429
+ - test_support/alternate_controller.rb
419
430
  - test_support/bin/run-tests.sh
420
431
  - test_support/bin/test.sh
421
432
  - test_support/data/test_data.utf8.mrc
@@ -468,7 +479,6 @@ files:
468
479
  - test_support/spec/lib/blacklight_spec.rb
469
480
  - test_support/spec/lib/blacklight_user_spec.rb
470
481
  - test_support/spec/lib/facet_paginator_spec.rb
471
- - test_support/spec/lib/global_configurable_spec.rb
472
482
  - test_support/spec/lib/marc_export_spec.rb
473
483
  - test_support/spec/lib/search_fields_spec.rb
474
484
  - test_support/spec/lib/solr_helper_spec.rb
@@ -480,6 +490,7 @@ files:
480
490
  - test_support/spec/models/search_spec.rb
481
491
  - test_support/spec/models/solr_docment_spec.rb
482
492
  - test_support/spec/rcov.opts
493
+ - test_support/spec/requests/alternate_controller_spec.rb
483
494
  - test_support/spec/spec.opts
484
495
  - test_support/spec/spec_helper.rb
485
496
  - test_support/spec/support/assert_difference.rb
@@ -505,7 +516,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
505
516
  version: '0'
506
517
  segments:
507
518
  - 0
508
- hash: -528944564261981247
519
+ hash: -2302454488615889589
509
520
  required_rubygems_version: !ruby/object:Gem::Requirement
510
521
  none: false
511
522
  requirements:
@@ -514,10 +525,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
514
525
  version: '0'
515
526
  segments:
516
527
  - 0
517
- hash: -528944564261981247
528
+ hash: -2302454488615889589
518
529
  requirements: []
519
530
  rubyforge_project: blacklight
520
- rubygems_version: 1.8.21
531
+ rubygems_version: 1.8.24
521
532
  signing_key:
522
533
  specification_version: 3
523
534
  summary: Blacklight provides a discovery interface for any Solr (http://lucene.apache.org/solr)
@@ -1,10 +0,0 @@
1
- # Sample localization file for Kaminari. You can override these values in your app's locales file if you want.
2
-
3
- en:
4
- views:
5
- pagination:
6
- first: "« First"
7
- last: "Last »"
8
- previous: "« Previous"
9
- next: "Next »"
10
- truncate: "…"
@@ -1,46 +0,0 @@
1
- module Blacklight::GlobalConfigurable
2
-
3
- # The config environment name used by the #config method
4
- #
5
- # Example:
6
- # class MyThing
7
- # extend Blacklight::GlobalConfigurable
8
- # end
9
- #
10
- # Now MyThing.config will be the result of:
11
- # MyThing.configure(:production) {|config|}
12
- #
13
- # You set shared attributes by leaving the first argument blank or passing the :shared value:
14
- # MyThing.configure {|config|}
15
- # or
16
- # MyThing.cofigure(:shared) {|config|}
17
-
18
- # sets the @configs variable to a new Hash with empty Hash for :shared key and @config to nil
19
- def reset_configs!
20
- @config = nil
21
- @configs = {:shared=>{}}
22
- end
23
-
24
- # A hash of all environment configs
25
- # The key is the environment name, the value a Hash
26
- def configs
27
- @configs ? @configs : (reset_configs! and @configs)
28
- end
29
-
30
- # The main config accessor. It merges the current configs[::Rails.env]
31
- # with configs[:shared] and lazy-loads @config to the result.
32
- def config
33
- @config ||= configs[:shared].merge(configs[::Rails.env] ||= {})
34
- end
35
- alias_method :blacklight_config, :config
36
-
37
- # Accepts a value for the environment to configure and a block
38
- # A hash is yielded to the block
39
- # If the "env" != :shared,
40
- # the hash is created by deep cloning the :shared environment config.
41
- # This makes it possible to create defaults in the :shared config
42
- def configure(env = :shared, &blk)
43
- configs[env] = {}
44
- yield configs[env]
45
- end
46
- end
@@ -1,98 +0,0 @@
1
- # -*- encoding : utf-8 -*-
2
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
3
-
4
- describe Blacklight::GlobalConfigurable do
5
-
6
- class TestConfig
7
- extend Blacklight::GlobalConfigurable
8
- end
9
-
10
- before(:each) do
11
- TestConfig.reset_configs!
12
- end
13
-
14
- it "should respond to configure" do
15
- TestConfig.respond_to? :configure
16
- end
17
-
18
- describe "the default state" do
19
- describe "config" do
20
- it "should be a Hash" do
21
- TestConfig.config.should be_a Hash
22
- end
23
- end
24
- describe "configs[:shared]" do
25
- it "should be a Hash" do
26
- TestConfig.configs[:shared].should be_a Hash
27
- end
28
- end
29
- end
30
-
31
- describe "configs[:shared]" do
32
- it "should not have the values of its members altered by other environments" do
33
- TestConfig.configure do |config|
34
- config[:key] = ":shared value"
35
- end
36
- TestConfig.configure(::Rails.env) do |config|
37
- config[:key] = ":test value"
38
- end
39
- TestConfig.config[:key].should == ":test value"
40
- TestConfig.configs[:shared][:key].should == ":shared value"
41
- TestConfig.configs[::Rails.env][:key].should == ":test value"
42
- end
43
- end
44
-
45
- describe "the #configure method behavior" do
46
- it "requires a block" do
47
- lambda{TestConfig.configure}.should raise_error(LocalJumpError)
48
- end
49
- it "yields a hash" do
50
- TestConfig.configure{|config| config.should be_a(Hash) }
51
- end
52
- it "should clear the configs if reset_configs! is called" do
53
- TestConfig.configure do |config|
54
- config[:asdf] = 'asdf'
55
- end
56
- TestConfig.configs[:shared][:asdf].should == 'asdf'
57
- TestConfig.reset_configs!
58
- TestConfig.configs[:shared][:asdf].should == nil
59
- end
60
-
61
- it "should merge settings from the :shared environment" do
62
- TestConfig.configure do |config|
63
- config[:app_id] = 'Blacklight'
64
- config[:mode] = :shared!
65
- end
66
- TestConfig.configure(::Rails.env) do |config|
67
- config[:mode] = ::Rails.env
68
- end
69
- TestConfig.config[:app_id].should == 'Blacklight'
70
- TestConfig.config[:mode].should_not == :shared!
71
- TestConfig.config[:mode].should == ::Rails.env
72
- end
73
- end
74
-
75
- describe "config" do
76
- it "should return an empty Hash if nothing was configured" do
77
- TestConfig.config.should == {}
78
- end
79
-
80
- it "should return only what is in configs[:shared] if no other environment was configured" do
81
- TestConfig.configure(:shared) do |config|
82
- config[:foo] = 'bar'
83
- config[:baz] = 'dang'
84
- end
85
- TestConfig.config.should == {:foo => 'bar', :baz => 'dang'}
86
- TestConfig.config.should == TestConfig.configs[:shared]
87
- end
88
-
89
- it "should return a merge of configs[:shared] and configs[RAILS_ENV]" do
90
- TestConfig.configure(:shared) do |config|
91
- config[:foo] = 'bar'
92
- config[:baz] = 'dang'
93
- end
94
- end
95
- end
96
-
97
-
98
- end