blacklight 4.3.0 → 4.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +0 -6
  4. data/Gemfile +5 -0
  5. data/README.md +1 -1
  6. data/Rakefile +0 -1
  7. data/VERSION +1 -1
  8. data/app/assets/javascripts/blacklight/autofocus.js +16 -0
  9. data/app/assets/javascripts/blacklight/blacklight.js +1 -0
  10. data/app/assets/javascripts/blacklight/bookmark_toggle.js +2 -5
  11. data/app/assets/javascripts/blacklight/checkbox_submit.js +3 -6
  12. data/app/assets/javascripts/blacklight/core.js +24 -1
  13. data/app/assets/javascripts/blacklight/css_dropdowns.js +2 -2
  14. data/app/assets/javascripts/blacklight/facet_expand_contract.js +4 -3
  15. data/app/assets/javascripts/blacklight/lightbox_dialog.js +7 -1
  16. data/app/assets/javascripts/blacklight/search_context.js +1 -1
  17. data/app/assets/javascripts/blacklight/select_submit.js +1 -1
  18. data/app/assets/javascripts/blacklight/zebra_stripe.js +1 -1
  19. data/app/assets/stylesheets/blacklight/_blacklight_base.css.scss +1 -0
  20. data/app/assets/stylesheets/blacklight/_catalog.css.scss +5 -0
  21. data/app/assets/stylesheets/blacklight/_facets.css.scss +6 -0
  22. data/app/assets/stylesheets/blacklight/_group.css.scss +14 -0
  23. data/app/assets/stylesheets/blacklight/blacklight_defaults.css.scss +1 -0
  24. data/app/controllers/bookmarks_controller.rb +2 -2
  25. data/app/helpers/blacklight/blacklight_helper_behavior.rb +41 -24
  26. data/app/helpers/blacklight/catalog_helper_behavior.rb +48 -28
  27. data/app/helpers/blacklight/facets_helper_behavior.rb +9 -75
  28. data/app/models/record_mailer.rb +1 -16
  29. data/app/views/bookmarks/index.html.erb +2 -0
  30. data/app/views/catalog/_bookmark_control.html.erb +3 -4
  31. data/app/views/catalog/_document.html.erb +2 -1
  32. data/app/views/catalog/_document_header.html.erb +6 -3
  33. data/app/views/catalog/_email_form.html.erb +0 -7
  34. data/app/views/catalog/_facet_layout.html.erb +1 -1
  35. data/app/views/catalog/_group_default.html.erb +12 -0
  36. data/app/views/catalog/_index_default.html.erb +1 -1
  37. data/app/views/catalog/_opensearch_response_metadata.html.erb +2 -3
  38. data/app/views/catalog/_paginate_compact.html.erb +2 -2
  39. data/app/views/catalog/_results_pagination.html.erb +2 -2
  40. data/app/views/catalog/_search_form.html.erb +1 -1
  41. data/app/views/catalog/_sms_form.html.erb +1 -21
  42. data/app/views/catalog/_thumbnail_default.html.erb +5 -0
  43. data/app/views/catalog/email_sent.html.erb +9 -0
  44. data/app/views/catalog/index.atom.builder +7 -8
  45. data/app/views/catalog/index.html.erb +6 -3
  46. data/app/views/catalog/librarian_view.html.erb +1 -1
  47. data/app/views/catalog/sms_sent.html.erb +9 -0
  48. data/app/views/feedback/complete.html.erb +2 -0
  49. data/app/views/feedback/show.html.erb +7 -5
  50. data/app/views/kaminari/blacklight_compact/_paginator.html.erb +1 -1
  51. data/app/views/layouts/blacklight.html.erb +1 -2
  52. data/app/views/saved_searches/index.html.erb +2 -0
  53. data/app/views/search_history/index.html.erb +1 -1
  54. data/blacklight.gemspec +1 -1
  55. data/config/locales/blacklight.en.yml +11 -0
  56. data/config/locales/blacklight.fr.yml +15 -1
  57. data/gemfiles/rails3.gemfile +7 -0
  58. data/gemfiles/rails4.gemfile +7 -0
  59. data/lib/blacklight.rb +1 -0
  60. data/lib/blacklight/catalog.rb +101 -56
  61. data/lib/blacklight/configuration.rb +1 -1
  62. data/lib/blacklight/controller.rb +7 -4
  63. data/lib/blacklight/facet.rb +79 -0
  64. data/lib/blacklight/routes.rb +0 -1
  65. data/lib/blacklight/solr/document.rb +4 -0
  66. data/lib/blacklight/solr/document/marc_export.rb +1 -1
  67. data/lib/blacklight/solr_helper.rb +39 -8
  68. data/lib/blacklight/solr_response.rb +35 -3
  69. data/lib/blacklight/solr_response/facets.rb +4 -0
  70. data/lib/blacklight/solr_response/group.rb +33 -0
  71. data/lib/blacklight/solr_response/group_response.rb +49 -0
  72. data/lib/blacklight/solr_response/pagination_methods.rb +27 -0
  73. data/lib/blacklight/user.rb +30 -32
  74. data/lib/generators/blacklight/assets_generator.rb +3 -1
  75. data/lib/generators/blacklight/blacklight_generator.rb +28 -125
  76. data/lib/generators/blacklight/marc_generator.rb +66 -0
  77. data/lib/generators/blacklight/models_generator.rb +113 -0
  78. data/lib/generators/blacklight/templates/alternate_controller.rb +9 -0
  79. data/lib/generators/blacklight/templates/config/solr.yml +0 -2
  80. data/lib/generators/blacklight/templates/solr_document.rb +1 -13
  81. data/lib/railties/all_tests.rake +5 -8
  82. data/spec/controllers/catalog_controller_spec.rb +185 -113
  83. data/spec/features/alternate_controller_spec.rb +34 -0
  84. data/spec/features/bookmarks_spec.rb +58 -0
  85. data/spec/features/did_you_mean_spec.rb +135 -0
  86. data/spec/features/librarian_view_spec.rb +13 -0
  87. data/spec/features/record_view_spec.rb +37 -0
  88. data/spec/features/saved_searches_spec.rb +47 -0
  89. data/spec/features/search_filters_spec.rb +137 -0
  90. data/spec/features/search_history_spec.rb +75 -0
  91. data/spec/features/search_pagination_spec.rb +91 -0
  92. data/spec/features/search_results_spec.rb +68 -0
  93. data/spec/features/search_sort_spec.rb +20 -0
  94. data/spec/features/search_spec.rb +108 -0
  95. data/spec/helpers/blacklight_helper_spec.rb +45 -2
  96. data/spec/helpers/catalog_helper_spec.rb +134 -1
  97. data/spec/helpers/facets_helper_spec.rb +8 -0
  98. data/spec/lib/blacklight/solr_response/group_response_spec.rb +78 -0
  99. data/spec/lib/blacklight/solr_response/group_spec.rb +70 -0
  100. data/spec/lib/blacklight_solr_response_spec.rb +11 -5
  101. data/spec/lib/blacklight_user_spec.rb +22 -41
  102. data/spec/lib/solr_helper_spec.rb +73 -1
  103. data/spec/models/record_mailer_spec.rb +3 -3
  104. data/spec/models/{solr_docment_spec.rb → solr_document_spec.rb} +1 -1
  105. data/spec/spec_helper.rb +0 -1
  106. data/spec/support/features.rb +7 -0
  107. data/spec/support/features/session_helpers.rb +22 -0
  108. data/spec/test_app_templates/Gemfile.extra +0 -4
  109. data/spec/test_app_templates/lib/generators/test_app_generator.rb +0 -6
  110. data/spec/test_app_templates/lib/tasks/blacklight_test_app.rake +1 -9
  111. data/spec/views/catalog/_facets.html.erb_spec.rb +2 -1
  112. data/tasks/blacklight.rake +0 -10
  113. metadata +49 -58
  114. data/features/bookmarks.feature +0 -68
  115. data/features/did_you_mean.feature +0 -123
  116. data/features/librarian_view.feature +0 -18
  117. data/features/record_view.feature +0 -40
  118. data/features/saved_searches.feature +0 -49
  119. data/features/search.feature +0 -83
  120. data/features/search_filters.feature +0 -119
  121. data/features/search_history.feature +0 -85
  122. data/features/search_pagination.feature +0 -53
  123. data/features/search_results.feature +0 -61
  124. data/features/search_sort.feature +0 -27
  125. data/features/step_definitions/bookmarks_steps.rb +0 -6
  126. data/features/step_definitions/error_steps.rb +0 -5
  127. data/features/step_definitions/general_steps.rb +0 -50
  128. data/features/step_definitions/record_view_steps.rb +0 -12
  129. data/features/step_definitions/saved_searches_steps.rb +0 -19
  130. data/features/step_definitions/search_facets_steps.rb +0 -29
  131. data/features/step_definitions/search_history_steps.rb +0 -9
  132. data/features/step_definitions/search_pagination_steps.rb +0 -29
  133. data/features/step_definitions/search_result_steps.rb +0 -115
  134. data/features/step_definitions/search_steps.rb +0 -118
  135. data/features/step_definitions/user_steps.rb +0 -5
  136. data/features/step_definitions/web_steps.rb +0 -217
  137. data/features/support/env.rb +0 -65
  138. data/features/support/paths.rb +0 -48
  139. data/features/support/selectors.rb +0 -40
  140. data/lib/railties/blacklight_cucumber.rake +0 -126
  141. data/lib/solrmarc.log.1 +0 -854
@@ -20,7 +20,9 @@ module Blacklight
20
20
  copy_file "blacklight.css.scss", "app/assets/stylesheets/blacklight.css.scss"
21
21
 
22
22
  unless IO.read("app/assets/javascripts/application.js").include?('blacklight/blacklight')
23
- insert_into_file "app/assets/javascripts/application.js", :after => "//= require jquery_ujs" do
23
+ marker = IO.read("app/assets/javascripts/application.js").include?('turbolinks') ?
24
+ '//= require turbolinks' : "//= require jquery_ujs"
25
+ insert_into_file "app/assets/javascripts/application.js", :after => marker do
24
26
  %q{
25
27
  //
26
28
  // Required by Blacklight
@@ -1,9 +1,7 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  require 'rails/generators'
3
- require 'rails/generators/migration'
4
3
 
5
4
  class BlacklightGenerator < Rails::Generators::Base
6
- include Rails::Generators::Migration
7
5
 
8
6
  source_root File.expand_path('../templates', __FILE__)
9
7
 
@@ -12,128 +10,46 @@ class BlacklightGenerator < Rails::Generators::Base
12
10
 
13
11
  desc """
14
12
  This generator makes the following changes to your application:
15
- 1. Creates several database migrations if they do not exist in /db/migrate
16
- 2. Adds additional mime types to you application in the file '/config/initializers/mime_types.rb'
17
- 3. Creates config/solr.yml with a default solr configuration that should work with standard marc records
18
- 4. Creates congig/SolrMarc/... with settings for SolrMarc
19
- 5. Creates a number of public assets, including images, stylesheets, and javascript
20
- 6. Adds a solr_marc.jar file to your lib/ directory
21
- 7. Injects behavior into your user application_controller.rb
22
- 8. Injects behavior into your user model
23
- 9. Creates a blacklight catalog controller in your /app/controllers directory
24
- 10. Creates a blacklight document in your /app/models directory
25
- 11. Adds Blacklight routes to your ./config/routes.rb
26
- 12. Enables internationalization.
13
+ 1. Generates blacklight:models
14
+ 2. Creates a number of public assets, including images, stylesheets, and javascript
15
+ 3. Injects behavior into your user application_controller.rb
16
+ 4. Adds example configurations for dealing with MARC-like data
17
+ 5. Adds Blacklight routes to your ./config/routes.rb
18
+
27
19
 
28
20
  Thank you for Installing Blacklight.
29
21
  """
30
22
 
31
- # Implement the required interface for Rails::Generators::Migration.
32
- # taken from http://github.com/rails/rails/blob/master/activerecord/lib/generators/active_record.rb
33
- def self.next_migration_number(path)
34
- unless @prev_migration_nr
35
- @prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
36
- else
37
- @prev_migration_nr += 1
38
- end
39
- @prev_migration_nr.to_s
40
- end
41
-
42
- def check_arguments
43
- if File.exists?("app/models/#{model_name}.rb") and options[:devise]
44
- puts "Because you have selected \"#{model_name}\", which is an existing class, you will need to install devise manually and then run this generator without the Devise option. You can find additional information here: https://github.com/plataformatec/devise. \n Please be sure to include a to_s method in #{model_name} that returns the users name or email, as this will be used by Blacklight to provide a link to user specific information."
45
- exit
46
- end
47
- end
48
-
49
-
50
- # Content types used by Marc Document extension, possibly among others.
51
- # Registering a unique content type with 'register' (rather than
52
- # register_alias) will allow content-negotiation for the format.
53
- def add_mime_types
54
- puts "Updating Mime Types"
55
- insert_into_file "config/initializers/mime_types.rb", :after => "# Be sure to restart your server when you modify this file." do <<EOF
56
- Mime::Type.register_alias "text/plain", :refworks_marc_txt
57
- Mime::Type.register_alias "text/plain", :openurl_kev
58
- Mime::Type.register "application/x-endnote-refer", :endnote
59
- Mime::Type.register "application/marc", :marc
60
- Mime::Type.register "application/marcxml+xml", :marcxml,
61
- ["application/x-marc+xml", "application/x-marcxml+xml",
62
- "application/marc+xml"]
63
- EOF
64
- end
65
- end
66
-
67
23
  def add_unicode_gem
68
24
  gem "unicode", :platforms => [:mri_18, :mri_19] unless defined?(:RUBY_VERSION) and RUBY_VERSION == '2.0.0'
69
25
  end
70
26
 
71
- # Install Devise?
72
- def generate_devise_assets
73
- if options[:devise]
74
- gem "devise"
75
- gem "devise-guests", "~> 0.3"
27
+ def add_bootstrap_gem
28
+ # Don't need a version here, because we specify the version in blacklight.gemspec
29
+ gem 'bootstrap-sass'
30
+ end
76
31
 
77
- Bundler.with_clean_env do
78
- run "bundle install"
79
- end
80
-
81
- generate "devise:install"
82
- generate "devise", model_name.classify
83
- generate "devise_guests", model_name.classify
84
- generate "devise:views"
85
-
86
- # add the #to_s to the model.
87
- insert_into_file("app/models/#{model_name}.rb", :before => /end(\n| )*$/) do
88
- %{
89
- # Method added by Blacklight; Blacklight uses #to_s on your
90
- # user class to get a user-displayable login/identifier for
91
- # the account.
92
- def to_s
93
- email
94
- end
95
- }
96
- end
97
- gsub_file("config/initializers/devise.rb", "config.sign_out_via = :delete", "config.sign_out_via = :get")
32
+ def bundle_install
33
+ Bundler.with_clean_env do
34
+ run "bundle install"
98
35
  end
99
36
  end
100
37
 
101
- # Copy all files in templates/config directory to host config
102
- def create_configuration_files
103
- copy_file "config/solr.yml", "config/solr.yml"
104
- copy_file "config/jetty.yml", "config/jetty.yml"
105
- directory("config/SolrMarc")
106
- end
107
-
108
38
  # Copy all files in templates/public/ directory to public/
109
39
  # Call external generator in AssetsGenerator, so we can
110
40
  # leave that callable seperately too.
111
41
  def copy_public_assets
112
42
  generate "blacklight:assets"
113
43
  end
114
-
115
- # Setup the database migrations
116
- def copy_migrations
117
- # Can't get this any more DRY, because we need this order.
118
- better_migration_template "create_searches.rb"
119
- better_migration_template "create_bookmarks.rb"
120
- better_migration_template "remove_editable_fields_from_bookmarks.rb"
121
- better_migration_template "add_user_types_to_bookmarks_searches.rb"
122
- end
123
44
 
45
+ def generate_blacklight_models
124
46
 
125
- # Add Blacklight to the user model
126
- def inject_blacklight_user_behavior
127
- file_path = "app/models/#{model_name.underscore}.rb"
128
- if File.exists?(file_path)
129
- inject_into_class file_path, model_name.classify do
130
- "\n attr_accessible :email, :password, :password_confirmation if Rails::VERSION::MAJOR < 4\n" +
131
- "# Connects this user object to Blacklights Bookmarks. " +
132
- "\n include Blacklight::User\n"
133
- end
134
- else
135
- say_status("warning", "Blacklight authenticated user functionality not installed, as a user model could not be found at /app/models/user.rb. If you used a different name, please re-run the migration and provide that name as an argument. Such as `rails -g blacklight client`", :yellow)
136
- end
47
+ generator_args = []
48
+ if options[:devise]
49
+ generator_args << "--devise #{options[:devise]}"
50
+ end
51
+
52
+ generate 'blacklight:models', generator_args.join(" ")
137
53
  end
138
54
 
139
55
  # Add Blacklight to the application controller
@@ -148,10 +64,14 @@ EOF
148
64
  end
149
65
  end
150
66
 
151
- # Generate blacklight document and the catalog controller
152
- def create_blacklight_catalog_and_document
153
- copy_file "solr_document.rb", "app/models/solr_document.rb"
154
- copy_file "catalog_controller.rb", "app/controllers/catalog_controller.rb"
67
+ # TODO
68
+ # def generate_stub_catalog_controller
69
+ ## see blacklight:marc generator
70
+ ##copy_file "catalog_controller.rb", "app/controllers/catalog_controller.rb"
71
+ #end
72
+
73
+ def generate_blacklight_marc_demo
74
+ generate 'blacklight:marc'
155
75
  end
156
76
 
157
77
  def inject_blacklight_routes
@@ -174,22 +94,5 @@ EOF
174
94
 
175
95
  end
176
96
 
177
- def add_bootstrap_gem
178
- # Don't need a version here, because we specify the version in blacklight.gemspec
179
- gem 'bootstrap-sass'
180
- end
181
-
182
-
183
- private
184
-
185
- def better_migration_template (file)
186
- begin
187
- migration_template "migrations/#{file}", "db/migrate/#{file}"
188
- sleep 1 # ensure scripts have different time stamps
189
- rescue
190
- puts " \e[1m\e[34mMigrations\e[0m " + $!.message
191
- end
192
- end
193
-
194
97
  end
195
98
 
@@ -0,0 +1,66 @@
1
+ require 'rails/generators'
2
+
3
+ module Blacklight
4
+ class MarcGenerator < Rails::Generators::Base
5
+
6
+ source_root File.expand_path('../templates', __FILE__)
7
+
8
+ desc """
9
+ 1. Adds additional mime types to you application in the file '/config/initializers/mime_types.rb'
10
+ 2. Creates config/SolrMarc/... with settings for SolrMarc
11
+ 3. Creates a CatalogController with some some demo fields for MARC-like data
12
+ 4. Injects MARC-specific behaviors into the SolrDocument
13
+ """
14
+
15
+ # Content types used by Marc Document extension, possibly among others.
16
+ # Registering a unique content type with 'register' (rather than
17
+ # register_alias) will allow content-negotiation for the format.
18
+ def add_mime_types
19
+ puts "Updating Mime Types"
20
+ insert_into_file "config/initializers/mime_types.rb", :after => "# Be sure to restart your server when you modify this file." do <<EOF
21
+ Mime::Type.register_alias "text/plain", :refworks_marc_txt
22
+ Mime::Type.register_alias "text/plain", :openurl_kev
23
+ Mime::Type.register "application/x-endnote-refer", :endnote
24
+ Mime::Type.register "application/marc", :marc
25
+ Mime::Type.register "application/marcxml+xml", :marcxml,
26
+ ["application/x-marc+xml", "application/x-marcxml+xml",
27
+ "application/marc+xml"]
28
+ EOF
29
+ end
30
+ end
31
+
32
+ # Copy all files in templates/config directory to host config
33
+ def create_configuration_files
34
+ directory("config/SolrMarc")
35
+ end
36
+
37
+ # Generate blacklight catalog controller
38
+ def create_blacklight_catalog
39
+ copy_file "catalog_controller.rb", "app/controllers/catalog_controller.rb"
40
+ end
41
+
42
+ # add MARC-specific extensions to the solr document
43
+ def add_marc_extension_to_solrdocument
44
+
45
+ insert_into_file "app/models/solr_document.rb", :after => "include Blacklight::Solr::Document" do <<EOF
46
+
47
+ # The following shows how to setup this blacklight document to display marc documents
48
+ extension_parameters[:marc_source_field] = :marc_display
49
+ extension_parameters[:marc_format_type] = :marcxml
50
+ use_extension( Blacklight::Solr::Document::Marc) do |document|
51
+ document.key?( :marc_display )
52
+ end
53
+
54
+ field_semantics.merge!(
55
+ :title => "title_display",
56
+ :author => "author_display",
57
+ :language => "language_facet",
58
+ :format => "format"
59
+ )
60
+
61
+ EOF
62
+ end
63
+ end
64
+
65
+ end
66
+ end
@@ -0,0 +1,113 @@
1
+ require 'rails/generators'
2
+ require 'rails/generators/migration'
3
+
4
+ module Blacklight
5
+ class ModelsGenerator < Rails::Generators::Base
6
+ include Rails::Generators::Migration
7
+
8
+ source_root File.expand_path('../templates', __FILE__)
9
+
10
+ argument :model_name, :type => :string , :default => "user"
11
+ class_option :devise , :type => :boolean, :default => false, :aliases => "-d", :desc => "Use Devise as authentication logic (this is default)."
12
+
13
+ desc """
14
+ This generator makes the following changes to your application:
15
+ 1. Creates several database migrations if they do not exist in /db/migrate
16
+ 2. Creates config/solr.yml with a default solr configuration
17
+ 3. Injects behavior into your user model
18
+ 4. Creates a blacklight document in your /app/models directory
19
+ """
20
+ # Implement the required interface for Rails::Generators::Migration.
21
+ # taken from http://github.com/rails/rails/blob/master/activerecord/lib/generators/active_record.rb
22
+ def self.next_migration_number(path)
23
+ if @prev_migration_nr
24
+ @prev_migration_nr += 1
25
+ else
26
+ if last_migration = Dir[File.join(path, '*.rb')].sort.last
27
+ @prev_migration_nr = last_migration.sub(File.join(path, '/'), '').to_i + 1
28
+ else
29
+ @prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
30
+ end
31
+ end
32
+ @prev_migration_nr.to_s
33
+ end
34
+
35
+ def check_arguments
36
+ if File.exists?("app/models/#{model_name}.rb") and options[:devise]
37
+ puts "Because you have selected \"#{model_name}\", which is an existing class, you will need to install devise manually and then run this generator without the Devise option. You can find additional information here: https://github.com/plataformatec/devise. \n Please be sure to include a to_s method in #{model_name} that returns the users name or email, as this will be used by Blacklight to provide a link to user specific information."
38
+ exit
39
+ end
40
+ end
41
+
42
+ # Install Devise?
43
+ def generate_devise_assets
44
+ if options[:devise]
45
+ gem "devise"
46
+ gem "devise-guests", "~> 0.3"
47
+
48
+ Bundler.with_clean_env do
49
+ run "bundle install"
50
+ end
51
+
52
+ generate "devise:install"
53
+ generate "devise", model_name.classify
54
+ generate "devise_guests", model_name.classify
55
+
56
+ # add the #to_s to the model.
57
+ insert_into_file("app/models/#{model_name}.rb", :before => /end(\n| )*$/) do
58
+ %{
59
+ # Method added by Blacklight; Blacklight uses #to_s on your
60
+ # user class to get a user-displayable login/identifier for
61
+ # the account.
62
+ def to_s
63
+ email
64
+ end
65
+ }
66
+ end
67
+ gsub_file("config/initializers/devise.rb", "config.sign_out_via = :delete", "config.sign_out_via = :get")
68
+ end
69
+ end
70
+
71
+ # Copy all files in templates/config directory to host config
72
+ def create_configuration_files
73
+ copy_file "config/solr.yml", "config/solr.yml"
74
+ copy_file "config/jetty.yml", "config/jetty.yml"
75
+ end
76
+
77
+
78
+ # Setup the database migrations
79
+ def copy_migrations
80
+ # Can't get this any more DRY, because we need this order.
81
+ better_migration_template "create_searches.rb"
82
+ better_migration_template "create_bookmarks.rb"
83
+ better_migration_template "remove_editable_fields_from_bookmarks.rb"
84
+ better_migration_template "add_user_types_to_bookmarks_searches.rb"
85
+ end
86
+
87
+
88
+ # Add Blacklight to the user model
89
+ def inject_blacklight_user_behavior
90
+ file_path = "app/models/#{model_name.underscore}.rb"
91
+ if File.exists?(file_path)
92
+ inject_into_class file_path, model_name.classify do
93
+ "\n attr_accessible :email, :password, :password_confirmation if Rails::VERSION::MAJOR < 4\n" +
94
+ "# Connects this user object to Blacklights Bookmarks. " +
95
+ "\n include Blacklight::User\n"
96
+ end
97
+ else
98
+ say_status("warning", "Blacklight authenticated user functionality not installed, as a user model could not be found at /app/models/user.rb. If you used a different name, please re-run the migration and provide that name as an argument. Such as `rails -g blacklight client`", :yellow)
99
+ end
100
+ end
101
+
102
+ def create_solr_document
103
+ copy_file "solr_document.rb", "app/models/solr_document.rb"
104
+ end
105
+
106
+ private
107
+
108
+ def better_migration_template(file)
109
+ migration_template "migrations/#{file}", "db/migrate/#{file}"
110
+ end
111
+
112
+ end
113
+ end
@@ -1,4 +1,13 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  class AlternateController < CatalogController
3
+ configure_blacklight do |config|
4
+ config.index.thumbnail_method = :xyz
5
+ end
6
+
7
+ def xyz *args
8
+ view_context.image_tag "asdfg"
9
+ end
10
+
11
+ helper_method :xyz
3
12
 
4
13
  end
@@ -14,5 +14,3 @@ development:
14
14
  url: <%= ENV['SOLR_URL'] || "http://127.0.0.1:8983/solr" %>
15
15
  test: &test
16
16
  url: <%= "http://127.0.0.1:#{ENV['TEST_JETTY_PORT'] || 8888}/solr" %>
17
- cucumber:
18
- <<: *test
@@ -5,13 +5,6 @@ class SolrDocument
5
5
 
6
6
  # self.unique_key = 'id'
7
7
 
8
- # The following shows how to setup this blacklight document to display marc documents
9
- extension_parameters[:marc_source_field] = :marc_display
10
- extension_parameters[:marc_format_type] = :marcxml
11
- use_extension( Blacklight::Solr::Document::Marc) do |document|
12
- document.key?( :marc_display )
13
- end
14
-
15
8
  # Email uses the semantic field mappings below to generate the body of an email.
16
9
  SolrDocument.use_extension( Blacklight::Solr::Document::Email )
17
10
 
@@ -24,10 +17,5 @@ class SolrDocument
24
17
  # and Blacklight::Solr::Document#to_semantic_values
25
18
  # Recommendation: Use field names from Dublin Core
26
19
  use_extension( Blacklight::Solr::Document::DublinCore)
27
- field_semantics.merge!(
28
- :title => "title_display",
29
- :author => "author_display",
30
- :language => "language_facet",
31
- :format => "format"
32
- )
20
+
33
21
  end
@@ -1,19 +1,17 @@
1
1
  namespace :blacklight do
2
2
  begin
3
- require 'cucumber/rake/task'
4
3
  require 'rspec/core'
5
4
  require 'rspec/core/rake_task'
6
5
 
7
- desc "Run Blacklight cucumber and rspec, with test solr"
6
+ desc "Run Blacklight rspec, with test solr"
8
7
  task :all_tests => :hudson
9
8
 
10
- desc "Run Blacklight cucumber and rspec, with test solr"
9
+ desc "Run Blacklight rspec, with test solr"
11
10
  task :hudson do
12
11
  Rails.env = 'test' unless ENV['RAILS_ENV']
13
12
 
14
13
  error = Jettywrapper.wrap(Jettywrapper.load_config) do
15
14
  Rake::Task["blacklight:spec"].invoke
16
- Rake::Task["blacklight:cucumber"].invoke
17
15
  end
18
16
 
19
17
  raise "test failures: #{error}" if error
@@ -21,22 +19,21 @@ namespace :blacklight do
21
19
 
22
20
  namespace :all_tests do
23
21
  task :rcov do
24
- desc "Run Blacklight rspec and cucumber tests with rcov"
22
+ desc "Run Blacklight rspec tests with rcov"
25
23
 
26
24
  rm "blacklight-coverage.data" if File.exist?("blacklight-coverage.data")
27
25
  Rails.env = 'test' unless ENV['RAILS_ENV']
28
26
  error = Jettywrapper.wrap(Jettywrapper.load_config) do
29
27
  Rake::Task["blacklight:spec:rcov"].invoke
30
- Rake::Task["blacklight:cucumber:rcov"].invoke
31
28
  end
32
29
  raise "test failures: #{error}" if error
33
30
  end
34
31
  end
35
32
 
36
33
  rescue LoadError
37
- desc "Not available! (cucumber and rspec not avail)"
34
+ desc "Not available! (rspec not avail)"
38
35
  task :all_tests do
39
- abort 'Not available. Both cucumber and rspec need to be installed to run blacklight:all_tests'
36
+ abort 'Not available. Rspec needs to be installed to run blacklight:all_tests'
40
37
  end
41
38
  end
42
39
  end