enju_book_jacket 0.1.0.pre2 → 0.1.0.pre3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,19 +1,37 @@
1
- <div id="gbsthumbnail" class="book_jacket"></div>
1
+ <% if manifestation.isbn? %>
2
+ <div id="gbsthumbnail" class="book_jacket"></div>
2
3
 
3
- <script>
4
- function addTheCover(booksInfo){
5
- var link = '<%= image_tag("unknown_resource.png", :size => "150x150", :alt => "*") %>';
6
- <% unless Setting.book_jacket.unknown_resource.blank? %>
7
- link = '<%= Setting.book_jacket.unknown_resource %>'
8
- <% end %>
9
- for (var i in booksInfo) {
10
- var book = booksInfo[i];
11
- if (book.thumbnail_url != undefined) {
12
- link = '<img src="' + book.thumbnail_url.replace('zoom=5', 'zoom=1') + '" alt="<%= manifestation.original_title %>" />';
4
+ <script type="text/javascript">
5
+ function addTheCover(booksInfo){
6
+ var link = '';
7
+ <% if Setting.book_jacket.unknown_resource.blank? %>
8
+ link = '<%= image_tag("unknown_resource.png", :size => "150x150", :alt => "*") %>';
9
+ <% else %>
10
+ link = '<%= Setting.book_jacket.unknown_resource %>'
11
+ <% end %>
12
+ for (i in booksInfo.items) {
13
+ var book = booksInfo.items[i]
14
+ var image = book.volumeInfo.imageLinks;
15
+ if (image && image.thumbnail != undefined) {
16
+ var thumbnail = image.thumbnail.replace('zoom=5', 'zoom=1');
17
+ if ( document.location.protocol == 'https:' ) {
18
+ var parser = document.createElement('a');
19
+ parser.href = thumbnail;
20
+ parser.protocol = 'https:';
21
+ parser.hostname = 'encrypted.google.com';
22
+ thumbnail = parser.href;
23
+ }
24
+ var link = '<img src="' + thumbnail + '" alt="<%= manifestation.original_title %>" />';
25
+ if (book.accessInfo && book.accessInfo.viewability != "NO_PAGES") {
26
+ var preview = book.volumeInfo.previewLink;
27
+ link += '<br /><a href="' + preview + '" target="_blank"><img border=0 src="//www.google.com/googlebooks/images/gbs_preview_button1.gif" title="Google Preview" alt="Google Preview" /></a>';
28
+ }
29
+ }
30
+ document.getElementById('gbsthumbnail').innerHTML = link;
13
31
  }
14
32
  }
15
- document.getElementById('gbsthumbnail').innerHTML = link;
16
- }
17
- </script>
18
-
19
- <script src="http://books.google.com/books?jscmd=viewapi&amp;bibkeys=ISBN:<%= manifestation.isbn %>&amp;callback=addTheCover"></script>
33
+ </script>
34
+ <script src="https://www.googleapis.com/books/v1/volumes?q=isbn:<%= manifestation.isbn %>&amp;callback=addTheCover"></script>
35
+ <% else %>
36
+ <%= image_tag("unknown_resource.png", :size => "150x150", :alt => "*") %>
37
+ <% end %>
@@ -1,3 +1,3 @@
1
1
  module EnjuBookJacket
2
- VERSION = "0.1.0.pre2"
2
+ VERSION = "0.1.0.pre3"
3
3
  end
@@ -30,9 +30,9 @@ ActiveRecord::Schema.define(:version => 20110916091020) do
30
30
  t.integer "extent_id", :default => 1, :null => false
31
31
  t.integer "start_page"
32
32
  t.integer "end_page"
33
- t.decimal "height"
34
- t.decimal "width"
35
- t.decimal "depth"
33
+ t.integer "height"
34
+ t.integer "width"
35
+ t.integer "depth"
36
36
  t.string "isbn"
37
37
  t.string "isbn10"
38
38
  t.string "wrong_isbn"
@@ -47,10 +47,6 @@ ActiveRecord::Schema.define(:version => 20110916091020) do
47
47
  t.string "serial_number_string"
48
48
  t.integer "edition"
49
49
  t.text "note"
50
- t.integer "produces_count", :default => 0, :null => false
51
- t.integer "exemplifies_count", :default => 0, :null => false
52
- t.integer "embodies_count", :default => 0, :null => false
53
- t.integer "work_has_subjects_count", :default => 0, :null => false
54
50
  t.boolean "repository_content", :default => false, :null => false
55
51
  t.integer "lock_version", :default => 0, :null => false
56
52
  t.integer "required_role_id", :default => 1, :null => false
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enju_book_jacket
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.pre2
4
+ version: 0.1.0.pre3
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-19 00:00:00.000000000 Z
12
+ date: 2012-12-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -66,7 +66,7 @@ dependencies:
66
66
  requirements:
67
67
  - - ~>
68
68
  - !ruby/object:Gem::Version
69
- version: 0.1.0.pre5
69
+ version: 0.1.0.pre13
70
70
  type: :development
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
@@ -74,7 +74,7 @@ dependencies:
74
74
  requirements:
75
75
  - - ~>
76
76
  - !ruby/object:Gem::Version
77
- version: 0.1.0.pre5
77
+ version: 0.1.0.pre13
78
78
  - !ruby/object:Gem::Dependency
79
79
  name: vcr
80
80
  requirement: !ruby/object:Gem::Requirement
@@ -160,6 +160,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
160
160
  - - ! '>='
161
161
  - !ruby/object:Gem::Version
162
162
  version: '0'
163
+ segments:
164
+ - 0
165
+ hash: -3840783042594306498
163
166
  required_rubygems_version: !ruby/object:Gem::Requirement
164
167
  none: false
165
168
  requirements: