Browse Source

Added list of available locales to locale not available page

development
Godwin 9 years ago
parent
commit
9f45bef94f
  1. 12
      app/assets/stylesheets/_application.scss
  2. 7
      app/helpers/application_helper.rb
  3. 8
      app/views/application/locale_not_available.html.haml

12
app/assets/stylesheets/_application.scss

@ -1725,6 +1725,18 @@ $header-tilt: 8deg;
} }
} }
body.error-locale-not-available {
.locales {
list-style: none;
padding: 0;
text-align: center;
li {
margin-bottom: 1em;
}
}
}
body { body {
#primary-content { #primary-content {
@include _(transition, 'filter 250ms ease-in-out, -webkit-filter 250ms ease-in-out'); @include _(transition, 'filter 250ms ease-in-out, -webkit-filter 250ms ease-in-out');

7
app/helpers/application_helper.rb

@ -646,7 +646,9 @@ module ApplicationHelper
end end
def language(locale, original_language = false) def language(locale, original_language = false)
_("languages.#{locale}", locale: original_language ? locale : nil) args = {}
args[:locale] = locale if original_language
_("languages.#{locale}", args)
end end
def date(date, format = :long) def date(date, format = :long)
@ -1086,13 +1088,10 @@ module ApplicationHelper
new_id = id new_id = id
if @_ids[id] > 0 if @_ids[id] > 0
#puts " ====== #{id} - #{@_ids[id]} : #{@_ids[id] + 1} ====== "
new_id += "--#{@_ids[id]}" new_id += "--#{@_ids[id]}"
end end
puts " ====== #{id} = #{@_ids[id]} ====== "
@_ids[id] += 1 @_ids[id] += 1
puts " ====== #{id} = #{@_ids[id]} ====== "
return new_id return new_id
end end

8
app/views/application/locale_not_available.html.haml

@ -1,4 +1,10 @@
= render :partial => 'application/header', :locals => {:image_file => 'runes.jpg'} = render :partial => 'application/header', :locals => {:image_file => 'runes.jpg'}
= row do = row do
= columns(medium: 12) do = columns(medium: 12) do
= paragraph(_'error.locale_not_available.description', :p, @main_title_vars) = paragraph(_'error.locale_not_available.description', :p, @main_title_vars)
%ul.locales
- @alt_lang_urls.each do |locale, url|
%li
- locale_translation = language(locale, true)
%a.button{href: url, lang: locale}
=_'translate.content.change_locale', "Read in #{locale_translation}", vars: {language: locale_translation}, locale: locale

Loading…
Cancel
Save