Commit 1ceb57494bc744e9ce60b30f3b322dde76569f03

Authored by Rafael Reggiani Manzo
1 parent 62193d8b

Remove VideoBlock#content

This method is no longer necessary given the structure at BoxesHelper.
It actually violates MVC as the model is holding view logic.

In order to comply with the BoxesHelper standards, the view got moved
and renamed properly. As well one unit test has been removed as it is
already better covered by the functional ones.
plugins/video/lib/video_plugin/video_block.rb
@@ -36,14 +36,6 @@ class VideoPlugin::VideoBlock < Block @@ -36,14 +36,6 @@ class VideoPlugin::VideoBlock < Block
36 _('This block presents a video from youtube, vimeo and some video formats (mp4, ogg, ogv and webm)') 36 _('This block presents a video from youtube, vimeo and some video formats (mp4, ogg, ogv and webm)')
37 end 37 end
38 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 39 private
48 40
49 def extract_youtube_id 41 def extract_youtube_id
plugins/video/test/unit/video_block_test.rb
@@ -208,12 +208,4 @@ class VideoBlockTest < ActiveSupport::TestCase @@ -208,12 +208,4 @@ class VideoBlockTest < ActiveSupport::TestCase
208 refute block.is_video_file? 208 refute block.is_video_file?
209 end 209 end
210 210
211 - should 'display video block partial' do  
212 - block = VideoPlugin::VideoBlock.new  
213 - self.expects(:render).with(:file => 'video_block', :locals => {  
214 - :block => block  
215 - })  
216 - instance_eval(& block.content)  
217 - end  
218 -  
219 end 211 end
plugins/video/views/blocks/video.html.erb 0 → 100644
@@ -0,0 +1,21 @@ @@ -0,0 +1,21 @@
  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>
plugins/video/views/video_block.html.erb
@@ -1,21 +0,0 @@ @@ -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>