Class: Maily::EmailsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Maily::EmailsController
- Defined in:
- app/controllers/maily/emails_controller.rb
Instance Method Summary collapse
- #attachment ⇒ Object
- #deliver ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #raw ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#attachment ⇒ Object
24 25 26 27 |
# File 'app/controllers/maily/emails_controller.rb', line 24 def = @email..find { |elem| elem.filename == params[:attachment] } send_data .body, filename: .filename, type: .content_type end |
#deliver ⇒ Object
39 40 41 42 43 44 45 |
# File 'app/controllers/maily/emails_controller.rb', line 39 def deliver @email.to = params[:to] @email.deliver redirect_to maily_email_path(mailer: params[:mailer], email: params[:email]) end |
#edit ⇒ Object
29 30 31 |
# File 'app/controllers/maily/emails_controller.rb', line 29 def edit @template = @maily_email.template(params[:part]) end |
#index ⇒ Object
8 9 |
# File 'app/controllers/maily/emails_controller.rb', line 8 def index end |
#raw ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'app/controllers/maily/emails_controller.rb', line 14 def raw content = if @email.parts.present? params[:part] == 'text' ? @email.text_part.body : @email.html_part.body else @email.body end render text: content, layout: false end |
#show ⇒ Object
11 12 |
# File 'app/controllers/maily/emails_controller.rb', line 11 def show end |
#update ⇒ Object
33 34 35 36 37 |
# File 'app/controllers/maily/emails_controller.rb', line 33 def update @maily_email.update_template(params[:body], params[:part]) redirect_to maily_email_path(mailer: params[:mailer], email: params[:email], part: params[:part]) end |