Commit a39547e4759ac1d5913456be3dc22b8a9486cd58
1 parent
8dc7f3e3
Exists in
theme-brasil-digital-from-staging
and in
9 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 | 2 | require 'application_helper' |
3 | 3 | require 'net/http' |
4 | 4 | |
5 | -# a base class for all text article types. | |
6 | 5 | class Video < Article |
7 | 6 | |
8 | 7 | settings_items :video_url, :type => :string, :default => 'http://' |
... | ... | @@ -13,14 +12,14 @@ class Video < Article |
13 | 12 | settings_items :video_format, :type => :string |
14 | 13 | settings_items :video_id, :type => :string |
15 | 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 | 16 | settings_items :video_thumbnail_height, :type=> :integer |
18 | 17 | settings_items :video_duration, :type=> :integer, :default => 0 |
19 | - | |
18 | + | |
20 | 19 | attr_accessible :video_url |
21 | 20 | |
22 | 21 | before_save :detect_video |
23 | - | |
22 | + | |
24 | 23 | def self.type_name |
25 | 24 | _('Video') |
26 | 25 | end |
... | ... | @@ -28,7 +27,7 @@ class Video < Article |
28 | 27 | def can_display_versions? |
29 | 28 | true |
30 | 29 | end |
31 | - | |
30 | + | |
32 | 31 | def self.short_description |
33 | 32 | _('Embedded Video') |
34 | 33 | end |
... | ... | @@ -41,10 +40,10 @@ class Video < Article |
41 | 40 | def to_html(options={}) |
42 | 41 | article = self |
43 | 42 | proc do |
44 | - render :file => 'content_viewer/video', :locals => {:article => article} | |
43 | + render :partial => 'content_viewer/video', :locals => {:article => article} | |
45 | 44 | end |
46 | - end | |
47 | - | |
45 | + end | |
46 | + | |
48 | 47 | def fitted_width |
49 | 48 | 499 |
50 | 49 | end |
... | ... | @@ -165,4 +164,4 @@ end |
165 | 164 | # } |
166 | 165 | # |
167 | 166 | # return hr + ':' + min + ':' + sec; |
168 | -#} | |
169 | 167 | \ No newline at end of file |
168 | +#} | ... | ... |
plugins/video/lib/video_gallery.rb
... | ... | @@ -3,11 +3,11 @@ class VideoGallery < Folder |
3 | 3 | def self.type_name |
4 | 4 | _('Video Gallery') |
5 | 5 | end |
6 | - | |
6 | + | |
7 | 7 | settings_items :thumbnail_width, :type => :integer, :default => 50 |
8 | 8 | settings_items :thumbnail_height, :type => :integer, :default => 50 |
9 | 9 | settings_items :videos_per_row, :type => :integer, :default => 5 |
10 | - | |
10 | + | |
11 | 11 | validate :not_belong_to_blog |
12 | 12 | |
13 | 13 | def not_belong_to_blog |
... | ... | @@ -22,7 +22,7 @@ class VideoGallery < Folder |
22 | 22 | filter_iframes :body |
23 | 23 | def iframe_whitelist |
24 | 24 | profile && profile.environment && profile.environment.trusted_sites_for_iframe |
25 | - end | |
25 | + end | |
26 | 26 | |
27 | 27 | def self.short_description |
28 | 28 | _('Video Gallery') |
... | ... | @@ -31,19 +31,19 @@ class VideoGallery < Folder |
31 | 31 | def self.description |
32 | 32 | _('A gallery of link to videos that are hosted elsewhere.') |
33 | 33 | end |
34 | - | |
34 | + | |
35 | 35 | include ActionView::Helpers::TagHelper |
36 | 36 | def to_html(options = {}) |
37 | 37 | video_gallery = self |
38 | 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 | 40 | end |
41 | - end | |
41 | + end | |
42 | 42 | |
43 | 43 | def video_gallery? |
44 | 44 | true |
45 | 45 | end |
46 | - | |
46 | + | |
47 | 47 | def can_display_hits? |
48 | 48 | false |
49 | 49 | end |
... | ... | @@ -58,6 +58,6 @@ class VideoGallery < Folder |
58 | 58 | |
59 | 59 | def news(limit = 30, highlight = false) |
60 | 60 | profile.recent_documents(limit, ["articles.type != ? AND articles.highlighted = ? AND articles.parent_id = ?", 'Folder', highlight, id]) |
61 | - end | |
62 | - | |
61 | + end | |
62 | + | |
63 | 63 | end | ... | ... |
plugins/video/lib/video_plugin.rb
... | ... | @@ -44,7 +44,7 @@ class VideoPlugin < Noosfero::Plugin |
44 | 44 | content_tag('a', _("New Video"), |
45 | 45 | { :id=>"new-video-btn", |
46 | 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 | 48 | :title=>_("New Video") |
49 | 49 | }) |
50 | 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 @@ |
1 | +<iframe width='<%="#{width}px"%>' height='<%="#{height}px"%>' src='<%= "#{url}" %>' frameborder="0" allowfullscreen></iframe> | ... | ... |
... | ... | @@ -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 | -<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 | -<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 | -<%= 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 | 5 | <div class="video-gallery-thumbnail"> |
6 | 6 | <div class="video-gallery-top-box"> |
7 | 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 | 9 | <% end %> |
10 | - </div> | |
11 | - <div class="video-gallery-botton-box"> | |
10 | + </div> | |
11 | + <div class="video-gallery-botton-box"> | |
12 | 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 | 14 | </div> |
18 | 15 | <% end %> |
19 | 16 | <% end %> |
20 | 17 | <p><%= pagination_links contents, :param_name => 'npage', :page_links => true %></p> |
21 | -</div> | |
22 | 18 | \ No newline at end of file |
19 | +</div> | ... | ... |