diff --git a/app/assets/stylesheets/bumbleberry-settings.json b/app/assets/stylesheets/bumbleberry-settings.json index 5beaf14..bf65d65 100644 --- a/app/assets/stylesheets/bumbleberry-settings.json +++ b/app/assets/stylesheets/bumbleberry-settings.json @@ -2,11 +2,11 @@ "stylesheets": ["application", "editor"], "precompile": { "test": { - "chrome": ["50"] + "chrome": ["51"] }, "development": { "and_chr": ["50"], - "chrome": ["50"], + "chrome": ["51"], "edge": ["13"], "firefox": ["44"], "ie": ["11"], diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 5ef7018..94bedc9 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -34,6 +34,12 @@ class ApplicationController < LinguaFrancaApplicationController halt_redirection! end + @alt_lang_urls = {} + I18n.backend.enabled_locales.each do |locale| + locale = locale.to_s + @alt_lang_urls[locale] = view_context.url_for_locale(locale) # don't show the current locale + end + # call the base method to detect the language super end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 7714f26..98ec0e9 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -713,6 +713,13 @@ module ApplicationHelper (button_tag interested, :value => :toggle_interest, :class => (workshop.interested?(current_user) ? :delete : :add), aria: { labelledby: id }) end + def link_with_confirmation(link_text, confirmation_text, path, args = {}) + @confirmation_dlg ||= true + args[:data] ||= {} + args[:data][:confirmation] = CGI::escapeHTML(confirmation_text) + link_to link_text, path, args + end + def richtext(text, reduce_headings = 2) return '' unless text.present? return _!(text). diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 78fda54..c5aba3c 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -10,6 +10,8 @@ = stylesheets %link{ href: asset_path('favicon.ico'), rel: 'shortcut icon', type: 'image/x-icon' } %link{ href: asset_path('favicon.ico'), rel: 'icon', type: 'image/x-icon' } + - @alt_lang_urls.each do |locale, url| + %link{ rel: :alternate, hreflang: locale, href: url } -#%link{ href: asset_path('apple-touch-icon.png'), rel: 'apple-touch-icon' } -#%link{ href: asset_path('apple-touch-icon-72x72.png'), rel: 'apple-touch-icon', sizes: '72x72' } -#%link{ href: asset_path('apple-touch-icon-114x114.png'), rel: 'apple-touch-icon', sizes: '114x114' } @@ -38,15 +40,16 @@ = yield #footer %footer= render 'shared/footer' - #content-overlay - #overlay - .dlg#confirmation-dlg - .dlg-content - %h2.title=_'modals.confirm' - .dlg-inner - %p.message='' - %a.button.confirm=_'modals.yes_button' - %button.delete=_'modals.no_button' + - if @confirmation_dlg.present? + #content-overlay + #overlay + .dlg#confirmation-dlg + .dlg-content + %h2.title=_'modals.confirm' + .dlg-inner + %p.message='' + %a.button.confirm=_'modals.yes_button' + %button.delete=_'modals.no_button' = yield :footer_scripts if content_for?(:footer_scripts) - add_inline_script :main diff --git a/app/views/shared/_footer.html.haml b/app/views/shared/_footer.html.haml index 13dc095..a402421 100644 --- a/app/views/shared/_footer.html.haml +++ b/app/views/shared/_footer.html.haml @@ -10,12 +10,11 @@ %a{href: 'https://github.com/bikebike/BikeBike', target: :_blank} =_'links.footer.text.Help_contribute' %ul.locales - -I18n.backend.enabled_locales.each do |locale| - - if locale.to_s != I18n.locale.to_s # don't show the current locale - %li - - locale_translation = _("languages.#{locale}", locale: locale) - %a{href: url_for_locale(locale)} - =_'translate.content.change_locale', "Read in #{locale_translation}", vars: {language: locale_translation}, locale: locale + - @alt_lang_urls.each do |locale, url| + %li + - locale_translation = _("languages.#{locale}", locale: locale) + %a{href: url, lang: locale} + =_'translate.content.change_locale', "Read in #{locale_translation}", vars: {language: locale_translation}, locale: locale if locale != I18n.locale.to_s .copy =_'links.footer.help_text.contributors', 'Who contributed to building this website' do |title| =link_to :humans_txt, {title: title} do diff --git a/app/views/workshops/_show.html.haml b/app/views/workshops/_show.html.haml index c1ffe87..f780f41 100644 --- a/app/views/workshops/_show.html.haml +++ b/app/views/workshops/_show.html.haml @@ -33,11 +33,11 @@ =(link_to (_'actions.workshops.Approve'), approve_facilitate_workshop_request_path(workshop.conference.slug, workshop.id, f.user_id, 'approve'), :class => [:button, :modify]) =(link_to (_'actions.workshops.Deny'), approve_facilitate_workshop_request_path(workshop.conference.slug, workshop.id, f.user_id, 'deny'), :class => [:button, :delete]) - elsif workshop.can_remove?(current_user, u) - =(link_to (_'actions.workshops.Make_Owner'), approve_facilitate_workshop_request_path(workshop.conference.slug, workshop.id, f.user_id, 'switch_ownership'), :class => [:button, :modify], data: {confirmation: CGI::escapeHTML(_'modals.workshops.facilitators.confirm_transfer_ownership', vars: { user_name: u.name})}) unless f.role.to_sym == :creator || !workshop.creator?(current_user) - =(link_to (_"actions.workshops.#{is_this_user ? 'Leave' : 'Remove'}"), approve_facilitate_workshop_request_path(workshop.conference.slug, workshop.id, f.user_id, 'remove'), :class => [:button, :delete], data: {confirmation: CGI::escapeHTML(_"modals.workshops.facilitators.confirm_remove#{is_this_user ? '_self' : ''}", vars: { user_name: u.name})}) + =(link_with_confirmation (_'actions.workshops.Make_Owner'), (_'modals.workshops.facilitators.confirm_transfer_ownership', vars: { user_name: u.name}),approve_facilitate_workshop_request_path(workshop.conference.slug, workshop.id, f.user_id, 'switch_ownership'), :class => [:button, :modify]) unless f.role.to_sym == :creator || !workshop.creator?(current_user) + =(link_with_confirmation (_"actions.workshops.#{is_this_user ? 'Leave' : 'Remove'}"), (_"modals.workshops.facilitators.confirm_remove#{is_this_user ? '_self' : ''}", vars: { user_name: u.name}), approve_facilitate_workshop_request_path(workshop.conference.slug, workshop.id, f.user_id, 'remove'), :class => [:button, :delete]) - if is_this_user && workshop.requested_collaborator?(current_user) .details - =(link_to (_'actions.workshops.Cancel_Request'), approve_facilitate_workshop_request_path(workshop.conference.slug, workshop.id, f.user_id, 'remove'), :class => [:button, :delete], data: {confirmation: CGI::escapeHTML(_'modals.workshops.facilitators.confirm_cancel_request')}) + =(link_with_confirmation (_'actions.workshops.Cancel_Request'), (_'modals.workshops.facilitators.confirm_cancel_request'), approve_facilitate_workshop_request_path(workshop.conference.slug, workshop.id, f.user_id, 'remove'), :class => [:button, :delete]) - unless preview.present? =(link_to (_'actions.workshops.Facilitate'), facilitate_workshop_path(workshop.conference.slug, workshop.id), :class => [:button, workshop.needs_facilitators ? :accented : :subdued]) unless workshop.facilitator?(current_user) - if is_facilitator