Class: TagCloudPortlet

Inherits:
Cms::Portlet show all
Defined in:
app/portlets/tag_cloud_portlet.rb

Instance Attribute Summary

Attributes inherited from Cms::Portlet

#connect_to_container, #connect_to_page_id, #controller

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Cms::Portlet

columns_for_index, connectable?, default_template, default_template_path, enable_template_editor, form, get_subclass, handler, has_edit_link?, #inline_options, #instance_name, #page_title, #portlet_type_name, render_inline, set_default_template_path, #store_errors_in_flash, #store_hash_in_flash, #store_params_in_flash, #type_name, types, #url_for_failure, #url_for_success

Class Method Details

.default_sizesObject



3
4
5
# File 'app/portlets/tag_cloud_portlet.rb', line 3

def self.default_sizes
  (0..4).map{|n| "size-#{n}" }.join(" ")
end

Instance Method Details

#renderObject



7
8
9
10
11
# File 'app/portlets/tag_cloud_portlet.rb', line 7

def render
  @sizes = self.sizes.blank? ? self.class.default_sizes : self.sizes
  @limit = self.limit.blank? ? 50 : self.limit
  @cloud = Cms::Tag.cloud(:sizes => @sizes.size, :limit => @limit)
end