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_identity) %> * | ++ | ++ | + + +<% else %> +<%= text_field_tag :no, nil, :placeholder => "请输入学号" %> + +<% end %> + +
<%= 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 %> |
<%= 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 %> | @@ -416,6 +439,18 @@ $().ready(function(){ <% end %> |