Commit 4955f96ee685742d9156fbd2044de5c860c46874

Authored by Evandro Jr
1 parent aa5984bb
Exists in new_video_plugin

Deleted old video plugin files

plugins/video/README.md
... ... @@ -1,57 +0,0 @@
1   -README - Video (Video Plugin)
2   -================================
3   -
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.
7   -
8   -The Video block will be available for all layout columns of communities,
9   -people, enterprises and environments.
10   -
11   -INSTALL
12   -=======
13   -
14   -Enable Plugin
15   --------------
16   -
17   -Also, you need to enable Video Plugin on your Noosfero:
18   -
19   -cd <your_noosfero_dir>
20   -./script/noosfero-plugins enable video
21   -
22   -Active Plugin
23   --------------
24   -
25   -As a Noosfero administrator user, go to administrator panel:
26   -
27   -- Click on "Enable/disable plugins" option
28   -- Click on "Display Content Plugin" check-box
29   -
30   -Running Video tests
31   ---------------------
32   -
33   -$ rake test:noosfero_plugins:video
34   -
35   -
36   -Get Involved
37   -============
38   -
39   -If you find any bug and/or want to collaborate, please send an e-mail to leandronunes@gmail.com
40   -
41   -LICENSE
42   -=======
43   -
44   -Copyright (c) The Author developers.
45   -
46   -See Noosfero license.
47   -
48   -
49   -AUTHORS
50   -=======
51   -
52   - Leandro Nunes dos Santos (leandronunes at gmail.com)
53   -
54   -ACKNOWLEDGMENTS
55   -===============
56   -
57   -The author have been supported by Serpro
plugins/video/lib/video_block.rb
... ... @@ -1,62 +0,0 @@
1   -class VideoBlock < Block
2   -
3   - attr_accessible :url, :width, :height
4   -
5   - settings_items :url, :type => :string, :default => ""
6   - settings_items :width, :type => :integer, :default => 400
7   - settings_items :height, :type => :integer, :default => 315
8   -
9   - YOUTUBE_ID_FORMAT = '\w-'
10   -
11   - def is_youtube?
12   - url.match(/.*(youtube.com.*v=[#{YOUTUBE_ID_FORMAT}]+|youtu.be\/[#{YOUTUBE_ID_FORMAT}]+).*/) ? true : false
13   - end
14   -
15   - def is_vimeo?
16   - url.match(/^(http[s]?:\/\/)?(www.)?(vimeo.com|player.vimeo.com\/video)\/[[:digit:]]+/) ? true : false
17   - end
18   -
19   - def is_video_file?
20   - url.match(/.*(mp4|ogg|ogv|webm)$/) ? true : false
21   - end
22   -
23   - def format_embed_video_url_for_youtube
24   - "//www.youtube-nocookie.com/embed/#{extract_youtube_id}?rel=0&wmode=transparent" if is_youtube?
25   - end
26   -
27   - def format_embed_video_url_for_vimeo
28   - "//player.vimeo.com/video/#{extract_vimeo_id}" if is_vimeo?
29   - end
30   -
31   - def self.description
32   - _('Display a Video')
33   - end
34   -
35   - def help
36   - _('This block presents a video from youtube, vimeo and some video formats (mp4, ogg, ogv and webm)')
37   - end
38   -
39   - def content(args={})
40   - block = self
41   -
42   - proc do
43   - render :file => 'video_block', :locals => { :block => block }
44   - end
45   - end
46   -
47   - private
48   -
49   - def extract_youtube_id
50   - return nil unless is_youtube?
51   - youtube_match = url.match("v=([#{YOUTUBE_ID_FORMAT}]*)")
52   - youtube_match ||= url.match("youtu.be\/([#{YOUTUBE_ID_FORMAT}]*)")
53   - youtube_match[1] unless youtube_match.nil?
54   - end
55   -
56   - def extract_vimeo_id
57   - return nil unless is_vimeo?
58   - vimeo_match = url.match('([[:digit:]]*)$')
59   - vimeo_match[1] unless vimeo_match.nil?
60   - end
61   -
62   -end
plugins/video/lib/video_plugin.rb
... ... @@ -1,19 +0,0 @@
1   -require_dependency File.dirname(__FILE__) + '/video_block'
2   -
3   -class VideoPlugin < Noosfero::Plugin
4   -
5   - def self.plugin_name
6   - "Video Block Plugin"
7   - end
8   -
9   - def self.plugin_description
10   - _("A plugin that adds a block where you can add videos from youtube, vimeo and html5.")
11   - end
12   -
13   - def self.extra_blocks
14   - {
15   - VideoBlock => {}
16   - }
17   - end
18   -
19   -end
plugins/video/po/pt/video.po
... ... @@ -1,49 +0,0 @@
1   -# translation of noosfero.po to
2   -# Krishnamurti Lelis Lima Vieira Nunes <krishna@colivre.coop.br>, 2007.
3   -# noosfero - Brazilian Portuguese translation
4   -# Copyright (C) 2007,
5   -# Forum Brasileiro de Economia Solidaria <http://www.fbes.org.br/>
6   -# Copyright (C) 2007,
7   -# Ynternet.org Foundation <http://www.ynternet.org/>
8   -# This file is distributed under the same license as noosfero itself.
9   -# Joenio Costa <joenio@colivre.coop.br>, 2008.
10   -#
11   -#
12   -msgid ""
13   -msgstr ""
14   -"Project-Id-Version: 1.3~rc2-1-ga15645d\n"
15   -"POT-Creation-Date: 2015-10-30 16:35-0300\n"
16   -"PO-Revision-Date: 2014-12-18 18:40-0200\n"
17   -"Last-Translator: Luciano Prestes Cavalcanti <lucianopcbr@gmail.com>\n"
18   -"Language-Team: Portuguese <https://hosted.weblate.org/projects/noosfero/"
19   -"noosfero/pt/>\n"
20   -"Language: pt\n"
21   -"MIME-Version: 1.0\n"
22   -"Content-Type: text/plain; charset=UTF-8\n"
23   -"Content-Transfer-Encoding: 8bit\n"
24   -"Plural-Forms: nplurals=2; plural=n != 1;\n"
25   -"X-Generator: Weblate 2.0\n"
26   -
27   -#: plugins/video/lib/video_block.rb:32
28   -msgid "Display a Video"
29   -msgstr "Mostrar um Vídeo"
30   -
31   -#: plugins/video/lib/video_block.rb:36
32   -msgid ""
33   -"This block presents a video from youtube, vimeo and some video formats (mp4, "
34   -"ogg, ogv and webm)"
35   -msgstr ""
36   -"Esse bloco apresenta um vídeo do youtube, vimeo e alguns formatos de video "
37   -"(mp4, ogg, ogv e webm)"
38   -
39   -#: plugins/video/lib/video_plugin.rb:10
40   -msgid ""
41   -"A plugin that adds a block where you can add videos from youtube, vimeo and "
42   -"html5."
43   -msgstr ""
44   -"Um plugin que adiciona um bloco onde você pode adicionar vídeos do youtube, "
45   -"vimeo e html5."
46   -
47   -#: plugins/video/views/video_block.html.erb:18
48   -msgid "Register a valid url (Vimeo, Youtube, video files)"
49   -msgstr "Registre uma url válida (Vimeo, Youtube, arquivo de vídeo)"
plugins/video/po/video.pot
... ... @@ -1,38 +0,0 @@
1   -# SOME DESCRIPTIVE TITLE.
2   -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3   -# This file is distributed under the same license as the PACKAGE package.
4   -# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5   -#
6   -#, fuzzy
7   -msgid ""
8   -msgstr ""
9   -"Project-Id-Version: 1.3~rc2-1-ga15645d\n"
10   -"POT-Creation-Date: 2015-10-30 16:35-0300\n"
11   -"PO-Revision-Date: 2015-08-06 17:21-0300\n"
12   -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13   -"Language-Team: LANGUAGE <LL@li.org>\n"
14   -"Language: \n"
15   -"MIME-Version: 1.0\n"
16   -"Content-Type: text/plain; charset=UTF-8\n"
17   -"Content-Transfer-Encoding: 8bit\n"
18   -"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
19   -
20   -#: plugins/video/lib/video_block.rb:32
21   -msgid "Display a Video"
22   -msgstr ""
23   -
24   -#: plugins/video/lib/video_block.rb:36
25   -msgid ""
26   -"This block presents a video from youtube, vimeo and some video formats (mp4, "
27   -"ogg, ogv and webm)"
28   -msgstr ""
29   -
30   -#: plugins/video/lib/video_plugin.rb:10
31   -msgid ""
32   -"A plugin that adds a block where you can add videos from youtube, vimeo and "
33   -"html5."
34   -msgstr ""
35   -
36   -#: plugins/video/views/video_block.html.erb:18
37   -msgid "Register a valid url (Vimeo, Youtube, video files)"
38   -msgstr ""
plugins/video/test/functional/video_plugin_environment_design_controller_test.rb
... ... @@ -1,127 +0,0 @@
1   -require_relative '../test_helper'
2   -
3   -class EnvironmentDesignControllerTest < ActionController::TestCase
4   -
5   - def setup
6   - @controller = EnvironmentDesignController.new
7   - @request = ActionController::TestRequest.new
8   - @response = ActionController::TestResponse.new
9   -
10   - Environment.delete_all
11   - User.delete_all
12   - @environment = Environment.create!(defaults_for_environment.merge(:is_default => true))
13   - user = create_user('testinguser')
14   - login_as(user.person.identifier)
15   - @environment.add_admin(user.person)
16   - @environment.save!
17   -
18   - @environment.enabled_plugins = ['VideoPlugin']
19   - @environment.save!
20   -
21   - VideoBlock.delete_all
22   -
23   - @block = VideoBlock.new
24   - @block.box = @environment.boxes.first
25   - @block.save!
26   - end
27   -
28   - attr_accessor :environment, :block
29   -
30   - should 'display video-block-data class in profile block edition' do
31   - block.url='youtube.com/?v=XXXXX'
32   - block.save!
33   - get :index
34   -
35   - assert_tag :div, :attributes => {:class => 'video-block-data'}
36   - end
37   -
38   - should "display iframe tag in profile block edition on youtube url's" do
39   - block.url='youtube.com/?v=XXXXX'
40   - block.save
41   - get :index
42   -
43   - assert_tag :tag => 'iframe'
44   - end
45   -
46   - should "the width in iframe tag be defined on youtube url's" do
47   - block.url='youtube.com/?v=XXXXX'
48   - block.save
49   - get :index
50   -
51   - assert_tag :tag => 'iframe', :attributes => {:width => '400px'}
52   - end
53   -
54   - should "display iframe tag in profile block edition on vimeo url's" do
55   - block.url='http://vimeo.com/98979'
56   - block.save
57   - get :index
58   -
59   - assert_tag :tag => 'iframe'
60   - end
61   -
62   - should "the width in iframe tag be defined on vimeo url's" do
63   - block.url='http://vimeo.com/98979'
64   - block.save
65   - get :index
66   -
67   - assert_tag :tag => 'iframe', :attributes => {:width => '400px'}
68   - end
69   -
70   - should "display video tag in profile block edition for any video url" do
71   - block.url='http://www.vmsd.com/98979.mp4'
72   - block.save
73   - get :index
74   -
75   - assert_tag :tag => 'video'
76   - end
77   -
78   - should "the width in video tag be defined for any video url" do
79   - block.url='http://www.vmsd.com/98979.mp4'
80   - block.save
81   - get :index
82   -
83   - assert_tag :tag => 'video', :attributes => {:width => '400px'}
84   - end
85   -
86   - should 'the heigth in iframe tag be defined' do
87   - block.url='youtube.com/?v=XXXXX'
88   - block.save
89   - get :index
90   -
91   - assert_tag :tag => 'iframe', :attributes => {:height => '315px'}
92   - end
93   -
94   - should 'display youtube videos' do
95   - block.url='youtube.com/?v=XXXXX'
96   - block.save
97   - get :index
98   -
99   - assert_tag :tag => 'div', :attributes => {:class => 'video-block-data'}, :descendant => { :tag => 'div', :attributes => {:class => 'youtube'} }
100   - end
101   -
102   - should 'display vimeo videos' do
103   - block.url='http://vimeo.com/98979'
104   - block.save
105   - get :index
106   -
107   - assert_tag :tag => 'div', :attributes => {:class => 'video-block-data'}, :descendant => { :tag => 'div', :attributes => {:class => 'vimeo'} }
108   - end
109   -
110   - should 'display other videos' do
111   - block.url='http://www.vmsd.com/98979.mp4'
112   - block.save
113   - get :index
114   -
115   - assert_tag :tag => 'div', :attributes => {:class => 'video-block-data'}, :descendant => { :tag => 'div', :attributes => {:class => 'video'} }
116   - end
117   -
118   - should 'display a message to register a new url' do
119   - block.url='http://www.vmsd.com/test.pdf'
120   - block.save
121   - get :index
122   -
123   - assert_tag :tag => 'div', :attributes => {:class => 'video-block-data'}, :descendant => { :tag => 'span', :attributes => {:class => 'alert-block'} }
124   - end
125   -
126   -
127   -end
plugins/video/test/functional/video_plugin_profile_design_controller_test.rb
... ... @@ -1,129 +0,0 @@
1   -require_relative '../test_helper'
2   -
3   -class ProfileDesignControllerTest < ActionController::TestCase
4   -
5   - def setup
6   - @controller = ProfileDesignController.new
7   - @request = ActionController::TestRequest.new
8   - @response = ActionController::TestResponse.new
9   -
10   - user = create_user('testinguser')
11   - login_as(user.login)
12   - @profile = user.person
13   - @environment = @profile.environment
14   -
15   - @environment.enabled_plugins = ['VideoPlugin']
16   - @environment.save!
17   -
18   - VideoBlock.delete_all
19   - @box1 = Box.create!(:owner => @profile)
20   - @profile.boxes = [@box1]
21   -
22   - @block = VideoBlock.new
23   - @block.box = @box1
24   - @block.save!
25   -
26   - @profile.blocks<<@block
27   - @profile.save!
28   - end
29   -
30   - attr_accessor :profile, :block
31   -
32   - should 'display video-block-data class in profile block edition' do
33   - block.url='youtube.com/?v=XXXXX'
34   - block.save
35   - get :index, :profile => profile.identifier
36   -
37   - assert_tag :div, :attributes => {:class => 'video-block-data'}
38   - end
39   -
40   - should "display iframe tag in profile block edition on youtube url's" do
41   - block.url='youtube.com/?v=XXXXX'
42   - block.save
43   - get :index, :profile => profile.identifier
44   -
45   - assert_tag :tag => 'iframe'
46   - end
47   -
48   - should "the width in iframe tag be defined on youtube url's" do
49   - block.url='youtube.com/?v=XXXXX'
50   - block.save
51   - get :index, :profile => profile.identifier
52   -
53   - assert_tag :tag => 'iframe', :attributes => {:width => '400px'}
54   - end
55   -
56   - should "display iframe tag in profile block edition on vimeo url's" do
57   - block.url='http://vimeo.com/98979'
58   - block.save
59   - get :index, :profile => profile.identifier
60   -
61   - assert_tag :tag => 'iframe'
62   - end
63   -
64   - should "the width in iframe tag be defined on vimeo url's" do
65   - block.url='http://vimeo.com/98979'
66   - block.save
67   - get :index, :profile => profile.identifier
68   -
69   - assert_tag :tag => 'iframe', :attributes => {:width => '400px'}
70   - end
71   -
72   - should "display video tag in profile block edition for any video url" do
73   - block.url='http://www.vmsd.com/98979.mp4'
74   - block.save
75   - get :index, :profile => profile.identifier
76   -
77   - assert_tag :tag => 'video'
78   - end
79   -
80   - should "the width in video tag be defined for any video url" do
81   - block.url='http://www.vmsd.com/98979.mp4'
82   - block.save
83   - get :index, :profile => profile.identifier
84   -
85   - assert_tag :tag => 'video', :attributes => {:width => '400px'}
86   - end
87   -
88   - should 'the heigth in iframe tag be defined' do
89   - block.url='youtube.com/?v=XXXXX'
90   - block.save
91   - get :index, :profile => profile.identifier
92   -
93   - assert_tag :tag => 'iframe', :attributes => {:height => '315px'}
94   - end
95   -
96   - should 'display youtube videos' do
97   - block.url='youtube.com/?v=XXXXX'
98   - block.save
99   - get :index, :profile => profile.identifier
100   -
101   - assert_tag :tag => 'div', :attributes => {:class => 'video-block-data'}, :descendant => { :tag => 'div', :attributes => {:class => 'youtube'} }
102   - end
103   -
104   - should 'display vimeo videos' do
105   - block.url='http://vimeo.com/98979'
106   - block.save
107   - get :index, :profile => profile.identifier
108   -
109   - assert_tag :tag => 'div', :attributes => {:class => 'video-block-data'}, :descendant => { :tag => 'div', :attributes => {:class => 'vimeo'} }
110   - end
111   -
112   - should 'display other videos' do
113   - block.url='http://www.vmsd.com/98979.mp4'
114   - block.save
115   - get :index, :profile => profile.identifier
116   -
117   - assert_tag :tag => 'div', :attributes => {:class => 'video-block-data'}, :descendant => { :tag => 'div', :attributes => {:class => 'video'} }
118   - end
119   -
120   - should 'display a messagem to register a new url' do
121   - block.url='http://www.vmsd.com/test.pdf'
122   - block.save
123   - get :index, :profile => profile.identifier
124   -
125   - assert_tag :tag => 'div', :attributes => {:class => 'video-block-data'}, :descendant => { :tag => 'span', :attributes => {:class => 'alert-block'} }
126   - end
127   -
128   -
129   -end
plugins/video/test/test_helper.rb
... ... @@ -1 +0,0 @@
1   -require 'test_helper'
plugins/video/test/unit/video_block_test.rb
... ... @@ -1,225 +0,0 @@
1   -require_relative '../test_helper'
2   -class VideoBlockTest < ActiveSupport::TestCase
3   -
4   - ### Tests for YouTube
5   -
6   - should "is_youtube return true when the url contains http://youtube.com" do
7   - block = VideoBlock.new
8   - block.url = "http://youtube.com/?v=XXXXX"
9   - assert block.is_youtube?
10   - end
11   -
12   - should "is_youtube return true when the url contains https://youtube.com" do
13   - block = VideoBlock.new
14   - block.url = "https://youtube.com/?v=XXXXX"
15   - assert block.is_youtube?
16   - end
17   -
18   - should "is_youtube return true when the url contains https://www.youtube.com" do
19   - block = VideoBlock.new
20   - block.url = "https://www.youtube.com/?v=XXXXX"
21   - assert block.is_youtube?
22   - end
23   -
24   - should "is_youtube return true when the url contains www.youtube.com" do
25   - block = VideoBlock.new
26   - block.url = "www.youtube.com/?v=XXXXX"
27   - assert block.is_youtube?
28   - end
29   -
30   - should "is_youtube return true when the url contains youtube.com" do
31   - block = VideoBlock.new
32   - block.url = "youtube.com/?v=XXXXX"
33   - assert block.is_youtube?
34   - end
35   -
36   - should "is_youtube return false when the url not contains youtube video ID" do
37   - block = VideoBlock.new
38   - block.url = "youtube.com/"
39   - refute block.is_youtube?
40   - end
41   -
42   - should "is_youtube return false when the url contains empty youtube video ID" do
43   - block = VideoBlock.new
44   - block.url = "youtube.com/?v="
45   - refute block.is_youtube?
46   - end
47   -
48   - should "is_youtube return false when the url contains an invalid youtube link" do
49   - block = VideoBlock.new
50   - block.url = "http://www.yt.com/?v=XXXXX"
51   - refute block.is_youtube?
52   - end
53   -
54   - should "format embed video for youtube videos" do
55   - block = VideoBlock.new
56   - block.url = "youtube.com/?v=XXXXX"
57   - assert_match /\/\/www.youtube-nocookie.com\/embed/, block.format_embed_video_url_for_youtube
58   - end
59   -
60   - should "format embed video return nil if is not a youtube url" do
61   - block = VideoBlock.new
62   - block.url = "http://www.yt.com/?v=XXXXX"
63   - assert_nil block.format_embed_video_url_for_youtube
64   - end
65   -
66   - should "extract youtube id from youtube video url's if it's a valid youtube full url" do
67   - block = VideoBlock.new
68   - id = 'oi43jre2d2'
69   - block.url = "youtube.com/?v=#{id}"
70   - assert_equal id, block.send('extract_youtube_id')
71   - end
72   -
73   - should "extract youtube id from youtube video url's if it has underline and hyphen" do
74   - block = VideoBlock.new
75   - id = 'oi43_re-d2'
76   - block.url = "youtube.com/?v=#{id}"
77   - assert_equal id, block.send('extract_youtube_id')
78   - end
79   -
80   - should "extract youtube id from youtube video url's if it's a valid youtube short url" do
81   - block = VideoBlock.new
82   - id = 'oi43jre2d2'
83   - block.url = "youtu.be/#{id}"
84   - assert_equal id, block.send('extract_youtube_id')
85   - end
86   -
87   - should "extract_youtube_id return nil if the url it's not a valid youtube url" do
88   - block = VideoBlock.new
89   - block.url = "http://www.yt.com/?v=XXXXX"
90   - assert_nil block.send('extract_youtube_id')
91   - end
92   -
93   - should "extract_youtube_id return nil if youtue url there is no id" do
94   - block = VideoBlock.new
95   - block.url = "youtube.com/"
96   - assert_nil block.send('extract_youtube_id')
97   - end
98   -
99   - #### Tests for Vimeo Videos
100   -
101   - should "is_vimeo return true when the url contains http://vimeo.com" do
102   - block = VideoBlock.new
103   - block.url = "http://vimeo.com/98979"
104   - assert block.is_vimeo?
105   - end
106   -
107   - should "is_vimeo return true when the url contains https://vimeo.com" do
108   - block = VideoBlock.new
109   - block.url = "https://vimeo.com/989798"
110   - assert block.is_vimeo?
111   - end
112   -
113   - should "is_vimeo return true when the url contains https://www.vimeo.com" do
114   - block = VideoBlock.new
115   - block.url = "https://www.vimeo.com/98987"
116   - assert block.is_vimeo?
117   - end
118   -
119   - should "is_vimeo return true when the url contains www.vimeo.com" do
120   - block = VideoBlock.new
121   - block.url = "www.vimeo.com/989798"
122   - assert block.is_vimeo?
123   - end
124   -
125   - should "is_vimeo return true when the url contains vimeo.com" do
126   - block = VideoBlock.new
127   - block.url = "vimeo.com/09898"
128   - assert block.is_vimeo?
129   - end
130   -
131   - should "is_vimeo return false when the url not contains vimeo video ID" do
132   - block = VideoBlock.new
133   - block.url = "vimeo.com/home"
134   - refute block.is_vimeo?
135   - end
136   -
137   - should "is_vimeo return false when the url contains empty vimeo video ID" do
138   - block = VideoBlock.new
139   - block.url = "vimeo.com/"
140   - refute block.is_vimeo?
141   - end
142   -
143   - should "is_vimeo return false when the url contains an invalid vimeo link" do
144   - block = VideoBlock.new
145   - block.url = "http://www.vmsd.com/98979"
146   - refute block.is_vimeo?
147   - end
148   -
149   - should "format embed video for vimeo videos" do
150   - block = VideoBlock.new
151   - block.url = "vimeo.com/09898"
152   - assert_match /\/\/player.vimeo.com\/video\/[[:digit:]]+/, block.format_embed_video_url_for_vimeo
153   - end
154   -
155   - should "format embed video return nil if is not a vimeo url" do
156   - block = VideoBlock.new
157   - block.url = "http://www.yt.com/?v=XXXXX"
158   - assert_nil block.format_embed_video_url_for_vimeo
159   - end
160   -
161   - should "extract vimeo id from vimeo video url's if it's a valid vimeo url" do
162   - block = VideoBlock.new
163   - id = '23048239432'
164   - block.url = "vimeo.com/#{id}"
165   - assert_equal id, block.send('extract_vimeo_id')
166   - end
167   -
168   - should "extract_vimeo_id return nil if the url it's not a valid vimeo url" do
169   - block = VideoBlock.new
170   - block.url = "http://www.yt.com/XXXXX"
171   - assert_nil block.send('extract_vimeo_id')
172   - end
173   -
174   - should "extract_vimeo_id return nil if vimeo url there is no id" do
175   - block = VideoBlock.new
176   - block.url = "vimeo.com/"
177   - assert_nil block.send('extract_youtube_id')
178   - end
179   -
180   - # Other video formats
181   - should "is_video return true if url ends with mp4" do
182   - block = VideoBlock.new
183   - block.url = "http://www.vmsd.com/98979.mp4"
184   - assert block.is_video_file?
185   - end
186   -
187   - should "is_video return true if url ends with ogg" do
188   - block = VideoBlock.new
189   - block.url = "http://www.vmsd.com/98979.ogg"
190   - assert block.is_video_file?
191   - end
192   -
193   - should "is_video return true if url ends with ogv" do
194   - block = VideoBlock.new
195   - block.url = "http://www.vmsd.com/98979.ogv"
196   - assert block.is_video_file?
197   - end
198   -
199   - should "is_video return true if url ends with webm" do
200   - block = VideoBlock.new
201   - block.url = "http://www.vmsd.com/98979.webm"
202   - assert block.is_video_file?
203   - end
204   -
205   - should "is_video return false if url ends without mp4, ogg, ogv, webm" do
206   - block = VideoBlock.new
207   - block.url = "http://www.vmsd.com/98979.mp4r"
208   - refute block.is_video_file?
209   - block.url = "http://www.vmsd.com/98979.oggr"
210   - refute block.is_video_file?
211   - block.url = "http://www.vmsd.com/98979.ogvr"
212   - refute block.is_video_file?
213   - block.url = "http://www.vmsd.com/98979.webmr"
214   - refute block.is_video_file?
215   - end
216   -
217   - should 'display video block partial' do
218   - block = VideoBlock.new
219   - self.expects(:render).with(:file => 'video_block', :locals => {
220   - :block => block
221   - })
222   - instance_eval(& block.content)
223   - end
224   -
225   -end
plugins/video/test/unit/video_plugin_test.rb
... ... @@ -1,8 +0,0 @@
1   -require_relative '../test_helper'
2   -class VideoPluginTest < ActiveSupport::TestCase
3   -
4   - should "return VideoBlock in extra_blocks class method" do
5   - assert VideoPlugin.extra_blocks.keys.include?(VideoBlock)
6   - end
7   -
8   -end
plugins/video/views/box_organizer/_html5_video_block.html.erb
... ... @@ -1,3 +0,0 @@
1   -<video controls preload="auto" width='<%="#{width}px"%>' height='<%="#{height}px"%>'>
2   - <source src=<%= "#{url}" %>>
3   -</video>
plugins/video/views/box_organizer/_iframe_video_block.html.erb
... ... @@ -1 +0,0 @@
1   -<iframe width='<%="#{width}px"%>' height='<%="#{height}px"%>' src='<%= "#{url}" %>' frameborder="0" allowfullscreen></iframe>
plugins/video/views/box_organizer/_video_block.html.erb
... ... @@ -1,11 +0,0 @@
1   -<label for="url" class="formlabel"> Video URL: </label>
2   -
3   -<div class="formfield type-text">
4   - <%= text_field_tag 'block[url]', @block.url, :class => 'video-url', :maxlength => 255 %>
5   -</div>
6   -<div class="formfield type-text">
7   - <label for="width" class="formlabel"> Width: </label>
8   - <%= text_field_tag 'block[width]', @block.width, :size => 7, :class => 'video-width', :maxlength => 5 %>
9   - <label for="height" class="formlabel"> Height: </label>
10   - <%= text_field_tag 'block[height]', @block.height, :size => 7, :class => 'video-height', :maxlength => 5 %>
11   -</div>
plugins/video/views/environment_design
... ... @@ -1 +0,0 @@
1   -box_organizer
2 0 \ No newline at end of file
plugins/video/views/profile_design
... ... @@ -1 +0,0 @@
1   -box_organizer
2 0 \ No newline at end of file
plugins/video/views/video_block.html.erb
... ... @@ -1,21 +0,0 @@
1   -<h3 class="block-title">
2   - <span><%=block.title%></span>
3   -</h3>
4   -<div class="video-block-data">
5   - <% if block.is_youtube? %>
6   - <div class='youtube'>
7   - <%= render :partial => 'box_organizer/iframe_video_block', :locals => { :url => block.format_embed_video_url_for_youtube, :width => block.width, :height => block.height }%>
8   - </div>
9   - <% elsif block.is_vimeo? %>
10   - <div class='vimeo'>
11   - <%= render :partial => 'box_organizer/iframe_video_block', :locals => { :url => block.format_embed_video_url_for_vimeo, :width => block.width, :height => block.height }%>
12   - </div>
13   - <% elsif block.is_video_file? %>
14   - <div class='video'>
15   - <%= render :partial => 'box_organizer/html5_video_block', :locals => { :url => block.url, :width => block.width, :height => block.height }%>
16   - </div>
17   - <% else %>
18   - <span class='alert-block'><%= _("Register a valid url (Vimeo, Youtube, video files)") %></span>
19   - <% end %>
20   -
21   -</div>