blacklight-marc 5.10.0 → 6.0.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.
- checksums.yaml +4 -4
- data/.gitignore +3 -1
- data/.travis.yml +12 -17
- data/Gemfile +21 -14
- data/README.md +18 -1
- data/Rakefile +2 -2
- data/app/assets/stylesheets/blacklight_marc.scss +42 -0
- data/app/helpers/blacklight_marc_helper.rb +17 -0
- data/{lib → app/models/concerns}/blacklight/solr/document/marc.rb +0 -0
- data/{lib → app/models/concerns}/blacklight/solr/document/marc_export.rb +0 -20
- data/app/views/bookmarks/_endnote.html.erb +1 -1
- data/app/views/bookmarks/_refworks.html.erb +1 -1
- data/app/views/catalog/_refworks_form.html.erb +6 -0
- data/app/views/catalog/show.refworks.erb +1 -0
- data/blacklight-marc.gemspec +9 -5
- data/config/locales/blacklight_marc.de.yml +5 -0
- data/config/locales/{blacklight.en.yml → blacklight_marc.en.yml} +2 -2
- data/config/locales/blacklight_marc.es.yml +5 -0
- data/config/locales/{blacklight.fr.yml → blacklight_marc.fr.yml} +0 -0
- data/config/locales/blacklight_marc.it.yml +5 -0
- data/config/locales/blacklight_marc.pt-BR.yml +5 -0
- data/lib/blacklight/marc.rb +2 -4
- data/lib/blacklight/marc/catalog.rb +23 -0
- data/lib/blacklight/marc/engine.rb +18 -0
- data/lib/blacklight/marc/indexer.rb +80 -0
- data/lib/blacklight/marc/indexer/dewey.rb +35 -0
- data/lib/blacklight/marc/indexer/formats.rb +194 -0
- data/lib/blacklight/marc/routes.rb +2 -2
- data/lib/blacklight/marc/version.rb +1 -1
- data/lib/generators/blacklight/marc/install_generator.rb +21 -7
- data/lib/generators/blacklight/marc/templates/app/models/marc_indexer.rb +161 -0
- data/lib/generators/blacklight/marc/templates/config/{SolrMarc/translation_maps → translation_maps}/README_MAPS +0 -0
- data/lib/generators/blacklight/marc/templates/config/{SolrMarc/translation_maps → translation_maps}/callnumber_map.properties +0 -0
- data/lib/generators/blacklight/marc/templates/config/{SolrMarc/translation_maps → translation_maps}/composition_era_map.properties +0 -0
- data/lib/generators/blacklight/marc/templates/config/{SolrMarc/translation_maps → translation_maps}/country_map.properties +0 -0
- data/lib/generators/blacklight/marc/templates/config/{SolrMarc/translation_maps → translation_maps}/format_map.properties +0 -0
- data/lib/generators/blacklight/marc/templates/config/{SolrMarc/translation_maps → translation_maps}/instrument_map.properties +0 -0
- data/lib/generators/blacklight/marc/templates/config/{SolrMarc/translation_maps → translation_maps}/language_map.properties +0 -0
- data/lib/railties/solr_marc.rake +24 -27
- data/spec/features/bookmarks_spec.rb +17 -0
- data/spec/features/librarian_view_spec.rb +1 -1
- data/spec/features/record_view_spec.rb +13 -0
- data/spec/features/search_formats_spec.rb +31 -0
- data/spec/helpers/blacklight_marc_helper_spec.rb +20 -0
- data/spec/lib/indexer/dewey_spec.rb +86 -0
- data/spec/lib/indexer/formats_spec.rb +65 -0
- data/spec/lib/tasks/solr_marc_task_spec.rb +14 -18
- data/spec/lib/traject_indexer_spec.rb +132 -0
- data/spec/routing/routes_spec.rb +2 -2
- data/spec/spec_helper.rb +8 -1
- data/spec/support/controller_level_helpers.rb +21 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +1 -3
- data/spec/views/bookmarks/_endnote.html.erb_spec.rb +4 -0
- data/spec/views/bookmarks/_refworks.html.erb_spec.rb +4 -0
- data/spec/views/catalog/_document_action.html.erb_spec.rb +21 -0
- data/spec/views/catalog/index.atom.builder_spec.rb +58 -0
- data/test_support/config/translation_maps/test_dewey.properties +99 -0
- data/test_support/config/translation_maps/test_formats.properties +22 -0
- metadata +101 -30
- data/lib/SolrMarc.jar +0 -0
- data/lib/blacklight/marc/railtie.rb +0 -17
- data/lib/generators/blacklight/marc/templates/config/SolrMarc/config-test.properties +0 -37
- data/lib/generators/blacklight/marc/templates/config/SolrMarc/config.properties +0 -37
- data/lib/generators/blacklight/marc/templates/config/SolrMarc/index.properties +0 -97
- data/lib/generators/blacklight/marc/templates/config/SolrMarc/index_scripts/dewey.bsh +0 -47
- data/lib/generators/blacklight/marc/templates/config/SolrMarc/index_scripts/format.bsh +0 -126
- data/lib/generators/blacklight_marc/marc_generator.rb +0 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3a674be3c4819a0ea53a8c949f68dc305adc2715
|
|
4
|
+
data.tar.gz: b2b7608c6e893f43fce519908d35f257a759a14f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 506c0334c905f179256b15044a46c0bf6a8cc0b71d49af5fc482a8e24b0cf9fbc402612486b3a3a01fc926ee6a20ad4acd1e32b79c06d69e0fe4e0333bd6cb90
|
|
7
|
+
data.tar.gz: 00399aeb90e6f0098849378eb99155f1b9f07d476e0970af1b39f9ca654c5e636d080033347f82f9509bf4d2d360738d002fab3e40b36d126cee5b06bd7774bf
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
|
@@ -1,34 +1,29 @@
|
|
|
1
|
+
language: ruby
|
|
2
|
+
sudo: false
|
|
3
|
+
|
|
1
4
|
notifications:
|
|
2
5
|
email: false
|
|
3
6
|
|
|
4
|
-
|
|
5
7
|
rvm:
|
|
6
|
-
- 2.
|
|
8
|
+
- 2.2.3
|
|
7
9
|
|
|
8
10
|
matrix:
|
|
9
11
|
include:
|
|
10
|
-
- rvm: 2.
|
|
11
|
-
env: "RAILS_VERSION=4.
|
|
12
|
-
- rvm: 2.
|
|
13
|
-
env: "RAILS_VERSION=4.
|
|
14
|
-
- rvm: 1.9.3
|
|
15
|
-
env: "RAILS_VERSION=4.1.8"
|
|
16
|
-
- rvm: jruby
|
|
17
|
-
env: "RAILS_VERSION=4.1.8 JRUBY_OPTS=\"-J-Xms512m -J-Xmx1024m\""
|
|
18
|
-
- rvm: 2.1.4
|
|
19
|
-
env: "RAILS_VERSION=4.2.0.rc3"
|
|
12
|
+
- rvm: 2.2.2
|
|
13
|
+
env: "RAILS_VERSION=4.1.13"
|
|
14
|
+
- rvm: 2.1.6
|
|
15
|
+
env: "RAILS_VERSION=4.2.4"
|
|
20
16
|
|
|
21
17
|
before_install:
|
|
22
18
|
- gem install bundler
|
|
23
19
|
|
|
24
20
|
env:
|
|
25
|
-
- "RAILS_VERSION=
|
|
26
|
-
- "RAILS_VERSION=4.1.8"
|
|
21
|
+
- "RAILS_VERSION=4.2.4"
|
|
27
22
|
|
|
28
23
|
notifications:
|
|
29
24
|
irc: "irc.freenode.org#blacklight"
|
|
30
25
|
email:
|
|
31
26
|
- blacklight-commits@googlegroups.com
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
|
|
28
|
+
global_env:
|
|
29
|
+
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
|
data/Gemfile
CHANGED
|
@@ -3,26 +3,33 @@ source 'https://rubygems.org'
|
|
|
3
3
|
# Please see blacklight_marc.gemspec for dependency information.
|
|
4
4
|
gemspec path: File.expand_path('..', __FILE__)
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
# Peg simplecov to < 0.8 until this is resolved:
|
|
8
|
-
# https://github.com/colszowka/simplecov/issues/281
|
|
9
|
-
gem 'simplecov', '~> 0.7.1', require: false
|
|
6
|
+
gem 'simplecov', '~> 0.10', require: false
|
|
10
7
|
gem 'coveralls', require: false
|
|
11
8
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
# BEGIN ENGINE_CART BLOCK
|
|
10
|
+
# engine_cart: 0.8.0
|
|
11
|
+
# engine_cart stanza: 0.8.0
|
|
12
|
+
# the below comes from engine_cart, a gem used to test this Rails engine gem in the context of a Rails app.
|
|
13
|
+
file = File.expand_path("Gemfile", ENV['ENGINE_CART_DESTINATION'] || ENV['RAILS_ROOT'] || File.expand_path(".internal_test_app", File.dirname(__FILE__)))
|
|
14
|
+
if File.exist?(file)
|
|
15
|
+
begin
|
|
16
|
+
eval_gemfile file
|
|
17
|
+
rescue Bundler::GemfileError => e
|
|
18
|
+
Bundler.ui.warn '[EngineCart] Skipping Rails application dependencies:'
|
|
19
|
+
Bundler.ui.warn e.message
|
|
20
|
+
end
|
|
16
21
|
else
|
|
17
|
-
|
|
22
|
+
Bundler.ui.warn "[EngineCart] Unable to find test application dependencies in #{file}, using placeholder dependencies"
|
|
23
|
+
|
|
24
|
+
gem 'rails', ENV['RAILS_VERSION'] if ENV['RAILS_VERSION']
|
|
18
25
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
gem 'sass-rails', ">= 5.0.0.beta1"
|
|
26
|
+
if ENV['RAILS_VERSION'].nil? || ENV['RAILS_VERSION'] =~ /^4.2/
|
|
27
|
+
gem 'bootstrap-sass', '>= 3.3.5.1'
|
|
22
28
|
gem 'responders', "~> 2.0"
|
|
29
|
+
gem 'sass-rails', ">= 5.0"
|
|
23
30
|
else
|
|
31
|
+
gem 'bootstrap-sass', '< 3.3.5' # 3.3.5 requires sass 3.3, incompatible with sass-rails 4.x
|
|
24
32
|
gem 'sass-rails', "< 5.0"
|
|
25
|
-
gem 'coffee-rails', "~> 4.0.0"
|
|
26
33
|
end
|
|
27
34
|
end
|
|
28
|
-
|
|
35
|
+
# END ENGINE_CART BLOCK
|
data/README.md
CHANGED
|
@@ -18,8 +18,25 @@ After running the blacklight generator, run the blacklight_marc generator:
|
|
|
18
18
|
|
|
19
19
|
$ rails generate blacklight_marc:marc
|
|
20
20
|
|
|
21
|
+
The generator will create a model called MarcIndexer. This model can be customized by modifying
|
|
22
|
+
the field configurations in its initializer as a Traject 2 indexer; new indexing behaviors can
|
|
23
|
+
be added to it via mixins or inline methods. Two example mixins are provided:
|
|
24
|
+
```ruby
|
|
25
|
+
MarcIndexer
|
|
26
|
+
# you would add one or both of the mixins below
|
|
27
|
+
include Blacklight::Marc::Indexer::Formats
|
|
28
|
+
include Blacklight::Marc::Indexer::Dewey
|
|
29
|
+
def initialize
|
|
30
|
+
# and define fields as normal with the mixed-in methods
|
|
31
|
+
to_field 'format', get_format
|
|
32
|
+
to_field 'dewey100', dewey_facets(base: :hundreds)
|
|
33
|
+
to_field 'dewey010', dewey_facets(base: :tens)
|
|
34
|
+
to_field 'dewey_text', dewey_text
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
```
|
|
21
38
|
## Features
|
|
22
|
-
* Rake task `solr:marc:index` to import .mrc files using
|
|
39
|
+
* Rake task `solr:marc:index` to import .mrc files using Traject and app/models/marc_indexer
|
|
23
40
|
* Librarian view at `catalog/:id/librarian_view`
|
|
24
41
|
* Export records to refworks and endnote
|
|
25
42
|
* Blacklight::Solr::Document mixins for exporting and transforming MARC data from a stored Solr field
|
data/Rakefile
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
require "bundler/gem_tasks"
|
|
2
|
-
ZIP_URL = "https://github.com/projectblacklight/blacklight-jetty/archive/v4.10.
|
|
2
|
+
ZIP_URL = "https://github.com/projectblacklight/blacklight-jetty/archive/v4.10.4.zip"
|
|
3
3
|
|
|
4
4
|
require 'jettywrapper'
|
|
5
5
|
require 'rspec/core/rake_task'
|
|
@@ -26,7 +26,7 @@ namespace :blacklight_marc do
|
|
|
26
26
|
desc "Load fixtures"
|
|
27
27
|
task :fixtures => [:generate] do
|
|
28
28
|
within_test_app do
|
|
29
|
-
system "rake solr:marc:index_test_data RAILS_ENV=test"
|
|
29
|
+
system "bundle exec rake solr:marc:index_test_data RAILS_ENV=test"
|
|
30
30
|
abort "Error running fixtures" unless $?.success?
|
|
31
31
|
end
|
|
32
32
|
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/* border between items on marc view */
|
|
2
|
+
$marc_item_separator: 1px solid $text-muted !default;
|
|
3
|
+
|
|
4
|
+
#librarian_view
|
|
5
|
+
{
|
|
6
|
+
left:-17%;
|
|
7
|
+
text-align:left;
|
|
8
|
+
top:10%;
|
|
9
|
+
width:700px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
#marc_view
|
|
13
|
+
{
|
|
14
|
+
text-align:left;
|
|
15
|
+
|
|
16
|
+
.field
|
|
17
|
+
{
|
|
18
|
+
border-bottom: $marc_item_separator;
|
|
19
|
+
clear:both;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.ind1, .ind2
|
|
23
|
+
{
|
|
24
|
+
display:inline;
|
|
25
|
+
padding:0 $padding-xs-horizontal;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.subfields
|
|
29
|
+
{
|
|
30
|
+
padding-left:5em;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.tag_ind
|
|
34
|
+
{
|
|
35
|
+
float:left;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* refworks uses a form; we need to give it some additional padding to make it look like a link */
|
|
40
|
+
#refworks-form .btn {
|
|
41
|
+
padding: $nav-link-padding;
|
|
42
|
+
}
|
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
module BlacklightMarcHelper
|
|
2
2
|
|
|
3
|
+
# This method should move to BlacklightMarc in Blacklight 6.x
|
|
4
|
+
def refworks_export_url params = {}
|
|
5
|
+
"http://www.refworks.com/express/expressimport.asp?vendor=#{CGI.escape(params[:vendor] || application_name)}&filter=#{CGI.escape(params[:filter] || "MARC Format")}&encoding=65001" + (("&url=#{CGI.escape(params[:url])}" if params[:url]) || "")
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def refworks_solr_document_path opts = {}
|
|
9
|
+
if opts[:id]
|
|
10
|
+
refworks_export_url(url: solr_document_url(opts[:id], format: :refworks_marc_txt))
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# For exporting a single endnote document. (endnote_catalog_path is defined by blacklight-marc and it is used for multiple document export)
|
|
15
|
+
def single_endnote_catalog_path opts = {}
|
|
16
|
+
solr_document_path(opts.merge(format: 'endnote'))
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
|
|
3
20
|
# puts together a collection of documents into one refworks export string
|
|
4
21
|
def render_refworks_texts(documents)
|
|
5
22
|
val = ''
|
|
File without changes
|
|
@@ -154,7 +154,6 @@ module Blacklight::Solr::Document::MarcExport
|
|
|
154
154
|
"%7" => "250.a"
|
|
155
155
|
}
|
|
156
156
|
marc_obj = to_marc
|
|
157
|
-
|
|
158
157
|
# TODO. This should be rewritten to guess
|
|
159
158
|
# from actual Marc instead, probably.
|
|
160
159
|
format_str = 'Generic'
|
|
@@ -190,25 +189,6 @@ module Blacklight::Solr::Document::MarcExport
|
|
|
190
189
|
text
|
|
191
190
|
end
|
|
192
191
|
|
|
193
|
-
## DEPRECATED stuff left in for backwards compatibility, but should
|
|
194
|
-
# be gotten rid of eventually.
|
|
195
|
-
|
|
196
|
-
def to_zotero(format)
|
|
197
|
-
warn("[DEPRECATION] Simply call document.export_as_openurl_kev to get an openURL kev context object suitable for including in a COinS; then have view code make the span for the COinS. ")
|
|
198
|
-
"<span class=\"Z3988\" title=\"#{export_as_openurl_kev(format)}\"></span>"
|
|
199
|
-
end
|
|
200
|
-
|
|
201
|
-
def to_apa
|
|
202
|
-
warn("[DEPRECATION] Call document.export_as_apa_citation instead.")
|
|
203
|
-
export_as_apa_citation
|
|
204
|
-
end
|
|
205
|
-
|
|
206
|
-
def to_mla
|
|
207
|
-
warn("[DEPRECATION] Call document.export_as_mla_citation instead.")
|
|
208
|
-
end
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
192
|
protected
|
|
213
193
|
|
|
214
194
|
# Main method for defining chicago style citation. If we don't end up converting to using a citation formatting service
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<% if @document_list.any? {|d| d.exports_as? :endnote } %>
|
|
2
2
|
<li class="endnote">
|
|
3
|
-
<%= link_to t('blacklight.tools.endnote'), bookmarks_path(:endnote, params_for_search), :class => "btn btn-default", :id => "endnoteLink" %>
|
|
3
|
+
<%= link_to t('blacklight.tools.endnote'), bookmarks_path(:endnote, search_state.params_for_search), :class => "btn btn-default", :id => "endnoteLink" %>
|
|
4
4
|
</li>
|
|
5
5
|
<% end %>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<% if @document_list.any? {|d| d.exports_as? :refworks_marc_txt } %>
|
|
2
2
|
<li class="refworks">
|
|
3
|
-
<%= link_to t('blacklight.tools.refworks'), refworks_export_url(url: bookmarks_export_url(:refworks_marc_txt, params_for_search)), :class => "btn btn-default", :id => "refworksLink" %>
|
|
3
|
+
<%= link_to t('blacklight.tools.refworks'), refworks_export_url(url: bookmarks_export_url(:refworks_marc_txt, search_state.params_for_search)), :class => "btn btn-default", :id => "refworksLink" %>
|
|
4
4
|
</li>
|
|
5
5
|
<% end %>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<%# this partial is used by blacklight-marc 5.0 %>
|
|
2
|
+
<%= form_tag refworks_export_url, :name => "refworks", :role => 'form', :target => "_blank", :id => "refworks-form" do %>
|
|
3
|
+
|
|
4
|
+
<%= hidden_field_tag "ImportData", render_refworks_texts(documents) %>
|
|
5
|
+
<%= submit_tag t('blacklight.tools.refworks'), :class => 'submit btn btn-default'%>
|
|
6
|
+
<% end %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= render_refworks_text(@document) %>
|
data/blacklight-marc.gemspec
CHANGED
|
@@ -9,15 +9,16 @@ Gem::Specification.new do |spec|
|
|
|
9
9
|
spec.email = ["justin@curationexperts.com"]
|
|
10
10
|
spec.description = %q{MARC support for Blacklight}
|
|
11
11
|
spec.summary = %q{MARC support for Blacklight}
|
|
12
|
-
spec.homepage = "https://github.com/projectblacklight/
|
|
12
|
+
spec.homepage = "https://github.com/projectblacklight/blacklight-marc"
|
|
13
13
|
spec.license = "Apache 2.0"
|
|
14
14
|
|
|
15
|
-
spec.files = `git ls-files`.split(
|
|
16
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
15
|
+
spec.files = `git ls-files -z`.split("\x0")
|
|
17
16
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
17
|
+
spec.bindir = 'exe'
|
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
18
19
|
spec.require_paths = ["lib"]
|
|
19
20
|
|
|
20
|
-
spec.add_dependency
|
|
21
|
+
spec.add_dependency 'blacklight', '>= 6.0.0.pre3', '< 7'
|
|
21
22
|
|
|
22
23
|
spec.add_development_dependency "bundler", "~> 1.3"
|
|
23
24
|
spec.add_development_dependency "rake"
|
|
@@ -25,10 +26,13 @@ Gem::Specification.new do |spec|
|
|
|
25
26
|
spec.add_development_dependency "rspec-activemodel-mocks"
|
|
26
27
|
spec.add_development_dependency "jettywrapper"
|
|
27
28
|
spec.add_development_dependency "capybara"
|
|
28
|
-
spec.add_development_dependency "engine_cart", "~> 0.
|
|
29
|
+
spec.add_development_dependency "engine_cart", "~> 0.8"
|
|
29
30
|
|
|
31
|
+
spec.add_dependency "library_stdnums"
|
|
30
32
|
spec.add_dependency "rails"
|
|
31
33
|
# Let's allow future versions of marc, count on
|
|
32
34
|
# them to be backwards compat until 1.1
|
|
33
35
|
spec.add_dependency "marc", ">= 0.4.3", "< 1.1" # Marc record parser.
|
|
36
|
+
spec.add_dependency "traject", "~>2.1"
|
|
37
|
+
spec.add_dependency 'marc-fastxmlwriter' # NO REXML
|
|
34
38
|
end
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
en:
|
|
2
|
-
|
|
3
2
|
blacklight:
|
|
4
3
|
tools:
|
|
5
4
|
librarian_view: 'Librarian View'
|
|
5
|
+
endnote: 'Export to EndNote'
|
|
6
|
+
refworks: 'Export to Refworks'
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
search:
|
|
@@ -10,4 +11,3 @@ en:
|
|
|
10
11
|
title: 'Librarian View'
|
|
11
12
|
leader: 'LEADER %{leader}'
|
|
12
13
|
empty: 'No MARC data found.'
|
|
13
|
-
|
|
File without changes
|
data/lib/blacklight/marc.rb
CHANGED
|
@@ -3,13 +3,11 @@ require 'blacklight'
|
|
|
3
3
|
|
|
4
4
|
module Blacklight
|
|
5
5
|
module Marc
|
|
6
|
-
Blacklight::Solr::Document.autoload :Marc, 'blacklight/solr/document/marc'
|
|
7
|
-
Blacklight::Solr::Document.autoload :MarcExport, 'blacklight/solr/document/marc_export'
|
|
8
|
-
|
|
9
6
|
require 'blacklight/marc/engine'
|
|
10
|
-
|
|
7
|
+
|
|
11
8
|
autoload :Routes, 'blacklight/marc/routes'
|
|
12
9
|
autoload :Catalog, 'blacklight/marc/catalog'
|
|
10
|
+
autoload :Indexer, 'blacklight/marc/indexer'
|
|
13
11
|
|
|
14
12
|
def self.add_routes(router, options = {})
|
|
15
13
|
Blacklight::Marc::Routes.new(router, options).draw
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
module Blacklight::Marc
|
|
2
2
|
module Catalog
|
|
3
|
+
extend ActiveSupport::Concern
|
|
4
|
+
|
|
5
|
+
included do
|
|
6
|
+
add_show_tools_partial(:librarian_view, if: :render_librarian_view_control?, define_method: false)
|
|
7
|
+
add_show_tools_partial(:refworks, if: :render_refworks_action?, modal: false)
|
|
8
|
+
add_show_tools_partial(:endnote, if: :render_endnote_action?, modal: false, path: :single_endnote_catalog_path, define_method: false)
|
|
9
|
+
end
|
|
10
|
+
|
|
3
11
|
def librarian_view
|
|
4
12
|
@response, @document = fetch params[:id]
|
|
5
13
|
|
|
@@ -16,5 +24,20 @@ module Blacklight::Marc
|
|
|
16
24
|
format.endnote { render :layout => false }
|
|
17
25
|
end
|
|
18
26
|
end
|
|
27
|
+
|
|
28
|
+
private
|
|
29
|
+
|
|
30
|
+
def render_refworks_action? config, options = {}
|
|
31
|
+
options[:document] && options[:document].respond_to?(:export_formats) && options[:document].export_formats.keys.include?(:refworks_marc_txt )
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def render_endnote_action? config, options = {}
|
|
35
|
+
options[:document] && options[:document].respond_to?(:export_formats) && options[:document].export_formats.keys.include?(:endnote )
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def render_librarian_view_control? config, options = {}
|
|
39
|
+
respond_to? :librarian_view_solr_document_path and options[:document] and options[:document].respond_to?(:to_marc)
|
|
40
|
+
end
|
|
41
|
+
|
|
19
42
|
end
|
|
20
43
|
end
|
|
@@ -3,6 +3,24 @@ require "rails"
|
|
|
3
3
|
|
|
4
4
|
module Blacklight::Marc
|
|
5
5
|
class Engine < Rails::Engine
|
|
6
|
+
config.autoload_paths += %W(
|
|
7
|
+
#{config.root}/app/presenters
|
|
8
|
+
#{config.root}/app/controllers/concerns
|
|
9
|
+
#{config.root}/app/models/concerns
|
|
10
|
+
)
|
|
6
11
|
|
|
12
|
+
rake_tasks do
|
|
13
|
+
load "railties/solr_marc.rake"
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
initializer 'blacklight_marc.initialize' do |app|
|
|
17
|
+
Mime::Type.register_alias "text/plain", :refworks_marc_txt
|
|
18
|
+
Mime::Type.register_alias "text/plain", :openurl_kev
|
|
19
|
+
Mime::Type.register "application/x-endnote-refer", :endnote
|
|
20
|
+
Mime::Type.register "application/marc", :marc
|
|
21
|
+
Mime::Type.register "application/marcxml+xml", :marcxml,
|
|
22
|
+
["application/x-marc+xml", "application/x-marcxml+xml",
|
|
23
|
+
"application/marc+xml"]
|
|
24
|
+
end
|
|
7
25
|
end
|
|
8
26
|
end
|