Refactured navigation
This commit is contained in:
@@ -17,6 +17,9 @@ gem 'mongoid-paperclip'
|
|||||||
# Stripe integration
|
# Stripe integration
|
||||||
gem 'stripe'
|
gem 'stripe'
|
||||||
|
|
||||||
|
# Render your navigation as HTML list, link list or breadcrumbs.
|
||||||
|
gem 'simple-navigation'
|
||||||
|
|
||||||
# To extend paperclip with locales
|
# To extend paperclip with locales
|
||||||
gem 'paperclip-i18n'
|
gem 'paperclip-i18n'
|
||||||
|
|
||||||
@@ -37,9 +40,6 @@ gem 'jbuilder', '~> 2.0'
|
|||||||
# bundle exec rake doc:rails generates the API under doc/api.
|
# bundle exec rake doc:rails generates the API under doc/api.
|
||||||
gem 'sdoc', '~> 0.4.0', group: :doc
|
gem 'sdoc', '~> 0.4.0', group: :doc
|
||||||
|
|
||||||
# Easily generate a Twitter Bootstrap navbar in your Rails app
|
|
||||||
gem 'rails_bootstrap_navbar'
|
|
||||||
|
|
||||||
# Kaminari Mongoid adapter.
|
# Kaminari Mongoid adapter.
|
||||||
gem 'kaminari-mongoid'
|
gem 'kaminari-mongoid'
|
||||||
gem 'kaminari-actionview'
|
gem 'kaminari-actionview'
|
||||||
|
|||||||
+4
-8
@@ -52,8 +52,6 @@ GEM
|
|||||||
benchmark-ips (2.7.2)
|
benchmark-ips (2.7.2)
|
||||||
binding_of_caller (0.7.2)
|
binding_of_caller (0.7.2)
|
||||||
debug_inspector (>= 0.0.1)
|
debug_inspector (>= 0.0.1)
|
||||||
bootstrap-navbar (2.5.0)
|
|
||||||
gem_config (~> 0.3)
|
|
||||||
bootstrap-sass (3.3.7)
|
bootstrap-sass (3.3.7)
|
||||||
autoprefixer-rails (>= 5.2.1)
|
autoprefixer-rails (>= 5.2.1)
|
||||||
sass (>= 3.3.4)
|
sass (>= 3.3.4)
|
||||||
@@ -114,7 +112,6 @@ GEM
|
|||||||
ffi (1.9.18)
|
ffi (1.9.18)
|
||||||
font-awesome-rails (4.7.0.2)
|
font-awesome-rails (4.7.0.2)
|
||||||
railties (>= 3.2, < 5.2)
|
railties (>= 3.2, < 5.2)
|
||||||
gem_config (0.3.1)
|
|
||||||
geocoder (1.4.4)
|
geocoder (1.4.4)
|
||||||
get_process_mem (0.2.1)
|
get_process_mem (0.2.1)
|
||||||
globalid (0.4.0)
|
globalid (0.4.0)
|
||||||
@@ -251,9 +248,6 @@ GEM
|
|||||||
rails (>= 4.0, < 6)
|
rails (>= 4.0, < 6)
|
||||||
remotipart (~> 1.3)
|
remotipart (~> 1.3)
|
||||||
sass-rails (>= 4.0, < 6)
|
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_serve_static_assets (0.0.5)
|
||||||
rails_stdout_logging (0.0.5)
|
rails_stdout_logging (0.0.5)
|
||||||
railties (4.2.10)
|
railties (4.2.10)
|
||||||
@@ -314,6 +308,8 @@ GEM
|
|||||||
sdoc (0.4.2)
|
sdoc (0.4.2)
|
||||||
json (~> 1.7, >= 1.7.7)
|
json (~> 1.7, >= 1.7.7)
|
||||||
rdoc (~> 4.0)
|
rdoc (~> 4.0)
|
||||||
|
simple-navigation (4.0.5)
|
||||||
|
activesupport (>= 2.3.2)
|
||||||
simple_form (3.5.0)
|
simple_form (3.5.0)
|
||||||
actionpack (> 4, < 5.2)
|
actionpack (> 4, < 5.2)
|
||||||
activemodel (> 4, < 5.2)
|
activemodel (> 4, < 5.2)
|
||||||
@@ -384,12 +380,12 @@ DEPENDENCIES
|
|||||||
rails-i18n
|
rails-i18n
|
||||||
rails_12factor
|
rails_12factor
|
||||||
rails_admin
|
rails_admin
|
||||||
rails_bootstrap_navbar
|
|
||||||
roadie-rails (~> 1.0)
|
roadie-rails (~> 1.0)
|
||||||
route_translator
|
route_translator
|
||||||
rspec-rails (~> 3.0)
|
rspec-rails (~> 3.0)
|
||||||
sass-rails (~> 5.0)
|
sass-rails (~> 5.0)
|
||||||
sdoc (~> 0.4.0)
|
sdoc (~> 0.4.0)
|
||||||
|
simple-navigation
|
||||||
simple_form
|
simple_form
|
||||||
slim
|
slim
|
||||||
slim-rails
|
slim-rails
|
||||||
@@ -402,4 +398,4 @@ RUBY VERSION
|
|||||||
ruby 2.3.1p112
|
ruby 2.3.1p112
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
1.14.6
|
1.16.0
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
@import "footnotes"
|
@import "footnotes"
|
||||||
@import "statements"
|
@import "statements"
|
||||||
@import "donations"
|
@import "donations"
|
||||||
|
@import "nav"
|
||||||
|
|
||||||
.alert-alert
|
.alert-alert
|
||||||
@extend .alert-danger
|
@extend .alert-danger
|
||||||
@@ -58,6 +59,12 @@ body
|
|||||||
.container
|
.container
|
||||||
padding-left: 0px
|
padding-left: 0px
|
||||||
|
|
||||||
|
header > .row
|
||||||
|
margin-bottom: 12px
|
||||||
|
|
||||||
|
main > h1
|
||||||
|
margin-top: 0px
|
||||||
|
|
||||||
ul#topnav
|
ul#topnav
|
||||||
font-size: 1.2em
|
font-size: 1.2em
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
@import "variables"
|
||||||
|
|
||||||
|
nav#mainnav
|
||||||
|
marign-top: 12px
|
||||||
|
font-size: 16pt
|
||||||
|
|
||||||
|
a
|
||||||
|
color: $brand-success
|
||||||
|
|
||||||
|
a.selected
|
||||||
|
font-weight: bold
|
||||||
|
|
||||||
|
|
||||||
|
ul
|
||||||
|
list-style: none
|
||||||
|
|
||||||
|
li
|
||||||
|
padding-bottom: 6px
|
||||||
|
|
||||||
|
ul
|
||||||
|
padding-left: 20px
|
||||||
|
padding-top: 12px
|
||||||
|
|
||||||
|
li
|
||||||
|
font-size: 12pt
|
||||||
@@ -65,8 +65,11 @@ html lang="#{I18n.locale}"
|
|||||||
.container.content
|
.container.content
|
||||||
= render 'shared/flashes'
|
= render 'shared/flashes'
|
||||||
= render 'shared/header'
|
= render 'shared/header'
|
||||||
= render 'shared/topnavigation'
|
.row
|
||||||
= yield
|
.col-xs-12.col-sm-3
|
||||||
|
nav#mainnav = render_navigation
|
||||||
|
.col-xs-12.col-sm-9
|
||||||
|
main= yield
|
||||||
hr
|
hr
|
||||||
footer.row
|
footer.row
|
||||||
.col-xs-12.col-sm-6
|
.col-xs-12.col-sm-6
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
= navbar do
|
|
||||||
= navbar_header
|
|
||||||
= navbar_collapse do
|
|
||||||
= navbar_group id: 'topnav' do
|
|
||||||
= navbar_item "Home", "/#{I18n.locale}"
|
|
||||||
= navbar_dropdown t('.initiative') do
|
|
||||||
= navbar_item t('.initiative_text'), initiative_text_path
|
|
||||||
= navbar_item t('.arguments'), arguments_path
|
|
||||||
= navbar_item t('.faq'), faq_path
|
|
||||||
= navbar_item t('.numbers'), numbers_path
|
|
||||||
= navbar_item t('.collection_concept'), collection_concept_path
|
|
||||||
= navbar_item t('.statements'), statements_path
|
|
||||||
= navbar_item t('donation'), donation_path
|
|
||||||
= navbar_item 'Blog', 'http://blog.cannabis-initiative.ch'
|
|
||||||
= navbar_item t('.sign_in'), new_supporter_session_path unless supporter_signed_in?
|
|
||||||
= navbar_item t('.sign_out'), destroy_supporter_session_path, nil, 'data-method' => :delete if supporter_signed_in?
|
|
||||||
- if supporter_signed_in? && current_supporter.admin?
|
|
||||||
= navbar_dropdown t('admin.title') do
|
|
||||||
= navbar_item t('admin.publicities.index.title'), admin_publicities_path
|
|
||||||
@@ -21,7 +21,6 @@
|
|||||||
= f.input :language, as: :radio_buttons, collection: t('languages').map{ |x| [x.first, raw(x.last)]}, label_method: :last, value_method: :first
|
= f.input :language, as: :radio_buttons, collection: t('languages').map{ |x| [x.first, raw(x.last)]}, label_method: :last, value_method: :first
|
||||||
.form-actions
|
.form-actions
|
||||||
= f.button :submit, t("devise.registrations.edit.update"), class: 'btn btn-primary'
|
= f.button :submit, t("devise.registrations.edit.update"), class: 'btn btn-primary'
|
||||||
p = link_to t("devise.shared.links.back"), :back
|
|
||||||
hr
|
hr
|
||||||
p = link_to t("devise.registrations.edit.cancel_my_account"), registration_path(resource_name), data: { confirm: t("devise.registrations.edit.are_you_sure") }, method: :delete, class: 'btn btn-danger btn-sm pull-right'
|
p = link_to t("devise.registrations.edit.cancel_my_account"), registration_path(resource_name), data: { confirm: t("devise.registrations.edit.are_you_sure") }, method: :delete, class: 'btn btn-danger btn-sm pull-right'
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
BootstrapNavbar.configure do |config|
|
|
||||||
config.bootstrap_version = '3.3.6'
|
|
||||||
config.root_paths = ['/', '/de', '/fr', '/it'] # default: ['/']
|
|
||||||
end
|
|
||||||
@@ -7,6 +7,8 @@ de:
|
|||||||
logo: Logo der Initiative
|
logo: Logo der Initiative
|
||||||
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:
|
||||||
|
support: Unterstützen
|
||||||
|
my_account: Mein Konto
|
||||||
sign_in: Anmelden
|
sign_in: Anmelden
|
||||||
sign_out: Abmelden
|
sign_out: Abmelden
|
||||||
initiative_text: Der Initiativtext im Wortlaut
|
initiative_text: Der Initiativtext im Wortlaut
|
||||||
@@ -15,7 +17,7 @@ de:
|
|||||||
faq: Fragen und Antworten
|
faq: Fragen und Antworten
|
||||||
sponsoring: Sponsoren
|
sponsoring: Sponsoren
|
||||||
numbers: Zahlen
|
numbers: Zahlen
|
||||||
statementes: Statements
|
statements: Statements
|
||||||
collection_concept: Wie macht man eine Volksinitiative?
|
collection_concept: Wie macht man eine Volksinitiative?
|
||||||
|
|
||||||
lang: Sprache
|
lang: Sprache
|
||||||
@@ -80,7 +82,7 @@ de:
|
|||||||
|
|
||||||
new:
|
new:
|
||||||
title: Hallo %{name}
|
title: Hallo %{name}
|
||||||
edit: Meine Daten bearbeiten...
|
edit: Meine Daten bearbeiten
|
||||||
my_data: Meine Daten
|
my_data: Meine Daten
|
||||||
|
|
||||||
publicities:
|
publicities:
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ fr:
|
|||||||
numbers: Chiffres (en allemand)
|
numbers: Chiffres (en allemand)
|
||||||
statements: Déclarations
|
statements: Déclarations
|
||||||
collection_concept: Comment faire une initiative populaire? (en allemand)
|
collection_concept: Comment faire une initiative populaire? (en allemand)
|
||||||
|
my_account: Mon compte
|
||||||
|
|
||||||
lang: Langue
|
lang: Langue
|
||||||
are_you_sure: Tu es sûre?
|
are_you_sure: Tu es sûre?
|
||||||
@@ -77,7 +78,7 @@ fr:
|
|||||||
|
|
||||||
new:
|
new:
|
||||||
title: Salut %{name}
|
title: Salut %{name}
|
||||||
edit: Modifier mes données ...
|
edit: Modifier mes données
|
||||||
my_data: Mes données
|
my_data: Mes données
|
||||||
|
|
||||||
publicities:
|
publicities:
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ it:
|
|||||||
numbers: Numeri (in tedesco)
|
numbers: Numeri (in tedesco)
|
||||||
statements: Dichiarazioni
|
statements: Dichiarazioni
|
||||||
collection_concept: Come fare un iniziativa popolare? (in tedesco)
|
collection_concept: Come fare un iniziativa popolare? (in tedesco)
|
||||||
|
my_account: Il mio account
|
||||||
|
|
||||||
counter:
|
counter:
|
||||||
supporters: "Sostenitore:"
|
supporters: "Sostenitore:"
|
||||||
@@ -81,7 +82,7 @@ it:
|
|||||||
|
|
||||||
new:
|
new:
|
||||||
title: Ciao %{name}
|
title: Ciao %{name}
|
||||||
edit: Modifica i miei dati ...
|
edit: Modifica i miei dati
|
||||||
my_data: Miei dati
|
my_data: Miei dati
|
||||||
|
|
||||||
publicities:
|
publicities:
|
||||||
|
|||||||
@@ -0,0 +1,83 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Configures your navigation
|
||||||
|
SimpleNavigation::Configuration.run do |navigation|
|
||||||
|
# Specify a custom renderer if needed.
|
||||||
|
# The default renderer is SimpleNavigation::Renderer::List which renders HTML lists.
|
||||||
|
# The renderer can also be specified as option in the render_navigation call.
|
||||||
|
# navigation.renderer = Your::Custom::Renderer
|
||||||
|
|
||||||
|
# Specify the class that will be applied to active navigation items. Defaults to 'selected'
|
||||||
|
#navigation.selected_class = 'selected'
|
||||||
|
|
||||||
|
# Specify the class that will be applied to the current leaf of
|
||||||
|
# active navigation items. Defaults to 'simple-navigation-active-leaf'
|
||||||
|
#navigation.active_leaf_class = 'simple-navigation-active-leaf'
|
||||||
|
|
||||||
|
# Specify if item keys are added to navigation items as id. Defaults to true
|
||||||
|
#navigation.autogenerate_item_ids = true
|
||||||
|
|
||||||
|
# You can override the default logic that is used to autogenerate the item ids.
|
||||||
|
# To do this, define a Proc which takes the key of the current item as argument.
|
||||||
|
# The example below would add a prefix to each key.
|
||||||
|
#navigation.id_generator = Proc.new {|key| "my-prefix-#{key}"}
|
||||||
|
|
||||||
|
# If you need to add custom html around item names, you can define a proc that
|
||||||
|
# will be called with the name you pass in to the navigation.
|
||||||
|
# The example below shows how to wrap items spans.
|
||||||
|
#navigation.name_generator = Proc.new {|name, item| "<span>#{name}</span>"}
|
||||||
|
|
||||||
|
# Specify if the auto highlight feature is turned on (globally, for the whole navigation). Defaults to true
|
||||||
|
#navigation.auto_highlight = true
|
||||||
|
|
||||||
|
# Specifies whether auto highlight should ignore query params and/or anchors when
|
||||||
|
# comparing the navigation items with the current URL. Defaults to true
|
||||||
|
#navigation.ignore_query_params_on_auto_highlight = true
|
||||||
|
#navigation.ignore_anchors_on_auto_highlight = true
|
||||||
|
|
||||||
|
# If this option is set to true, all item names will be considered as safe (passed through html_safe). Defaults to false.
|
||||||
|
#navigation.consider_item_names_as_safe = false
|
||||||
|
|
||||||
|
# Define the primary navigation
|
||||||
|
navigation.items do |primary|
|
||||||
|
# Add an item to the primary navigation. The following params apply:
|
||||||
|
# key - a symbol which uniquely defines your navigation item in the scope of the primary_navigation
|
||||||
|
# name - will be displayed in the rendered navigation. This can also be a call to your I18n-framework.
|
||||||
|
# url - the address that the generated item links to. You can also use url_helpers (named routes, restful routes helper, url_for etc.)
|
||||||
|
# options - can be used to specify attributes that will be included in the rendered navigation item (e.g. id, class etc.)
|
||||||
|
# some special options that can be set:
|
||||||
|
# :if - Specifies a proc to call to determine if the item should
|
||||||
|
# be rendered (e.g. <tt>if: -> { current_user.admin? }</tt>). The
|
||||||
|
# proc should evaluate to a true or false value and is evaluated in the context of the view.
|
||||||
|
# :unless - Specifies a proc to call to determine if the item should not
|
||||||
|
# be rendered (e.g. <tt>unless: -> { current_user.admin? }</tt>). The
|
||||||
|
# proc should evaluate to a true or false value and is evaluated in the context of the view.
|
||||||
|
# :method - Specifies the http-method for the generated link - default is :get.
|
||||||
|
# :highlights_on - if autohighlighting is turned off and/or you want to explicitly specify
|
||||||
|
# when the item should be highlighted, you can set a regexp which is matched
|
||||||
|
# against the current URI. You may also use a proc, or the symbol <tt>:subpath</tt>.
|
||||||
|
#
|
||||||
|
|
||||||
|
unless supporter_signed_in?
|
||||||
|
primary.item :home, I18n.t('.shared.topnavigation.support'), "/#{I18n.locale}"
|
||||||
|
end
|
||||||
|
primary.item :initiative, I18n.t('.shared.topnavigation.initiative'), initiative_text_path do | initiative |
|
||||||
|
initiative.item :arguments, I18n.t('.shared.topnavigation.arguments'), arguments_path
|
||||||
|
initiative.item :faq, I18n.t('.shared.topnavigation.faq'), faq_path
|
||||||
|
initiative.item :numbers, I18n.t('.shared.topnavigation.numbers'), numbers_path
|
||||||
|
initiative.item :collection_concept, I18n.t('.shared.topnavigation.collection_concept'), collection_concept_path
|
||||||
|
end
|
||||||
|
primary.item :statements, I18n.t('.shared.topnavigation.statements'), statements_path do |statements|
|
||||||
|
statements.item :new_statement, I18n.t('.supporters.publicity.renew'), new_publicity_path
|
||||||
|
end
|
||||||
|
primary.item :donation, I18n.t('donation'), donation_path
|
||||||
|
primary.item :blog, 'Blog', 'http://blog.cannabis-initiative.ch/', link_html: { target: '_blank'}
|
||||||
|
if supporter_signed_in?
|
||||||
|
primary.item :home, I18n.t('.shared.topnavigation.my_account'), "/#{I18n.locale}" do |my_account|
|
||||||
|
my_account.item :edit_account, I18n.t('.supporters.new.edit'), edit_supporter_registration_path()
|
||||||
|
my_account.item :sign_out, I18n.t('.shared.topnavigation.sign_out'), destroy_supporter_session_path, link_html: { 'data-method' => :delete }
|
||||||
|
end
|
||||||
|
else
|
||||||
|
primary.item :home, I18n.t('.shared.topnavigation.sign_in'), new_supporter_session_path
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user