Method: IshManager::EmailContextsController#new

Defined in:
app/controllers/ish_manager/email_contexts_controller.rb

#newObject



76
77
78
79
80
81
82
83
84
85
86
# File 'app/controllers/ish_manager/email_contexts_controller.rb', line 76

def new
  authorize! :new, ::Ish::EmailContext
  @tmpl = @email_template = Ish::EmailTemplate.where( slug: params[:template_slug] ).first ||
    Ish::EmailTemplate.where( id: params[:template_slug] ).first ||
    Ish::EmailTemplate.new
  attrs = {}
  if @tmpl
    attrs = @tmpl.attributes.slice( :subject, :body, :from_email )
  end
  @ctx = ::Ish::EmailContext.new({ email_template: @tmpl }.merge(attrs))
end