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-padding-horizontal: none
|
||||||
$navbar-default-link-color: #66903F
|
$navbar-default-link-color: #66903F
|
||||||
$navbar-default-link-active-bg: #FFF
|
$navbar-default-link-active-bg: #FFF
|
||||||
$font-size-h1: floor($font-size-base * 2)
|
$font-size-h1: floor($font-size-base * 1.8)
|
||||||
$font-size-h2: floor($font-size-base * 1.8)
|
$font-size-h2: floor($font-size-base * 1.5)
|
||||||
$font-size-h3: floor($font-size-base * 1.5)
|
$font-size-h3: floor($font-size-base * 1.2)
|
||||||
|
|
||||||
@import "bootstrap-sprockets"
|
@import "bootstrap-sprockets"
|
||||||
@import "bootstrap"
|
@import "bootstrap"
|
||||||
|
|||||||
@@ -7,8 +7,9 @@ class SupportersController < ApplicationController
|
|||||||
|
|
||||||
def create
|
def create
|
||||||
@supporter = Supporter.new supporter_form_params.merge(language: I18n.locale)
|
@supporter = Supporter.new supporter_form_params.merge(language: I18n.locale)
|
||||||
|
@supporter.password = random_password = SecureRandom.hex(5)
|
||||||
if !input_to_fast? && @supporter.save
|
if !input_to_fast? && @supporter.save
|
||||||
# SupporterMailer.welcome_email(@supporter).deliver_now
|
SupporterMailer.welcome_email(@supporter, random_password).deliver_now
|
||||||
mailchimp_registration
|
mailchimp_registration
|
||||||
redirect_to thanks_path
|
redirect_to thanks_path
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
class SupporterMailer < ApplicationMailer
|
class SupporterMailer < ApplicationMailer
|
||||||
include Roadie::Rails::Automatic
|
include Roadie::Rails::Automatic
|
||||||
|
|
||||||
def welcome_email(supporter)
|
def welcome_email(supporter, random_password)
|
||||||
@supporter = supporter
|
@supporter = supporter
|
||||||
|
@password = random_password
|
||||||
mail(to: @supporter.email, subject: I18n.t('welcome_email.subject'))
|
mail(to: @supporter.email, subject: I18n.t('welcome_email.subject'))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -26,4 +26,3 @@ h3 Weitere Informationen zur Initiative findest du hier:
|
|||||||
ul
|
ul
|
||||||
li = link_to 'Initiativ-Seite', 'https://www.hanflegal.ch/initiative'
|
li = link_to 'Initiativ-Seite', 'https://www.hanflegal.ch/initiative'
|
||||||
li = link_to 'Onlineformular', root_path
|
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_group id: 'topnav' do
|
||||||
= navbar_item "Home", "/#{I18n.locale}"
|
= navbar_item "Home", "/#{I18n.locale}"
|
||||||
= navbar_item t('.donation'), spenden_path
|
= 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 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 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
|
p
|
||||||
|
|||||||
@@ -1,9 +1,15 @@
|
|||||||
p Salut #{@supporter.first_name}, Tu fais maintenant partie du mouvement!
|
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 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
|
p
|
||||||
| Que peux-tu faire?
|
| Que peux-tu faire?
|
||||||
ul
|
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 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
|
p
|
||||||
| Che cosa puoi fare?
|
| Che cosa puoi fare?
|
||||||
ul
|
ul
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ Rails.application.configure do
|
|||||||
# config.action_view.raise_on_missing_translations = true
|
# config.action_view.raise_on_missing_translations = true
|
||||||
|
|
||||||
config.action_mailer.default_url_options = { host: 'localhost:3000' }
|
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.delivery_method = :smtp
|
||||||
config.action_mailer.smtp_settings = { address: 'localhost', port: 1025 }
|
config.action_mailer.smtp_settings = { address: 'localhost', port: 1025 }
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ Rails.application.configure do
|
|||||||
config.log_formatter = ::Logger::Formatter.new
|
config.log_formatter = ::Logger::Formatter.new
|
||||||
|
|
||||||
config.action_mailer.default_url_options = { host: 'ch420.herokuapp.com' }
|
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.delivery_method = :smtp
|
||||||
config.action_mailer.smtp_settings = {
|
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>
|
title_html: Ja, ich will <strong class="text-success">Cannabis</strong> in der Schweiz <strong class="text-success">legalisieren</strong>
|
||||||
topnavigation:
|
topnavigation:
|
||||||
donation: Spenden
|
donation: Spenden
|
||||||
|
sign_in: Anmelden
|
||||||
counter:
|
counter:
|
||||||
supporters: "Unterstützer:"
|
supporters: "Unterstützer:"
|
||||||
amount_of_supporters: Zurzeit haben wir %{amount} 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
|
# Preview all emails at http://localhost:3000/rails/mailers/supporter_mailer
|
||||||
class SupporterMailerPreview < ActionMailer::Preview
|
class SupporterMailerPreview < ActionMailer::Preview
|
||||||
def welcome
|
def welcome
|
||||||
I18n.locale = :fr
|
I18n.locale = :de
|
||||||
SupporterMailer.welcome_email(Supporter.first)
|
SupporterMailer.welcome_email(Supporter.first, SecureRandom.hex(5))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user