Added supporter model and send email with the password
This commit is contained in:
@@ -21,9 +21,9 @@ $font-size-base: 14px
|
||||
$navbar-padding-horizontal: none
|
||||
$navbar-default-link-color: #66903F
|
||||
$navbar-default-link-active-bg: #FFF
|
||||
$font-size-h1: floor($font-size-base * 2)
|
||||
$font-size-h2: floor($font-size-base * 1.8)
|
||||
$font-size-h3: floor($font-size-base * 1.5)
|
||||
$font-size-h1: floor($font-size-base * 1.8)
|
||||
$font-size-h2: floor($font-size-base * 1.5)
|
||||
$font-size-h3: floor($font-size-base * 1.2)
|
||||
|
||||
@import "bootstrap-sprockets"
|
||||
@import "bootstrap"
|
||||
|
||||
@@ -7,8 +7,9 @@ class SupportersController < ApplicationController
|
||||
|
||||
def create
|
||||
@supporter = Supporter.new supporter_form_params.merge(language: I18n.locale)
|
||||
@supporter.password = random_password = SecureRandom.hex(5)
|
||||
if !input_to_fast? && @supporter.save
|
||||
# SupporterMailer.welcome_email(@supporter).deliver_now
|
||||
SupporterMailer.welcome_email(@supporter, random_password).deliver_now
|
||||
mailchimp_registration
|
||||
redirect_to thanks_path
|
||||
else
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
class SupporterMailer < ApplicationMailer
|
||||
include Roadie::Rails::Automatic
|
||||
|
||||
def welcome_email(supporter)
|
||||
def welcome_email(supporter, random_password)
|
||||
@supporter = supporter
|
||||
@password = random_password
|
||||
mail(to: @supporter.email, subject: I18n.t('welcome_email.subject'))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -26,4 +26,3 @@ h3 Weitere Informationen zur Initiative findest du hier:
|
||||
ul
|
||||
li = link_to 'Initiativ-Seite', 'https://www.hanflegal.ch/initiative'
|
||||
li = link_to 'Onlineformular', root_path
|
||||
li = link_to 'Initiativ-Forum', 'https://forum.hanflegal.ch'
|
||||
|
||||
@@ -4,3 +4,4 @@
|
||||
= navbar_group id: 'topnav' do
|
||||
= navbar_item "Home", "/#{I18n.locale}"
|
||||
= navbar_item t('.donation'), spenden_path
|
||||
= navbar_item t('.sign_in'), new_supporter_session_path if current_supporter.blank?
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
p Hallo #{@supporter.first_name}, du bist nun ein Teil der Bewegung!
|
||||
|
||||
p
|
||||
| Um deine Angaben anzupassen kannst dich unter #{link_to new_supporter_session_url, new_supporter_session_url} mit folgenden Daten anmelden:
|
||||
|
||||
dl.dl-horizontal
|
||||
dt E-Mail
|
||||
dd= @supporter.email
|
||||
dt Passwort
|
||||
dd= @password
|
||||
|
||||
p Wir informieren dich per E-Mail über die nächsten Schritte und kommen aktiv auf dich zu. Auf <a href="https://www.hanflegal.ch/initiative">https://www.hanflegal.ch/initiative</a> informieren wir über laufende Aktivitäten.
|
||||
|
||||
p
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
p Salut #{@supporter.first_name}, Tu fais maintenant partie du mouvement!
|
||||
|
||||
|
||||
|
||||
p Nous allons t’envoyer par e-mail les informations sur les prochaines étapes. Sur <a href="https://www.hanflegal.ch/initiative">https://www.hanflegal.ch/initiative</a> initiative nous informons des activités en cours.
|
||||
|
||||
p
|
||||
| Pour régler vos données peut vous inscrire à #{link_to new_supporter_session_url, new_supporter_session_url} avec les données suivantes:
|
||||
|
||||
dl.dl-horizontal
|
||||
dt E-Mail
|
||||
dd= @supporter.email
|
||||
dt Mot de passe
|
||||
dd= @password
|
||||
p
|
||||
| Que peux-tu faire?
|
||||
ul
|
||||
|
||||
@@ -2,6 +2,14 @@ p Ciao #{@supporter.first_name}, ora sei una parte del movimento!
|
||||
|
||||
p Vi informeremo via e-mail circa i prossimi passi e diventare attivo. Su <a href="https://www.hanflegal.ch/initiative">https://www.hanflegal.ch/initiative</a> può informarsi sulle attività in corso.
|
||||
|
||||
p
|
||||
| Per regolare i dati possono iscriversi a #{link_to new_supporter_session_url, new_supporter_session_url} i seguenti dati:
|
||||
|
||||
dl.dl-horizontal
|
||||
dt E-Mail
|
||||
dd= @supporter.email
|
||||
dt Password
|
||||
dd= @password
|
||||
p
|
||||
| Che cosa puoi fare?
|
||||
ul
|
||||
|
||||
@@ -37,6 +37,7 @@ Rails.application.configure do
|
||||
# config.action_view.raise_on_missing_translations = true
|
||||
|
||||
config.action_mailer.default_url_options = { host: 'localhost:3000' }
|
||||
config.action_mailer.asset_host = 'http://localhost:3000'
|
||||
|
||||
config.action_mailer.delivery_method = :smtp
|
||||
config.action_mailer.smtp_settings = { address: 'localhost', port: 1025 }
|
||||
|
||||
@@ -75,6 +75,7 @@ Rails.application.configure do
|
||||
config.log_formatter = ::Logger::Formatter.new
|
||||
|
||||
config.action_mailer.default_url_options = { host: 'ch420.herokuapp.com' }
|
||||
config.action_mailer.asset_host = 'https://ch420.herokuapp.com'
|
||||
|
||||
config.action_mailer.delivery_method = :smtp
|
||||
config.action_mailer.smtp_settings = {
|
||||
|
||||
@@ -5,6 +5,7 @@ de:
|
||||
title_html: Ja, ich will <strong class="text-success">Cannabis</strong> in der Schweiz <strong class="text-success">legalisieren</strong>
|
||||
topnavigation:
|
||||
donation: Spenden
|
||||
sign_in: Anmelden
|
||||
counter:
|
||||
supporters: "Unterstützer:"
|
||||
amount_of_supporters: Zurzeit haben wir %{amount} Unterstützer.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Preview all emails at http://localhost:3000/rails/mailers/supporter_mailer
|
||||
class SupporterMailerPreview < ActionMailer::Preview
|
||||
def welcome
|
||||
I18n.locale = :fr
|
||||
SupporterMailer.welcome_email(Supporter.first)
|
||||
I18n.locale = :de
|
||||
SupporterMailer.welcome_email(Supporter.first, SecureRandom.hex(5))
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user