From 87fc860b89f393e8190ccde1275592cd36c8e47e Mon Sep 17 00:00:00 2001 From: JoenioCosta Date: Sat, 7 Jun 2008 21:12:42 +0000 Subject: [PATCH] ActionItem373: add dropdown to language choose --- app/helpers/language_helper.rb | 26 +++++++++++++++++--------- app/views/layouts/application.rhtml | 4 ++++ 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/app/helpers/language_helper.rb b/app/helpers/language_helper.rb index 10cfeff..8d75ead 100644 --- a/app/helpers/language_helper.rb +++ b/app/helpers/language_helper.rb @@ -9,17 +9,25 @@ module LanguageHelper alias :calendar_date_select_language :tinymce_language - def language_chooser + def language_chooser(options = {}) current = language - languages = Noosfero.locales.map do |code,name| - if code == current - content_tag('strong', name) - else - link_to(name, :lang => code) - end - end.join(' — ') + if options[:element] == 'dropdown' + select_tag('lang', + options_for_select(Noosfero.locales.map{|code,name| [name, code]}, current), + :onchange => remote_function(:update => 'wrap', :url => { :action => :index }, :with => "'lang='+value"), + :help => _('The language you choose here is the language used for options, buttons, etc. It does not affect the language of the content created by other users.') + ) + else + languages = Noosfero.locales.map do |code,name| + if code == current + content_tag('strong', name) + else + link_to(name, :lang => code) + end + end.join(' — ') + content_tag('div', languages, :id => 'language-chooser', :help => _('The language you choose here is the language used for options, buttons, etc. It does not affect the language of the content created by other users.')) + end - content_tag('div', languages, :id => 'language-chooser', :help => _('The language you choose here is the language used for options, buttons, etc. It does not affect the language of the content created by other users.')) end end diff --git a/app/views/layouts/application.rhtml b/app/views/layouts/application.rhtml index 3a17088..4b6c52a 100644 --- a/app/views/layouts/application.rhtml +++ b/app/views/layouts/application.rhtml @@ -98,6 +98,10 @@ prepareMenu('navigation_bar', { timeout: 1000 }); +
+ <%= language_chooser(:element => 'dropdown') %> +
+
<%= render :file => 'shared/user_menu' %> <%= theme_opt_menu_search %> -- libgit2 0.21.2