Commit 837a8ef9d25a80b9c5aa408ff72d80d0f8fee869

Authored by Evandro Junior
1 parent 9967b75e

before removeing trailing spaces

plugins/video/lib/ext/article.rb
@@ -2,8 +2,8 @@ require_dependency 'article' @@ -2,8 +2,8 @@ require_dependency 'article'
2 2
3 class Article 3 class Article
4 4
5 - scope :video_gallery, :conditions => ["articles.type == 'VideoGallery'"]  
6 - 5 + scope :video_gallery, :conditions => ["articles.type = 'VideoPlugin::VideoGallery'"]
  6 +
7 #FIXME This should be done via hotspot 7 #FIXME This should be done via hotspot
8 def self.folder_types_with_video 8 def self.folder_types_with_video
9 self.folder_types_without_video << 'VideoPlugin::VideoGallery' 9 self.folder_types_without_video << 'VideoPlugin::VideoGallery'
@@ -13,31 +13,15 @@ class Article @@ -13,31 +13,15 @@ class Article
13 class << self 13 class << self
14 alias_method_chain :folder_types, :video 14 alias_method_chain :folder_types, :video
15 end 15 end
16 -  
17 -  
18 -# def self.articles_columns  
19 -# Article.column_names.map {|c| "articles.#{c}"} .join(",")  
20 -# end  
21 -#  
22 -# def self.most_accessed(owner, limit = nil)  
23 -# conditions = owner.kind_of?(Environment) ? ["hits > 0"] : ["profile_id = ? and hits > 0", owner.id]  
24 -# result = Article.relevant_content.find(  
25 -# :all,  
26 -# :order => 'hits desc',  
27 -# :limit => limit,  
28 -# :conditions => conditions)  
29 -# result.paginate({:page => 1, :per_page => limit})  
30 -# end  
31 -  
32 - def self.can_be_listed  
33 - conditions = owner.kind_of?(Environment) ? ["hits > 0"] : ["profile_id = ? and hits > 0", owner.id] 16 +
  17 + def self.owner_video_galleries(owner)
  18 + conditions = owner.kind_of?(Environment) ? [] : ["profile_id = ?", owner.id]
34 result = Article.video_gallery.find( 19 result = Article.video_gallery.find(
35 :all, 20 :all,
36 - :order => 'hits desc', 21 + :order => 'created_at desc',
37 :conditions => conditions) 22 :conditions => conditions)
38 end 23 end
39 -  
40 - 24 +
41 end 25 end
42 26
43 27
plugins/video/lib/video_plugin/video_gallery_block.rb 0 → 100644
@@ -0,0 +1,31 @@ @@ -0,0 +1,31 @@
  1 +class VideoPlugin::VideoGalleryBlock < Block
  2 +
  3 + settings_items :video_gallery_id, :type => :integer
  4 + attr_accessible :video_gallery_id
  5 +
  6 + include ActionView::Helpers
  7 + include Rails.application.routes.url_helpers
  8 +
  9 + def self.description
  10 + _('Display a Video Gallery')
  11 + end
  12 +
  13 + def help
  14 + _('This block presents a video gallery')
  15 + end
  16 +
  17 + def content(args={})
  18 + block = self
  19 + if video_gallery_id.present?
  20 + video_gallery = VideoPlugin::VideoGallery.find(video_gallery_id)
  21 + proc do
  22 + render :partial => 'content_viewer/video_plugin/video_gallery', :locals => {:video_gallery => video_gallery}
  23 + end
  24 + end
  25 + end
  26 +
  27 + def list_my_galleries
  28 + Article.owner_video_galleries(owner)
  29 + end
  30 +
  31 +end
plugins/video/views/box_organizer/video_plugin/_video_gallery_block.html.erb 0 → 100644
@@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
  1 +<div id='edit-video-gallery-block'>
  2 + <%= labelled_select(_('Video gallery')+' ', 'block[video_gallery_id]', :id, :name, @block.video_gallery_id, @block.list_my_galleries) %>
  3 +</div>
0 \ No newline at end of file 4 \ No newline at end of file
plugins/video/views/shared/video_plugin/apagar_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>  
plugins/video/views/video_gallery_block.html.erb 0 → 100644
@@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
  1 +<%#
  2 +# To change this license header, choose License Headers in Project Properties.
  3 +# To change this template file, choose Tools | Templates
  4 +# and open the template in the editor.
  5 +%>
  6 +
  7 +<%= "video_gallery_block.html" %>