video_plugin.rb
1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
class VideoPlugin < Noosfero::Plugin
def self.plugin_name
"Video Content type, Video Block and Video Gallery Plugin"
end
def self.plugin_description
_("A plugin that adds a block where you can add videos from youtube, vimeo and html5.")
end
def self.extra_blocks
{ VideoPlugin::VideoBlock => {}, VideoPlugin::VideoGalleryBlock => {:position=>['1']} }
end
def stylesheet?
true
end
def content_types
[VideoPlugin::VideoGallery, VideoPlugin::Video]
end
def content_remove_new(content)
if content.kind_of?(VideoPlugin::VideoGallery) or content.kind_of?(VideoPlugin::Video)
true
end
end
def content_remove_upload(content)
if content.kind_of?(VideoPlugin::VideoGallery) or content.kind_of?(VideoPlugin::Video)
true
end
end
def article_extra_toolbar_buttons(content)
if content.kind_of?(VideoPlugin::VideoGallery)
url = url_for(:action => 'new', :type=>'VideoPlugin::Video', :controller=>'cms', :parent_id => content.id)
{:title => _('New Video'), :url => url, :icon => 'button with-text icon-new'}
end
end
end