Commit a39547e4759ac1d5913456be3dc22b8a9486cd58
1 parent
8dc7f3e3
Exists in
staging
and in
4 other branches
video_plugin: small fixes
Showing
12 changed files
with
38 additions
and
60 deletions
Show diff stats
plugins/video/lib/video.rb
@@ -2,7 +2,6 @@ require 'noosfero/translatable_content' | @@ -2,7 +2,6 @@ require 'noosfero/translatable_content' | ||
2 | require 'application_helper' | 2 | require 'application_helper' |
3 | require 'net/http' | 3 | require 'net/http' |
4 | 4 | ||
5 | -# a base class for all text article types. | ||
6 | class Video < Article | 5 | class Video < Article |
7 | 6 | ||
8 | settings_items :video_url, :type => :string, :default => 'http://' | 7 | settings_items :video_url, :type => :string, :default => 'http://' |
@@ -13,14 +12,14 @@ class Video < Article | @@ -13,14 +12,14 @@ class Video < Article | ||
13 | settings_items :video_format, :type => :string | 12 | settings_items :video_format, :type => :string |
14 | settings_items :video_id, :type => :string | 13 | settings_items :video_id, :type => :string |
15 | settings_items :video_thumbnail_url, :type => :string, :default => '/plugins/video/images/video_generic_thumbnail.jpg' | 14 | settings_items :video_thumbnail_url, :type => :string, :default => '/plugins/video/images/video_generic_thumbnail.jpg' |
16 | - settings_items :video_thumbnail_width, :type=> :integer | 15 | + settings_items :video_thumbnail_width, :type=> :integer |
17 | settings_items :video_thumbnail_height, :type=> :integer | 16 | settings_items :video_thumbnail_height, :type=> :integer |
18 | settings_items :video_duration, :type=> :integer, :default => 0 | 17 | settings_items :video_duration, :type=> :integer, :default => 0 |
19 | - | 18 | + |
20 | attr_accessible :video_url | 19 | attr_accessible :video_url |
21 | 20 | ||
22 | before_save :detect_video | 21 | before_save :detect_video |
23 | - | 22 | + |
24 | def self.type_name | 23 | def self.type_name |
25 | _('Video') | 24 | _('Video') |
26 | end | 25 | end |
@@ -28,7 +27,7 @@ class Video < Article | @@ -28,7 +27,7 @@ class Video < Article | ||
28 | def can_display_versions? | 27 | def can_display_versions? |
29 | true | 28 | true |
30 | end | 29 | end |
31 | - | 30 | + |
32 | def self.short_description | 31 | def self.short_description |
33 | _('Embedded Video') | 32 | _('Embedded Video') |
34 | end | 33 | end |
@@ -41,10 +40,10 @@ class Video < Article | @@ -41,10 +40,10 @@ class Video < Article | ||
41 | def to_html(options={}) | 40 | def to_html(options={}) |
42 | article = self | 41 | article = self |
43 | proc do | 42 | proc do |
44 | - render :file => 'content_viewer/video', :locals => {:article => article} | 43 | + render :partial => 'content_viewer/video', :locals => {:article => article} |
45 | end | 44 | end |
46 | - end | ||
47 | - | 45 | + end |
46 | + | ||
48 | def fitted_width | 47 | def fitted_width |
49 | 499 | 48 | 499 |
50 | end | 49 | end |
@@ -165,4 +164,4 @@ end | @@ -165,4 +164,4 @@ end | ||
165 | # } | 164 | # } |
166 | # | 165 | # |
167 | # return hr + ':' + min + ':' + sec; | 166 | # return hr + ':' + min + ':' + sec; |
168 | -#} | ||
169 | \ No newline at end of file | 167 | \ No newline at end of file |
168 | +#} |
plugins/video/lib/video_gallery.rb
@@ -3,11 +3,11 @@ class VideoGallery < Folder | @@ -3,11 +3,11 @@ class VideoGallery < Folder | ||
3 | def self.type_name | 3 | def self.type_name |
4 | _('Video Gallery') | 4 | _('Video Gallery') |
5 | end | 5 | end |
6 | - | 6 | + |
7 | settings_items :thumbnail_width, :type => :integer, :default => 50 | 7 | settings_items :thumbnail_width, :type => :integer, :default => 50 |
8 | settings_items :thumbnail_height, :type => :integer, :default => 50 | 8 | settings_items :thumbnail_height, :type => :integer, :default => 50 |
9 | settings_items :videos_per_row, :type => :integer, :default => 5 | 9 | settings_items :videos_per_row, :type => :integer, :default => 5 |
10 | - | 10 | + |
11 | validate :not_belong_to_blog | 11 | validate :not_belong_to_blog |
12 | 12 | ||
13 | def not_belong_to_blog | 13 | def not_belong_to_blog |
@@ -22,7 +22,7 @@ class VideoGallery < Folder | @@ -22,7 +22,7 @@ class VideoGallery < Folder | ||
22 | filter_iframes :body | 22 | filter_iframes :body |
23 | def iframe_whitelist | 23 | def iframe_whitelist |
24 | profile && profile.environment && profile.environment.trusted_sites_for_iframe | 24 | profile && profile.environment && profile.environment.trusted_sites_for_iframe |
25 | - end | 25 | + end |
26 | 26 | ||
27 | def self.short_description | 27 | def self.short_description |
28 | _('Video Gallery') | 28 | _('Video Gallery') |
@@ -31,19 +31,19 @@ class VideoGallery < Folder | @@ -31,19 +31,19 @@ class VideoGallery < Folder | ||
31 | def self.description | 31 | def self.description |
32 | _('A gallery of link to videos that are hosted elsewhere.') | 32 | _('A gallery of link to videos that are hosted elsewhere.') |
33 | end | 33 | end |
34 | - | 34 | + |
35 | include ActionView::Helpers::TagHelper | 35 | include ActionView::Helpers::TagHelper |
36 | def to_html(options = {}) | 36 | def to_html(options = {}) |
37 | video_gallery = self | 37 | video_gallery = self |
38 | proc do | 38 | proc do |
39 | - render :file => 'content_viewer/video_gallery', :locals => {:video_gallery => video_gallery} | 39 | + render :partial => 'content_viewer/video_gallery', :locals => {:video_gallery => video_gallery} |
40 | end | 40 | end |
41 | - end | 41 | + end |
42 | 42 | ||
43 | def video_gallery? | 43 | def video_gallery? |
44 | true | 44 | true |
45 | end | 45 | end |
46 | - | 46 | + |
47 | def can_display_hits? | 47 | def can_display_hits? |
48 | false | 48 | false |
49 | end | 49 | end |
@@ -58,6 +58,6 @@ class VideoGallery < Folder | @@ -58,6 +58,6 @@ class VideoGallery < Folder | ||
58 | 58 | ||
59 | def news(limit = 30, highlight = false) | 59 | def news(limit = 30, highlight = false) |
60 | profile.recent_documents(limit, ["articles.type != ? AND articles.highlighted = ? AND articles.parent_id = ?", 'Folder', highlight, id]) | 60 | profile.recent_documents(limit, ["articles.type != ? AND articles.highlighted = ? AND articles.parent_id = ?", 'Folder', highlight, id]) |
61 | - end | ||
62 | - | 61 | + end |
62 | + | ||
63 | end | 63 | end |
plugins/video/lib/video_plugin.rb
@@ -44,7 +44,7 @@ class VideoPlugin < Noosfero::Plugin | @@ -44,7 +44,7 @@ class VideoPlugin < Noosfero::Plugin | ||
44 | content_tag('a', _("New Video"), | 44 | content_tag('a', _("New Video"), |
45 | { :id=>"new-video-btn", | 45 | { :id=>"new-video-btn", |
46 | :class=>"button with-text icon-new", | 46 | :class=>"button with-text icon-new", |
47 | - :href=>url_for(:action => 'new', :type=>'Video', :controller=>'cms'), | 47 | + :href=>url_for(:action => 'new', :type=>'Video', :controller=>'cms', :parent_id => content.id), |
48 | :title=>_("New Video") | 48 | :title=>_("New Video") |
49 | }) | 49 | }) |
50 | end | 50 | end |
plugins/video/views/box_organizer/_html5_video_block.html.erb
0 → 100644
plugins/video/views/box_organizer/_iframe_video_block.html.erb
0 → 100644
@@ -0,0 +1 @@ | @@ -0,0 +1 @@ | ||
1 | +<iframe width='<%="#{width}px"%>' height='<%="#{height}px"%>' src='<%= "#{url}" %>' frameborder="0" allowfullscreen></iframe> |
@@ -0,0 +1,11 @@ | @@ -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_plugin/_html5_video_block.html.erb
plugins/video/views/box_organizer/video_plugin/_iframe_video_block.html.erb
@@ -1 +0,0 @@ | @@ -1 +0,0 @@ | ||
1 | -<iframe width='<%="#{width}px"%>' height='<%="#{height}px"%>' src='<%= "#{url}" %>' frameborder="0" allowfullscreen></iframe> |
plugins/video/views/box_organizer/video_plugin/_video_block.html.erb
@@ -1,11 +0,0 @@ | @@ -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/cms/video_plugin/_video_video.html.erb
@@ -1,12 +0,0 @@ | @@ -1,12 +0,0 @@ | ||
1 | -<%= required_fields_message %> | ||
2 | - | ||
3 | -<div> | ||
4 | -<%= required f.text_field('name', :size => '64', :maxlength => 150) %> | ||
5 | -<%= required labelled_form_field _('URL of the video'), text_field(:article, :video_url, :size => 300) %> | ||
6 | -<%= labelled_form_field(_('Description:'), text_area(:article, :body, :rows => 3, :cols => 64)) %> | ||
7 | -<%= render :partial => 'general_fields' %> | ||
8 | -<%= render :partial => 'translatable' %> | ||
9 | -</div> | ||
10 | - | ||
11 | - | ||
12 | - |
plugins/video/views/cms/video_plugin/_video_video_gallery.html.erb
plugins/video/views/shared/video_list.html.erb
@@ -5,17 +5,14 @@ | @@ -5,17 +5,14 @@ | ||
5 | <div class="video-gallery-thumbnail"> | 5 | <div class="video-gallery-thumbnail"> |
6 | <div class="video-gallery-top-box"> | 6 | <div class="video-gallery-top-box"> |
7 | <%= link_to content.view_url do %> | 7 | <%= link_to content.view_url do %> |
8 | - <img width="<%= content.thumbnail_fitted_width %>" height="<%= content.thumbnail_fitted_width %>" src='<%= content.video_thumbnail_url %>'/> | 8 | + <img width="<%= content.thumbnail_fitted_width %>" height="<%= content.thumbnail_fitted_width %>" src='<%= content.video_thumbnail_url %>' class="disable-zoom"/> |
9 | <% end %> | 9 | <% end %> |
10 | - </div> | ||
11 | - <div class="video-gallery-botton-box"> | 10 | + </div> |
11 | + <div class="video-gallery-botton-box"> | ||
12 | <font size="1em"><%= content.title %></font> | 12 | <font size="1em"><%= content.title %></font> |
13 | - </div> | ||
14 | - <% if content.video_duration != 0 %> | ||
15 | - <span class="video-duration"><%= content.video_duration %></span> | ||
16 | - <% end %> | 13 | + </div> |
17 | </div> | 14 | </div> |
18 | <% end %> | 15 | <% end %> |
19 | <% end %> | 16 | <% end %> |
20 | <p><%= pagination_links contents, :param_name => 'npage', :page_links => true %></p> | 17 | <p><%= pagination_links contents, :param_name => 'npage', :page_links => true %></p> |
21 | -</div> | ||
22 | \ No newline at end of file | 18 | \ No newline at end of file |
19 | +</div> |