Skip to content

Commit

Permalink
Add support for Vimeo videos
Browse files Browse the repository at this point in the history
  • Loading branch information
danielcnorman committed Oct 12, 2012
1 parent 4801cac commit e566eb3
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
11 changes: 11 additions & 0 deletions app/helpers/preorder_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ def tweet_button
raw "<a href='https://twitter.com/share?url=/' id='tweet_button' class='twitter-share-button twitter-button' data-url=#{request.scheme}//#{request.host}' data-via='#{Settings.product_name}' data-lang='en' data-count='vertical' data-text=\"#{tweet_text}\">Tweet</a>"
end

def video_url
"#{Settings.video_embed_url}?" + case Settings.video_embed_url
when /vimeo/
'title=0&byline=0&portrait=0&autoplay=0'
when /youtube/
'autohide=1&showinfo=0&rel=0&autoplay=0'
else
''
end
end

def encoded_root_url
raw URI.encode "#{request.scheme}://#{request.host}/preorder"
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/preorder/homepage/_faqs.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<li>
<details class=''>
<summary>How do I change around the images, product name, etc?</summary>
<p>The best way is in <code>config/settings.yml</code>. It has variables for several different parts, the YouTube video, the product name, the call to action button ("Fork Now"), and several more.
<p>The best way is in <code>config/settings.yml</code>. It has variables for several different parts, the video, the product name, the call to action button ("Fork Now"), and several more.
</p>
</details>
</li>
Expand Down
2 changes: 1 addition & 1 deletion app/views/preorder/homepage/_stats.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="wrapper clearfix">
<div id="video">
<iframe width='512' height='385' src="<%= Settings.youtube_embed_url %>?autohide=1&showinfo=0&rel=0&autoplay=0"></iframe>
<iframe width='512' height='385' src="<%= video_url %>"></iframe>
</div>

<div id="backing">
Expand Down
5 changes: 2 additions & 3 deletions config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ product_image_path: "my-product-image.png"
# The message on the preorder page, Lockitron's
value_proposition: "Roll your own crowdfunding"

# YouTube Video URL (The embed URL, without the query string options)
# There's no Vimeo support at the moment, but feel free to implement it and send a pull request!
youtube_embed_url: "https://www.youtube.com/v/D1L3o88GKew"
# YouTube or Vimeo Video URL (The embed URL, without the query string options)
video_embed_url: "https://www.youtube.com/v/D1L3o88GKew"

# Amazon settings -- you'll need an Amazon Payments account, sign up here --> http://bit.ly/SGksTv

Expand Down

0 comments on commit e566eb3

Please sign in to comment.