#1887 用户职称显示问题

This commit is contained in:
sw 2015-01-29 16:39:25 +08:00
parent bf75f32903
commit b71d714103
2 changed files with 17 additions and 54 deletions

View File

@ -1963,6 +1963,15 @@ module ApplicationHelper
end end
def get_technical_title user def get_technical_title user
#user.user_extensions.technical_title if user.user_extensions.technical_title == "Professor" || user.user_extensions.technical_title == "教授"
technical_title = l(:label_technicl_title_professor)
elsif user.user_extensions.technical_title == "Associate professor" || user.user_extensions.technical_title == "副教授"
technical_title = l(:label_technicl_title_associate_professor)
elsif user.user_extensions.technical_title == "Lecturer" || user.user_extensions.technical_title == "讲师"
technical_title = l(:label_technicl_title_lecturer)
elsif user.user_extensions.technical_title == "Teaching assistant" || user.user_extensions.technical_title == "助教"
technical_title = l(:label_technicl_title_teaching_assistant)
end
technical_title
end end
end end

View File

@ -21,8 +21,6 @@
<%= call_hook :view_layouts_base_html_head %> <%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags --> <!-- page specific tags -->
<%= yield :header_tags -%> <%= yield :header_tags -%>
<% title1 = @user.user_extensions.technical_title %>
<% language1 = @user.language %>
<script type="text/javascript"> <script type="text/javascript">
function startXMLHttp() function startXMLHttp()
@ -39,59 +37,11 @@
{ {
setInterval("startXMLHttp()",5000); setInterval("startXMLHttp()",5000);
} }
function init_title() {
var title = "<%= "#{title1}" %>"
var language = "<%= "#{language1}" %>"
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;
}
}
var obj = document.getElementById('td_tech_title');
if(!(obj == "undefined" || obj == null))
{
obj.innerHTML = title1;
}
}
</script> </script>
</head> </head>
<!--加上 onload="Javascript:t()" 开始定时刷新分数 --> <!--加上 onload="Javascript:t()" 开始定时刷新分数 -->
<body class="<%= h body_css_classes %>" onload="init_title()" > <body class="<%= h body_css_classes %>">
<div id="wrapper"> <div id="wrapper">
<div id="wrapper2"> <div id="wrapper2">
<div id="wrapper3"> <div id="wrapper3">
@ -283,10 +233,14 @@
<tr> <tr>
<% if @user.user_extensions.identity == 0 %> <% if @user.user_extensions.identity == 0 %>
<td style=" float: right" width="70px" > <td style=" float: right" width="70px" >
<span style="float: right"> <%= l(:label_technical_title) %></span> <span style="float: right">
<%= l(:label_technical_title) %>
</span>
</td> </td>
<td class="font_lighter_sidebar" style="padding-left: 0px" width="170px"> <td class="font_lighter_sidebar" style="padding-left: 0px" width="170px">
<span id = "td_tech_title"></span> <span id = "td_tech_title">
<%= get_technical_title @user %>
</span>
</td> </td>
<% end %> <% end %>
</tr> </tr>