Commit cf21bd0791388fb35c15cb7b3ede2c1e44be159d
1 parent
4bf542ef
Exists in
staging
and in
42 other branches
Small cosmetics changes
* removed whitespaces * fixes on texts (ActionItem2823)
Showing
6 changed files
with
32 additions
and
29 deletions
Show diff stats
plugins/video/README
1 | README - Video (Video Plugin) | 1 | README - Video (Video Plugin) |
2 | ================================ | 2 | ================================ |
3 | 3 | ||
4 | -Video is a plugin to allow the user adds a block where you could choose any url from youtube, vimeo and url's of the following file formats: mp4, ogg, ogv and webm. | 4 | +Video is a plugin that allow users to add a block where you can choose |
5 | +any url from youtube, vimeo and url's of the following file formats: | ||
6 | +mp4, ogg, ogv and webm. | ||
5 | 7 | ||
6 | -The Video block will be available for all layout columns of communities, peole, enterprises and environments. | 8 | +The Video block will be available for all layout columns of communities, |
9 | +people, enterprises and environments. | ||
7 | 10 | ||
8 | INSTALL | 11 | INSTALL |
9 | ======= | 12 | ======= |
@@ -11,7 +14,7 @@ INSTALL | @@ -11,7 +14,7 @@ INSTALL | ||
11 | Enable Plugin | 14 | Enable Plugin |
12 | ------------- | 15 | ------------- |
13 | 16 | ||
14 | -Also, you need to enable Video Plugin at you Noosfero: | 17 | +Also, you need to enable Video Plugin on your Noosfero: |
15 | 18 | ||
16 | cd <your_noosfero_dir> | 19 | cd <your_noosfero_dir> |
17 | ./script/noosfero-plugins enable video | 20 | ./script/noosfero-plugins enable video |
@@ -33,7 +36,7 @@ $ rake test:noosfero_plugins:video | @@ -33,7 +36,7 @@ $ rake test:noosfero_plugins:video | ||
33 | Get Involved | 36 | Get Involved |
34 | ============ | 37 | ============ |
35 | 38 | ||
36 | -If you found any bug and/or want to collaborate, please send an e-mail to leandronunes@gmail.com | 39 | +If you find any bug and/or want to collaborate, please send an e-mail to leandronunes@gmail.com |
37 | 40 | ||
38 | LICENSE | 41 | LICENSE |
39 | ======= | 42 | ======= |
plugins/video/lib/video_block.rb
@@ -12,7 +12,7 @@ class VideoBlock < Block | @@ -12,7 +12,7 @@ class VideoBlock < Block | ||
12 | url.match(/^(http[s]?:\/\/)?(www.)?(vimeo.com|player.vimeo.com\/video)\/[[:digit:]]+/) ? true : false | 12 | url.match(/^(http[s]?:\/\/)?(www.)?(vimeo.com|player.vimeo.com\/video)\/[[:digit:]]+/) ? true : false |
13 | end | 13 | end |
14 | 14 | ||
15 | - def is_video_file? | 15 | + def is_video_file? |
16 | url.match(/.*(mp4|ogg|ogv|webm)$/) ? true : false | 16 | url.match(/.*(mp4|ogg|ogv|webm)$/) ? true : false |
17 | end | 17 | end |
18 | 18 | ||
@@ -25,11 +25,11 @@ class VideoBlock < Block | @@ -25,11 +25,11 @@ class VideoBlock < Block | ||
25 | end | 25 | end |
26 | 26 | ||
27 | def self.description | 27 | def self.description |
28 | - _('Add Videos') | 28 | + _('Display a Video') |
29 | end | 29 | end |
30 | 30 | ||
31 | def help | 31 | def help |
32 | - _('This block presents a video from youtube, vimeo and video formats mp4, ogg, ogv and webm') | 32 | + _('This block presents a video from youtube, vimeo and some video formats (mp4, ogg, ogv and webm)') |
33 | end | 33 | end |
34 | 34 | ||
35 | def content(args={}) | 35 | def content(args={}) |
@@ -39,20 +39,20 @@ class VideoBlock < Block | @@ -39,20 +39,20 @@ class VideoBlock < Block | ||
39 | render :file => 'video_block', :locals => { :block => block } | 39 | render :file => 'video_block', :locals => { :block => block } |
40 | end | 40 | end |
41 | end | 41 | end |
42 | - | 42 | + |
43 | private | 43 | private |
44 | 44 | ||
45 | def extract_youtube_id | 45 | def extract_youtube_id |
46 | return nil unless is_youtube? | 46 | return nil unless is_youtube? |
47 | youtube_match = url.match('v=([[:alnum:]]*)') | 47 | youtube_match = url.match('v=([[:alnum:]]*)') |
48 | youtube_match ||= url.match('youtu.be\/([[:alnum:]]*)') | 48 | youtube_match ||= url.match('youtu.be\/([[:alnum:]]*)') |
49 | - youtube_match[1] unless youtube_match.nil? | 49 | + youtube_match[1] unless youtube_match.nil? |
50 | end | 50 | end |
51 | - | 51 | + |
52 | def extract_vimeo_id | 52 | def extract_vimeo_id |
53 | return nil unless is_vimeo? | 53 | return nil unless is_vimeo? |
54 | vimeo_match = url.match('([[:digit:]]*)$') | 54 | vimeo_match = url.match('([[:digit:]]*)$') |
55 | - vimeo_match[1] unless vimeo_match.nil? | 55 | + vimeo_match[1] unless vimeo_match.nil? |
56 | end | 56 | end |
57 | 57 | ||
58 | end | 58 | end |
plugins/video/lib/video_plugin.rb
@@ -7,7 +7,7 @@ class VideoPlugin < Noosfero::Plugin | @@ -7,7 +7,7 @@ class VideoPlugin < Noosfero::Plugin | ||
7 | end | 7 | end |
8 | 8 | ||
9 | def self.plugin_description | 9 | def self.plugin_description |
10 | - _("A plugin that adds a block where you could add videos from youtube, vimeo and html5.") | 10 | + _("A plugin that adds a block where you can add videos from youtube, vimeo and html5.") |
11 | end | 11 | end |
12 | 12 | ||
13 | def self.extra_blocks | 13 | def self.extra_blocks |
plugins/video/test/functional/video_plugin_environment_design_controller_test.rb
@@ -118,7 +118,7 @@ class EnvironmentDesignControllerTest < ActionController::TestCase | @@ -118,7 +118,7 @@ class EnvironmentDesignControllerTest < ActionController::TestCase | ||
118 | assert_tag :tag => 'div', :attributes => {:class => 'video-block-data'}, :descendant => { :tag => 'div', :attributes => {:class => 'video'} } | 118 | assert_tag :tag => 'div', :attributes => {:class => 'video-block-data'}, :descendant => { :tag => 'div', :attributes => {:class => 'video'} } |
119 | end | 119 | end |
120 | 120 | ||
121 | - should 'display a messagem to register a new url' do | 121 | + should 'display a message to register a new url' do |
122 | block.url='http://www.vmsd.com/test.pdf' | 122 | block.url='http://www.vmsd.com/test.pdf' |
123 | block.save | 123 | block.save |
124 | get :index | 124 | get :index |
plugins/video/test/unit/video_block_test.rb
@@ -8,19 +8,19 @@ class VideoBlockTest < ActiveSupport::TestCase | @@ -8,19 +8,19 @@ class VideoBlockTest < ActiveSupport::TestCase | ||
8 | block.url = "http://youtube.com/?v=XXXXX" | 8 | block.url = "http://youtube.com/?v=XXXXX" |
9 | assert block.is_youtube? | 9 | assert block.is_youtube? |
10 | end | 10 | end |
11 | - | 11 | + |
12 | should "is_youtube return true when the url contains https://youtube.com" do | 12 | should "is_youtube return true when the url contains https://youtube.com" do |
13 | block = VideoBlock.new | 13 | block = VideoBlock.new |
14 | block.url = "https://youtube.com/?v=XXXXX" | 14 | block.url = "https://youtube.com/?v=XXXXX" |
15 | assert block.is_youtube? | 15 | assert block.is_youtube? |
16 | end | 16 | end |
17 | - | 17 | + |
18 | should "is_youtube return true when the url contains https://www.youtube.com" do | 18 | should "is_youtube return true when the url contains https://www.youtube.com" do |
19 | block = VideoBlock.new | 19 | block = VideoBlock.new |
20 | block.url = "https://www.youtube.com/?v=XXXXX" | 20 | block.url = "https://www.youtube.com/?v=XXXXX" |
21 | assert block.is_youtube? | 21 | assert block.is_youtube? |
22 | end | 22 | end |
23 | - | 23 | + |
24 | should "is_youtube return true when the url contains www.youtube.com" do | 24 | should "is_youtube return true when the url contains www.youtube.com" do |
25 | block = VideoBlock.new | 25 | block = VideoBlock.new |
26 | block.url = "www.youtube.com/?v=XXXXX" | 26 | block.url = "www.youtube.com/?v=XXXXX" |
@@ -50,13 +50,13 @@ class VideoBlockTest < ActiveSupport::TestCase | @@ -50,13 +50,13 @@ class VideoBlockTest < ActiveSupport::TestCase | ||
50 | block.url = "http://www.yt.com/?v=XXXXX" | 50 | block.url = "http://www.yt.com/?v=XXXXX" |
51 | assert !block.is_youtube? | 51 | assert !block.is_youtube? |
52 | end | 52 | end |
53 | - | 53 | + |
54 | should "format embed video for youtube videos" do | 54 | should "format embed video for youtube videos" do |
55 | block = VideoBlock.new | 55 | block = VideoBlock.new |
56 | block.url = "youtube.com/?v=XXXXX" | 56 | block.url = "youtube.com/?v=XXXXX" |
57 | assert_match /\/\/www.youtube-nocookie.com\/embed/, block.format_embed_video_url_for_youtube | 57 | assert_match /\/\/www.youtube-nocookie.com\/embed/, block.format_embed_video_url_for_youtube |
58 | end | 58 | end |
59 | - | 59 | + |
60 | should "format embed video return nil if is not a youtube url" do | 60 | should "format embed video return nil if is not a youtube url" do |
61 | block = VideoBlock.new | 61 | block = VideoBlock.new |
62 | block.url = "http://www.yt.com/?v=XXXXX" | 62 | block.url = "http://www.yt.com/?v=XXXXX" |
@@ -69,7 +69,7 @@ class VideoBlockTest < ActiveSupport::TestCase | @@ -69,7 +69,7 @@ class VideoBlockTest < ActiveSupport::TestCase | ||
69 | block.url = "youtube.com/?v=#{id}" | 69 | block.url = "youtube.com/?v=#{id}" |
70 | assert_equal id, block.send('extract_youtube_id') | 70 | assert_equal id, block.send('extract_youtube_id') |
71 | end | 71 | end |
72 | - | 72 | + |
73 | should "extract youtube id from youtube video url's if it's a valid youtube short url" do | 73 | should "extract youtube id from youtube video url's if it's a valid youtube short url" do |
74 | block = VideoBlock.new | 74 | block = VideoBlock.new |
75 | id = 'oi43jre2d2' | 75 | id = 'oi43jre2d2' |
@@ -82,33 +82,33 @@ class VideoBlockTest < ActiveSupport::TestCase | @@ -82,33 +82,33 @@ class VideoBlockTest < ActiveSupport::TestCase | ||
82 | block.url = "http://www.yt.com/?v=XXXXX" | 82 | block.url = "http://www.yt.com/?v=XXXXX" |
83 | assert_nil block.send('extract_youtube_id') | 83 | assert_nil block.send('extract_youtube_id') |
84 | end | 84 | end |
85 | - | 85 | + |
86 | should "extract_youtube_id return nil if youtue url there is no id" do | 86 | should "extract_youtube_id return nil if youtue url there is no id" do |
87 | block = VideoBlock.new | 87 | block = VideoBlock.new |
88 | block.url = "youtube.com/" | 88 | block.url = "youtube.com/" |
89 | assert_nil block.send('extract_youtube_id') | 89 | assert_nil block.send('extract_youtube_id') |
90 | end | 90 | end |
91 | - | 91 | + |
92 | #### Tests for Vimeo Videos | 92 | #### Tests for Vimeo Videos |
93 | - | 93 | + |
94 | should "is_vimeo return true when the url contains http://vimeo.com" do | 94 | should "is_vimeo return true when the url contains http://vimeo.com" do |
95 | block = VideoBlock.new | 95 | block = VideoBlock.new |
96 | block.url = "http://vimeo.com/98979" | 96 | block.url = "http://vimeo.com/98979" |
97 | assert block.is_vimeo? | 97 | assert block.is_vimeo? |
98 | end | 98 | end |
99 | - | 99 | + |
100 | should "is_vimeo return true when the url contains https://vimeo.com" do | 100 | should "is_vimeo return true when the url contains https://vimeo.com" do |
101 | block = VideoBlock.new | 101 | block = VideoBlock.new |
102 | block.url = "https://vimeo.com/989798" | 102 | block.url = "https://vimeo.com/989798" |
103 | assert block.is_vimeo? | 103 | assert block.is_vimeo? |
104 | end | 104 | end |
105 | - | 105 | + |
106 | should "is_vimeo return true when the url contains https://www.vimeo.com" do | 106 | should "is_vimeo return true when the url contains https://www.vimeo.com" do |
107 | block = VideoBlock.new | 107 | block = VideoBlock.new |
108 | block.url = "https://www.vimeo.com/98987" | 108 | block.url = "https://www.vimeo.com/98987" |
109 | assert block.is_vimeo? | 109 | assert block.is_vimeo? |
110 | end | 110 | end |
111 | - | 111 | + |
112 | should "is_vimeo return true when the url contains www.vimeo.com" do | 112 | should "is_vimeo return true when the url contains www.vimeo.com" do |
113 | block = VideoBlock.new | 113 | block = VideoBlock.new |
114 | block.url = "www.vimeo.com/989798" | 114 | block.url = "www.vimeo.com/989798" |
@@ -144,7 +144,7 @@ class VideoBlockTest < ActiveSupport::TestCase | @@ -144,7 +144,7 @@ class VideoBlockTest < ActiveSupport::TestCase | ||
144 | block.url = "vimeo.com/09898" | 144 | block.url = "vimeo.com/09898" |
145 | assert_match /\/\/player.vimeo.com\/video\/[[:digit:]]+/, block.format_embed_video_url_for_vimeo | 145 | assert_match /\/\/player.vimeo.com\/video\/[[:digit:]]+/, block.format_embed_video_url_for_vimeo |
146 | end | 146 | end |
147 | - | 147 | + |
148 | should "format embed video return nil if is not a vimeo url" do | 148 | should "format embed video return nil if is not a vimeo url" do |
149 | block = VideoBlock.new | 149 | block = VideoBlock.new |
150 | block.url = "http://www.yt.com/?v=XXXXX" | 150 | block.url = "http://www.yt.com/?v=XXXXX" |
@@ -157,13 +157,13 @@ class VideoBlockTest < ActiveSupport::TestCase | @@ -157,13 +157,13 @@ class VideoBlockTest < ActiveSupport::TestCase | ||
157 | block.url = "vimeo.com/#{id}" | 157 | block.url = "vimeo.com/#{id}" |
158 | assert_equal id, block.send('extract_vimeo_id') | 158 | assert_equal id, block.send('extract_vimeo_id') |
159 | end | 159 | end |
160 | - | 160 | + |
161 | should "extract_vimeo_id return nil if the url it's not a valid vimeo url" do | 161 | should "extract_vimeo_id return nil if the url it's not a valid vimeo url" do |
162 | block = VideoBlock.new | 162 | block = VideoBlock.new |
163 | block.url = "http://www.yt.com/XXXXX" | 163 | block.url = "http://www.yt.com/XXXXX" |
164 | assert_nil block.send('extract_vimeo_id') | 164 | assert_nil block.send('extract_vimeo_id') |
165 | end | 165 | end |
166 | - | 166 | + |
167 | should "extract_vimeo_id return nil if vimeo url there is no id" do | 167 | should "extract_vimeo_id return nil if vimeo url there is no id" do |
168 | block = VideoBlock.new | 168 | block = VideoBlock.new |
169 | block.url = "vimeo.com/" | 169 | block.url = "vimeo.com/" |
plugins/video/views/video_block.rhtml
@@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
15 | <%= render :partial => 'box_organizer/html5_video_block', :locals => { :url => block.url, :width => block.width, :height => block.height }%> | 15 | <%= render :partial => 'box_organizer/html5_video_block', :locals => { :url => block.url, :width => block.width, :height => block.height }%> |
16 | </div> | 16 | </div> |
17 | <% else %> | 17 | <% else %> |
18 | - <span class='alert-block'><%= _("Register a new url (Vimeo, Youtube, Other)") %></span> | 18 | + <span class='alert-block'><%= _("Register a valid url (Vimeo, Youtube, video files)") %></span> |
19 | <% end %> | 19 | <% end %> |
20 | 20 | ||
21 | </div> | 21 | </div> |