修改了企业注册与修改企业资料过程,以及一些企业主页中的显示细节

This commit is contained in:
fanqiang 2013-10-08 16:31:28 +08:00
parent 08aa5be7df
commit 8e51ea7327
6 changed files with 158 additions and 31 deletions

View File

@ -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]

View File

@ -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])

View File

@ -187,6 +187,61 @@
}
</script>
<script type="text/javascript" language="javascript">
function showtechnical_title(identity, technical_titleField) {
switch (identity) {
case '0' :
$('#technical_title').show()
$('#no').hide()
$('#name').show()
$('#enterprise').hide()
$('#gender').show()
var technical_titleOptions = new Array(
"教授","副教授","讲师","助教");
break;
case '1' :
$('#technical_title').hide()
$('#no').show()
$('#name').show()
$('#enterprise').hide()
$('#gender').show()
var titleOptions = new Array("");
break;
case '2' :
$('#technical_title').hide()
$('#no').hide()
$('#name').hide()
$('#enterprise').show()
$('#gender').hide()
var titleOptions = new Array("");
break;
default:
$('#technical_title').hide()
$('#no').hide()
$('#name').show()
$('#enterprise').hide()
$('#gender').show()
var titleOptions = new Array("");
break;
}
technical_titleField.options.length = 0;
for(var i = 0; i < technical_titleOptions.length; i++) {
technical_titleField.options[i]=new Option(technical_titleOptions[i],technical_titleOptions[i]);
/*
if (cityField.options[i].value==city)
{
//alert("here put City ok!");
document.oblogform["city"].selectedIndex = i;
}*/
}
}
</script>
<!-- end -->
<h3><%=l(:label_register)%> <%=link_to l(:label_login_with_open_id_option), signin_url if Setting.openid? %></h3>
@ -195,6 +250,33 @@
<%= error_messages_for 'user' %>
<div class="box tabular">
<p><table><tr><td class="info" align="right" style="width: 90px"><strong><%= l(:label_identity) %><span class="required"> *</span></strong></td>
<td class="info" style="width: 10px">
<select onchange="showtechnical_title(this.value, document.getElementById(&#39;userTechnical_title&#39;));" name="identity" id="userIdentity" class="location">
<option value="">--请选择身份--</option>
<option value="0"><%= l(:label_teacher) %></option>
<option value="1"><%= l(:label_student) %></option>
<option value="2"><%= l(:label_enterprise) %></option>
<option value="3"><%= l(:label_developer) %></option>
</select></td>
<td>
<span id = 'technical_title' style = 'display:none'>
<select name="technical_title" id="userTechnical_title"></select></span>
<span id = 'no' style = 'display:none'>
<!-- modified by fq -->
<% unless User.current.user_extensions.student_id.nil? %>
<%= text_field_tag :no, User.current.user_extensions.student_id, :placeholder => "请输入学号" %></span>
<!-- <input name="no" id="no" value=<%= "#{User.current.user_extensions.student_id}" %> placeholder="请输入学号"></span> -->
<% else %>
<%= text_field_tag :no, nil, :placeholder => "请输入学号" %></span>
<!-- <input name="no" id="no" placeholder="请输入学号"></span> -->
<% end %>
<!-- end -->
</td></tr></table></p>
<% if @user.auth_source_id.nil? %>
<p><%= f.text_field :login, :size => 25, :required => true %>
<em class="info"><%= l(:label_max_number) %></em></p>
@ -203,9 +285,15 @@
<p><%= f.password_field :password_confirmation, :size => 25, :required => true %></p>
<% end %>
<span id = 'name' style = 'display:none'>
<p><%= f.text_field :firstname, :required => true %></p>
<p><%= f.text_field :lastname, :required => true %></p>
</span>
<span id = 'enterprise' style = 'display:none'>
<p><table><tr><td class="info" align="right" style="width: 90px"><strong>企业名<span class="required"> *</span></strong></td>
<td class="info" style="width: 10px">
<%= text_field_tag :enterprise_name %></td></tr></table></p>
</span>
<p><%= f.text_field :mail, :required => true %></p>
<p>
<em class="info"><%="#{l(:label_mail_attention)} "%></em></p>
@ -213,19 +301,12 @@
<!-- added by bai 增加了身份、性别和地区-->
<p><table><tr><td class="info" align="right" style="width: 90px"><strong><%= l(:label_identity) %><span class="required"> *</span></strong></td>
<td class="info" style="width: 10px">
<%= select_tag 'identity', "<option value = '0'>#{l(:label_teacher)}</option>
<option value = '1'>#{l(:label_student)}</option>
<option value = '2'>#{l(:label_enterprise)}</option>
<option value = '3'>#{l(:label_developer)}</option> ".html_safe %></td></tr></table></p>
<span id = 'gender' style = 'display:none'>
<p><table><tr><td class="info" align="right" style="width: 90px"><strong><%= l(:label_gender) %></strong></td>
<td class="info" style="width: 10px">
<%= select_tag 'gender', "<option value = '0'>#{l(:label_gender_male)}</option>
<option value = '1'>#{l(:label_gender_female)}</option>".html_safe %></td></tr></table></p>
<option value = '1'>#{l(:label_gender_female)}</option>".html_safe %></td></tr></table></p></span>
<p><table><tr><td class="info" align="right" style="width: 90px"><strong><%= l(:label_location) %><span class="required"> *</span></strong></td>
<td class="info" style="width: 80px">

View File

@ -42,8 +42,9 @@
<td class="info_font" align="center" style=" word-wrap: break-word; word-break: break-all"><%= h @user.lastname<<@user.firstname %>
<!-- added by bai -->
<% 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 %>
<!-- end -->
@ -118,9 +119,10 @@
<% unless @user.user_extensions.nil? %>
<% unless @user.user_extensions.identity == 2 %>
<tr>
<td style="padding-left: 8px" width="70px"><%= l(:field_occupation) %>:</td><td class="font_lighter_sidebar" style="padding-left: 0px" width="170px"><%= @user.user_extensions.occupation %></td>
</tr>
</tr><% end %>
<tr>
<td style="padding-left: 8px" width="70px"><%= l(:label_location) %>:</td><td class="font_lighter_sidebar" style="padding-left: 0px" width="170px"><%= @user.user_extensions.location %><%= @user.user_extensions.location_city %></td>
</tr>

View File

@ -25,14 +25,21 @@
<%= l(:label_information_plural)%>
</legend>
<div>
<span id = 'name' style = 'display:none'>
<p style="width:400px;padding-left: 26px;">
<%= f.text_field :firstname, :required => true %>
</p>
<p style="width:400px;padding-left: 26px;">
<%= f.text_field :lastname, :required => true %>
</p></span>
<span id = 'enterprise' style = 'display:none'>
<p style="width:400px;padding-left: 26px;">企业名<%= text_field_tag :enterprise_name, @user.firstname %>
</p>
</span>
<!-- added by bai 增加账户里的性别-->
<span id = 'gender' style = 'display:none'>
<% unless @user.user_extensions.nil? %>
<% if @user.user_extensions.gender == 0 %>
<p style="width:400px;padding-left: 26px;">
@ -50,15 +57,6 @@
</p>
<% end %>
<!-- end -->
<p style="width:357px;padding-left: 26px;">
<%= f.text_field :mail, :required => true %>
</p>
<p style="width:426px;padding-left:26px;>
<%= f.select :language, :Chinese简体中文 => :zh, :English => :en%>
</p>
<!-- added by bai 单位-->
<% unless @user.user_extensions.nil?%>
<p style="width:400px;padding-left: 26px;"><%= l(:field_occupation)%><%= text_field_tag "occupation", @user.user_extensions.occupation, :class => 'occupation'%>
@ -70,6 +68,19 @@
<!-- added by bai 增加了地区 -->
</span>
<!-- end -->
<p style="width:357px;padding-left: 26px;">
<%= f.text_field :mail, :required => true %>
</p>
<p style="width:426px;padding-left:26px;>
<%= f.select :language, :Chinese简体中文 => :zh, :English => :en%>
</p>
<script type="text/javascript" language="javascript">
function showcity(province, cityField) {
switch (province) {
@ -353,21 +364,36 @@ $().ready(function(){
case '0' :
$('#technical_title').show()
$('#no').hide()
$('#name').show()
$('#enterprise').hide()
$('#gender').show()
var technical_titleOptions = new Array(
"教授","副教授","讲师","助教");
break;
case '1' :
case '1' :
$('#technical_title').hide()
$('#no').show()
$('#name').show()
$('#enterprise').hide()
$('#gender').show()
var titleOptions = new Array("");
break;
break;
case '2' :
$('#technical_title').hide()
$('#no').hide()
$('#name').hide()
$('#enterprise').show()
$('#gender').hide()
var titleOptions = new Array("");
break;
default:
$('#technical_title').hide()
$('#no').hide()
$('#name').show()
$('#enterprise').hide()
$('#gender').show()
var titleOptions = new Array("");
break;
@ -383,22 +409,19 @@ $().ready(function(){
document.oblogform["city"].selectedIndex = i;
}*/
}
}
</script>
<!-- end -->
<% unless @user.user_extensions.identity == 2 %>
<p style="width:400px;padding-left: 26px;"><%= l(:label_identity) %>
<td class="info" style="width: 10px">
<select onchange="showtechnical_title(this.value, document.getElementById(&#39;userTechnical_title&#39;));" name="identity" id="userIdentity" class="location">
<option value="">--请选择身份--</option>
<option value="0">教师</option>
<option value="1">学生</option>
<option value="2">企业</option>
<option value="3">开发者</option>
</select></td>
@ -416,6 +439,18 @@ $().ready(function(){
<% end %>
<!-- end -->
</td></tr></table></p>
<% else %>
<span style="display:none">
<select onchange="showtechnical_title(this.value, document.getElementById(&#39;userTechnical_title&#39;));" name="identity" id="userIdentity" class="location">
<option value="">--请选择身份--</option>
<option value="0">教师</option>
<option value="1">学生</option>
<option value="2">企业</option>
<option value="3">开发者</option>
</select>
</span>
<% end %>
<!-- end -->
</div>

View File

@ -1279,6 +1279,7 @@ zh:
label_bidding_project: 参与项目
label_homework_project: 已提交作业 #huang
button_bidding: 我要参加
field_enterprise: '企业:'
button_bidding_homework: 参加竞赛 #huang
field_homework_type: 作业类型