Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class ApplicationController < ActionController::Base
helper_method :current_user
helper_method :current_service

before_action :set_locale

def render_not_found
respond_to do |format|
format.html { render :template => "errors/not_found", layout: false, :status => 404 }
Expand Down Expand Up @@ -120,6 +122,11 @@ def has_access?

private

def set_locale
store_locale_to_cookie(params[:locale]) if locale
I18n.locale = cookies[:locale] || I18n.default_locale
end

def user_not_authorized
redirect_to(user_path, notice: 'You are not authorized to perform this action.')
end
Expand Down Expand Up @@ -151,4 +158,13 @@ def redirect_back(fallback_location:, **args)
redirect_to fallback_location, **args
end
end

def store_locale_to_cookie(locale)
cookies[:locale] = { value: locale,
expires: Time.zone.now + 36_000 }
end

def locale
params[:locale] if params[:locale] && I18n.available_locales.include?(params[:locale].to_sym)
end
end
27 changes: 16 additions & 11 deletions app/views/dashboard/code.html.haml
Original file line number Diff line number Diff line change
@@ -1,33 +1,38 @@
.stripe.reverse#code-of-conduct
.row
.large-12.columns
%h2 Code of conduct
%h1
= t('code_of_conduct.title')
.stripe.reverse
.row
.large-12.columns
%h3= t('code_of_conduct.summary.title')
%h2
= t('code_of_conduct.summary.title')

%p.lead
= t('code_of_conduct.summary.intro')

%h3 The Long Version
%h2
= t('code_of_conduct.content.title')

%p
= t('code_of_conduct.harassment')
= t('code_of_conduct.content.harassment')

%p
= t('code_of_conduct.comply')
= t('code_of_conduct.content.comply')

%p
= t('code_of_conduct.sponsors')
= t('code_of_conduct.content.sponsors')

%p
= t('code_of_conduct.sanctions')
= t('code_of_conduct.content.sanctions')

%p
= t('code_of_conduct.concerns')
= t('code_of_conduct.content.concerns')

%p
= raw t('code_of_conduct.applies_to')
= raw t('code_of_conduct.content.applies_to')

%p
= t('code_of_conduct.questions')
=mail_to "hello@codebar.io", "contact us", subject: t('code_of_conduct.email_subject')
= t('code_of_conduct.content.questions')
=mail_to 'hello@codebar.io', t('code_of_conduct.content.contact'), subject: t('code_of_conduct.email_subject')
9 changes: 0 additions & 9 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,6 @@ class Application < Rails::Application
config.time_zone = 'London'
config.active_record.default_timezone = :local
config.active_record.raise_in_transactional_callbacks = true

# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
config.i18n.default_locale = :en
config.i18n.fallbacks = true
config.i18n.available_locales = [:en]
# config.i18n.enforce_available_locales = false
config.active_job.queue_adapter = :delayed_job
end
end

Expand Down
6 changes: 6 additions & 0 deletions config/initializers/locale.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
Rails.application.config.i18n.default_locale = :en
Rails.application.config.i18n.fallbacks = true
Rails.application.config.i18n.available_locales = [:en, :fr, :de]
#config.i18n.enforce_available_locales = false
22 changes: 12 additions & 10 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,19 +152,22 @@ en:


code_of_conduct:
title: "Code of conduct"
summary:
title: "The Quick Version"
intro: "Our events are dedicated to providing a harassment-free experience for everyone, regardless of gender, sexual orientation, disability, physical appearance, body size, race, or religion. We do not tolerate harassment of our members in any form. Sexual language and imagery is not appropriate for any of our events, including talks, workshops, parties, Twitter and any other online media. Members violating these rules may be sanctioned or expelled from the event and any future events at the discretion of the organisers."

title: "The Long Version"
harassment: "Harassment includes offensive verbal comments related to gender, sexual orientation, disability, physical appearance, body size, race, religion, sexual images in public spaces, deliberate intimidation, stalking, following, harassing photography or recording, sustained disruption of talks or other events, inappropriate physical contact, and unwelcome sexual attention."
comply: "We expect any participants asked to stop any harassing behaviour to comply immediately."
sponsors: "Sponsors are also subject to the anti-harassment policy. In particular, sponsors should not use sexualized images, activities, or other material. Staff (including volunteers) should not use sexualized clothing/uniforms/costumes, or otherwise create a sexualized environment."
sanctions: "If a participant engages in harassing behaviour the organisers may take any action they deem appropriate. This includes warning the offender or expulsion."
concerns: "If you are being harassed, notice that someone else is being harassed, or have any other concerns, please contact one of the organisers immediately."
applies_to: "We expect participants to follow these rules at all <b>codebar</b> events."
questions: "If you have any questions or concerns about this code please"
email_subject: "Regarding code of conduct"
content:
title: "The Long Version"
harassment: "Harassment includes offensive verbal comments related to gender, sexual orientation, disability, physical appearance, body size, race, religion, sexual images in public spaces, deliberate intimidation, stalking, following, harassing photography or recording, sustained disruption of talks or other events, inappropriate physical contact, and unwelcome sexual attention."
comply: "We expect any participants asked to stop any harassing behaviour to comply immediately."
sponsors: "Sponsors are also subject to the anti-harassment policy. In particular, sponsors should not use sexualized images, activities, or other material. Staff (including volunteers) should not use sexualized clothing/uniforms/costumes, or otherwise create a sexualized environment."
sanctions: "If a participant engages in harassing behaviour the organisers may take any action they deem appropriate. This includes warning the offender or expulsion."
concerns: "If you are being harassed, notice that someone else is being harassed, or have any other concerns, please contact one of the organisers immediately."
applies_to: "We expect participants to follow these rules at all <b>codebar</b> events."
questions: "If you have any questions or concerns about this code please"
contact: "contact us"
email_subject: "Regarding code of conduct"

sponsors:
sponsoring: "Sponsoring"
Expand Down Expand Up @@ -279,4 +282,3 @@ en:
already_on_list: "%{name} is already on the list!"
rsvp_error: "Something went wrong, %{name} has not been added."
update_rsvp: 'Updated attendance of %{name}'

Loading