Commit 9eb6f1f7568ff22971beda0a0237e5c07c823498
1 parent
87fc860b
Exists in
master
and in
29 other branches
ActionItem373: fixing page reload after select language on dropdown
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1924 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
2 changed files
with
22 additions
and
2 deletions
Show diff stats
app/helpers/language_helper.rb
... | ... | @@ -14,7 +14,7 @@ module LanguageHelper |
14 | 14 | if options[:element] == 'dropdown' |
15 | 15 | select_tag('lang', |
16 | 16 | options_for_select(Noosfero.locales.map{|code,name| [name, code]}, current), |
17 | - :onchange => remote_function(:update => 'wrap', :url => { :action => :index }, :with => "'lang='+value"), | |
17 | + :onchange => "document.location='?' + name + '=' + value;", | |
18 | 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 | 19 | ) |
20 | 20 | else |
... | ... | @@ -27,7 +27,6 @@ module LanguageHelper |
27 | 27 | end.join(' — ') |
28 | 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 | 29 | end |
30 | - | |
31 | 30 | end |
32 | 31 | |
33 | 32 | end | ... | ... |
test/unit/language_helper_test.rb
... | ... | @@ -36,6 +36,27 @@ class LanguageHelperTest < Test::Unit::TestCase |
36 | 36 | |
37 | 37 | end |
38 | 38 | |
39 | + should 'generate drodown language chooser correcly' do | |
40 | + Noosfero.expects(:locales).returns({ 'en' => 'English', 'pt_BR' => 'Português Brasileiro', 'fr' => 'Français', 'it' => 'Italiano' }).at_least_once | |
41 | + | |
42 | + self.expects(:language).returns('pt_BR') | |
43 | + result = self.language_chooser(:element => 'dropdown') | |
44 | + assert_match /<option value="en" selected="selected">English<\/option>/, result | |
45 | + | |
46 | + #assert_match /<strong>Português Brasileiro<\/strong>/, result | |
47 | + #assert_no_match /<strong>English<\/strong>/, result | |
48 | + #assert_no_match /<strong>Français<\/strong>/, result | |
49 | + #assert_no_match /<strong>Italiano<\/strong>/, result | |
50 | + | |
51 | + #self.expects(:language).returns('fr') | |
52 | + #result = self.language_chooser | |
53 | + #assert_no_match /<strong>Português Brasileiro<\/strong>/, result | |
54 | + #assert_no_match /<strong>English<\/strong>/, result | |
55 | + #assert_match /<strong>Français<\/strong>/, result | |
56 | + #assert_no_match /<strong>Italiano<\/strong>/, result | |
57 | + | |
58 | + end | |
59 | + | |
39 | 60 | protected |
40 | 61 | |
41 | 62 | def _(s) | ... | ... |