Conflicts: db/schema.rb public/javascripts/application.jsdaiao_dev v20160808
commit
ef8b127225
@ -0,0 +1,30 @@
|
||||
<td style="text-align: center;">
|
||||
<%= course.id %>
|
||||
</td>
|
||||
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=course.name%>'>
|
||||
<span>
|
||||
<%= link_to(course.name, course_path(course.id)) %>
|
||||
</span>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%= link_to(course.try(:teacher).try(:realname).truncate(6, omission: '...'), user_path(course.teacher)) %>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%= course.class_period %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= checked_image course.is_public? %>
|
||||
</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 %>, 0)">新建课程</a>
|
||||
<%#= link_to "新建课程", admin_create_syllabus_path%>
|
||||
</td>
|
@ -0,0 +1,7 @@
|
||||
<div class="tabs">
|
||||
<ul>
|
||||
<li><%= link_to '课程列表', {:action => 'syllabuses'}, class: "#{current_page?(all_syllabuses_path)? 'selected' : nil }" %></li>
|
||||
<li><%= link_to '全部班级列表', {:action => 'courses'}, class: "#{current_page?(all_courses_path)? 'selected' : nil }" %></li>
|
||||
<li><%= link_to '未配置班级列表', {:action => 'non_syllabus_courses'}, class: "#{current_page?(non_syllabus_courses_path)? 'selected' : nil }" %></li>
|
||||
</ul>
|
||||
</div>
|
@ -0,0 +1,10 @@
|
||||
hideModal();
|
||||
<%courses = Course.where("tea_id = #{@user.id}") %>
|
||||
<% unless courses.empty? %>
|
||||
<% courses.each do |course|%>
|
||||
$("#course_<%=course.id %>").html("<%=escape_javascript(render :partial => 'courselist_detail_tr', :locals => {:course => course}) %>");
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if @flag == 1 %>
|
||||
$("#course_<%=@course.id %>").html("");
|
||||
<% end %>
|
@ -0,0 +1,164 @@
|
||||
<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 %>
|
||||
|
||||
|
||||
<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: 35px;">
|
||||
主讲老师
|
||||
</th>
|
||||
<th style="width: 20px;">
|
||||
学时
|
||||
</th>
|
||||
<th style="width: 15px;">
|
||||
<%=l(:field_is_public)%>
|
||||
</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| %>
|
||||
<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%>'>
|
||||
<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 align="center">
|
||||
<%= course.class_period %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= checked_image course.is_public? %>
|
||||
</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 %>
|
||||
</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)) -%>
|
@ -0,0 +1,142 @@
|
||||
<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>
|
@ -0,0 +1 @@
|
||||
$("#rename_course_name_<%=@course.id %>").html("<%=@course.name %>");
|
@ -0,0 +1,5 @@
|
||||
<span style="word-break: normal; word-wrap: normal;"><%=@syllabus.title %></span>
|
||||
|
||||
<% if User.current == syllabus.user %>
|
||||
<%= link_to image_tag("../images/signature_edit.png",width:"12px", height: "12px"), "javascript:void(0);",:id => "syllabus_edit_title_png", :class => "none", :onclick => "show_edit_title();"%>
|
||||
<% end %>
|
@ -0,0 +1,3 @@
|
||||
$("#syllabus_title_show").html("<%= escape_javascript render :partial => 'layouts/syllabus_title', :locals => {:syllabus => @syllabus} %>");
|
||||
$("#syllabus_title_show").show();
|
||||
$("#syllabus_title_edit").hide();
|
Loading…
Reference in new issue