Class: EmailPagePortlet

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

Instance Attribute Summary

Attributes inherited from Cms::Portlet

#connect_to_container, #connect_to_page_id, #controller

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

Instance Method Details

#deliverObject

—– Handlers ————————————————————–



12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/portlets/email_page_portlet.rb', line 12

def deliver
  message = Cms::EmailMessage.new(params[:email_message])
  message.subject = self.subject
  message.body = "#{params[:email_page_portlet_url]}\n\n#{message.body}"    
  if message.save
    url_for_success
  else
    store_params_in_flash
    store_errors_in_flash(message.errors)
    url_for_failure
  end
end

#renderObject



3
4
5
6
7
8
# File 'app/portlets/email_page_portlet.rb', line 3

def render
  pmap = flash[instance_name] || params
  @email_message = Cms::EmailMessage.new pmap[:email_message]
  @email_message.errors.add_from_hash flash["#{instance_name}_errors"]
  @email_page_portlet_url = pmap[:email_page_portlet_url] || request.url
end