blacklight_marc 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8b4870724570c056a2d91c1bf88e482f1bb2c67b
4
- data.tar.gz: c5b83522ad592c1693c5f1657591393413376d60
3
+ metadata.gz: 0a86016a95f2a9c10a3089af21a39eb18b4ee2cb
4
+ data.tar.gz: 66e706efdf39a39da7170c2fe82eb17d446decf7
5
5
  SHA512:
6
- metadata.gz: 1b4a7552c668a3696895cde9e2d816a16f8dab864179bd9c34f0dcf4cc8574d9ff107f67172b15641bd4a2200f7047c18d41af66b469e3d5eb80d4ae070e32fd
7
- data.tar.gz: 73ed1286c4d595b16f558c64ada2b7bcfe51533fd41fe6fd10014b04758a0420e0c15dc2c492fa4e1a80d300d3b1bf2d24dec1ab7bf7f5cf548c86b1a1972e8c
6
+ metadata.gz: d8ae8e2af04a8a95ca2d8c55b445f06b1dab4a8b1aa9564ebb13900711d5d3abbab2104bd7deed1d3398d0ed34e9b2b514fb3023c1149f5584818b0dda83f904
7
+ data.tar.gz: 20b253b11c2dd529352196203e0dad1a662ecbabfbff6b1d52e365d66ade6afb53d014010908fcdc66a787eb766c8ad2ab96bd60a70e96f6bdecb4987416af83
data/README.md CHANGED
@@ -14,6 +14,16 @@ And then execute:
14
14
 
15
15
  $ bundle
16
16
 
17
+ After running the blacklight generator, run the blacklight_marc generator:
18
+
19
+ $ rails generate blacklight_marc:marc
20
+
21
+ ## Features
22
+ * Rake task `solr:marc:index` to import .mrc files using SolrMarc
23
+ * Librarian view at `catalog/:id/librarian_view`
24
+ * Blacklight::Solr::Document mixins for exporting and transforming MARC data from a stored Solr field
25
+
26
+
17
27
  ## Documentation, Information and Support
18
28
 
19
29
  * [Project Homepage](http://projectblacklight.org)
@@ -0,0 +1,24 @@
1
+ module BlacklightMarcHelper
2
+
3
+ # puts together a collection of documents into one refworks export string
4
+ def render_refworks_texts(documents)
5
+ val = ''
6
+ documents.each do |doc|
7
+ if doc.respond_to?(:to_marc)
8
+ val += doc.export_as_refworks_marc_txt + "\n"
9
+ end
10
+ end
11
+ val
12
+ end
13
+
14
+ # puts together a collection of documents into one endnote export string
15
+ def render_endnote_texts(documents)
16
+ val = ''
17
+ documents.each do |doc|
18
+ if doc.respond_to?(:to_marc)
19
+ val += doc.export_as_endnote + "\n"
20
+ end
21
+ end
22
+ val
23
+ end
24
+ end
@@ -0,0 +1,3 @@
1
+ <li class="endnote">
2
+ <%= link_to t('blacklight.tools.endnote'), endnote_catalog_path(:sort=>params[:sort], :per_page=>params[:per_page], :id => @bookmarks.collect {|doc| doc.document_id}, :format => 'endnote'), {:class => 'btn btn-default'}%>
3
+ </li>
@@ -0,0 +1,3 @@
1
+ <li class="refworks">
2
+ <%= render :partial => 'catalog/refworks_form', :locals => {:documents=>@document_list} %>
3
+ </li>
@@ -7,9 +7,9 @@ Gem::Specification.new do |spec|
7
7
  spec.version = BlacklightMarc::VERSION
8
8
  spec.authors = ["Justin Coyne"]
9
9
  spec.email = ["justin@curationexperts.com"]
10
- spec.description = %q{SolrMarc support for Blacklight}
11
- spec.summary = %q{SolrMarc support for Blacklight}
12
- spec.homepage = ""
10
+ spec.description = %q{MARC support for Blacklight}
11
+ spec.summary = %q{MARC support for Blacklight}
12
+ spec.homepage = "https://github.com/projectblacklight/blacklight_marc"
13
13
  spec.license = "MIT"
14
14
 
15
15
  spec.files = `git ls-files`.split($/)
@@ -8,5 +8,13 @@ module BlacklightMarc
8
8
  format.js { render :layout => false }
9
9
  end
10
10
  end
11
+
12
+ # grabs a bunch of documents to export to endnote
13
+ def endnote
14
+ @response, @documents = get_solr_response_for_field_values(SolrDocument.unique_key,params[:id])
15
+ respond_to do |format|
16
+ format.endnote { render :layout => false }
17
+ end
18
+ end
11
19
  end
12
- end
20
+ end
@@ -32,6 +32,8 @@ module BlacklightMarc
32
32
  add_routes do |options|
33
33
  # Catalog stuff.
34
34
  get 'catalog/:id/librarian_view', :to => "catalog#librarian_view", :as => "librarian_view_catalog"
35
+ get "catalog/endnote"
36
+
35
37
  end
36
38
  end
37
39
  end
@@ -1,3 +1,3 @@
1
1
  module BlacklightMarc
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ describe CatalogController do
4
+ describe "endnote" do
5
+ before do
6
+ SolrDocument.use_extension( Blacklight::Solr::Document::Marc )
7
+ end
8
+ render_views
9
+ it "should render endnote" do
10
+ get :endnote, id: '86207417', format: 'endnote'
11
+ expect(response.body).to eq "%0 Generic
12
+ %A Finkel, Chaim Jacob.
13
+ %C Yerushalayim :
14
+ %D c1984.
15
+ %I Devir,
16
+ %@ 9650101373
17
+ %T Shodede-yam Yehudiyim : sipurim mafliʼim ha-mevusasim ʻal ʻuvdot hisṭoriyot /\n\n"
18
+ end
19
+ end
20
+
21
+
22
+ end
@@ -0,0 +1,26 @@
1
+ require 'spec_helper'
2
+
3
+ describe BlacklightMarcHelper do
4
+ let(:one) { SolrDocument.new }
5
+ let(:two) { SolrDocument.new }
6
+ describe "render_refworks_texts" do
7
+ before do
8
+ one.stub(:export_as_refworks_marc_txt => 'one')
9
+ two.stub(:export_as_refworks_marc_txt => 'two')
10
+ end
11
+ it "should render_refworks_texts" do
12
+ expect(helper.render_refworks_texts([one, two])).to eq "one\ntwo\n"
13
+
14
+ end
15
+ end
16
+
17
+ describe "render_endnote_texts" do
18
+ before do
19
+ one.stub(:export_as_endnote => 'one')
20
+ two.stub(:export_as_endnote => 'two')
21
+ end
22
+ it "should render_endnote_texts" do
23
+ expect(helper.render_endnote_texts([one, two])).to eq "one\ntwo\n"
24
+ end
25
+ end
26
+ end
@@ -6,6 +6,10 @@ describe "Routing" do
6
6
  { :get => "/catalog/111/librarian_view" }.should route_to(:controller => 'catalog', :action => 'librarian_view', :id => "111")
7
7
  { :get => librarian_view_catalog_path('111') }.should route_to(:controller => 'catalog', :action => 'librarian_view', :id => "111")
8
8
  end
9
+ it "should map {:controller => 'catalog', :action => 'endnote'} to /catalog/endnote" do
10
+ { :get => "/catalog/endnote" }.should route_to(:controller => 'catalog', :action => 'endnote')
11
+ { :get => endnote_catalog_path }.should route_to(:controller => 'catalog', :action => 'endnote')
12
+ end
9
13
  end
10
14
  end
11
15
 
@@ -17,6 +17,6 @@ group :test do
17
17
  gem 'simplecov', :platform => :mri_19
18
18
  end
19
19
 
20
- gem 'blacklight', :github => 'projectblacklight/blacklight', :branch => 'no_marc'
20
+ gem 'blacklight', github: 'projectblacklight/blacklight'
21
21
  gem 'jettywrapper', '>= 1.2.0'
22
22
 
@@ -0,0 +1,9 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'bookmarks/_endnote.html.erb' do
4
+ it "should have a link" do
5
+ assign(:bookmarks, [mock_model(Bookmark, document_id: 7), mock_model(Bookmark, document_id: 8)])
6
+ render
7
+ expect(rendered).to have_link "Export to EndNote"
8
+ end
9
+ end
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'bookmarks/_refworks.html.erb' do
4
+ it "should have a link" do
5
+ assign(:document_list, [mock_model(Bookmark, document_id: 7), mock_model(Bookmark, document_id: 8)])
6
+ render
7
+ expect(rendered).to have_button "Export to Refworks"
8
+ end
9
+ end
10
+
metadata CHANGED
@@ -1,132 +1,135 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight_marc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-31 00:00:00.000000000 Z
11
+ date: 2014-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec-rails
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: jettywrapper
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rails
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: marc
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: 0.4.3
104
- - - <
104
+ - - "<"
105
105
  - !ruby/object:Gem::Version
106
106
  version: '1.1'
107
107
  type: :runtime
108
108
  prerelease: false
109
109
  version_requirements: !ruby/object:Gem::Requirement
110
110
  requirements:
111
- - - '>='
111
+ - - ">="
112
112
  - !ruby/object:Gem::Version
113
113
  version: 0.4.3
114
- - - <
114
+ - - "<"
115
115
  - !ruby/object:Gem::Version
116
116
  version: '1.1'
117
- description: SolrMarc support for Blacklight
117
+ description: MARC support for Blacklight
118
118
  email:
119
119
  - justin@curationexperts.com
120
120
  executables: []
121
121
  extensions: []
122
122
  extra_rdoc_files: []
123
123
  files:
124
- - .gitignore
125
- - .travis.yml
124
+ - ".gitignore"
125
+ - ".travis.yml"
126
126
  - Gemfile
127
127
  - LICENSE.txt
128
128
  - README.md
129
129
  - Rakefile
130
+ - app/helpers/blacklight_marc_helper.rb
131
+ - app/views/bookmarks/_endnote.html.erb
132
+ - app/views/bookmarks/_refworks.html.erb
130
133
  - app/views/catalog/_marc_view.html.erb
131
134
  - app/views/catalog/librarian_view.html.erb
132
135
  - blacklight_marc.gemspec
@@ -157,7 +160,9 @@ files:
157
160
  - lib/generators/blacklight_marc/templates/config/SolrMarc/translation_maps/instrument_map.properties
158
161
  - lib/generators/blacklight_marc/templates/config/SolrMarc/translation_maps/language_map.properties
159
162
  - lib/railties/solr_marc.rake
163
+ - spec/controllers/catalog_controller_spec.rb
160
164
  - spec/features/librarian_view_spec.rb
165
+ - spec/helpers/blacklight_marc_helper_spec.rb
161
166
  - spec/integration/solr_document_spec.rb
162
167
  - spec/lib/blacklight_solr_document_marc_spec.rb
163
168
  - spec/lib/marc_export_spec.rb
@@ -167,8 +172,10 @@ files:
167
172
  - spec/test_app_templates/Gemfile.extra
168
173
  - spec/test_app_templates/lib/generators/test_app_generator.rb
169
174
  - spec/test_app_templates/lib/tasks/blacklight_test_app.rake
175
+ - spec/views/bookmarks/_endnote.html.erb_spec.rb
176
+ - spec/views/bookmarks/_refworks.html.erb_spec.rb
170
177
  - test_support/data/test_data.utf8.mrc
171
- homepage: ''
178
+ homepage: https://github.com/projectblacklight/blacklight_marc
172
179
  licenses:
173
180
  - MIT
174
181
  metadata: {}
@@ -178,22 +185,24 @@ require_paths:
178
185
  - lib
179
186
  required_ruby_version: !ruby/object:Gem::Requirement
180
187
  requirements:
181
- - - '>='
188
+ - - ">="
182
189
  - !ruby/object:Gem::Version
183
190
  version: '0'
184
191
  required_rubygems_version: !ruby/object:Gem::Requirement
185
192
  requirements:
186
- - - '>='
193
+ - - ">="
187
194
  - !ruby/object:Gem::Version
188
195
  version: '0'
189
196
  requirements: []
190
197
  rubyforge_project:
191
- rubygems_version: 2.1.11
198
+ rubygems_version: 2.2.0
192
199
  signing_key:
193
200
  specification_version: 4
194
- summary: SolrMarc support for Blacklight
201
+ summary: MARC support for Blacklight
195
202
  test_files:
203
+ - spec/controllers/catalog_controller_spec.rb
196
204
  - spec/features/librarian_view_spec.rb
205
+ - spec/helpers/blacklight_marc_helper_spec.rb
197
206
  - spec/integration/solr_document_spec.rb
198
207
  - spec/lib/blacklight_solr_document_marc_spec.rb
199
208
  - spec/lib/marc_export_spec.rb
@@ -203,4 +212,6 @@ test_files:
203
212
  - spec/test_app_templates/Gemfile.extra
204
213
  - spec/test_app_templates/lib/generators/test_app_generator.rb
205
214
  - spec/test_app_templates/lib/tasks/blacklight_test_app.rake
215
+ - spec/views/bookmarks/_endnote.html.erb_spec.rb
216
+ - spec/views/bookmarks/_refworks.html.erb_spec.rb
206
217
  has_rdoc: