2016-07-07 09:02:41 +08:00
|
|
|
<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>
|
2016-07-15 14:48:39 +08:00
|
|
|
<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} %>
|
2016-07-07 09:02:41 +08:00
|
|
|
</td>
|
|
|
|
<td class="center">
|
|
|
|
</td>
|
|
|
|
<td align="center">
|
2016-07-29 20:18:26 +08:00
|
|
|
<%= link_to syllabus.user.show_name, user_path(syllabus.user) %>
|
2016-07-07 09:02:41 +08:00
|
|
|
</td>
|
|
|
|
<td class="center">
|
|
|
|
<%= format_date(syllabus.created_at) %>
|
|
|
|
</td>
|
|
|
|
</tr>
|
2016-09-07 15:26:15 +08:00
|
|
|
<% courses = syllabus.courses.not_deleted %>
|
2016-07-07 09:02:41 +08:00
|
|
|
<% courses.each do |course| %>
|
|
|
|
<tr class="even">
|
|
|
|
<td style="text-align: center;">
|
|
|
|
<%= course.id %>
|
|
|
|
</td>
|
|
|
|
<td class="center">
|
|
|
|
</td>
|
2016-07-08 19:16:53 +08:00
|
|
|
<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} %>
|
2016-07-07 09:02:41 +08:00
|
|
|
</td>
|
|
|
|
<td align="center">
|
2016-07-29 20:18:26 +08:00
|
|
|
<%= link_to(course.teacher.show_name, user_path(course.teacher)) %>
|
2016-07-07 09:02:41 +08:00
|
|
|
</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">
|
2016-07-15 14:48:39 +08:00
|
|
|
var CourseTagNameHtml; //当前双击的链接的父节点的html
|
|
|
|
var CourseParentCssBorder; //当前双击的链接的父节点
|
|
|
|
var CourseEle; //当前双击的链接
|
|
|
|
var CourseTagId; //班级的id
|
|
|
|
var CourseTagName; //班级名称
|
|
|
|
var CourseIsdb;
|
2016-07-07 09:02:41 +08:00
|
|
|
|
|
|
|
function rename_course_name(domEle,name,id){
|
2016-07-15 14:48:39 +08:00
|
|
|
CourseIsdb = true; //这是双击
|
2016-07-07 09:02:41 +08:00
|
|
|
//clearTimeout(clickFunction);
|
|
|
|
if (domEle.children().get(0) != undefined) { //已经是编辑框的情况下不要动
|
|
|
|
return;
|
|
|
|
}
|
2016-07-15 14:48:39 +08:00
|
|
|
CourseTagNameHtml = domEle.parent().html();
|
|
|
|
CourseParentCssBorder = domEle.parent().css("border");
|
|
|
|
CourseEle = domEle;
|
|
|
|
CourseTagId = id;
|
|
|
|
CourseTagName = name;
|
2016-07-07 09:02:41 +08:00
|
|
|
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();
|
|
|
|
}
|
|
|
|
});
|
2016-07-15 14:48:39 +08:00
|
|
|
$("#renameSyllabusTitle").live("blur",function(){
|
|
|
|
updateSyllabusTitle();
|
|
|
|
}).live("keypress",function(e){
|
|
|
|
if (e.keyCode == '13') {
|
|
|
|
updateSyllabusTitle();
|
|
|
|
}
|
|
|
|
});
|
2016-07-07 09:02:41 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
//执行修改TAGName方法
|
|
|
|
function updateCourseName(){
|
2016-07-15 14:48:39 +08:00
|
|
|
if(CourseIsdb){
|
|
|
|
CourseIsdb = false;
|
|
|
|
if($("#renameCourseName").val() == CourseTagName){ //如果值一样,则恢复原来的状态
|
2016-07-07 09:02:41 +08:00
|
|
|
ele.parent().css("border","");
|
2016-07-15 14:48:39 +08:00
|
|
|
ele.parent().html(CourseTagNameHtml);
|
2016-07-07 09:02:41 +08:00
|
|
|
}
|
|
|
|
else{
|
|
|
|
$.post(
|
|
|
|
'<%= admin_update_course_name_path %>',
|
2016-07-15 14:48:39 +08:00
|
|
|
{"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()}
|
2016-07-07 09:02:41 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|