Merge branch 'dev_shcool' into develop

This commit is contained in:
cxt 2016-08-26 17:10:15 +08:00
commit 5fbb9f56a6
3 changed files with 16 additions and 5 deletions

View File

@ -30,6 +30,8 @@ class AccountController < ApplicationController
user = UserExtensions.where(:user_id => User.current.id).first
if user.gender.nil? || user.school_id.nil? || User.current.lastname.nil?
redirect_to my_account_path(:tip => 1)
elsif user.identity == 3 && user.occupation.nil?
redirect_to my_account_path(:tip => 1)
else
redirect_to user_path(User.current)
end
@ -357,6 +359,8 @@ class AccountController < ApplicationController
user = UserExtensions.where(:user_id => User.current.id).first
if user.gender.nil? || user.school_id.nil? || User.current.lastname.nil?
redirect_to my_account_path(:tip => 1)
elsif user.identity == 3 && user.occupation.nil?
redirect_to my_account_path(:tip => 1)
else
redirect_back_or_default User.current
#redirect_to my_account_url

View File

@ -165,8 +165,10 @@ class MyController < ApplicationController
@user.pref[:no_self_notified] = (params[:no_self_notified] == '1')
#@user.login = params[:login]
unless @user.user_extensions.nil?
if @user.user_extensions.identity == 2
# 如果用户是从业者将单位名称保存至学校id字段
if @user.user_extensions.identity == 3
# @user.firstname = params[:enterprise_name]
@user.user_extensions.school_id = params[:occupation]
end
end
@ -177,7 +179,6 @@ class MyController < ApplicationController
# @se.occupation = params[:occupation]
# end
@se.school_id = params[:occupation]
@se.gender = params[:sex]
@se.location = params[:province] if params[:province]
@se.location_city = params[:city] if params[:city]
@ -200,6 +201,7 @@ class MyController < ApplicationController
@user.login = lg
end
end
# 不管前面是否有异常,如果文件已存在就删除
ensure
File.delete(diskfile1) if File.exist?(diskfile1)
end

View File

@ -99,8 +99,13 @@
</p>
<!--<input nhname="tag" nh_tag_0="true" nh_tag_1="true" id="occupation_name" type="text" style="display: none;width:117px;" readonly/>-->
<% elsif User.current.user_extensions.identity == 3 || User.current.user_extensions.identity == 2 %>
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="province" style="display: none;" class="w210 fl" type="text" placeholder="--请搜索您所在的高校(单位)--" >
<input nhname="tag" nh_tag_4="true" id="occupation" name="occupation" style="display: none;" class="w210" type="text" value="<%= @user.user_extensions.occupation %>" />
<% if User.current.user_extensions.school_id.nil? %>
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="province" style="display: none;" class="w210 fl" type="text" placeholder="--请搜索您所在的高校(单位)--" >
<input nhname="tag" nh_tag_4="true" id="occupation" name="occupation" style="display: none;" class="w210" type="text" value="<%= @user.user_extensions.occupation %>" />
<% else %>
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="province" style="display: none;" class="w210 fl" type="text"value="<%= User.current.user_extensions.school %>" >
<input nhname="tag" nh_tag_4="true" id="occupation" name="occupation" style="display: none;" class="w210" type="text" value="<%= @user.user_extensions.occupation %>" />
<% end %>
<p class="fl ml10">
<!-- <span id="errortip" class="icons_warning fl mt5" style="display: none;"></span> -->
<span id="hint" style="color: #7f7f7f;display: none"><a id="school_num" href="javascript:void(0)" style="color: red" ></a><a id="search_condition" href="javascript:void(0)"></a></span>
@ -169,7 +174,7 @@
<li>
<%= select_tag( 'user[mail_notification]', options_for_select( user_mail_notification_options(@user), @user.mail_notification) ) %>
<label class="ml10"><%= check_box_tag 'no_self_notified', 1, @user.pref[:no_self_notified],:style => "height:14px;" %>不要发送对我自己提交的修改的通知</label>
<label class="ml10"><%= check_box_tag 'no_self_notified', 1, @user.pref[:no_self_notified], :style => "height:14px;" %>不要发送对我自己提交的修改的通知</label>
</li>
<!--<li><input name="brief_introduction" class="w450" type="text" maxlength="255" value="<%#= (@user.user_extensions.nil?) ? '' : @user.user_extensions.brief_introduction %>"></li>-->
<li style="height:auto;"><textarea name="description" class="w450 h200" maxlength="255" style="resize:none;"><%= (@user.user_extensions.nil?) ? '' : @user.user_extensions.description %></textarea></li>