mdarby-scribd_fu 1.2 → 1.2.1
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.
- data/lib/scribd_fu_helper.rb +17 -4
- data/scribd_fu.gemspec +2 -2
- metadata +2 -2
data/lib/scribd_fu_helper.rb
CHANGED
@@ -1,4 +1,10 @@
|
|
1
1
|
module ScribdFuHelper
|
2
|
+
# Available parameters for the JS API
|
3
|
+
# http://www.scribd.com/publisher/api/api?method_name=Javascript+API
|
4
|
+
AVAILABLE_JS_PARAMS = [ :height, :width, :page, :my_user_id, :search_query,
|
5
|
+
:jsapi_version, :disable_related_docs, :mode, :auto_size ]
|
6
|
+
|
7
|
+
|
2
8
|
# Displays the scribd object for the attachment on the given +object+. If
|
3
9
|
# +alt_text_or_attribute+ is given, then it will be used as the alternate text
|
4
10
|
# for an Attachment_fu model, or as the attribute name for a Paperclip
|
@@ -29,12 +35,19 @@ module ScribdFuHelper
|
|
29
35
|
alt_text = alt_text_if_paperclip
|
30
36
|
end
|
31
37
|
|
38
|
+
# Collect a set of addParam statements to set up JS parameters for the scribd document
|
39
|
+
# (only if they are valid).
|
40
|
+
param_includes = options[:params].collect do |param, value|
|
41
|
+
"scribd_doc.addParam('#{param}', '#{value}');" if AVAILABLE_JS_PARAMS.include?(param)
|
42
|
+
end.compact.join("\n")
|
43
|
+
|
32
44
|
<<-END
|
33
|
-
<script type
|
34
|
-
<div id
|
35
|
-
<script type
|
45
|
+
<script type="text/javascript" src="http://www.scribd.com/javascripts/view.js"></script>
|
46
|
+
<div id="embedded_flash">#{alt_text}</div>
|
47
|
+
<script type="text/javascript">
|
36
48
|
var scribd_doc = scribd.Document.getDoc(#{scribd_id}, '#{scribd_ak}');
|
37
|
-
|
49
|
+
#{param_includes}
|
50
|
+
scribd_doc.write("embedded_flash");
|
38
51
|
</script>
|
39
52
|
END
|
40
53
|
end
|
data/scribd_fu.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "scribd_fu"
|
3
|
-
s.version = "1.2"
|
4
|
-
s.date = "
|
3
|
+
s.version = "1.2.1"
|
4
|
+
s.date = "2009-01-01"
|
5
5
|
s.summary = "Quick and easy interactions with Scribd's iPaper service"
|
6
6
|
s.email = "matt@matt-darby.com"
|
7
7
|
s.homepage = "http://github.com/mdarby/scribd_fu/tree/master"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mdarby-scribd_fu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Darby
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2009-01-01 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|