enju_manifestation_viewer 0.2.0 → 0.2.1

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: 3c465b586da5080ab7554842e26535706e47a482
4
- data.tar.gz: fad0d8ea2267febc281e1b86c0d187bce21996e3
3
+ metadata.gz: 2602851a53cd3f48d006ec02c43cd2fc62940a0b
4
+ data.tar.gz: 768106ba67c16e4aeb9afade0a3db11ff45fcf29
5
5
  SHA512:
6
- metadata.gz: 3991c4ddd70fbc60e54c46fa057b76877cbfded24c3d17a0100db46c6a48424b1432ed3299fad362995567f877d6cf7f04ae0cc92c0035222ba1f15ebc65dde8
7
- data.tar.gz: 76e3b9fcc8dfa271aafd9780d3e5e60f49297be1e8e244b187bca8fee05ce1f1a18f57996cfce038984ec874aba0181a7599a1ddf618bce0131d54992478d196
6
+ metadata.gz: 7589a1ce074cb6481332be0c583ec41d4c369ca59e3af736304ceb8c7aeaa803ada896ffbf4b0e2ac12d0989e6aca51be1780bda90356eadc986a556a06b3021
7
+ data.tar.gz: a6eb2c68dbc96f52a22b48fc90052a45e24aa3469f16d77dab44a21ac3378597547b68fefe55c9b91fc12de20a0fa0c5a72820ec8a6ef9eb104adff9450bec52
@@ -0,0 +1,12 @@
1
+ <% unless manifestation.identifier_contents(:isbn).empty? %>
2
+ <div id="openbd_thumbnail<%= manifestation.id %>" class="book_jacket"></div>
3
+ <script type="text/javascript">
4
+ openbd_addTheCover( '<%= manifestation.identifier_contents(:isbn).first %>', 'openbd_thumbnail<%= manifestation.id %>' );
5
+ </script>
6
+ <% else %>
7
+ <% if @library_group.settings[:book_jacket_unknown_resource] %>
8
+ <%= @library_group.settings[:book_jacket_unknown_resource] %>
9
+ <% else %>
10
+ <%= image_tag("unknown_resource.png", size: "100x100", alt: "No Image", class: "book_jacket") %>
11
+ <% end %>
12
+ <% end %>
@@ -0,0 +1,33 @@
1
+ <script type="text/javascript">
2
+ function openbd_make_thumbnail_link( book, element_id ) {
3
+ var link = '';
4
+ var thumbnail = book.summary.cover;
5
+ if (thumbnail) {
6
+ var link = '<img src="' + thumbnail + '" alt="' + book.summary.title + '" class="book_jacket" />';
7
+ }
8
+ var thumb_element = document.getElementById( element_id );
9
+ if (thumb_element) {
10
+ thumb_element.innerHTML = link;
11
+ }
12
+ }
13
+ function openbd_addTheCover( isbn, element_id ) {
14
+ var url = "https://api.openbd.jp/v1/get?isbn=" + isbn;
15
+ $.getJSON( url, function (books) {
16
+ var link = '';
17
+ for (i in books) {
18
+ var book = books[i];
19
+ if (book) {
20
+ openbd_make_thumbnail_link(book, element_id);
21
+ }
22
+ }
23
+ var thumb_element = document.getElementById( element_id );
24
+ if (thumb_element.innerHTML === "") {
25
+ <% if @library_group.settings[:book_jacket_unknown_resource] %>
26
+ thumb_element.innerHTML = '<%= @library_group.settings[:book_jacket_unknown_resource] %>';
27
+ <% else %>
28
+ thumb_element.innerHTML = '<%= image_tag("unknown_resource.png", size: "100x100", alt: "No Image", class: "book_jacket") %>';
29
+ <% end %>
30
+ }
31
+ });
32
+ }
33
+ </script>
@@ -53,6 +53,8 @@ module EnjuManifestationViewer
53
53
  render partial: 'manifestations/google_book_thumbnail', locals: {manifestation: manifestation}
54
54
  when "hanmotocom"
55
55
  render partial: 'manifestations/hanmotocom_thumbnail', locals: {manifestation: manifestation}
56
+ when "openbd"
57
+ render partial: 'manifestations/openbd_thumbnail', locals: {manifestation: manifestation}
56
58
  end
57
59
  end
58
60
 
@@ -76,6 +78,8 @@ module EnjuManifestationViewer
76
78
  when "google"
77
79
  string << javascript_tag(nil, src: "https://www.google.com/jsapi")
78
80
  string << render('manifestations/google_book_thumbnail_header')
81
+ when "openbd"
82
+ string << render('manifestations/openbd_thumbnail_header')
79
83
  end
80
84
  string.html_safe
81
85
  end
@@ -1,3 +1,3 @@
1
1
  module EnjuManifestationViewer
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -29,4 +29,8 @@ describe EnjuManifestationViewer::BookJacketHelper do
29
29
  html = helper.book_jacket_tag(manifestations(:manifestation_00001), "hanmotocom")
30
30
  expect(html).to have_selector 'img[src="http://www.hanmoto.com/bd/img/9784798002064.jpg"]'
31
31
  end
32
+
33
+ it "should get openbd book jacket" do
34
+ helper.book_jacket_tag(manifestations(:manifestation_00001), "openbd").should =~ /<div id=\"openbd_thumbnail1\" class=\"book_jacket\"><\/div>/
35
+ end
32
36
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enju_manifestation_viewer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kosuke Tanabe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-12 00:00:00.000000000 Z
11
+ date: 2017-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: enju_biblio
@@ -16,42 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.2.0
19
+ version: 0.2.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.2.0
26
+ version: 0.2.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: enju_leaf
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.2.0
33
+ version: 1.2.1
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
- version: 1.2.0
40
+ version: 1.2.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: globalize
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 5.0.1
47
+ version: 5.1.0.beta1
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
- version: 5.0.1
54
+ version: 5.1.0.beta1
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: globalize-accessors
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -208,6 +208,8 @@ files:
208
208
  - app/views/manifestations/_google_book_thumbnail_header.html.erb
209
209
  - app/views/manifestations/_hanmotocom_thumbnail.html.erb
210
210
  - app/views/manifestations/_nicovideo.html.erb
211
+ - app/views/manifestations/_openbd_thumbnail.html.erb
212
+ - app/views/manifestations/_openbd_thumbnail_header.html
211
213
  - app/views/manifestations/_scribd.html.erb
212
214
  - app/views/manifestations/_youtube.html.erb
213
215
  - config/routes.rb
@@ -427,7 +429,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
427
429
  version: '0'
428
430
  requirements: []
429
431
  rubyforge_project:
430
- rubygems_version: 2.5.1
432
+ rubygems_version: 2.6.11
431
433
  signing_key:
432
434
  specification_version: 4
433
435
  summary: enju_manifestation_viewer plugin