diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index ba34add..0f5ab39 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -2,6 +2,8 @@ class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception + + before_action :set_locale INPUT_TIMEOUT = 2.seconds # We estimate that a user needs more then x seconds to enter some informations @@ -16,4 +18,13 @@ class ApplicationController < ActionController::Base def set_form_timestamp session[:form_timestamp] = Time.now end + + def set_locale + I18n.locale = params[:locale] || I18n.default_locale + end + + # I18n set default language in url + def default_url_options(options = {}) + options.merge locale: I18n.locale + end end diff --git a/app/views/pages/thanks.it.slim b/app/views/pages/thanks.it.slim new file mode 100644 index 0000000..3371df6 --- /dev/null +++ b/app/views/pages/thanks.it.slim @@ -0,0 +1,44 @@ +.lead + h1 = title t('.title') + + p Ora sei una parte del movimento! + +h2 Qual’é la strada da seguire? +p.lead + | Vi informeremo via e-mail circa i prossimi passi e diventare attivo. + | Su #{link_to 'https://www.hanflegal.ch/initiative', 'https://www.hanflegal.ch/initiative'} può informarsi sulle attività in corso. + +h2 Che cosa puoi fare? +.row + .col-xs-12.col-sm-6 + ul.lead + li Invia il link del formulario on-line a tutti i tuoi amici e conoscenti + li Seguici su Facebook e Twitter + li Racconta die nostri progetti sui social media con l’Hashtag #CH420 + li Di a tutti di unirsi ai nostri progetti + li Diventa un membro dell’ associazione Verein Legalize it! + li Visita il nostro Forum. Puoi trovare scambi di lavoro e progetti interessanti in cui potrebbe esser richiesto il tuo aiuto.. + .col-xs-12.col-sm-6 + .well + .lead Seguici su Facebook + #fb-root + javascript: + (function(d, s, id) { + var js, fjs = d.getElementsByTagName(s)[0]; + if (d.getElementById(id)) return; + js = d.createElement(s); js.id = id; + js.src = "//connect.facebook.net/de_DE/sdk.js#xfbml=1&version=v2.4&appId=236723906381514"; + fjs.parentNode.insertBefore(js, fjs); + }(document, 'script', 'facebook-jssdk')); + + .fb-like data-action="like" data-href="https://www.facebook.com/vereinlegalizeit" data-layout="standard" data-share="true" data-show-faces="true" + .well + .lead Seguici su Twitter + p + @vereinlegalize folgen + + p + Twittern + + +a href="/" Zurück zum Formular diff --git a/app/views/shared/_counter.de.slim b/app/views/shared/_counter.slim similarity index 81% rename from app/views/shared/_counter.de.slim rename to app/views/shared/_counter.slim index 2823025..8c6556a 100644 --- a/app/views/shared/_counter.de.slim +++ b/app/views/shared/_counter.slim @@ -1,4 +1,4 @@ #counter.pull-right - | Unterstützer: + = t('.supporters') - Supporter.counter.to_s.split('').each do |x| .counter_char= x diff --git a/app/views/supporter_mailer/welcome_email.slim b/app/views/supporter_mailer/welcome_email.de.slim similarity index 100% rename from app/views/supporter_mailer/welcome_email.slim rename to app/views/supporter_mailer/welcome_email.de.slim diff --git a/app/views/supporter_mailer/welcome_email.it.slim b/app/views/supporter_mailer/welcome_email.it.slim new file mode 100644 index 0000000..35dd536 --- /dev/null +++ b/app/views/supporter_mailer/welcome_email.it.slim @@ -0,0 +1,21 @@ +p + strong Ciao #{@supporter.first_name}, + +p Ora sei una parte del movimento! + +p Vi informeremo via e-mail circa i prossimi passi e diventare attivo. Su https://www.hanflegal.ch/initiative può informarsi sulle attività in corso. + +p + b Che cosa puoi fare? +p + ul + li Invia il https://ch420.herokuapp.com a tutti i tuoi amici e conoscenti + li Seguici su Facebook e Twitter + li Racconta die nostri progetti sui social media con l’Hashtag #CH420 + li Di a tutti di unirsi ai nostri progetti + li Diventa un membro dell’ associazione Verein Legalize it! + li Visita il nostro Forum. Puoi trovare scambi di lavoro e progetti interessanti in cui potrebbe esser richiesto il tuo aiuto. + +p + | Saluti, + em hanflegal.ch diff --git a/app/views/supporters/_form.slim b/app/views/supporters/_form.slim index cc1e14e..03c856f 100644 --- a/app/views/supporters/_form.slim +++ b/app/views/supporters/_form.slim @@ -6,7 +6,14 @@ h1 = title t('.title_html') .col-xs-12.col-md-3 + .pull-right + a href='/' + | Deutsch + |   + a href='/it' + | | Italiano = render 'shared/counter' + .row .col-xs-12.col-md-7 = simple_form_for @supporter do |f| @@ -69,36 +76,5 @@ $("#supporter_city").val(datum.city); }); .col-md-5.col-xs-12 - .well - p = image_tag 'li_logo.svg', class: 'img-responsive' - p Wir wollen die nötigen Unterschriften für eine Volksinitiative zur Cannabis-Legalisierung sammeln. Für die Umsetzung setzt man auf ein neues Sammelkonzept. Dies funktioniert in drei Schritten: - - p - strong Schritt 1: - | Durch dieses Onlineformular sammeln wir Sympathisanten und potentielle Aktivisten. - p - strong Schritt 2: - | Sobald die geforderte Anzahl Personen gesammelt sind, schauen wir, wie viele Ressourcen an Helfer/innen an welchen Orten benötigt werden. - p - strong Schritt 3: - | Durch eine ausgeklügelte Logistik werden Sympathisanten und Aktivisten zusammengebracht, um gemeinsam die nötigen Unterschriften zu generieren. - - p.lead Wenn du also Cannabis in der Schweiz legalisieren willst, fülle das nebenstehende Formular aus und schreibe mit uns Geschichte. - - p Mehr Informationen findest du unter #{link_to 'https://www.hanflegal.ch/initiative', 'https://www.hanflegal.ch/initiative'} - - / p.embed-responsive.embed-responsive-4by3 - iframe.embed-responsive-item src="https://www.youtube.com/embed/l5DjuLXRVVM" frameborder="0" allowfullscreen="" - p.embed-responsive.embed-responsive-4by3 - iframe src="https://player.vimeo.com/video/163576706?title=0&byline=0&portrait=0" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen - - strong Wer steht hinter dieser Aktion? - p Die Aktion wurde von Mitgliedern des Verein Legalize it! initiiert. Seit 25 Jahren helfen wir vom Verein Legalize it! Menschen, die mit THC-Produkten Umgang pflegen, bei den unterschiedlichsten Fragen. - strong Kontakt - p - | Nino Forrer (#{mail_to 'nino@hanflegal.ch'}) - em Strategie / Presse - br - | Markus Graf (#{mail_to 'markus@hanflegal.ch'}) - em Inhalt / Technik - + = render 'right_side' + diff --git a/app/views/supporters/_right_side.de.slim b/app/views/supporters/_right_side.de.slim new file mode 100644 index 0000000..c9f0721 --- /dev/null +++ b/app/views/supporters/_right_side.de.slim @@ -0,0 +1,32 @@ +.well + p = image_tag 'li_logo.svg', class: 'img-responsive' + p Wir wollen die nötigen Unterschriften für eine Volksinitiative zur Cannabis-Legalisierung sammeln. Für die Umsetzung setzt man auf ein neues Sammelkonzept. Dies funktioniert in drei Schritten: + + p + strong Schritt 1: + | Durch dieses Onlineformular sammeln wir Sympathisanten und potentielle Aktivisten. + p + strong Schritt 2: + | Sobald die geforderte Anzahl Personen gesammelt sind, schauen wir, wie viele Ressourcen an Helfer/innen an welchen Orten benötigt werden. + p + strong Schritt 3: + | Durch eine ausgeklügelte Logistik werden Sympathisanten und Aktivisten zusammengebracht, um gemeinsam die nötigen Unterschriften zu generieren. + + p.lead Wenn du also Cannabis in der Schweiz legalisieren willst, fülle das nebenstehende Formular aus und schreibe mit uns Geschichte. + + p Mehr Informationen findest du unter #{link_to 'https://www.hanflegal.ch/initiative', 'https://www.hanflegal.ch/initiative'} + + / p.embed-responsive.embed-responsive-4by3 + iframe.embed-responsive-item src="https://www.youtube.com/embed/l5DjuLXRVVM" frameborder="0" allowfullscreen="" + p.embed-responsive.embed-responsive-4by3 + iframe src="https://player.vimeo.com/video/163576706?title=0&byline=0&portrait=0" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen + + strong Wer steht hinter dieser Aktion? + p Die Aktion wurde von Mitgliedern des Verein Legalize it! initiiert. Seit 25 Jahren helfen wir vom Verein Legalize it! Menschen, die mit THC-Produkten Umgang pflegen, bei den unterschiedlichsten Fragen. + strong Kontakt + p + | Nino Forrer (#{mail_to 'nino@hanflegal.ch'}) + em Strategie / Presse + br + | Markus Graf (#{mail_to 'markus@hanflegal.ch'}) + em Inhalt / Technik diff --git a/app/views/supporters/_right_side.it.slim b/app/views/supporters/_right_side.it.slim new file mode 100644 index 0000000..81bd472 --- /dev/null +++ b/app/views/supporters/_right_side.it.slim @@ -0,0 +1,29 @@ +.well + p = image_tag 'li_logo.svg', class: 'img-responsive' + p Vogliamo raccogliere le firme necessarie per un'iniziativa popolare per la legalizzazione della cannabis. Per implementare l'accento su un nuovo concetto collettivo. Questo funziona in tre fasi: + + p + strong Fase 1: + | Con questo modulo on-line che raccoglie simpatizzanti e potenziali attivisti. + p + strong Fase 2: + | Una volta raccolto il numero richiesto di persone, andiamo a vedere quante risorse di aiuto sono in nel luogo dove richiesto. + p + strong Fase 3: + | Utilizzando un sofisticata logistica riuniremo simpatizzanti e attivisti per generare congiuntamente le firme necessarie. + + + p.lead Quindi, se anche tu vuoi legalizzare la Cannabis in Svizzera, compila il seguente modulo e riscrivi la storia con noi. + + p Più informazioni le trovi su #{link_to 'https://www.hanflegal.ch/initiative', 'https://www.hanflegal.ch/initiative'} + + strong Chi c’é dietro questa azione? + p L'azione è stata sostenuta da membri dell'associazione Legalize It! Da 25 anni aiutiamo l'associazione Legalize It! Le persone che si prendono cura con prodotti THC si occupano di una vasta gamma di questioni. + + strong Contatti + p + | Nino Forrer (#{mail_to 'nino@hanflegal.ch'}) + em Strategie / Presse + br + | Markus Graf (#{mail_to 'markus@hanflegal.ch'}) + em Inhalt / Technik diff --git a/config/locales/de.yml b/config/locales/de.yml index 53a8e74..7576641 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -34,6 +34,10 @@ de: thanks: title: Besten Dank für deine Unterstützung! + shared: + counter: + supporters: "Unterstützer:" + mongoid: attributes: supporter: diff --git a/config/locales/it.yml b/config/locales/it.yml new file mode 100644 index 0000000..1662c67 --- /dev/null +++ b/config/locales/it.yml @@ -0,0 +1,53 @@ +it: + welcome_email: + subject: Grazie mille per il tuo sostegno! + + support_type: + signer: Voglio sottoscrivere l’iniziativa popolare per la legalizzazione della Cannabis. + supporter: Voglio sottoscrivere l’iniziativa popolare per la legalizzazione della Cannabis e aiutare attivamente con la raccolta firme nella mia zona. + # activist: Ich unterschreibe eine Volksinitiative für die Legalisierung von Cannabis und beteilige mich bei der Planung und Koordination einer Volksinitiative. + # nonvoting_supporter: Ich bin nicht stimmberechtigt, helfe aber aktiv Unterschriften in meiner Umgebung zu sammeln um Cannabis zu legalisierung. + + age_category: + underage: Ho meno di 18 anni + young: Ho tra 18 e 30 anni + middle: Ho tra i 30 ed i 64 anni + retired: Ho più di 64 anni + + supporters: + form: + title_html: Si, voglio legalizzare la cannabis in Svizzera + submit: Garantire il sostengo + terms_and_conditions: Mit dem Absenden deiner Daten stimmst du den Nutzungsbedingungen zu. + placeholders: + first_name: Hans + last_name: Muster + street: Mustergasse 12 + city: Hinterpfupfikon + zip: "4200" + email: hans.muster@hanflegal.ch + + create: + timeout: Ihre Eingabe war zu schnell. + + pages: + thanks: + title: Grazie mille per il tuo sostegno! + + shared: + counter: + supporters: "Sostenitore:" + + mongoid: + attributes: + supporter: + first_name: Nome + last_name: Cognome + street: Via/N° + zip: Codice postale + city: Paese + email: E-Mail + support: Supporto + age_category: Categoria Età + li_membership: Sono interessato a diventare membro attivo di Verein Legalize It (50 franchi annuali di tassa). + comments: Commenti / Feedback (opzionale) diff --git a/config/routes.rb b/config/routes.rb index 551fc81..2460eae 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,9 +1,12 @@ Rails.application.routes.draw do root 'supporters#new' + scope "/:locale" do + get '/', to: 'supporters#new' + resources :supporters - resources :supporters - - get '/thanks', to: 'pages#thanks', as: :thanks + get '/thanks', to: 'pages#thanks', as: :thanks + end + get '/cities_autocomplete', to: 'cities_autocomplete#index', as: :cities_autocomplete namespace :admin do diff --git a/spec/mailers/previews/supporter_mailer_preview.rb b/spec/mailers/previews/supporter_mailer_preview.rb index f8178a0..3e61c1a 100644 --- a/spec/mailers/previews/supporter_mailer_preview.rb +++ b/spec/mailers/previews/supporter_mailer_preview.rb @@ -1,6 +1,7 @@ # Preview all emails at http://localhost:3000/rails/mailers/supporter_mailer class SupporterMailerPreview < ActionMailer::Preview def welcome + I18n.locale = 'it' SupporterMailer.welcome_email(Supporter.first) end end