diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 062199491..769214d65 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -111,6 +111,11 @@ class AccountController < ApplicationController user_params = params[:user] || {} @user = User.new @user.safe_attributes = user_params + #这里判断 + if params[:identity] == "2" + @user.firstname = params[:enterprise_name] + @user.lastname = l(:field_enterprise) + end @user.admin = false @user.register if session[:auth_source_registration] diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb index 550f2f903..941e3bf19 100644 --- a/app/controllers/my_controller.rb +++ b/app/controllers/my_controller.rb @@ -68,6 +68,9 @@ class MyController < ApplicationController @user.safe_attributes = params[:user] @user.pref.attributes = params[:pref] @user.pref[:no_self_notified] = (params[:no_self_notified] == '1') + if params[:identity] == "2" + @user.firstname = params[:enterprise_name] + end # # UserExtensions.create(:user_id => @user.id, :occupation => params[:occupation]) diff --git a/app/views/account/register.html.erb b/app/views/account/register.html.erb index 59184d697..48b4641a7 100644 --- a/app/views/account/register.html.erb +++ b/app/views/account/register.html.erb @@ -187,6 +187,61 @@ } + +

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

@@ -195,6 +250,33 @@ <%= error_messages_for 'user' %>
+

+ +
<%= l(:label_identity) %> * + + + + +<% else %> +<%= text_field_tag :no, nil, :placeholder => "请输入学号" %> + +<% end %> + +

+ + <% if @user.auth_source_id.nil? %>

<%= f.text_field :login, :size => 25, :required => true %> <%= l(:label_max_number) %>

@@ -203,9 +285,15 @@

<%= f.password_field :password_confirmation, :size => 25, :required => true %>

<% end %> - + +

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

<%="#{l(:label_mail_attention)} "%>

@@ -213,19 +301,12 @@ - -

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

- - + +

- + <% end %> diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index 86f273e4a..d516dd706 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -25,14 +25,21 @@ <%= l(:label_information_plural)%>
+ + + +
@@ -416,6 +439,18 @@ $().ready(function(){ <% end %>
<%= l(:label_location) %> * diff --git a/app/views/layouts/base_users.html.erb b/app/views/layouts/base_users.html.erb index 009b40d5e..5ac13e207 100644 --- a/app/views/layouts/base_users.html.erb +++ b/app/views/layouts/base_users.html.erb @@ -42,8 +42,9 @@ <%= 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 %> + <% unless @user.user_extensions.identity == 2 %> + <% 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 %><% end %> <% else %> <%=image_tag("/images/sidebar/male.png", weight:"25px", height:"25px") %> <% end %> @@ -118,9 +119,10 @@ <% unless @user.user_extensions.nil? %> + <% unless @user.user_extensions.identity == 2 %>
<%= l(:field_occupation) %>:<%= @user.user_extensions.occupation %>
<%= l(:label_location) %>:<%= @user.user_extensions.location %><%= @user.user_extensions.location_city %>

+<% else %> + + + +<% end %>
diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 52721ce4a..d3adb6055 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1279,6 +1279,7 @@ zh: label_bidding_project: 参与项目 label_homework_project: 已提交作业 #huang button_bidding: 我要参加 + field_enterprise: '企业:' button_bidding_homework: 参加竞赛 #huang field_homework_type: 作业类型