diff --git a/README b/README index 787a8f8..e301d8e 100644 --- a/README +++ b/README @@ -15,6 +15,7 @@ h2. FEATURES: * Upload local files or from remote web sites * Search, tag, and organize documents * Associate documents with your users' accounts +* Display Scribd Reader in your views h2. SYNOPSIS: @@ -49,6 +50,27 @@ For more information, please see the documentation for the Scribd::API, Scribd::User, and Scribd::Document classes. (You can also check out the docs for the other classes for a more in-depth look at this gem's features). +To display a Scribd reader on your view, simply include RscribdHelper to your view's helper. + +
+module PdfFileHelper
+ include RscribdHelper
+end
+
+
+Then in your view, you can display your document like so:
+
+
+ <%= display_scribd_reader(@pdffile.scribd_doc_id, @pdffile.scribd_doc_access_key) %>
+
+or with options:
+
+ <%= display_scribd_reader(@pdffile.scribd_doc_id, @pdffile.scribd_doc_access_key, :width => 300, :height => 500) %>
+
+
+Available options are :
+http://www.scribd.com/developers/api?method_name=Javascript+API#parameters
+
h2. REQUIREMENTS:
* A Scribd API account
diff --git a/lib/rscribd.rb b/lib/rscribd.rb
index 2839b41..171ea3c 100644
--- a/lib/rscribd.rb
+++ b/lib/rscribd.rb
@@ -15,3 +15,4 @@ module Scribd
require 'scribd/document'
require 'scribd/user'
require 'scribd/security'
+require 'rscribd_helper'
\ No newline at end of file
diff --git a/lib/rscribd_helper.rb b/lib/rscribd_helper.rb
new file mode 100644
index 0000000..468ea37
--- /dev/null
+++ b/lib/rscribd_helper.rb
@@ -0,0 +1,32 @@
+module RscribdHelper
+ def display_scribd_reader(doc_id, doc_key, options = {})
+ opts = {
+ :jsapi_version => 1,
+ :hide_disabled_buttons => true,
+ :mode => "slide"
+ }.merge(options)
+
+ if doc_id and doc_key
+ str = []
+ str << ""
+ str << ""
+ return content_tag("div", str.join("\n").html_safe, :class => "scribd_reader")
+ else
+ return "Scribd document not found."
+ end
+ end
+end
\ No newline at end of file
diff --git a/rscribd.gemspec b/rscribd.gemspec
index 6665811..2023653 100644
--- a/rscribd.gemspec
+++ b/rscribd.gemspec
@@ -22,6 +22,7 @@ Gem::Specification.new do |s|
"Rakefile",
"VERSION",
"lib/rscribd.rb",
+ "lib/rscribd_helper.rb",
"lib/scribd/api.rb",
"lib/scribd/category.rb",
"lib/scribd/collection.rb",