修改bug<有些课程school_id=0 或为空则课程进不去>

Signed-off-by: alan <547533434@qq.com>
This commit is contained in:
alan 2014-10-31 20:46:23 +08:00
parent cbc2d2e99d
commit 9c4c1679af
4 changed files with 65 additions and 7 deletions

View File

@ -21,6 +21,9 @@
<%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags -->
<%= yield :header_tags -%>
<% title1 = @user.user_extensions.technical_title %>
<% language1 = @user.language %>
<script type="text/javascript">
function startXMLHttp()
{
@ -36,11 +39,55 @@
{
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;
}
}
document.getElementById('td_tech_title').innerHTML = title1;
}
</script>
</head>
<!--加上 onload="Javascript:t()" 开始定时刷新分数 -->
<body class="<%= h body_css_classes %>">
<body class="<%= h body_css_classes %>" onload="init_title()" >
<div id="wrapper">
<div id="wrapper2">
<div id="wrapper3">
@ -193,8 +240,8 @@
<td style="padding-left: 5px" width="76px">
<%= l(:label_technical_title) %>:
</td>
<td class="font_lighter_sidebar" style="padding-left: 0px" width="170px">
<%= @user.user_extensions.technical_title %>
<td class="font_lighter_sidebar" style="padding-left: 0px" width="170px">
<span id = "td_tech_title"></span>
</td>
<% end %>
</tr>

View File

@ -61,7 +61,7 @@
<!-- 昵称 -->
<p style="width:630px;padding-left: 26px;">
<%= f.text_field :login, :required => true, :name => "login"%>
<%= f.text_field :login, :required => true, :size => 25, :name => "login"%>
<span class='font_lighter'><%= l(:label_max_number) %></span>
<br/>
</p>
@ -69,13 +69,13 @@
<div>
<span id='name' style='display:none'>
<p style="width:530px;padding-left: 26px;">
<%= f.text_field :lastname, :required => true %>
<%= f.text_field :lastname, :size => 25, :required => true %>
<span class='font_lighter'>
<%= l(:field_lastname_eg) %>
</span>
</p>
<p style="width:530px;padding-left: 26px;">
<%= f.text_field :firstname, :required => true %>
<%= f.text_field :firstname, :size => 25, :required => true %>
<span class='font_lighter'>
<%= l(:field_firstname_eg) %>
</span>

View File

@ -0,0 +1,11 @@
#encoding=UTF-8
class ChangeSchoolIdForSchool < ActiveRecord::Migration
def up
sql = "update courses, user_extensions set courses.school_id = user_extensions.school_id
where courses.tea_id = user_extensions.user_id"
execute(sql)
end
def down
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20141031065238) do
ActiveRecord::Schema.define(:version => 20141031122331) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false