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 | 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 | 11 | INSTALL |
9 | 12 | ======= |
... | ... | @@ -11,7 +14,7 @@ INSTALL |
11 | 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 | 19 | cd <your_noosfero_dir> |
17 | 20 | ./script/noosfero-plugins enable video |
... | ... | @@ -33,7 +36,7 @@ $ rake test:noosfero_plugins:video |
33 | 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 | 41 | LICENSE |
39 | 42 | ======= | ... | ... |
plugins/video/lib/video_block.rb
... | ... | @@ -12,7 +12,7 @@ class VideoBlock < Block |
12 | 12 | url.match(/^(http[s]?:\/\/)?(www.)?(vimeo.com|player.vimeo.com\/video)\/[[:digit:]]+/) ? true : false |
13 | 13 | end |
14 | 14 | |
15 | - def is_video_file? | |
15 | + def is_video_file? | |
16 | 16 | url.match(/.*(mp4|ogg|ogv|webm)$/) ? true : false |
17 | 17 | end |
18 | 18 | |
... | ... | @@ -25,11 +25,11 @@ class VideoBlock < Block |
25 | 25 | end |
26 | 26 | |
27 | 27 | def self.description |
28 | - _('Add Videos') | |
28 | + _('Display a Video') | |
29 | 29 | end |
30 | 30 | |
31 | 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 | 33 | end |
34 | 34 | |
35 | 35 | def content(args={}) |
... | ... | @@ -39,20 +39,20 @@ class VideoBlock < Block |
39 | 39 | render :file => 'video_block', :locals => { :block => block } |
40 | 40 | end |
41 | 41 | end |
42 | - | |
42 | + | |
43 | 43 | private |
44 | 44 | |
45 | 45 | def extract_youtube_id |
46 | 46 | return nil unless is_youtube? |
47 | 47 | youtube_match = url.match('v=([[:alnum:]]*)') |
48 | 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 | 50 | end |
51 | - | |
51 | + | |
52 | 52 | def extract_vimeo_id |
53 | 53 | return nil unless is_vimeo? |
54 | 54 | vimeo_match = url.match('([[:digit:]]*)$') |
55 | - vimeo_match[1] unless vimeo_match.nil? | |
55 | + vimeo_match[1] unless vimeo_match.nil? | |
56 | 56 | end |
57 | 57 | |
58 | 58 | end | ... | ... |
plugins/video/lib/video_plugin.rb
... | ... | @@ -7,7 +7,7 @@ class VideoPlugin < Noosfero::Plugin |
7 | 7 | end |
8 | 8 | |
9 | 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 | 11 | end |
12 | 12 | |
13 | 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 | 118 | assert_tag :tag => 'div', :attributes => {:class => 'video-block-data'}, :descendant => { :tag => 'div', :attributes => {:class => 'video'} } |
119 | 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 | 122 | block.url='http://www.vmsd.com/test.pdf' |
123 | 123 | block.save |
124 | 124 | get :index | ... | ... |
plugins/video/test/unit/video_block_test.rb
... | ... | @@ -8,19 +8,19 @@ class VideoBlockTest < ActiveSupport::TestCase |
8 | 8 | block.url = "http://youtube.com/?v=XXXXX" |
9 | 9 | assert block.is_youtube? |
10 | 10 | end |
11 | - | |
11 | + | |
12 | 12 | should "is_youtube return true when the url contains https://youtube.com" do |
13 | 13 | block = VideoBlock.new |
14 | 14 | block.url = "https://youtube.com/?v=XXXXX" |
15 | 15 | assert block.is_youtube? |
16 | 16 | end |
17 | - | |
17 | + | |
18 | 18 | should "is_youtube return true when the url contains https://www.youtube.com" do |
19 | 19 | block = VideoBlock.new |
20 | 20 | block.url = "https://www.youtube.com/?v=XXXXX" |
21 | 21 | assert block.is_youtube? |
22 | 22 | end |
23 | - | |
23 | + | |
24 | 24 | should "is_youtube return true when the url contains www.youtube.com" do |
25 | 25 | block = VideoBlock.new |
26 | 26 | block.url = "www.youtube.com/?v=XXXXX" |
... | ... | @@ -50,13 +50,13 @@ class VideoBlockTest < ActiveSupport::TestCase |
50 | 50 | block.url = "http://www.yt.com/?v=XXXXX" |
51 | 51 | assert !block.is_youtube? |
52 | 52 | end |
53 | - | |
53 | + | |
54 | 54 | should "format embed video for youtube videos" do |
55 | 55 | block = VideoBlock.new |
56 | 56 | block.url = "youtube.com/?v=XXXXX" |
57 | 57 | assert_match /\/\/www.youtube-nocookie.com\/embed/, block.format_embed_video_url_for_youtube |
58 | 58 | end |
59 | - | |
59 | + | |
60 | 60 | should "format embed video return nil if is not a youtube url" do |
61 | 61 | block = VideoBlock.new |
62 | 62 | block.url = "http://www.yt.com/?v=XXXXX" |
... | ... | @@ -69,7 +69,7 @@ class VideoBlockTest < ActiveSupport::TestCase |
69 | 69 | block.url = "youtube.com/?v=#{id}" |
70 | 70 | assert_equal id, block.send('extract_youtube_id') |
71 | 71 | end |
72 | - | |
72 | + | |
73 | 73 | should "extract youtube id from youtube video url's if it's a valid youtube short url" do |
74 | 74 | block = VideoBlock.new |
75 | 75 | id = 'oi43jre2d2' |
... | ... | @@ -82,33 +82,33 @@ class VideoBlockTest < ActiveSupport::TestCase |
82 | 82 | block.url = "http://www.yt.com/?v=XXXXX" |
83 | 83 | assert_nil block.send('extract_youtube_id') |
84 | 84 | end |
85 | - | |
85 | + | |
86 | 86 | should "extract_youtube_id return nil if youtue url there is no id" do |
87 | 87 | block = VideoBlock.new |
88 | 88 | block.url = "youtube.com/" |
89 | 89 | assert_nil block.send('extract_youtube_id') |
90 | 90 | end |
91 | - | |
91 | + | |
92 | 92 | #### Tests for Vimeo Videos |
93 | - | |
93 | + | |
94 | 94 | should "is_vimeo return true when the url contains http://vimeo.com" do |
95 | 95 | block = VideoBlock.new |
96 | 96 | block.url = "http://vimeo.com/98979" |
97 | 97 | assert block.is_vimeo? |
98 | 98 | end |
99 | - | |
99 | + | |
100 | 100 | should "is_vimeo return true when the url contains https://vimeo.com" do |
101 | 101 | block = VideoBlock.new |
102 | 102 | block.url = "https://vimeo.com/989798" |
103 | 103 | assert block.is_vimeo? |
104 | 104 | end |
105 | - | |
105 | + | |
106 | 106 | should "is_vimeo return true when the url contains https://www.vimeo.com" do |
107 | 107 | block = VideoBlock.new |
108 | 108 | block.url = "https://www.vimeo.com/98987" |
109 | 109 | assert block.is_vimeo? |
110 | 110 | end |
111 | - | |
111 | + | |
112 | 112 | should "is_vimeo return true when the url contains www.vimeo.com" do |
113 | 113 | block = VideoBlock.new |
114 | 114 | block.url = "www.vimeo.com/989798" |
... | ... | @@ -144,7 +144,7 @@ class VideoBlockTest < ActiveSupport::TestCase |
144 | 144 | block.url = "vimeo.com/09898" |
145 | 145 | assert_match /\/\/player.vimeo.com\/video\/[[:digit:]]+/, block.format_embed_video_url_for_vimeo |
146 | 146 | end |
147 | - | |
147 | + | |
148 | 148 | should "format embed video return nil if is not a vimeo url" do |
149 | 149 | block = VideoBlock.new |
150 | 150 | block.url = "http://www.yt.com/?v=XXXXX" |
... | ... | @@ -157,13 +157,13 @@ class VideoBlockTest < ActiveSupport::TestCase |
157 | 157 | block.url = "vimeo.com/#{id}" |
158 | 158 | assert_equal id, block.send('extract_vimeo_id') |
159 | 159 | end |
160 | - | |
160 | + | |
161 | 161 | should "extract_vimeo_id return nil if the url it's not a valid vimeo url" do |
162 | 162 | block = VideoBlock.new |
163 | 163 | block.url = "http://www.yt.com/XXXXX" |
164 | 164 | assert_nil block.send('extract_vimeo_id') |
165 | 165 | end |
166 | - | |
166 | + | |
167 | 167 | should "extract_vimeo_id return nil if vimeo url there is no id" do |
168 | 168 | block = VideoBlock.new |
169 | 169 | block.url = "vimeo.com/" | ... | ... |
plugins/video/views/video_block.rhtml
... | ... | @@ -15,7 +15,7 @@ |
15 | 15 | <%= render :partial => 'box_organizer/html5_video_block', :locals => { :url => block.url, :width => block.width, :height => block.height }%> |
16 | 16 | </div> |
17 | 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 | 19 | <% end %> |
20 | 20 | |
21 | 21 | </div> | ... | ... |