Add mockup new_supplier mail code
This commit is contained in:
@@ -17,6 +17,7 @@ class NewSuppliersController < ApplicationController
|
||||
|
||||
if @new_supplier.save
|
||||
sign_in @new_supplier.employee unless current_employee
|
||||
Notifier.new_supplier(@new_supplier.supplier.try(:id), @new_supplier.employee.id).deliver_later
|
||||
session[:supplier_id] = @new_supplier.supplier.try(:id)
|
||||
redirect_to supplier_root_path(anchor: '/pages/introduction')
|
||||
else
|
||||
|
||||
@@ -127,7 +127,7 @@ class UserController < Users::ApplicationController
|
||||
|
||||
def feedback
|
||||
user_feedback = UserFeedback.create(user_id: current_user.id, content: params[:feedback].to_s)
|
||||
Notifier.user_feedback(user_feedback).deliver_later
|
||||
Notifier.user_feedback(user_feedback.id).deliver_later
|
||||
render json: {}
|
||||
end
|
||||
|
||||
|
||||
@@ -8,9 +8,16 @@ class Notifier < ActionMailer::Base
|
||||
mail to: "bterkuile+mozo-contact-form@gmail.com", subject: "[CONTACTFORM] new entry"
|
||||
end
|
||||
|
||||
def user_feedback(feedback)
|
||||
@user_feedback = feedback
|
||||
def user_feedback(feedback_id)
|
||||
@user_feedback = UserFeedback.find(feedback_id)
|
||||
I18n.locale = :en
|
||||
mail to: "bterkuile+mozo-user-feedback@gmail.com", subject: "[MOZO][USER-FEEDBACK] New user feedback"
|
||||
end
|
||||
|
||||
def new_supplier(supplier_id, employee_id)
|
||||
return unless @supplier = Supplier.find(supplier_id)
|
||||
@employee = Employee.find(employee_id)
|
||||
@employee.enrich_with_settings @supplier.settings_for(@employee)
|
||||
mail to: "bterkuile+mozo-new-supplier@gmail.com", subject: "[MOZO][NEW-SUPPLIER] New supplier registration"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
h3 New supplier
|
||||
p There is a new supplier
|
||||
pre= @supplier.as_json.to_yaml
|
||||
p Created by employee
|
||||
pre= @employee.as_json.to_yaml
|
||||
@@ -1,5 +1,5 @@
|
||||
h3 New feedback received:
|
||||
b User info
|
||||
pre= @user_feedback.user.try(:attributes).try(:to_yaml)
|
||||
pre= @user_feedback.user.try(:attributes).try(:as_json).try(:to_yaml)
|
||||
b Feedback info
|
||||
pre= @user_feedback.content
|
||||
|
||||
Reference in New Issue
Block a user