Permalink
Browse files

Adding fullscreen_url

  • Loading branch information...
1 parent 92ef532 commit 940749de72a9e5a33e34596b684b527a342090c6 @aubreyrhodes committed Dec 1, 2011
Showing with 21 additions and 2 deletions.
  1. +5 −1 README.md
  2. +4 −0 lib/scribd-carrierwave.rb
  3. +1 −1 lib/scribd-carrierwave/version.rb
  4. +11 −0 spec/scribd-carrierwave_spec.rb
View
@@ -42,4 +42,8 @@ Just add ````<%= attachment.display_ipaper %>```` into your view.
To display multiple documents on the same page, you need to pass in a unique id for each one:
-````<%= attachment.display_ipaper({id: '_attachemment1'}) %>````
+````<%= attachment.display_ipaper({id: '_attachemment1'}) %>````
+
+To get the link to the fullscreen document:
+
+````<%= attachment.fullscreen_url %>````
@@ -63,6 +63,10 @@ def display_ipaper(options = {})
</script>
END
end
+
+ def fullscreen_url
+ "http://www.scribd.com/fullscreen/#{ipaper_id}?access_key=#{ipaper_access_key}"
+ end
def ipaper_id
self.model.send("#{self.mounted_as.to_s}_ipaper_id")
@@ -1,3 +1,3 @@
module ScribdCarrierWave
- VERSION = "0.0.8"
+ VERSION = "0.0.9"
end
@@ -89,6 +89,17 @@
html.should match /id="embedded_flashtest_id"/
end
end
+
+ describe "fullscreen_url" do
+ before(:each) do
+ @uploader.stubs(:ipaper_id).returns('test_id')
+ @uploader.stubs(:ipaper_access_key).returns('test_access_key')
+ end
+
+ it "returns the correct url" do
+ @uploader.fullscreen_url.should match /http:\/\/www.scribd.com\/fullscreen\/test_id\?access_key=test_access_key/
+ end
+ end
describe "ipaper_id" do
it "should return the value of the model's attribute" do

0 comments on commit 940749d

Please sign in to comment.