mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Confirmation email when creating enterprise
This commit is contained in:
@@ -1,10 +1,18 @@
|
||||
require 'devise/mailers/helpers'
|
||||
class EnterpriseMailer < Spree::BaseMailer
|
||||
include Devise::Mailers::Helpers
|
||||
|
||||
def creation_confirmation(enterprise)
|
||||
find_enterprise(enterprise)
|
||||
subject = "#{@enterprise.name} is now on #{Spree::Config[:site_name]}"
|
||||
mail(:to => @enterprise.owner.email, :from => from_address, :subject => subject)
|
||||
end
|
||||
|
||||
def confirmation_instructions(record, token, opts={})
|
||||
@token = token
|
||||
devise_mail(record, :confirmation_instructions, opts)
|
||||
end
|
||||
|
||||
private
|
||||
def find_enterprise(enterprise)
|
||||
@enterprise = enterprise.is_a?(Enterprise) ? enterprise : Enterprise.find(enterprise)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Spree::UserMailer.class_eval do
|
||||
|
||||
|
||||
def signup_confirmation(user)
|
||||
@user = user
|
||||
mail(:to => user.email, :from => from_address,
|
||||
|
||||
@@ -262,6 +262,12 @@ class Enterprise < ActiveRecord::Base
|
||||
select('DISTINCT spree_taxons.*')
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def devise_mailer
|
||||
EnterpriseMailer
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def send_creation_email
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
%p= "Welcome #{@resource.contact}!"
|
||||
|
||||
%p= "You can confirm this email address for #{@resource.name} using the link below:"
|
||||
|
||||
%p= link_to 'Confirm this email address', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token)
|
||||
@@ -35,6 +35,8 @@ Openfoodnetwork::Application.routes.draw do
|
||||
end
|
||||
end
|
||||
|
||||
devise_for :enterprise
|
||||
|
||||
namespace :admin do
|
||||
resources :order_cycles do
|
||||
post :bulk_update, on: :collection, as: :bulk_update
|
||||
|
||||
Reference in New Issue
Block a user