enju_book_jacket 0.0.1 → 0.0.2

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.
@@ -1,5 +1,31 @@
1
1
  module EnjuBookJacket
2
2
  module BookJacketHelper
3
+ def book_jacket(manifestation)
4
+ if manifestation.picture_files.exists?
5
+ link = ''
6
+ manifestation.picture_files.each_with_index do |picture_file, i|
7
+ if i == 0
8
+ link += link_to(show_image(picture_file, :size => :thumb), picture_file_path(picture_file, :format => :download), :rel => "manifestation_#{manifestation.id}")
9
+ else
10
+ link += content_tag :span, :style => "display: none" do
11
+ link_to(show_image(picture_file, :size => :thumb), picture_file_path(picture_file, :format => :download), :rel => "manifestation_#{manifestation.id}")
12
+ end
13
+ end
14
+ end
15
+ return link.html_safe
16
+ else
17
+ link = book_jacket_tag(manifestation)
18
+ unless link
19
+ link = screenshot_tag(manifestation)
20
+ end
21
+ end
22
+
23
+ unless link
24
+ link = link_to image_tag('unknown_resource.png', :width => '100', :height => '100', :alt => '*', :itemprop => 'image'), manifestation
25
+ end
26
+ link
27
+ end
28
+
3
29
  def screenshot_tag(manifestation, generator = configatron.screenshot.generator)
4
30
  return nil unless manifestation.try(:access_address)
5
31
  case generator
@@ -32,5 +58,27 @@ module EnjuBookJacket
32
58
  return nil if asin.blank?
33
59
  "http://#{hostname}/dp/#{asin}"
34
60
  end
61
+
62
+ def book_jacket_source_link
63
+ case configatron.book_jacket.source
64
+ when :google
65
+ link_to "Google Books", "http://books.google.com/"
66
+ when :amazon
67
+ link_to "Amazon Web Services", "http://aws.amazon.com/"
68
+ end
69
+ end
70
+
71
+ def screenshot_generator_link
72
+ case configatron.screenshot.generator
73
+ when :mozshot
74
+ link_to "MozShot", "http://mozshot.nemui.org/"
75
+ when :simpleapi
76
+ link_to "SimpleAPI", "http://img.simpleapi.net/"
77
+ when :heartrails
78
+ link_to "HeartRails Capture", "http://capture.heartrails.com/"
79
+ when :thumbalizr
80
+ link_to "thumbalizr", "http://www.thumbalizr.com/"
81
+ end
82
+ end
35
83
  end
36
84
  end
@@ -1,3 +1,3 @@
1
1
  module EnjuBookJacket
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
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.0.1
4
+ version: 0.0.2
5
5
  prerelease:
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-06-03 00:00:00.000000000 Z
12
+ date: 2012-06-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails