Commit 87fc860b89f393e8190ccde1275592cd36c8e47e
1 parent
a062f148
Exists in
master
and in
29 other branches
ActionItem373: add dropdown to language choose
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1923 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
2 changed files
with
21 additions
and
9 deletions
Show diff stats
app/helpers/language_helper.rb
| ... | ... | @@ -9,17 +9,25 @@ module LanguageHelper |
| 9 | 9 | |
| 10 | 10 | alias :calendar_date_select_language :tinymce_language |
| 11 | 11 | |
| 12 | - def language_chooser | |
| 12 | + def language_chooser(options = {}) | |
| 13 | 13 | current = language |
| 14 | - languages = Noosfero.locales.map do |code,name| | |
| 15 | - if code == current | |
| 16 | - content_tag('strong', name) | |
| 17 | - else | |
| 18 | - link_to(name, :lang => code) | |
| 19 | - end | |
| 20 | - end.join(' — ') | |
| 14 | + if options[:element] == 'dropdown' | |
| 15 | + select_tag('lang', | |
| 16 | + options_for_select(Noosfero.locales.map{|code,name| [name, code]}, current), | |
| 17 | + :onchange => remote_function(:update => 'wrap', :url => { :action => :index }, :with => "'lang='+value"), | |
| 18 | + :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.') | |
| 19 | + ) | |
| 20 | + else | |
| 21 | + languages = Noosfero.locales.map do |code,name| | |
| 22 | + if code == current | |
| 23 | + content_tag('strong', name) | |
| 24 | + else | |
| 25 | + link_to(name, :lang => code) | |
| 26 | + end | |
| 27 | + end.join(' — ') | |
| 28 | + 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.')) | |
| 29 | + end | |
| 21 | 30 | |
| 22 | - 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.')) | |
| 23 | 31 | end |
| 24 | 32 | |
| 25 | 33 | end | ... | ... |
app/views/layouts/application.rhtml
| ... | ... | @@ -98,6 +98,10 @@ |
| 98 | 98 | prepareMenu('navigation_bar', { timeout: 1000 }); |
| 99 | 99 | </script> |
| 100 | 100 | |
| 101 | + <div id='language-selector'> | |
| 102 | + <%= language_chooser(:element => 'dropdown') %> | |
| 103 | + </div> | |
| 104 | + | |
| 101 | 105 | <div id='user_box'> |
| 102 | 106 | <%= render :file => 'shared/user_menu' %> |
| 103 | 107 | <%= theme_opt_menu_search %> | ... | ... |