Class: EmailPagePortlet
- Inherits:
-
Cms::Portlet
- Object
- ActiveRecord::Base
- Cms::Portlet
- EmailPagePortlet
- 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
-
#deliver ⇒ Object
—– Handlers ————————————————————–.
- #email_message_params ⇒ Object
- #render ⇒ Object
Methods inherited from Cms::Portlet
blacklist, blacklisted?, columns_for_index, connectable?, #connected_pages, default_template, default_template_path, description, 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
#deliver ⇒ Object
—– Handlers ————————————————————–
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/portlets/email_page_portlet.rb', line 14 def deliver = Cms::EmailMessage.new(()) .subject = self.subject .body = "#{params[:email_page_portlet_url]}\n\n#{message.body}" .sender = self.sender if .save url_for_success else store_params_in_flash store_errors_in_flash(.errors) url_for_failure end end |
#email_message_params ⇒ Object
28 29 30 |
# File 'app/portlets/email_page_portlet.rb', line 28 def params.require(:email_message).permit(Cms::EmailMessage.permitted_params) end |
#render ⇒ Object
5 6 7 8 9 10 |
# File 'app/portlets/email_page_portlet.rb', line 5 def render pmap = flash[instance_name] || params = Cms::EmailMessage.new pmap[:email_message] .errors.add_from_hash flash["#{instance_name}_errors"] @email_page_portlet_url = pmap[:email_page_portlet_url] || request.url end |