]> git.openstreetmap.org Git - rails.git/commitdiff
Add a simple edit control for the user's preferred languages.
authorTom Hughes <tom@compton.nu>
Sun, 31 May 2009 15:22:59 +0000 (15:22 +0000)
committerTom Hughes <tom@compton.nu>
Sun, 31 May 2009 15:22:59 +0000 (15:22 +0000)
app/controllers/user_controller.rb
app/views/user/account.rhtml
config/locales/en.yml

index 2050ffdb4506056bbb39811ba34fd745ad6b8402..9c2787cc84c6002359775c9dde2c0b198d65a9e8 100644 (file)
@@ -50,10 +50,13 @@ class UserController < ApplicationController
       end
 
       @user.description = params[:user][:description]
+      @user.languages = params[:user][:languages].split(",")
       @user.home_lat = params[:user][:home_lat]
       @user.home_lon = params[:user][:home_lon]
 
       if @user.save
+        set_locale
+
         if params[:user][:email] == @user.new_email
           flash[:notice] = I18n.t('user.account.flash update success confirm needed')
           Notifier.deliver_email_confirm(@user, @user.tokens.create)
index 4552c22a13fa5fddb67dd4bfc39703562b054741..1df79c789bbb4823f5440731681feb69a6dbf08a 100644 (file)
@@ -20,6 +20,8 @@
 
   <tr><td class="fieldName" valign="top"><%= t 'user.account.profile description' %></td><td><%= f.text_area :description, :rows => '5', :cols => '60' %><br /><br /></td></tr>
 
+  <tr><td class="fieldName" valign="top"><%= t 'user.account.preferred languages' %></td><td><%= f.text_field :languages %><br /><br /></td></tr>
+
   <tr id="homerow" <% unless @user.home_lat and @user.home_lon %> class="nohome" <%end%> ><td class="fieldName"><%= t 'user.account.home location' %></td><td><em class="message"><%= t 'user.account.no home location' %></em><span class="location"><%= t 'user.account.latitude' %> <%= f.text_field :home_lat, :size => 20, :id => "home_lat" %><%= t 'user.account.longitude' %><%= f.text_field :home_lon, :size => 20, :id => "home_lon" %></span></td></tr>
 
   <tr><td></td><td>
index bbd4f2d1b6535d0978f8a990bb646e437172cb55..c3662c220d402ede0a432bc3c724b04526bed3b8 100644 (file)
@@ -401,6 +401,7 @@ en:
         disabled: "Disabled and cannot edit data, all previous edits are anonymous."
         disabled link text: "why can't I edit?"
       profile description: "Profile Description: "
+      preferred languages: "Preferred Languages: "
       home location: "Home Location: "
       no home location: "You have not entered your home location."
       latitude: "Latitude: "