From 8e51ea7327f1b17eda7f329c1a9be3116fa0cdbf Mon Sep 17 00:00:00 2001 From: fanqiang <316257774@qq.com> Date: Tue, 8 Oct 2013 16:31:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E4=BC=81=E4=B8=9A?= =?UTF-8?q?=E6=B3=A8=E5=86=8C=E4=B8=8E=E4=BF=AE=E6=94=B9=E4=BC=81=E4=B8=9A?= =?UTF-8?q?=E8=B5=84=E6=96=99=E8=BF=87=E7=A8=8B=EF=BC=8C=E4=BB=A5=E5=8F=8A?= =?UTF-8?q?=E4=B8=80=E4=BA=9B=E4=BC=81=E4=B8=9A=E4=B8=BB=E9=A1=B5=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E6=98=BE=E7=A4=BA=E7=BB=86=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/account_controller.rb | 5 ++ app/controllers/my_controller.rb | 3 + app/views/account/register.html.erb | 103 +++++++++++++++++++++++--- app/views/layouts/base_users.html.erb | 8 +- app/views/my/account.html.erb | 69 ++++++++++++----- config/locales/zh.yml | 1 + 6 files changed, 158 insertions(+), 31 deletions(-) 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 %> |