Added localization to workshops, made login persist through subdomains

This commit is contained in:
Godwin
2015-09-14 21:16:22 -07:00
parent a63b5e1dc2
commit 01d8679c9d
73 changed files with 1840 additions and 187 deletions
+4
View File
@@ -7,6 +7,10 @@
= label_tag :info
= text_area_tag :info, @this_conference.info, :required => true
.actions.right
.left
- I18n.backend.enabled_locales.each do |locale|
= (link_to (_'actions.conference.Translate', "Edit #{language_name(locale)} version", :vars => {:language => language_name(locale)}), edit_conference_path(@this_conference.slug, url_params(locale)), :class => 'translate') if locale.to_sym != I18n.locale.to_sym
= button_tag :save, :value => :save
:javascript
+1 -1
View File
@@ -18,7 +18,7 @@
%ul
-I18n.backend.enabled_locales.each do |locale|
%li
%a{href: request.original_url.gsub(/^(https?:\/\/)(preview\-)?(..\.)?(.*)$/, '\1\2' + locale + '.\4')}
%a{href: home_url(url_params(locale))}
=_! locale.upcase
%span=I18n.t("languages.#{locale}", locale: locale, context: I18n.t("languages.#{locale}"))
.copy
+2 -2
View File
@@ -9,11 +9,11 @@
= nav_link about_path, (_'page_titles.About_BikeBike')
= nav_link policy_path, (_'page_titles.Safe_Space_Policy')
.actions
- if @conference.registration_open
- if @conference && @conference.registration_open
- if params[:action] != 'register' && !@registration
= link_to register_path(@conference.slug), class: [:button, :register] do
=_'conference.actions.Register'
- else
- elsif @conference
= render 'shared/donate_button', :email_address => (@conference.paypal_email_address || @conference.email_address)
- if current_user
= form_tag :logout, class: :logout do
+52 -43
View File
@@ -8,52 +8,61 @@
.text-field.input-field.big
= label_tag :title
= text_field_tag :title, @title, :required => true
- if @workshop && I18n.locale.to_s != @workshop.locale.to_s
.original-text
%h4=_'translate.content.Translation_of'
.value=@workshop.title!
.text-area-field.input-field
= label_tag :info
= text_area_tag :info, @info, :required => true
= columns(medium: 6) do
%h3=_'articles.workshops.headings.languages','Workshop Language'
- [:en, :es, :fr].each do |language|
.single-check-box-field.input-field
= label_tag "languages_#{language}" do
= check_box_tag "languages[#{language}]", 1, @languages && @languages.include?(language)
= _"languages.#{language}"
%h3=_'articles.workshops.headings.theme','Theme'
.input-field-help=_'articles.workshops.paragraphs.theme', :p
- theme_found = false
- [:race_gender, :mechanics, :funding, :organization, :community].each do |theme|
.single-radio-button-field.input-field
= label_tag "theme_#{theme}" do
- is_selected = (@theme == theme)
- theme_found ||= is_selected
= radio_button_tag :theme, theme, is_selected
= _"workshop.options.theme.#{theme}"
.single-radio-button-field.other-field.input-field
= label_tag "theme_other" do
= radio_button_tag :theme, :other, (@theme && !theme_found)
%div
= _"workshop.options.theme.other"
= text_field_tag :other_theme, (@theme && !theme_found ? @theme : nil)
= columns(medium: 6) do
%h3=_'articles.workshops.headings.needs','What do you need?'
- [:sound, :projector, :tools].each do |need|
.single-check-box-field.input-field
= label_tag "needs_#{need}" do
= check_box_tag "needs[#{need}]", 1, @needs.include?(need)
= _"workshop.options.needs.#{need}"
%h3=_'articles.workshops.headings.space','Type of space'
.input-field-help=_'articles.workshops.paragraphs.space', :p
- [:meeting_room, :workshop, :outdoor_meeting].each do |space|
.single-radio-button-field.input-field
= label_tag "space_#{space}" do
= radio_button_tag :space, space, @space == space
= _"workshop.options.space.#{space}"
= columns(medium: 12) do
%h3=_'articles.workshops.headings.notes','Notes for Conference Organizers and Workshop Facilitators'
%p=_'articles.workshops.paragraphs.notes','Notes are only viewable by conference hosts and workshop facilitators'
.text-area-field.input-field
= label_tag :notes
= text_area_tag :notes, @notes
- if @workshop && I18n.locale.to_s != @workshop.locale.to_s
.original-text
%h4=_'translate.content.Translation_of'
.value=markdown @workshop.info!
- if !@workshop || @can_edit
= columns(medium: 6) do
%h3=_'articles.workshops.headings.languages','Workshop Language'
- [:en, :es, :fr].each do |language|
.single-check-box-field.input-field
= label_tag "languages_#{language}" do
= check_box_tag "languages[#{language}]", 1, @languages && @languages.include?(language)
= _"languages.#{language}"
%h3=_'articles.workshops.headings.theme','Theme'
.input-field-help=_'articles.workshops.paragraphs.theme', :p
- theme_found = false
- [:race_gender, :mechanics, :funding, :organization, :community].each do |theme|
.single-radio-button-field.input-field
= label_tag "theme_#{theme}" do
- is_selected = (@theme == theme)
- theme_found ||= is_selected
= radio_button_tag :theme, theme, is_selected
= _"workshop.options.theme.#{theme}"
.single-radio-button-field.other-field.input-field
= label_tag "theme_other" do
= radio_button_tag :theme, :other, (@theme && !theme_found)
%div
= _"workshop.options.theme.other"
= text_field_tag :other_theme, (@theme && !theme_found ? @theme : nil)
= columns(medium: 6) do
%h3=_'articles.workshops.headings.needs','What do you need?'
- [:sound, :projector, :tools].each do |need|
.single-check-box-field.input-field
= label_tag "needs_#{need}" do
= check_box_tag "needs[#{need}]", 1, @needs.include?(need)
= _"workshop.options.needs.#{need}"
%h3=_'articles.workshops.headings.space','Type of space'
.input-field-help=_'articles.workshops.paragraphs.space', :p
- [:meeting_room, :workshop, :outdoor_meeting].each do |space|
.single-radio-button-field.input-field
= label_tag "space_#{space}" do
= radio_button_tag :space, space, @space == space
= _"workshop.options.space.#{space}"
= columns(medium: 12) do
%h3=_'articles.workshops.headings.notes','Notes for Conference Organizers and Workshop Facilitators'
%p=_'articles.workshops.paragraphs.notes','Notes are only viewable by conference hosts and workshop facilitators'
.text-area-field.input-field
= label_tag :notes
= text_area_tag :notes, @notes
= columns(medium: 12) do
.actions.right
= button_tag :save, :value => :save
+3
View File
@@ -40,4 +40,7 @@
= columns(medium: 12) do
.actions
= (link_to (_'actions.workshops.Edit'), edit_workshop_path(@this_conference.slug, @workshop.id), :class => 'button modify') if @workshop.can_edit?(current_user)
- if @workshop.can_translate?(current_user)
- I18n.backend.enabled_locales.each do |locale|
= (link_to (_'actions.workshops.Translate', "Translate into #{language_name(locale)}", :vars => {:language => language_name(locale)}), edit_workshop_url(@this_conference.slug, @workshop.id, url_params(locale)), :class => 'button translate') if locale.to_sym != I18n.locale.to_sym
= (link_to (_'actions.workshops.Delete'), delete_workshop_path(@this_conference.slug, @workshop.id), :class => 'button delete') if @workshop.can_delete?(current_user)