185 lines
6.4 KiB
Plaintext
185 lines
6.4 KiB
Plaintext
<h3>
|
|
课程列表
|
|
</h3>
|
|
<%= render 'tab_syllabuses_courses' %>
|
|
|
|
<h3>
|
|
课程列表
|
|
</h3>
|
|
|
|
<%= form_tag({}, :method => :get) do %>
|
|
<fieldset>
|
|
<label for='name'>
|
|
课程:
|
|
</label>
|
|
<%= text_field_tag 'name', params[:name], :size => 30, :placeholder => '课程名称' %>
|
|
<%= submit_tag l(:button_apply), :class => "small", :name => nil %>
|
|
<%= link_to l(:button_clear), {:controller => 'admin', :action => 'syllabuses'}, :class => 'icon icon-reload' %>
|
|
</fieldset>
|
|
<% end %>
|
|
|
|
|
|
<div class="autoscroll">
|
|
<table class="list" style="width: 100%;table-layout: fixed">
|
|
<thead>
|
|
<tr>
|
|
<th style="width: 30px;">
|
|
序号
|
|
</th>
|
|
<th style="width: 85px;">
|
|
课程名称
|
|
</th>
|
|
<th style="width: 85px;">
|
|
班级名称
|
|
</th>
|
|
<th style="width: 35px;">
|
|
创建老师
|
|
</th>
|
|
<th style="width: 60px;">
|
|
<%=l(:field_created_on)%>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<% @syllabuses.each do |syllabus| %>
|
|
<tr class="odd">
|
|
<td style="text-align: center;">
|
|
<%= syllabus.id %>
|
|
</td>
|
|
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=syllabus.title%>' id="syllabus_title_<%=syllabus.id %>">
|
|
<%= render :partial => 'admin/rename_syllabus_title', :locals => {:syllabus => syllabus} %>
|
|
</td>
|
|
<td class="center">
|
|
</td>
|
|
<td align="center">
|
|
<%= link_to(syllabus.try(:user).try(:realname).truncate(6, omission: '...'), user_path(syllabus.user)) %>
|
|
</td>
|
|
<td class="center">
|
|
<%= format_date(syllabus.created_at) %>
|
|
</td>
|
|
</tr>
|
|
<% courses = syllabus.courses %>
|
|
<% courses.each do |course| %>
|
|
<tr class="even">
|
|
<td style="text-align: center;">
|
|
<%= course.id %>
|
|
</td>
|
|
<td class="center">
|
|
</td>
|
|
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=course.name%>' id="syllabus_course_name_<%=course.id %>">
|
|
<%= render :partial => 'admin/rename_course_name', :locals => {:course => course} %>
|
|
</td>
|
|
<td align="center">
|
|
<%= link_to(course.try(:teacher).try(:realname).truncate(6, omission: '...'), user_path(course.teacher)) %>
|
|
</td>
|
|
<td class="center">
|
|
<%= format_date(course.created_at) %>
|
|
</td>
|
|
</tr>
|
|
<% end %>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="pagination">
|
|
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
var CourseTagNameHtml; //当前双击的链接的父节点的html
|
|
var CourseParentCssBorder; //当前双击的链接的父节点
|
|
var CourseEle; //当前双击的链接
|
|
var CourseTagId; //班级的id
|
|
var CourseTagName; //班级名称
|
|
var CourseIsdb;
|
|
|
|
function rename_course_name(domEle,name,id){
|
|
CourseIsdb = true; //这是双击
|
|
//clearTimeout(clickFunction);
|
|
if (domEle.children().get(0) != undefined) { //已经是编辑框的情况下不要动
|
|
return;
|
|
}
|
|
CourseTagNameHtml = domEle.parent().html();
|
|
CourseParentCssBorder = domEle.parent().css("border");
|
|
CourseEle = domEle;
|
|
CourseTagId = id;
|
|
CourseTagName = name;
|
|
domEle.html('<input name="" id="renameCourseName" maxlength="120" minlength="1" style="width:125px;" value="' + name + '"/>');
|
|
domEle.parent().css("border", "1px solid #ffffff");
|
|
$("#renameCourseName").focus();
|
|
}
|
|
|
|
$(function(){
|
|
$("#renameCourseName").live("blur",function(){
|
|
updateCourseName();
|
|
}).live("keypress",function(e){
|
|
if (e.keyCode == '13') {
|
|
updateCourseName();
|
|
}
|
|
});
|
|
$("#renameSyllabusTitle").live("blur",function(){
|
|
updateSyllabusTitle();
|
|
}).live("keypress",function(e){
|
|
if (e.keyCode == '13') {
|
|
updateSyllabusTitle();
|
|
}
|
|
});
|
|
});
|
|
|
|
//执行修改TAGName方法
|
|
function updateCourseName(){
|
|
if(CourseIsdb){
|
|
CourseIsdb = false;
|
|
if($("#renameCourseName").val() == CourseTagName){ //如果值一样,则恢复原来的状态
|
|
ele.parent().css("border","");
|
|
ele.parent().html(CourseTagNameHtml);
|
|
}
|
|
else{
|
|
$.post(
|
|
'<%= admin_update_course_name_path %>',
|
|
{"course_id": CourseTagId, "name": $("#renameCourseName").val().trim()}
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
var SyllabusTagNameHtml; //当前双击的链接的父节点的html
|
|
var SyllabusParentCssBorder; //当前双击的链接的父节点
|
|
var SyllabusEle; //当前双击的链接
|
|
var SyllabusTagId; //课程的id
|
|
var SyllabusTagName; //课程名称
|
|
var SyllabusIsdb;
|
|
function rename_syllabus_title(domEle,name,id){
|
|
SyllabusIsdb = true; //这是双击
|
|
//clearTimeout(clickFunction);
|
|
if (domEle.children().get(0) != undefined) { //已经是编辑框的情况下不要动
|
|
return;
|
|
}
|
|
SyllabusTagNameHtml = domEle.parent().html();
|
|
SyllabusParentCssBorder = domEle.parent().css("border");
|
|
SyllabusEle = domEle;
|
|
SyllabusTagId = id;
|
|
SyllabusTagName = name;
|
|
domEle.html('<input name="" id="renameSyllabusTitle" maxlength="120" minlength="1" style="width:125px;" value="' + name + '"/>');
|
|
domEle.parent().css("border", "1px solid #ffffff");
|
|
$("#renameSyllabusTitle").focus();
|
|
}
|
|
|
|
//执行修改TAGName方法
|
|
function updateSyllabusTitle(){
|
|
if(SyllabusIsdb){
|
|
SyllabusIsdb = false;
|
|
if($("#renameSyllabusTitle").val() == SyllabusTagName){ //如果值一样,则恢复原来的状态
|
|
ele.parent().css("border","");
|
|
ele.parent().html(SyllabusTagNameHtml);
|
|
}
|
|
else{
|
|
$.post(
|
|
'<%= admin_update_syllabus_title_path %>',
|
|
{"syllabus_id": SyllabusTagId, "name": $("#renameSyllabusTitle").val().trim()}
|
|
);
|
|
}
|
|
}
|
|
}
|
|
</script> |