spud_videos 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,7 +1,62 @@
1
- Spud Video
2
- ==========
1
+ # Spud Videos
2
+
3
+ Spud Videos is an engine for managing and embedding Youtube / Vimeo videos, designed for use with [Spud][spud] and [Spud CMS][spud_cms].
4
+
5
+
6
+ ## Installation/Usage
7
+
8
+ 1. In your Gemfile add the following
9
+
10
+ gem 'spud_videos'
11
+
12
+ 2. Run bundle install
13
+ 3. Copy in database migrations to your new rails project
14
+
15
+ bundle exec rake railties:install:migrations
16
+ rake db:migrate
17
+
18
+ 4. Run a rails server instance and point your browser to /spud/admin
19
+
20
+ ## Configuration
21
+
22
+ Spud Videos accepts the following configuration options:
23
+
24
+ ```ruby
25
+ Spud::Banners.configure do |config|
26
+ config.base_layout = "application"
27
+ config.enable_videos_route = true
28
+ config.default_dimensions = [560,315]
29
+ end
30
+ ```
31
+
32
+ ## Adding a Video
33
+ Videos are added in the Spud admin. When adding a video, you can specify wether the video is hosted on youtube or vimeo.
34
+ It is also possible to specify a name and description for the video which can be rendered on the /videos url. In many cases,
35
+ it may be unnecessary to have the videos route. Spud Videos makes it easy to embed videos into spud_cms pages by using liquid tags.
36
+
37
+ ## Helpers
38
+ Videos provides a helper method for rendering these embedded videos:
39
+
40
+ ```ruby
41
+ spud_video(set_or_identifier, options)
42
+ ```
43
+
44
+ Example:
45
+
46
+ ```ruby
47
+ spud_video(:promotional, {:width => 500, :height => 300})
48
+ ```
49
+
50
+ ## Liquid
51
+
52
+ Spud Videos comes with its own custom [Liquid][liquid] tag. For now the liquid tag only supports rendering the standard html as generated by the `spud_video`. Will support more advanced options in the future.
53
+
54
+ Usage:
55
+
56
+ ```erb
57
+ <%= raw Liquid::Template.parse("{% video Promotion width=500 height=300 %}").render %>
58
+ ```
3
59
 
4
- Documentation goes here.
5
60
 
6
61
  Testing
7
62
  -----------------
@@ -9,7 +64,7 @@ Testing
9
64
  Spud uses RSpec for testing. Get the tests running with a few short commands:
10
65
 
11
66
  1. Create and migrate the databases:
12
-
67
+
13
68
  rake db:create
14
69
  rake db:migrate
15
70
 
@@ -21,4 +76,8 @@ Spud uses RSpec for testing. Get the tests running with a few short commands:
21
76
 
22
77
  rspec spec
23
78
 
24
- After the tests have completed the current code coverage stats is available by opening ```/coverage/index.html``` in a browser.
79
+ After the tests have completed the current code coverage stats is available by opening ```/coverage/index.html``` in a browser.
80
+
81
+ [spud]:https://github.com/spud-rails/spud_core_admin
82
+ [spud_cms]:https://github.com/spud-rails/spud_cms
83
+ [liquid]:https://github.com/Shopify/liquid
@@ -1,3 +1,4 @@
1
+ require 'cgi'
1
2
  module SpudVideosHelper
2
3
 
3
4
  def spud_video(set_or_identifier,options = {})
@@ -20,6 +21,28 @@ module SpudVideosHelper
20
21
  source = "http://player.vimeo.com/video/#{extracted_video_id}?title=0&amp;byline=0&amp;portrait=0"
21
22
  content = "<iframe src='#{source}' width='#{width}' height='#{height}' frameborder='0' webkitAllowFullScreen mozallowfullscreen allowfullscreen></iframe>"
22
23
  return content.html_safe
24
+ elsif video.source == 'brightcove'
25
+ parameters = CGI::parse(video.embed_link)
26
+ content="<!-- Start of Brightcove Player -->
27
+ <div style=\"display: none;\"></div>
28
+ <!-- By use of this code snippet, I agree to the Brightcove Publisher T and C found at https://accounts.brightcove.com/en/terms-and-conditions/. -->
29
+ <p><script language=\"JavaScript\" type=\"text/javascript\" src=\"http://admin.brightcove.com/js/BrightcoveExperiences.js\"></script> <object id=\"myExperience2124779161001\" class=\"BrightcoveExperience\">
30
+ <param name=\"bgcolor\" value=\"#FFFFFF\" />
31
+ <param name=\"width\" value=\"#{width}\" />
32
+ <param name=\"height\" value=\"#{height}\" />
33
+
34
+ <param name=\"isVid\" value=\"true\" />
35
+ <param name=\"isUI\" value=\"true\" />
36
+ <param name=\"dynamicStreaming\" value=\"true\" />
37
+ "
38
+ parameters.each do |key,value|
39
+ content += "<param name=\"#{key}\" value=\"#{value}\" />"
40
+ end
41
+ content += "</object></p>
42
+ <!-- This script tag will cause the Brightcove Players defined above it to be created as soon as the line is read by the browser. If you wish to have the player instantiated only after the rest of the HTML is processed and the page load is complete, remove the line. -->
43
+ "
44
+
45
+ return content.html_save
23
46
  end
24
47
  end
25
48
  end
@@ -11,7 +11,7 @@
11
11
  <div class="control-group">
12
12
  <%=f.label :source, :required=>true,:class => "control-label"%>
13
13
  <div class="controls">
14
- <%=f.select :source,[["Youtube","youtube"],["Vimeo","vimeo"]]%>
14
+ <%=f.select :source,[["Youtube","youtube"],["Vimeo","vimeo"], ['Brightcove', 'brightcove']]%>
15
15
  </div>
16
16
  </div>
17
17
  <div class="control-group">
@@ -1,5 +1,5 @@
1
1
  module Spud
2
2
  module Videos
3
- VERSION = "0.9.0"
3
+ VERSION = "0.9.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spud_videos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
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: 2013-01-23 00:00:00.000000000 Z
12
+ date: 2013-02-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -235,7 +235,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
235
235
  version: '0'
236
236
  segments:
237
237
  - 0
238
- hash: 976809633072896379
238
+ hash: 1478897495711587335
239
239
  required_rubygems_version: !ruby/object:Gem::Requirement
240
240
  none: false
241
241
  requirements:
@@ -244,7 +244,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
244
244
  version: '0'
245
245
  segments:
246
246
  - 0
247
- hash: 976809633072896379
247
+ hash: 1478897495711587335
248
248
  requirements: []
249
249
  rubyforge_project:
250
250
  rubygems_version: 1.8.24