diff --git a/lib/install/application_mailer.rb b/lib/install/application_mailer.rb
index f104b1cb..21135147 100644
--- a/lib/install/application_mailer.rb
+++ b/lib/install/application_mailer.rb
@@ -1,6 +1,8 @@
class ApplicationMailer < ActionMailer::Base
- helper Railsui::MailHelper
-
default from: email_address_with_name("#{Railsui.config.support_email}", "#{Railsui.config.application_name}")
+
+ # Required to use helpers in mailers
+ helper ApplicationHelper
+
layout "mailer"
end
diff --git a/lib/install/install.rb b/lib/install/install.rb
index 6cbbe7e6..819d62e8 100644
--- a/lib/install/install.rb
+++ b/lib/install/install.rb
@@ -66,6 +66,7 @@
say "✉️ Update mail sender"
update_mailer_sender
copy_sample_mailers
+ update_application_helper
# Migrate
rails_command "db:create"
diff --git a/lib/install/setup.rb b/lib/install/setup.rb
index 459c6cb9..a754840d 100644
--- a/lib/install/setup.rb
+++ b/lib/install/setup.rb
@@ -144,7 +144,6 @@ def add_devise_customizations
Devise::ConfirmationsController.layout "devise"
Devise::PasswordsController.layout "devise"
Devise::UnlocksController.layout "devise"
- Devise::Mailer.helper Railsui::MailHelper
end
RUBY
@@ -208,9 +207,30 @@ def copy_hero_icons
end
def copy_application_mailer
- copy_file "#{__dir__}/application_mailer.rb", Rails.root.join("app/mailers/application_mailer.rb"), force: true
+ copy_file "#{__dir__}/application_mailer.rb", Rails.root.join("app/mailers/application_mailer.rb"), force: true
end
+def update_application_helper
+content = <<-RUBY
+ def spacer(amount = 16)
+ render "shared/email_spacer", amount: amount
+ end
+
+ def email_action(action, url, options={})
+ align = options[:align] ||= "left"
+ theme = options[:theme] ||= "primary"
+ fullwidth = options[:fullwidth] ||= false
+ render "shared/email_action", align: align, theme: theme, action: action, url: url, fullwidth: fullwidth
+ end
+
+ def email_callout(&block)
+ render "shared/email_callout", block: block
+ end
+RUBY
+
+ insert_into_file "#{Rails.root}/app/helpers/application_helper.rb", content, after: "module ApplicationHelper\n"
+ end
+
# Extend this gems helper into the client app + extend devise
def add_application_controller_code
app_controller_code = <<-RUBY
diff --git a/lib/install/shared/_email_callout.html.erb b/lib/install/shared/_email_callout.html.erb
new file mode 100644
index 00000000..d8ea8755
--- /dev/null
+++ b/lib/install/shared/_email_callout.html.erb
@@ -0,0 +1,7 @@
+
+
+
+ <%= capture(&block) %>
+ |
+
+
diff --git a/lib/install/shared/_email_spacer.html.erb b/lib/install/shared/_email_spacer.html.erb
index 66ef3c3e..0a071a7e 100644
--- a/lib/install/shared/_email_spacer.html.erb
+++ b/lib/install/shared/_email_spacer.html.erb
@@ -5,4 +5,3 @@
-x
diff --git a/lib/install/tailwind/themes/hound/shared/_email_callout.html.erb b/lib/install/tailwind/themes/hound/shared/_email_callout.html.erb
new file mode 100644
index 00000000..d8ea8755
--- /dev/null
+++ b/lib/install/tailwind/themes/hound/shared/_email_callout.html.erb
@@ -0,0 +1,7 @@
+
+
+
+ <%= capture(&block) %>
+ |
+
+
diff --git a/lib/install/tailwind/themes/hound/shared/_email_spacer.html.erb b/lib/install/tailwind/themes/hound/shared/_email_spacer.html.erb
index 66ef3c3e..0a071a7e 100644
--- a/lib/install/tailwind/themes/hound/shared/_email_spacer.html.erb
+++ b/lib/install/tailwind/themes/hound/shared/_email_spacer.html.erb
@@ -5,4 +5,3 @@
-x
diff --git a/lib/install/tailwind/themes/shepherd/shared/_email_callout.html.erb b/lib/install/tailwind/themes/shepherd/shared/_email_callout.html.erb
new file mode 100644
index 00000000..d8ea8755
--- /dev/null
+++ b/lib/install/tailwind/themes/shepherd/shared/_email_callout.html.erb
@@ -0,0 +1,7 @@
+
+
+
+ <%= capture(&block) %>
+ |
+
+
diff --git a/lib/install/tailwind/themes/shepherd/shared/_email_spacer.html.erb b/lib/install/tailwind/themes/shepherd/shared/_email_spacer.html.erb
index 66ef3c3e..0a071a7e 100644
--- a/lib/install/tailwind/themes/shepherd/shared/_email_spacer.html.erb
+++ b/lib/install/tailwind/themes/shepherd/shared/_email_spacer.html.erb
@@ -5,4 +5,3 @@
-x