diff --git a/Gemfile b/Gemfile index 01421f7..439ca3f 100644 --- a/Gemfile +++ b/Gemfile @@ -20,6 +20,8 @@ gem 'jbuilder', '~> 2.0' # bundle exec rake doc:rails generates the API under doc/api. gem 'sdoc', '~> 0.4.0', group: :doc +gem 'rails_bootstrap_navbar' + # Use ActiveModel has_secure_password # gem 'bcrypt', '~> 3.1.7' diff --git a/Gemfile.lock b/Gemfile.lock index d554a83..f860516 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -42,6 +42,8 @@ GEM execjs binding_of_caller (0.7.2) debug_inspector (>= 0.0.1) + bootstrap-navbar (2.4.0) + gem_config (~> 0.3) bootstrap-sass (3.3.6) autoprefixer-rails (>= 5.2.1) sass (>= 3.3.4) @@ -75,6 +77,7 @@ GEM execjs (2.7.0) font-awesome-rails (4.6.3.0) railties (>= 3.2, < 5.1) + gem_config (0.3.1) geocoder (1.3.7) globalid (0.3.6) activesupport (>= 4.1.0) @@ -183,6 +186,9 @@ GEM remotipart (~> 1.0) safe_yaml (~> 1.0) sass-rails (>= 4.0, < 6) + rails_bootstrap_navbar (2.0.1) + bootstrap-navbar (~> 2.0) + rails (>= 3.0.0) rails_serve_static_assets (0.0.5) rails_stdout_logging (0.0.5) railties (4.2.6) @@ -284,6 +290,7 @@ DEPENDENCIES rails-i18n rails_12factor rails_admin + rails_bootstrap_navbar rspec-rails (~> 3.0) sass-rails (~> 5.0) sdoc (~> 0.4.0) @@ -295,4 +302,4 @@ DEPENDENCIES web-console (~> 2.0) BUNDLED WITH - 1.10.2 + 1.14.6 diff --git a/app/assets/stylesheets/application.sass b/app/assets/stylesheets/application.sass index 4b82eeb..ffc3ea9 100644 --- a/app/assets/stylesheets/application.sass +++ b/app/assets/stylesheets/application.sass @@ -15,23 +15,36 @@ */ $brand-success: #66903F -$font-size-base: 16px +$font-size-base: 14px $font-size-h3: $font-size-base +$navbar-default-bg: #FFF +$navbar-default-border: none +$navbar-padding-horizontal: none +$navbar-default-link-color: #66903F +$navbar-default-link-active-bg: #FFF @import "bootstrap-sprockets" @import "bootstrap" @import "typeaheadjs" body - .container + > .container box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19) padding-top: 20px + header + h1 + font-size: 20px + margin-top: 35px + + ul#topnav + font-size: 1.5em + + li.active + border-bottom: 1px solid #66903F .lead font-weight: normal - .pagelogo - margin-top: 22px #new_supporter label.required diff --git a/app/views/layouts/application.html.slim b/app/views/layouts/application.html.slim index 7ed2c8d..f7c5b25 100644 --- a/app/views/layouts/application.html.slim +++ b/app/views/layouts/application.html.slim @@ -38,5 +38,6 @@ html lang="#{I18n.locale}" / = console if Rails.env.development? .container = render 'shared/header' + = render 'shared/topnavigation' = render 'shared/flashes' = yield diff --git a/app/views/shared/_header.slim b/app/views/shared/_header.slim index 72202f4..c7d2591 100644 --- a/app/views/shared/_header.slim +++ b/app/views/shared/_header.slim @@ -4,7 +4,7 @@ header = image_tag('ch420_logo.png', class:'img-responsive pagelogo', alt: t('.logo')) .col-md-8.col-xs-8 h1 - = title t('.title_html') + = t('.title_html') .col-xs-12.col-md-3 nav.pull-right h2.sr-only =t('.lang') diff --git a/app/views/shared/_topnavigation.slim b/app/views/shared/_topnavigation.slim new file mode 100644 index 0000000..a861015 --- /dev/null +++ b/app/views/shared/_topnavigation.slim @@ -0,0 +1,6 @@ += navbar do + = navbar_header + = navbar_collapse do + = navbar_group id: 'topnav' do + = navbar_item "Home", "/#{I18n.locale}" + = navbar_item t('.donation'), spenden_path diff --git a/app/views/supporters/_form.slim b/app/views/supporters/_form.slim index d3100ce..5171f5b 100644 --- a/app/views/supporters/_form.slim +++ b/app/views/supporters/_form.slim @@ -1,6 +1,7 @@ +- title(t('shared.header.title_html')) .row .col-xs-12.col-md-7 - h2.sr-only =t('.form') + h2.sr-only = t('.form') = simple_form_for @supporter do |f| = f.input :first_name, placeholder: t('.placeholders.first_name') = f.input :last_name, placeholder: t('.placeholders.last_name') diff --git a/config/initializers/rails-bootstrap-navbar.rb b/config/initializers/rails-bootstrap-navbar.rb new file mode 100644 index 0000000..b0816f5 --- /dev/null +++ b/config/initializers/rails-bootstrap-navbar.rb @@ -0,0 +1,4 @@ +BootstrapNavbar.configure do |config| + config.bootstrap_version = '3.3.6' + config.root_paths = ['/', '/de', '/fr', '/it'] # default: ['/'] +end \ No newline at end of file diff --git a/config/locales/de.yml b/config/locales/de.yml index 735549c..fe15967 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -1,4 +1,14 @@ de: + shared: + header: + logo: Logo der Initiative + title_html: Ja, ich will Cannabis in der Schweiz legalisieren + topnavigation: + donation: Spenden + counter: + supporters: "Unterstützer:" + amount_of_supporters: Zurzeit haben wir %{amount} Unterstützer. + input_error: Deine Eingaben konnte nicht gespeichert werden. Überprüfe deine Eingaben. welcome_email: @@ -38,15 +48,6 @@ de: pages: thanks: title: Besten Dank für deine Unterstützung! - - shared: - header: - logo: Logo der Initiative - title_html: Ja, ich will Cannabis in der Schweiz legalisieren - - counter: - supporters: "Unterstützer:" - amount_of_supporters: Zurzeit haben wir %{amount} Unterstützer. mongoid: attributes: diff --git a/config/locales/fr.yml b/config/locales/fr.yml index f6c7775..5c54e3f 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -1,6 +1,16 @@ fr: input_error: Vos entrées ne peuvent pas être enregistrées. Vérifiez les entrées. + shared: + counter: + supporters: "Militant:" + amount_of_supporters: Nous avons actuellement %{amount} supporters. + header: + logo: Logo de l'initiative + title_html: Oui, je veux légaliser le cannabis en Suisse. + topnavigation: + donation: Donation + welcome_email: subject: Merci beaucoup pour ton soutien! @@ -20,8 +30,6 @@ fr: form: form: Formulaire lang: Langue - logo: Logo de l'initiative - title_html: Oui, je veux légaliser le cannabis en Suisse. submit: Confirmer mon soutien terms_and_conditions: En soumettant vos données, vous acceptez les conditions d'utilisation. placeholders: @@ -39,11 +47,6 @@ fr: thanks: title: Merci beaucoup pour ton soutien! - shared: - counter: - supporters: "Militant:" - amount_of_supporters: Nous avons actuellement %{amount} supporters. - mongoid: attributes: supporter: diff --git a/config/locales/it.yml b/config/locales/it.yml index 33366ca..b2ac702 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -1,6 +1,17 @@ it: input_error: I dati immessi non potevano essere salvati. Verificare i dati immessi. + shared: + header: + logo: Logo dell'iniziativa + title_html: Si, voglio legalizzare la cannabis in Svizzera + topnavigation: + donation: Donazione + counter: + supporters: "Sostenitore:" + amount_of_supporters: Al momento abbiamo %{amount} sostenitori. + + welcome_email: subject: Grazie mille per il tuo sostegno! @@ -21,7 +32,6 @@ it: form: Modulo lang: Lingua logo: Logo dell'iniziativa - title_html: Si, voglio legalizzare la cannabis in Svizzera submit: Garantire il sostengo terms_and_conditions: "Con l'invio dei tuoi dati, accetti le condizioni d'utilizzo." placeholders: @@ -38,11 +48,6 @@ it: pages: thanks: title: Grazie mille per il tuo sostegno! - - shared: - counter: - supporters: "Sostenitore:" - amount_of_supporters: Al momento abbiamo %{amount} sostenitori. mongoid: attributes: diff --git a/config/routes.rb b/config/routes.rb index b8871b4..a371dff 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,5 @@ Rails.application.routes.draw do - root 'supporters#new' + root to: redirect("/#{I18n.default_locale}") namespace :admin do get '/map', to: 'pages#map', as: :map