142 lines
4.5 KiB
Plaintext
142 lines
4.5 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%>'>
|
||
|
<span>
|
||
|
<%= link_to(syllabus.title, syllabus_path(syllabus.id)) %>
|
||
|
</span>
|
||
|
</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%>'>
|
||
|
<span>
|
||
|
<a title="<%=course.name %>" id="rename_course_name_<%=course.id %>" ondblclick="rename_course_name($(this),'<%=course.name %>','<%=course.id %>');"><%= course.name%></a>
|
||
|
</span>
|
||
|
</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 tagNameHtml; //当前双击的链接的父节点的html
|
||
|
var parentCssBorder; //当前双击的链接的父节点
|
||
|
var ele; //当前双击的链接
|
||
|
var tagId; //班级的id
|
||
|
var tagName; //班级名称
|
||
|
|
||
|
function rename_course_name(domEle,name,id){
|
||
|
isdb = true; //这是双击
|
||
|
//clearTimeout(clickFunction);
|
||
|
if (domEle.children().get(0) != undefined) { //已经是编辑框的情况下不要动
|
||
|
return;
|
||
|
}
|
||
|
tagNameHtml = domEle.parent().html();
|
||
|
parentCssBorder = domEle.parent().css("border");
|
||
|
ele = domEle;
|
||
|
tagId = id;
|
||
|
tagName = 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();
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
|
||
|
//执行修改TAGName方法
|
||
|
function updateCourseName(){
|
||
|
if(isdb){
|
||
|
isdb = false;
|
||
|
if($("#renameCourseName").val() == tagName){ //如果值一样,则恢复原来的状态
|
||
|
ele.parent().css("border","");
|
||
|
ele.parent().html(tagNameHtml);
|
||
|
}
|
||
|
else{
|
||
|
$.post(
|
||
|
'<%= admin_update_course_name_path %>',
|
||
|
{"course_id": tagId, "name": $("#renameCourseName").val().trim()}
|
||
|
);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
</script>
|