ref: master
plugins/community_track/lib/community_track_plugin.rb
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 |
class CommunityTrackPlugin < Noosfero::Plugin def self.plugin_name 'Community Track' end def self.plugin_description _("New kind of content for communities.") end def stylesheet? true end def content_types if context.kind_of?(CmsController) && context.respond_to?(:params) && context.params types = [] parent_id = context.params[:parent_id] types << CommunityTrackPlugin::Track if context.profile.community? && !parent_id parent = parent_id ? context.profile.articles.find(parent_id) : nil types << CommunityTrackPlugin::Step if parent.kind_of?(CommunityTrackPlugin::Track) types else [CommunityTrackPlugin::Track, CommunityTrackPlugin::Step] end end def self.extra_blocks { CommunityTrackPlugin::TrackListBlock => {:position => 1}, CommunityTrackPlugin::TrackCardListBlock => {} } end def content_remove_new(page) page.kind_of?(CommunityTrackPlugin::Track) end end |