blacklight 4.1.0 → 4.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/.gitignore +2 -3
  5. data/{test_support/.rspec → .rspec} +0 -0
  6. data/.travis.yml +4 -4
  7. data/Rakefile +8 -0
  8. data/VERSION +1 -1
  9. data/app/assets/javascripts/blacklight/checkbox_submit.js +1 -1
  10. data/app/controllers/bookmarks_controller.rb +2 -2
  11. data/app/helpers/blacklight/facets_helper_behavior.rb +17 -15
  12. data/app/views/layouts/blacklight.html.erb +0 -1
  13. data/blacklight.gemspec +2 -1
  14. data/config/jetty.yml +4 -0
  15. data/{test_support/features → features}/bookmarks.feature +0 -0
  16. data/{test_support/features → features}/did_you_mean.feature +0 -0
  17. data/{test_support/features → features}/librarian_view.feature +0 -0
  18. data/{test_support/features → features}/record_view.feature +0 -0
  19. data/{test_support/features → features}/saved_searches.feature +0 -0
  20. data/{test_support/features → features}/search.feature +0 -0
  21. data/{test_support/features → features}/search_filters.feature +0 -0
  22. data/{test_support/features → features}/search_history.feature +0 -0
  23. data/{test_support/features → features}/search_pagination.feature +0 -0
  24. data/{test_support/features → features}/search_results.feature +0 -0
  25. data/{test_support/features → features}/search_sort.feature +0 -0
  26. data/{test_support/features → features}/step_definitions/bookmarks_steps.rb +0 -0
  27. data/{test_support/features → features}/step_definitions/error_steps.rb +0 -0
  28. data/{test_support/features → features}/step_definitions/general_steps.rb +0 -0
  29. data/{test_support/features → features}/step_definitions/record_view_steps.rb +0 -0
  30. data/{test_support/features → features}/step_definitions/saved_searches_steps.rb +0 -0
  31. data/{test_support/features → features}/step_definitions/search_facets_steps.rb +0 -0
  32. data/{test_support/features → features}/step_definitions/search_history_steps.rb +0 -0
  33. data/{test_support/features → features}/step_definitions/search_pagination_steps.rb +0 -0
  34. data/{test_support/features → features}/step_definitions/search_result_steps.rb +0 -0
  35. data/{test_support/features → features}/step_definitions/search_steps.rb +0 -0
  36. data/{test_support/features → features}/step_definitions/user_steps.rb +0 -0
  37. data/{test_support/features → features}/step_definitions/web_steps.rb +0 -0
  38. data/{test_support/features → features}/support/env.rb +0 -0
  39. data/{test_support/features → features}/support/paths.rb +0 -0
  40. data/{test_support/features → features}/support/selectors.rb +0 -0
  41. data/lib/railties/blacklight_cucumber.rake +1 -1
  42. data/{test_support/spec → spec}/controllers/application_controller_spec.rb +0 -0
  43. data/spec/controllers/bookmarks_controller_spec.rb +42 -0
  44. data/{test_support/spec → spec}/controllers/catalog_controller_spec.rb +0 -0
  45. data/{test_support/spec → spec}/controllers/search_history_controller_spec.rb +0 -0
  46. data/{test_support/spec → spec}/data/sample_docs.yml +0 -0
  47. data/{test_support/spec → spec}/data/test_data.utf8.mrc +0 -0
  48. data/{test_support/spec → spec}/helpers/blacklight_helper_spec.rb +0 -0
  49. data/{test_support/spec → spec}/helpers/catalog_helper_spec.rb +0 -0
  50. data/{test_support/spec → spec}/helpers/facets_helper_spec.rb +31 -4
  51. data/{test_support/spec → spec}/helpers/hash_as_hidden_fields_spec.rb +0 -0
  52. data/{test_support/spec → spec}/helpers/html_head_helper_spec.rb +0 -0
  53. data/{test_support/spec → spec}/helpers/render_constraints_helper_spec.rb +0 -0
  54. data/{test_support/spec → spec}/helpers/search_history_constraints_helper_spec.rb +0 -0
  55. data/{test_support/spec → spec}/lib/blacklight_configurable_spec.rb +0 -0
  56. data/{test_support/spec → spec}/lib/blacklight_configuration_spec.rb +0 -0
  57. data/{test_support/spec → spec}/lib/blacklight_email_spec.rb +0 -0
  58. data/{test_support/spec → spec}/lib/blacklight_sms_spec.rb +0 -0
  59. data/{test_support/spec → spec}/lib/blacklight_solr_document_dublin_core_spec.rb +0 -0
  60. data/{test_support/spec → spec}/lib/blacklight_solr_document_marc_spec.rb +0 -0
  61. data/{test_support/spec → spec}/lib/blacklight_solr_document_more_like_this_spec.rb +0 -0
  62. data/{test_support/spec → spec}/lib/blacklight_solr_document_spec.rb +0 -0
  63. data/{test_support/spec → spec}/lib/blacklight_solr_response_spec.rb +0 -0
  64. data/{test_support/spec → spec}/lib/blacklight_spec.rb +1 -1
  65. data/{test_support/spec → spec}/lib/blacklight_user_spec.rb +0 -0
  66. data/{test_support/spec → spec}/lib/facet_paginator_spec.rb +0 -0
  67. data/{test_support/spec → spec}/lib/marc_export_spec.rb +0 -0
  68. data/{test_support/spec → spec}/lib/search_fields_spec.rb +0 -0
  69. data/{test_support/spec → spec}/lib/solr_helper_spec.rb +0 -0
  70. data/{test_support/spec → spec}/lib/tasks/blacklight_task_spec.rb +0 -0
  71. data/{test_support/spec → spec}/lib/tasks/solr_marc_task_spec.rb +0 -0
  72. data/{test_support/spec → spec}/lib/utils_spec.rb +0 -0
  73. data/{test_support/spec → spec}/models/bookmark_spec.rb +0 -0
  74. data/{test_support/spec → spec}/models/record_mailer_spec.rb +0 -0
  75. data/{test_support/spec → spec}/models/search_spec.rb +0 -0
  76. data/{test_support/spec → spec}/models/solr_docment_spec.rb +0 -0
  77. data/{test_support/spec → spec}/rcov.opts +0 -0
  78. data/{test_support/spec → spec}/requests/alternate_controller_spec.rb +0 -0
  79. data/{test_support/spec → spec}/routing/catalog_routing_spec.rb +0 -0
  80. data/{test_support/spec → spec}/spec.opts +0 -0
  81. data/{test_support/spec → spec}/spec_helper.rb +2 -3
  82. data/{test_support/spec → spec}/support/assert_difference.rb +0 -0
  83. data/{test_support/spec → spec}/support/include_text.rb +0 -0
  84. data/spec/test_app_templates/Gemfile.extra +38 -0
  85. data/spec/test_app_templates/lib/generators/test_app_generator.rb +40 -0
  86. data/spec/test_app_templates/lib/tasks/rspec.rake +8 -0
  87. data/{test_support/spec → spec}/views/catalog/_constraints_element.html.erb_spec.rb +0 -0
  88. data/{test_support/spec → spec}/views/catalog/_document_list.html.erb_spec.rb +0 -0
  89. data/{test_support/spec → spec}/views/catalog/_facets.html.erb_spec.rb +0 -0
  90. data/{test_support/spec → spec}/views/catalog/_index_default.erb_spec.rb +0 -0
  91. data/{test_support/spec → spec}/views/catalog/_show_default.erb_spec.rb +0 -0
  92. data/{test_support/spec → spec}/views/catalog/_show_sidebar.erb_spec.rb +0 -0
  93. data/{test_support/spec → spec}/views/catalog/index.atom.builder_spec.rb +0 -0
  94. data/tasks/blacklight.rake +97 -0
  95. metadata +178 -83
  96. metadata.gz.sig +0 -0
  97. data/test_support/bin/run-tests.sh +0 -56
  98. data/test_support/bin/setup-test-app.sh +0 -119
  99. data/test_support/bin/test.sh +0 -147
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 85237ab5ca9df6a7dceedb02ee41c653bea8f99b
4
- data.tar.gz: d8e94fa7a2eb458e6e072f5b9178a59874d28672
3
+ metadata.gz: 64ee8019553f491ded8b0186b6d9d30358c2ca25
4
+ data.tar.gz: d4935e93a6fa56fb5ae42f32f0140e61bb1b0032
5
5
  SHA512:
6
- metadata.gz: cd6f5b56a806020627da8539450d8b9e259960d8f6e74e1cfbc2b2be140868705c69f57edb245bcf3fa971aadef6ad3020c67b4c87d47c2a7d4a9d661767a01d
7
- data.tar.gz: 3e1b35b3aa99e852e2d43c93135937d0ed4392b7356a08368768f0c2951cd756d0881147aa86e448957322ec2b3d44d5f3227fc4c40afb19eaf999257bed605e
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/logs/*.log
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
- tmp/test_app
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
- - test_support/bin/test.sh
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
- - gem install bundler
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.0
1
+ 4.2.0
@@ -64,7 +64,7 @@
64
64
  label.append(span);
65
65
 
66
66
  function update_state_for(state) {
67
- checkbox.attr("checked", state);
67
+ checkbox.prop("checked", state);
68
68
  label.toggleClass("checked", state);
69
69
  if (state) {
70
70
  //Set the Rails hidden field that fakes an HTTP verb
@@ -52,7 +52,7 @@ class BookmarksController < CatalogController
52
52
  end
53
53
 
54
54
  if request.xhr?
55
- render :text => "", :status => (success ? "200" : "500" )
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
- render :text => "", :status => (success ? "200" : "500")
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.label, add_facet_params_and_redirect(facet_solr_field, item), :class=>"facet_select") + " " + render_facet_count(item.hits)).html_safe
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
- display_label = value
224
-
225
- if facet_config.query and facet_config.query[value]
226
- display_label = facet_config.query[value][:label]
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
- if facet_config.date
230
- localization_options = {}
231
- localization_options = facet_config.date unless facet_config.date === true
232
- display_label = l(value.to_datetime, localization_options)
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.2.0"
32
+ s.add_development_dependency "jettywrapper", ">= 1.4.1"
33
+ s.add_development_dependency "rspec-rails"
33
34
  end
data/config/jetty.yml ADDED
@@ -0,0 +1,4 @@
1
+ default:
2
+ startup_wait: 15
3
+ jetty_port: <%= ENV['TEST_JETTY_PORT'] || 8888 %>
4
+ <%= ENV['TEST_JETTY_PATH'] ? "jetty_home: " + ENV['TEST_JETTY_PATH'] : '' %>
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("./test_support/features", Blacklight.root)
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
 
@@ -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
@@ -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
@@ -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