register Mod
This commit is contained in:
parent
94542e935a
commit
8fb82bbdc4
|
@ -137,6 +137,7 @@ class User < Principal
|
|||
has_one :user_extensions,:dependent => :destroy
|
||||
## end
|
||||
|
||||
#default_scope -> { includes(:user_extensions, :user_score) }
|
||||
scope :teacher, -> {
|
||||
joins(:user_extensions).where('user_extensions.identity = ?', UserExtensions::TEACHER)
|
||||
}
|
||||
|
|
|
@ -250,36 +250,40 @@
|
|||
<%= 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>
|
||||
<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('userTechnical_title'));" name="identity" id="userIdentity" class="location">
|
||||
<select onchange="showtechnical_title(this.value, document.getElementById('userTechnical_title'));" 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_account_developer) %></option>
|
||||
|
||||
</select></td>
|
||||
</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.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>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</p>
|
||||
|
||||
<% if @user.auth_source_id.nil? %>
|
||||
<p><%= f.text_field :login, :size => 25, :required => true %><span id="valid_user_login"></span>
|
||||
<em class="info"><%= l(:label_max_number) %></em></p>
|
||||
|
||||
<p><%= f.password_field :password, :size => 25, :required => true %>
|
||||
<em class="info"><%= l(:text_caracters_minimum, :count => Setting.password_min_length) %></em></p>
|
||||
|
||||
|
@ -290,33 +294,49 @@
|
|||
<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>
|
||||
<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>
|
||||
<%= text_field_tag :enterprise_name %></td>
|
||||
</tr>
|
||||
</table>
|
||||
</p>
|
||||
</span>
|
||||
|
||||
<p><%= f.text_field :mail, :required => true %><span id="valid_user_mail"></span></p>
|
||||
|
||||
<p>
|
||||
<em class="info"><%= "#{l(:label_mail_attention)} " %></em></p>
|
||||
|
||||
<p><%= f.select :language, lang_options_for_select, :required => true %></p>
|
||||
|
||||
<!-- added by bai 增加了身份、性别和地区-->
|
||||
|
||||
<span id='gender' style='display:none'>
|
||||
<p>
|
||||
<table><tr>
|
||||
<td class="info" align="right" style="width: 90px"><strong><%= l(:label_gender) %><span class="required"> </span></strong></td>
|
||||
<table>
|
||||
<tr>
|
||||
<td class="info" align="right" style="width: 90px">
|
||||
<strong><%= l(:label_gender) %><span class="required"> </span></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>
|
||||
</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>
|
||||
<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">
|
||||
<select onchange="showcity(this.value, document.getElementById('userCity'));" name="province" id="userProvince">
|
||||
<select onchange="showcity(this.value, document.getElementById('userCity'));" name="province" id="userProvince">
|
||||
<option value="">--请选择省份--</option>
|
||||
<option value="北京">北京</option>
|
||||
<option value="上海">上海</option>
|
||||
|
@ -353,13 +373,24 @@
|
|||
<option value="澳门">澳门特别行政区</option>
|
||||
<option value="台湾">台湾</option>
|
||||
<option value="海外">海外</option>
|
||||
</select></td>
|
||||
</select>
|
||||
</td>
|
||||
<td class="info" style="width: 100px">
|
||||
<select name="city" id="userCity"></select></td></tr></table></p>
|
||||
<select name="city" id="userCity"></select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</p>
|
||||
<!-- end -->
|
||||
</div>
|
||||
|
||||
<p><table><tr><td><%= submit_tag l(:button_submit) %></td></tr></table></p>
|
||||
<p>
|
||||
<table>
|
||||
<tr>
|
||||
<td><%= submit_tag l(:button_submit) %></td>
|
||||
</tr>
|
||||
</table>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
<% if Setting.openid? %>
|
||||
|
@ -375,34 +406,41 @@
|
|||
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function () {
|
||||
var $login = $('#user_login')
|
||||
var $mail = $('#user_mail')
|
||||
|
||||
jQuery(document).ready(function() {
|
||||
$login.blur(function (event) {
|
||||
var $parent = $(this).parent();
|
||||
if ($(this).is('#user_login')) {
|
||||
$.get('<%=account_valid_ajax_path%>?valid=login&value='+this.value, function(data) {
|
||||
$.get(
|
||||
'<%=account_valid_ajax_path%>',
|
||||
{ valid: "login",
|
||||
value: this.value },
|
||||
function (data) {
|
||||
if (data.valid) {
|
||||
$('#valid_user_login').html('<span class="green">' + data.message + "</span>");
|
||||
} else {
|
||||
$('#valid_user_login').html('<span class="red">' + data.message + "</span>");
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
;
|
||||
});
|
||||
|
||||
$mail.blur(function (event) {
|
||||
var $parent = $(this).parent();
|
||||
if ($(this).is('#user_mail')) {
|
||||
$.get('<%=account_valid_ajax_path%>?valid=mail&value='+this.value, function(data) {
|
||||
$.get('<%=account_valid_ajax_path%>',
|
||||
{ valid: "mail",
|
||||
value: this.value },
|
||||
function (data) {
|
||||
if (data.valid) {
|
||||
$('#valid_user_mail').html('<span class="green">' + data.message + "</span>");
|
||||
} else {
|
||||
$('#valid_user_mail').html('<span class="red">' + data.message + "</span>");
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
;
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue