diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 04323c1c5..80fb89178 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -148,7 +148,7 @@ class AccountController < ApplicationController #added by bai unless @user.id.nil? - UserExtensions.create(:identity => params[:identity].to_i,:gender => params[:gender].to_i, :user_id => @user.id) + UserExtensions.create(:identity => params[:identity].to_i,:gender => params[:gender].to_i,:location => params[:province]+params[:city], :user_id => @user.id) end #end diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb index c6a183bbf..89aa9f906 100644 --- a/app/controllers/my_controller.rb +++ b/app/controllers/my_controller.rb @@ -77,17 +77,19 @@ class MyController < ApplicationController # ue.save # end - # added by bai + # added by bai 往数据库里写职业、性别和地区 if @user.user_extensions.nil? se = UserExtensions.new se.user_id = @user.id se.occupation = params[:occupation] se.gender = params[:gender] + se.location = params[:province]+params[:city] se.save else se = @user.user_extensions se.occupation = params[:occupation] se.gender = params[:gender] + se.location = params[:province]+params[:city] se.save end # end diff --git a/app/views/account/register.html.erb b/app/views/account/register.html.erb index 639d845bf..1f09ba6ab 100644 --- a/app/views/account/register.html.erb +++ b/app/views/account/register.html.erb @@ -1,3 +1,194 @@ + + + + +
<%= f.select :language, lang_options_for_select %>
- +<%= l(:label_identity) %><%= select_tag 'identity', "".html_safe %>
<%= l(:label_gender) %><%= select_tag 'gender', "".html_safe %>
+<%= l(:label_location) %> +
<% if Setting.openid? %> diff --git a/app/views/layouts/base_users.html.erb b/app/views/layouts/base_users.html.erb index 176ea8bbb..7a6179361 100644 --- a/app/views/layouts/base_users.html.erb +++ b/app/views/layouts/base_users.html.erb @@ -72,6 +72,28 @@<%= l(:label_gender) %><%= select_tag 'gender', "".html_safe %>
+ <% unless @user.user_extensions.nil? %> + <% if @user.user_extensions.gender == 0 %> ++ <%= l(:label_gender) %><%= select_tag 'gender', "".html_safe ,:class =>'gender' %> +
+ + <% else %> ++ <%= l(:label_gender) %><%= select_tag 'gender', "".html_safe %> +
+ + <% end %> + <% else %> +<%= l(:label_gender) %><%= select_tag 'gender', "".html_safe %>
+ <% end %> +@@ -44,9 +59,270 @@ <%= f.select :language, :Chinese简体中文 => :zh, :English => :en%>
- + + <% unless @user.user_extensions.nil?%> +<%= l(:field_occupation)%><%= text_field_tag "occupation", @user.user_extensions.occupation%> +
+ <%else%><%= l(:field_occupation)%><%= text_field_tag "occupation"%>
+ <%end%> + + + + + + +<%= l(:label_location) %> +
<% if Setting.openid? %> diff --git a/config/locales/en.yml b/config/locales/en.yml index cdfc7c830..ea267ce04 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1420,5 +1420,6 @@ en: label_gender: Gender label_gender_male: male label_gender_female: female + label_location: Location #end diff --git a/config/locales/zh.yml b/config/locales/zh.yml index db680d8a7..6ce21cbd5 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1429,6 +1429,7 @@ zh: label_gender: 性别 label_gender_male: 男 label_gender_female: 女 + label_location: 地区 #end diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 0cc4b45a4..91cf2ca39 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -1173,7 +1173,7 @@ ul.properties li span {font-style:italic;} .total-hours { font-size: 110%; font-weight: bold; } .total-hours span.hours-int { font-size: 120%; } - +select.gender { width: 20%; } .autoscroll {overflow-x: auto; padding:1px; margin-bottom: 1.2em;} #user_login, #user_firstname, #user_lastname, #user_mail, #my_account_form select, #user_form select, #user_identity_url { width: 60%; }