This commit is contained in:
sw 2014-10-28 09:31:18 +08:00
commit 0ff7eec412
2 changed files with 47 additions and 3 deletions

View File

@ -178,6 +178,7 @@
<% city = User.current.user_extensions.location_city %>
<% identity = User.current.user_extensions.identity %>
<% title = User.current.user_extensions.technical_title %>
<% language = User.current.language %>
<script type="text/javascript" language="javascript">
$().ready(function () {
var province = "<%= "#{province}" %>"
@ -185,7 +186,8 @@
init_province_and_city(document.getElementById('userProvince'), province, document.getElementById('userCity'), city);
var identity = "<%= "#{identity}" %>"
var title = "<%= "#{title}" %>"
init_identity_and_title(document.getElementById('userIdentity'), identity, document.getElementById('userTechnical_title'), title);
var language = "<%= "#{language}" %>"
init_identity_and_title(document.getElementById('userIdentity'), identity, document.getElementById('userTechnical_title'), title, language);
});
</script>
@ -526,15 +528,55 @@
}
}
}
function init_identity_and_title(pField, identity, cField, title) {
function init_identity_and_title(pField, identity, cField, title, language) {
for (var i = 0; i < pField.options.length; i++) {
if (pField.options[i].value == identity) {
pField.selectedIndex = i;
}
}
showtechnical_title(identity, cField);
if(language == 'zh') {
switch (title) {
case 'Professor' :
title1 = '教授';
break;
case 'Associate professor' :
title1 = '副教授';
break;
case 'Lecturer' :
title1 = '讲师';
break;
case 'Teaching assistant' :
title1 = '助教';
break;
default :
title1 = title;
break;
}
}
else {
switch (title) {
case '教授' :
title1 = 'Professor';
break;
case '副教授' :
title1 = 'Associate professor';
break;
case '讲师' :
title1 = 'Lecturer';
break;
case '助教' :
title1 = 'Teaching assistant';
break;
default :
title1 = title;
break;
}
}
for (var i = 0; i < cField.options.length; i++) {
if (cField.options[i].value == title) {
if (cField.options[i].value == title1) {
cField.selectedIndex = i;
}
}

View File

@ -204,6 +204,8 @@ default:
# specific configuration options for production environment
# that overrides the default ones
production:
# CJK support
rmagick_font_path: /usr/share/fonts/ipa-mincho/ipam.ttf
# specific configuration options for development environment
# that overrides the default ones