Skip to content

Commit

Permalink
Merge pull request #1050 from brian-kephart/master
Browse files Browse the repository at this point in the history
Fix the test email for non-main sites
  • Loading branch information
brian-kephart authored May 19, 2023
2 parents b83efee + ec95cb2 commit 034fa94
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app/controllers/camaleon_cms/admin/settings_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ def save_theme

# send email test
def test_email
CamaleonCms::HtmlMailer.sender(params[:email], 'Test', { content: 'Test content' }).deliver_now
data = { content: 'Test content', current_site: current_site, url_base: cama_root_url }
CamaleonCms::HtmlMailer.sender(params[:email], 'Test', data).deliver_now
head :ok
rescue StandardError => e
render inline: e.message, status: 502
Expand Down
7 changes: 5 additions & 2 deletions app/mailers/camaleon_cms/html_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,11 @@ def sender(email, subject = 'Hello', data = {})
prepend_view_path(Rails.root.join(views_dir).to_s)

theme = @current_site.get_theme
lookup_context.prefixes.prepend("themes/#{theme.slug}") if theme.settings['gem_mode']
lookup_context.prefixes.prepend("themes/#{theme.slug}/views") unless theme.settings['gem_mode']
if theme.settings && theme.settings['gem_mode']
lookup_context.prefixes.prepend("themes/#{theme.slug}")
else
lookup_context.prefixes.prepend("themes/#{theme.slug}/views")
end
lookup_context.use_camaleon_partial_prefixes = true
((data[:files] || []) + (data[:attachments] || [])).each do |attach|
if File.exist?(attach) && !File.directory?(attach)
Expand Down

0 comments on commit 034fa94

Please sign in to comment.