Commit c73820bbd7bd36a4878237941635643ae48795cb

Authored by Victor Costa
1 parent ac2fca89

rails3: fix video_block plugin

plugins/video/lib/video_block.rb
... ... @@ -35,7 +35,7 @@ class VideoBlock < Block
35 35 def content(args={})
36 36 block = self
37 37  
38   - lambda do
  38 + proc do
39 39 render :file => 'video_block', :locals => { :block => block }
40 40 end
41 41 end
... ...
plugins/video/views/box_organizer/_html5_video_block.html.erb 0 → 100644
... ... @@ -0,0 +1,3 @@
  1 +<video controls preload="auto" width='<%="#{width}px"%>' height='<%="#{height}px"%>'>
  2 + <source src=<%= "#{url}" %>>
  3 +</video>
... ...
plugins/video/views/box_organizer/_html5_video_block.rhtml
... ... @@ -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 0 → 100644
... ... @@ -0,0 +1 @@
  1 +<iframe width='<%="#{width}px"%>' height='<%="#{height}px"%>' src='<%= "#{url}" %>' frameborder="0" allowfullscreen></iframe>
... ...
plugins/video/views/box_organizer/_iframe_video_block.rhtml
... ... @@ -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 0 → 100644
... ... @@ -0,0 +1,11 @@
  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/box_organizer/_video_block.rhtml
... ... @@ -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/video_block.html.erb 0 → 100644
... ... @@ -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.rhtml
... ... @@ -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>