% if @block.class == Cms::Portlet %>
<% Cms::Portlet.types.each do |portlet_class|
type_code = portlet_class.name.underscore
%>
<%
link_params = {:type => type_code}
unless params[:portlet].blank?
link_params["portlet[connect_to_page_id]"] = params[:portlet][:connect_to_page_id]
link_params["portlet[connect_to_container]"] = params[:portlet][:connect_to_container]
end
%>
<%= link_to h(portlet_class.name.titleize), new_portlet_path(link_params) %>: <%= portlet_class.description %>
<% end %>
<% @hide_buttons = true %>
<% else %>
<%= hidden_field_tag :type, @block.class.name.underscore, :id => "portlet_type_field" %>
<%= render :partial => @block.class.form, :locals => {:f => f} %>
<% end %>