diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index deeafaa7d..04323c1c5 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, :user_id => @user.id) + UserExtensions.create(:identity => params[:identity].to_i,:gender => params[:gender].to_i, :user_id => @user.id) end #end diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb index d5a4834a4..c6a183bbf 100644 --- a/app/controllers/my_controller.rb +++ b/app/controllers/my_controller.rb @@ -78,14 +78,16 @@ class MyController < ApplicationController # end # added by bai - if @user.UserExtensions.nil? + if @user.user_extensions.nil? se = UserExtensions.new se.user_id = @user.id - se.occupation = params[:occupation] + se.occupation = params[:occupation] + se.gender = params[:gender] se.save else se = @user.user_extensions se.occupation = params[:occupation] + se.gender = params[:gender] se.save end # end diff --git a/app/views/account/register.html.erb b/app/views/account/register.html.erb index 292cf9a74..639d845bf 100644 --- a/app/views/account/register.html.erb +++ b/app/views/account/register.html.erb @@ -1,4 +1,4 @@ -

<%=l(:label_register)%> <%=link_to l(:label_loginkk), signin_url if Setting.openid? %>

+

<%=l(:label_register)%> <%=link_to l(:label_login_with_open_id_option), signin_url if Setting.openid? %>

<%= labelled_form_for @user, :url => register_path do |f| %> <%= error_messages_for 'user' %> @@ -20,9 +20,10 @@ <%="#{l(:label_mail_attention)} "%>

<%= f.select :language, lang_options_for_select %>

- +

<%= l(:label_identity) %><%= select_tag 'identity', "".html_safe %>

+

<%= l(:label_gender) %><%= select_tag 'gender', "".html_safe %>

<% if Setting.openid? %> diff --git a/app/views/layouts/base_users.html.erb b/app/views/layouts/base_users.html.erb index 8641e3138..176ea8bbb 100644 --- a/app/views/layouts/base_users.html.erb +++ b/app/views/layouts/base_users.html.erb @@ -33,7 +33,13 @@ - diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index 9a89af75c..af855d5a3 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -31,14 +31,24 @@

<%= f.text_field :lastname, :required => true %>

+ + +

<%= l(:label_gender) %><%= select_tag 'gender', "".html_safe %>

+

+ +

<%= f.text_field :mail, :required => true %>

-

+

+ + <% if Setting.openid? %>

<%= f.text_field :identity_url %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 552e029e7..cdfc7c830 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1411,3 +1411,14 @@ en: label_in_bids: in the call: label_in_users: in the user: label_user_create_project: has created + +#added by bai + label_identity: Identity + label_teacher: Teacher + label_student: Student + label_other: Other + label_gender: Gender + label_gender_male: male + label_gender_female: female +#end + diff --git a/config/locales/zh.yml b/config/locales/zh.yml index d31671777..db680d8a7 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1209,6 +1209,8 @@ zh: #added by liuping button_unfollow: 取消关注 button_follow: 关注 + label_followers: 关注 + label_responses: 留言 label_delete_confirm: 确认删除? label_more_tags: 更多 label_tags_bid: 需求名称 @@ -1424,7 +1426,9 @@ zh: label_teacher: 教师 label_student: 学生 label_other: 其他 - + label_gender: 性别 + label_gender_male: 男 + label_gender_female: 女 #end diff --git a/public/images/sidebar/male.png b/public/images/sidebar/male.png index f432062af..294e8d38d 100644 Binary files a/public/images/sidebar/male.png and b/public/images/sidebar/male.png differ

<%= h @user.lastname<<@user.firstname %> <%=image_tag("/images/sidebar/male.png", weight:"11px", height:"11px") %> + <%= h @user.lastname<<@user.firstname %> + + <% unless @user.user_extensions.nil?%> + <% if @user.user_extensions.gender == 1 %> <%=image_tag("/images/sidebar/female.png", weight:"22px", height:"22px") %> + <% else %> <%=image_tag("/images/sidebar/male.png", weight:"25px", height:"25px") %> <% end %> + <% else %> <%=image_tag("/images/sidebar/male.png", weight:"25px", height:"25px") %> <% end %> +