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

View File

@ -61,7 +61,7 @@
<!-- 昵称 --> <!-- 昵称 -->
<p style="width:630px;padding-left: 26px;"> <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> <span class='font_lighter'><%= l(:label_max_number) %></span>
<br/> <br/>
</p> </p>
@ -69,13 +69,13 @@
<div> <div>
<span id='name' style='display:none'> <span id='name' style='display:none'>
<p style="width:530px;padding-left: 26px;"> <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'> <span class='font_lighter'>
<%= l(:field_lastname_eg) %> <%= l(:field_lastname_eg) %>
</span> </span>
</p> </p>
<p style="width:530px;padding-left: 26px;"> <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'> <span class='font_lighter'>
<%= l(:field_firstname_eg) %> <%= l(:field_firstname_eg) %>
</span> </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. # 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| create_table "activities", :force => true do |t|
t.integer "act_id", :null => false t.integer "act_id", :null => false