From 1ceb57494bc744e9ce60b30f3b322dde76569f03 Mon Sep 17 00:00:00 2001 From: Rafael Reggiani Manzo Date: Tue, 3 May 2016 09:34:47 -0300 Subject: [PATCH] Remove VideoBlock#content --- plugins/video/lib/video_plugin/video_block.rb | 8 -------- plugins/video/test/unit/video_block_test.rb | 8 -------- plugins/video/views/blocks/video.html.erb | 21 +++++++++++++++++++++ plugins/video/views/video_block.html.erb | 21 --------------------- 4 files changed, 21 insertions(+), 37 deletions(-) create mode 100644 plugins/video/views/blocks/video.html.erb delete mode 100644 plugins/video/views/video_block.html.erb diff --git a/plugins/video/lib/video_plugin/video_block.rb b/plugins/video/lib/video_plugin/video_block.rb index fac16d7..7ac2c7a 100644 --- a/plugins/video/lib/video_plugin/video_block.rb +++ b/plugins/video/lib/video_plugin/video_block.rb @@ -36,14 +36,6 @@ class VideoPlugin::VideoBlock < Block _('This block presents a video from youtube, vimeo and some video formats (mp4, ogg, ogv and webm)') end - def content(args={}) - block = self - - proc do - render :file => 'video_block', :locals => { :block => block } - end - end - private def extract_youtube_id diff --git a/plugins/video/test/unit/video_block_test.rb b/plugins/video/test/unit/video_block_test.rb index 2d535bb..5583dfc 100644 --- a/plugins/video/test/unit/video_block_test.rb +++ b/plugins/video/test/unit/video_block_test.rb @@ -208,12 +208,4 @@ class VideoBlockTest < ActiveSupport::TestCase refute block.is_video_file? end - should 'display video block partial' do - block = VideoPlugin::VideoBlock.new - self.expects(:render).with(:file => 'video_block', :locals => { - :block => block - }) - instance_eval(& block.content) - end - end diff --git a/plugins/video/views/blocks/video.html.erb b/plugins/video/views/blocks/video.html.erb new file mode 100644 index 0000000..0bfbf68 --- /dev/null +++ b/plugins/video/views/blocks/video.html.erb @@ -0,0 +1,21 @@ +

+ <%=block.title%> +

+
+ <% if block.is_youtube? %> +
+ <%= render :partial => 'box_organizer/iframe_video_block', :locals => { :url => block.format_embed_video_url_for_youtube, :width => block.width, :height => block.height }%> +
+ <% elsif block.is_vimeo? %> +
+ <%= render :partial => 'box_organizer/iframe_video_block', :locals => { :url => block.format_embed_video_url_for_vimeo, :width => block.width, :height => block.height }%> +
+ <% elsif block.is_video_file? %> +
+ <%= render :partial => 'box_organizer/html5_video_block', :locals => { :url => block.url, :width => block.width, :height => block.height }%> +
+ <% else %> + <%= _("Register a valid url (Vimeo, Youtube, video files)") %> + <% end %> + +
diff --git a/plugins/video/views/video_block.html.erb b/plugins/video/views/video_block.html.erb deleted file mode 100644 index 0bfbf68..0000000 --- a/plugins/video/views/video_block.html.erb +++ /dev/null @@ -1,21 +0,0 @@ -

- <%=block.title%> -

-
- <% if block.is_youtube? %> -
- <%= render :partial => 'box_organizer/iframe_video_block', :locals => { :url => block.format_embed_video_url_for_youtube, :width => block.width, :height => block.height }%> -
- <% elsif block.is_vimeo? %> -
- <%= render :partial => 'box_organizer/iframe_video_block', :locals => { :url => block.format_embed_video_url_for_vimeo, :width => block.width, :height => block.height }%> -
- <% elsif block.is_video_file? %> -
- <%= render :partial => 'box_organizer/html5_video_block', :locals => { :url => block.url, :width => block.width, :height => block.height }%> -
- <% else %> - <%= _("Register a valid url (Vimeo, Youtube, video files)") %> - <% end %> - -
-- libgit2 0.21.2