socialforge/app/views/admin/non_syllabus_courses.html.erb

173 lines
5.4 KiB
Plaintext

<div class="contextual">
<%= link_to l(:label_course_new), {:controller => 'courses', :action => 'new'}, :class => 'icon icon-add' %>
</div>
<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 => 'non_syllabus_courses'}, :class => 'icon icon-reload' %>
</fieldset>
<% end %>
&nbsp;
<div class="autoscroll">
<table class="list" style="width: 100%;table-layout: fixed">
<thead>
<tr>
<th style="width: 20px;">
序号
</th>
<th style="width: 70px;">
班级
</th>
<th style="width: 35px;">
主讲老师
</th>
<th style="width: 20px;">
学时
</th>
<th style="width: 15px;">
<%=l(:field_is_public)%>
</th>
<th style="width: 20px;">
状态
</th>
<th style="width: 45px;">
<%=l(:field_created_on)%>
</th>
<th style="width: 45px;">
动态时间
</th>
<th style="width:75px">
课程
</th>
<th style="width:35px">
</th>
</tr>
</thead>
<tbody>
<% @courses.each do |course| %>
<% unless course.teacher.nil? %>
<tr class="<%= cycle("odd", "even") %>" id="course_<%=course.id %>">
<td style="text-align: center;">
<%= course.id %>
</td>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=course.name%>' id="syllabus_course_name_<%=course.id %>">
<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.teacher.show_name, user_path(course.teacher)) %>
</td>
<td align="center">
<%= course.class_period %>
</td>
<td class="center">
<%= checked_image course.is_public? %>
</td>
<td class="center">
<%= course.is_delete == 0 ? '正常' : '归档' %>
</td>
<td class="center">
<%= format_date(course.created_at) %>
</td>
<td class="center">
<%= course.updated_at.strftime('%Y-%m-%d %H:%M:%S') %>
</td>
<td class="center">
<%= select_tag :syllabus_id,options_for_select(course_syllabus_option(course.teacher),course.syllabus_id), {:id=>"new_syllabus_id_#{course.id}", :class=>"course_syllabus_input", :onchange=>"select_syllabus(#{course.id});"}%>
</td>
<td class="center">
<a href="javascript:void(0)" onclick="alert_new_syllabus(<%=course.id %>, 1)">新建课程</a>
</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();
}
});
});
//执行修改courseName方法
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()}
);
}
}
}
function select_syllabus(id){
val = $("#new_syllabus_id_"+id).children('option:selected').val();
if(val != "0") {
$.ajax({
type: "post",
url: "/admin/select_course_syllabus",
data: {syllabus_id: val,
course_id: id},
success: function (data) {
}
});
}
}
</script>
<% html_title(l(:label_course_all)) -%>