Browse Source

Added hreflang alternate urls

development
Godwin 9 years ago
parent
commit
70fd4ccef8
  1. 4
      app/assets/stylesheets/bumbleberry-settings.json
  2. 6
      app/controllers/application_controller.rb
  3. 7
      app/helpers/application_helper.rb
  4. 3
      app/views/layouts/application.html.haml
  5. 7
      app/views/shared/_footer.html.haml
  6. 6
      app/views/workshops/_show.html.haml

4
app/assets/stylesheets/bumbleberry-settings.json

@ -2,11 +2,11 @@
"stylesheets": ["application", "editor"], "stylesheets": ["application", "editor"],
"precompile": { "precompile": {
"test": { "test": {
"chrome": ["50"] "chrome": ["51"]
}, },
"development": { "development": {
"and_chr": ["50"], "and_chr": ["50"],
"chrome": ["50"], "chrome": ["51"],
"edge": ["13"], "edge": ["13"],
"firefox": ["44"], "firefox": ["44"],
"ie": ["11"], "ie": ["11"],

6
app/controllers/application_controller.rb

@ -34,6 +34,12 @@ class ApplicationController < LinguaFrancaApplicationController
halt_redirection! halt_redirection!
end 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 # call the base method to detect the language
super super
end end

7
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 }) (button_tag interested, :value => :toggle_interest, :class => (workshop.interested?(current_user) ? :delete : :add), aria: { labelledby: id })
end 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) def richtext(text, reduce_headings = 2)
return '' unless text.present? return '' unless text.present?
return _!(text). return _!(text).

3
app/views/layouts/application.html.haml

@ -10,6 +10,8 @@
= stylesheets = stylesheets
%link{ href: asset_path('favicon.ico'), rel: 'shortcut icon', type: 'image/x-icon' } %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' } %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.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-72x72.png'), rel: 'apple-touch-icon', sizes: '72x72' }
-#%link{ href: asset_path('apple-touch-icon-114x114.png'), rel: 'apple-touch-icon', sizes: '114x114' } -#%link{ href: asset_path('apple-touch-icon-114x114.png'), rel: 'apple-touch-icon', sizes: '114x114' }
@ -38,6 +40,7 @@
= yield = yield
#footer #footer
%footer= render 'shared/footer' %footer= render 'shared/footer'
- if @confirmation_dlg.present?
#content-overlay #content-overlay
#overlay #overlay
.dlg#confirmation-dlg .dlg#confirmation-dlg

7
app/views/shared/_footer.html.haml

@ -10,12 +10,11 @@
%a{href: 'https://github.com/bikebike/BikeBike', target: :_blank} %a{href: 'https://github.com/bikebike/BikeBike', target: :_blank}
=_'links.footer.text.Help_contribute' =_'links.footer.text.Help_contribute'
%ul.locales %ul.locales
-I18n.backend.enabled_locales.each do |locale| - @alt_lang_urls.each do |locale, url|
- if locale.to_s != I18n.locale.to_s # don't show the current locale
%li %li
- locale_translation = _("languages.#{locale}", locale: locale) - locale_translation = _("languages.#{locale}", locale: locale)
%a{href: url_for_locale(locale)} %a{href: url, lang: locale}
=_'translate.content.change_locale', "Read in #{locale_translation}", vars: {language: locale_translation}, locale: locale =_'translate.content.change_locale', "Read in #{locale_translation}", vars: {language: locale_translation}, locale: locale if locale != I18n.locale.to_s
.copy .copy
=_'links.footer.help_text.contributors', 'Who contributed to building this website' do |title| =_'links.footer.help_text.contributors', 'Who contributed to building this website' do |title|
=link_to :humans_txt, {title: title} do =link_to :humans_txt, {title: title} do

6
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.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]) =(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) - 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_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_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.#{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) - if is_this_user && workshop.requested_collaborator?(current_user)
.details .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? - 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) =(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 - if is_facilitator

Loading…
Cancel
Save