管理员界面增加配置课程

This commit is contained in:
cxt 2016-07-07 09:02:41 +08:00
parent c5840d75da
commit a99b03ff76
19 changed files with 599 additions and 63 deletions

View File

@ -45,9 +45,62 @@ class AdminController < ApplicationController
render :action => "projects", :layout => false if request.xhr?
end
def courses
def syllabuses
@name = params[:name]
@courses = Course.like(@name).order('created_at desc')
@syllabuses = Syllabus.like(@name).order('created_at desc')
@syllabuses = paginateHelper @syllabuses,30
@page = (params['page'] || 1).to_i - 1
respond_to do |format|
format.html
end
end
#为班级选择课程
def select_course_syllabus
@flag = false
if params[:syllabus_id] && params[:course_id]
course = Course.where("id = #{params[:course_id].to_i}").first
unless course.nil?
course.update_attribute('syllabus_id', params[:syllabus_id].to_i)
@flag = true
end
end
if @flag
render :text=> "succ"
else
render :text=>'fail'
end
end
#新建课程
def create_syllabus
if params[:course_id]
course = Course.where("id = #{params[:course_id]}").first
if course
@user = course.teacher
syllabus = Syllabus.new
syllabus.update_attributes(:title => params[:title], :eng_name => params[:eng_name], :user_id => @user.id)
syllabus.description = Message.where("id = 19412").first.nil? ? nil : Message.where("id = 19412").first.content
if syllabus.save
course.update_attribute('syllabus_id', syllabus.id)
@flag = params[:flag].to_i
@course = course
respond_to do |format|
format.js
end
end
end
end
end
def courses
@name = params[:name].to_s.strip.downcase
if @name && @name != ""
@courses = Course.select{ |course| (course.teacher[:lastname].to_s.downcase + course.teacher[:firstname].to_s.downcase).include?(@name) || course.name.include?(@name)}
@courses = @courses.sort{|x, y| y.created_at <=> x.created_at}
else
@courses = Course.order('created_at desc')
end
@courses = paginateHelper @courses,30
@page = (params['page'] || 1).to_i - 1
respond_to do |format|
@ -55,6 +108,33 @@ class AdminController < ApplicationController
end
end
#未配置班级列表
def non_syllabus_courses
@name = params[:name].to_s.strip.downcase
if @name && @name != ""
@courses = Course.where("syllabus_id is null").select{ |course| (course.teacher[:lastname].to_s.downcase + course.teacher[:firstname].to_s.downcase).include?(@name) || course.name.include?(@name)}
@courses = @courses.sort{|x, y| y.created_at <=> x.created_at}
else
@courses = Course.where("syllabus_id is null").order('created_at desc')
end
@courses = paginateHelper @courses,30
@page = (params['page'] || 1).to_i - 1
respond_to do |format|
format.html
end
end
#修改课程名称
def update_course_name
@course = Course.where("id = #{params[:course_id].to_i}").first
unless @course.nil?
@course.update_attribute("name", params[:name])
respond_to do |format|
format.js
end
end
end
#管理员界面精品课程列表
def excellent_courses
@courses = Course.where("is_excellent =? or excellent_option =?", 1, 1 )

View File

@ -3322,3 +3322,21 @@ def get_group_member_names work
end
result
end
def course_syllabus_option user
syllabuses = user.syllabuses
type = []
option1 = []
option1 << "请选择课程"
option1 << 0
type << option1
unless syllabuses.empty?
syllabuses.each do |syllabus|
option = []
option << syllabus.title
option << syllabus.id
type << option
end
end
type
end

View File

@ -9,9 +9,18 @@ class Syllabus < ActiveRecord::Base
belongs_to :user
has_many :courses
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
attr_accessible :description, :title, :eng_name, :syllabus_type, :credit, :hours, :theory_hours, :practice_hours, :applicable_major, :pre_course
attr_accessible :user_id, :description, :title, :eng_name, :syllabus_type, :credit, :hours, :theory_hours, :practice_hours, :applicable_major, :pre_course
safe_attributes 'title', 'description', 'eng_name', 'syllabus_type', 'credit', 'hours', 'theory_hours', 'practice_hours', 'credit', 'applicable_major', 'pre_course'
scope :like, lambda {|arg|
if arg.blank?
where(nil)
else
pattern = "%#{arg.to_s.strip.downcase}%"
where(" LOWER(title) LIKE :p ", :p => pattern)
end
}
def delete_kindeditor_assets
delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::SYLLABUS
end

View File

@ -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>

View File

@ -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>

View File

@ -5,15 +5,20 @@
<h3>
<%=l(:label_course_all)%>
</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 => '课程名称' %>
<%= 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 => 'courses'},:remote => true, :class => 'icon icon-reload' %>
<%= link_to l(:button_clear), {:controller => 'admin', :action => 'courses'}, :class => 'icon icon-reload' %>
</fieldset>
<% end %>
&nbsp;
@ -26,51 +31,35 @@
序号
</th>
<th style="width: 85px;">
课程
班级
</th>
<th style="width: 35px;">
主讲老师
</th>
<th style="width: 30px;">
<th style="width: 20px;">
学时
</th>
<th style="width: 20px;">
<th style="width: 15px;">
<%=l(:field_is_public)%>
</th>
<th style="width: 60px;">
<th style="width: 45px;">
<%=l(:field_created_on)%>
</th>
<th style="width: 65px;">
<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") %>">
<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>
<tr class="<%= cycle("odd", "even") %>" id="course_<%=course.id %>">
<%=render :partial => 'courselist_detail_tr', :locals => {:course => course} %>
</tr>
<% end %>
</tbody>
@ -81,4 +70,19 @@
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
</div>
<script type="text/javascript">
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)) -%>

View File

@ -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 %>

View File

@ -16,7 +16,7 @@
序号
</th>
<th style="width: 120px;">
课程
班级
</th>
<th style="width: 50px;">
主讲老师

View File

@ -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 %>
&nbsp;
<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)) -%>

View File

@ -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 %>
&nbsp;
<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>

View File

@ -0,0 +1 @@
$("#rename_course_name_<%=@course.id %>").html("<%=@course.name %>");

View File

@ -19,6 +19,10 @@
<%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags -->
<%= yield :header_tags -%>
<!-- MathJax的配置 -->
<script type="text/javascript"
src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
</head>
<body class="<%= h body_css_classes %>">
<div id="wrapper">

View File

@ -12,7 +12,7 @@ zh:
#
label_course_join_student: 加入班级
label_course_exit_student: 退出班级
label_course_new: 新建课程
label_course_new: 新建班级
label_course_name: 课程名称
label_homework: 作业

View File

@ -482,9 +482,10 @@ zh:
label_show_contest: 显示竞赛
#by young
label_requirement: 需求
label_new_course: 课程列表
label_course_all: 课程列表
label_excellent_courses_list: 精品课程列表
label_new_course: 班级列表
label_course_all: 班级列表
label_syllabus_all: 课程列表
label_excellent_courses_list: 精品班级列表
label_course_resource_list: 班级资源列表
label_project_resource_list: 項目资源列表
label_teacher_all: 所有教师
@ -1367,7 +1368,7 @@ zh:
label_bid_reason_homework: 请输入作业提交说明!
label_create_new_projects: 创建项目
label_call_for_bids: 发布需求
label_create_course: 创建课程
label_create_course: 创建班级
label_milestone: 里程碑
label_features: 特性
@ -1488,7 +1489,7 @@ zh:
label_user_project: 项目
label_user_course: 课程
label_user_course: 班级
label_user_homework: 作业
label_bid_if_agreement: 如果喜欢我,请点击我
@ -1542,7 +1543,7 @@ zh:
label_teacher_work_unit: 教师单位
label_course_time: 课程年度
label_i_new_activity: 有了新活动在
label_choose_course: 选择课程
label_choose_course: 选择班级
button_submit_homework: 提交作业
button_submit_bid: 参与竞标
label_requirement_from: 需求来源
@ -1596,9 +1597,9 @@ zh:
#end
label_joined_course: 参加的课程
label_created_course: 创建的课程
label_course: 课程
label_joined_course: 参加的班级
label_created_course: 创建的班级
label_course: 班级
label_public_info: (打钩为公开,不打钩则不公开,若不公开,仅项目成员可见该项目。)

View File

@ -1027,7 +1027,10 @@ RedmineApp::Application.routes.draw do
match 'admin', :to => 'admin#index', :via => :get
match 'admin/projects', :via => :get
get 'admin/courses'
get 'admin/courses', as: :all_courses
get 'admin/syllabuses', as: :all_syllabuses
get 'admin/non_syllabus_courses', as: :non_syllabus_courses
post 'admin/update_course_name'
get 'admin/excellent_courses', as: :excellent_courses
get 'admin/excellent_all_courses', as: :excellent_all_courses
match 'admin/set_excellent_course/:id', :to => 'admin#set_excellent_course'
@ -1060,6 +1063,8 @@ RedmineApp::Application.routes.draw do
get 'admin/homework'
get 'admin/apply_for_homework'
get 'admin/code_work_tests'
post 'admin/select_course_syllabus'
post 'admin/create_syllabus'
resources :auth_sources do
member do

View File

@ -367,7 +367,7 @@ end
Redmine::MenuManager.map :admin_menu do |menu|
menu.push :organization, {:controller => 'admin', :action => 'organization'}, :caption => :label_organization_list
menu.push :projects, {:controller => 'admin', :action => 'projects'}, :caption => :label_project_plural
menu.push :courses, {:controller => 'admin', :action => 'courses'}, :caption => :label_course_all
menu.push :syllabuses, {:controller => 'admin', :action => 'syllabuses'}, :caption => :label_course_all
menu.push :users, {:controller => 'admin', :action => 'users'}, :caption => :label_user_plural
menu.push :messages, {:controller => 'admin', :action => 'messages'}, :caption => :label_system_message
menu.push :schools, {:controller => 'admin', :action => 'schools'}, :caption => :label_school_plural

View File

@ -1589,3 +1589,71 @@ function expand_course_list(id, target, btnid, count) {
}
}
function regex_syllabus_name() {
var name = $.trim($("#new_syllabus_name").val());
if(name.length < 2)
{
$("#new_syllabus_name_notice").show();
return false;
}
else
{
$("#new_syllabus_name_notice").hide();
return true;
}
}
function alert_new_syllabus(course_id, flag){
htmlvalue = "<div><h2 style='text-align: center'>新建课程</h2><ul>" +
"<li class='ml45'>" +
"<label><span class='c_red'>*</span>&nbsp;课程名称&nbsp;&nbsp;</label>" +
"<input type='text' name='title' id='new_syllabus_name' class='name_input' placeholder='例如:设计管理' maxlength='100' onkeyup='regex_syllabus_name();'><br>" +
"<span class='c_red' id='new_syllabus_name_notice' style='display: none; font-size: 12px;'>课程名称不能为空且至少有两个字符</span>" +
"</li>" +
"<div class='cl'></div>" +
"<li class='ml45'>" +
"<label><span class='c_white'>*</span>&nbsp;英文名称&nbsp;&nbsp;</label>" +
"<input type='text' name='eng_name' id='new_syllabus_eng_name' placeholder='例如Management of design' class='name_input' maxlength='100'>" +
"</li>" +
"<div class='cl'></div>" +
"<li class='ml90' >" +
"<a href='javascript:void(0)' style='margin-left: 145px;' class='Blue-btn fl' onclick='admin_new_syllabus("+course_id+","+flag+");' >提交</a>" +
"<a href='javascript:void(0)' style='margin-left: 50px;' class='Blue-btn fl' onclick='hideModal();' >取消</a>" +
"<div class='cl'></div>" +
"</li>" +
"</ul></div>";
pop_up_box(htmlvalue,600,30,50);
}
function admin_new_syllabus(course_id, flag){
if(regex_syllabus_name()) {
$.ajax({
type: "post",
url: "/admin/create_syllabus",
data: {course_id: course_id,
title: $("#new_syllabus_name").val(),
eng_name: $("#new_syllabus_eng_name").val(),
flag: flag},
success: function (data) {
}
});
hideModal();
}
}
//执行修改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()}
);
}
}
}

View File

@ -224,20 +224,6 @@ function submit_new_syllabus()
}
}
function regex_syllabus_name() {
var name = $.trim($("#new_syllabus_name").val());
if(name.length < 2)
{
$("#new_syllabus_name_notice").show();
return false;
}
else
{
$("#new_syllabus_name_notice").hide();
return true;
}
}
//课程讨论区
function regexTopicSubject() {
var name = $("#message_subject").val();

View File

@ -1409,6 +1409,7 @@ table td {padding:2px;}
table p {margin:0;}
.odd {background-color:#f6f7f8;}
.even {background-color: #fff;}
.odd_grey {background-color: #b4b4b4}
a.sort { padding-right: 16px; background-position: 100% 50%; background-repeat: no-repeat; }
a.sort.asc { background-image: url(../images/sort_asc.png); }
@ -2848,3 +2849,9 @@ img.school_avatar {
.admin_message_warn{font-size: 12px;color: red;}
a.btn_message_free{ background:#15BCCF; display:block; text-align:center; color:#fff; padding:3px 0; width:60px; margin-bottom:10px;margin-left: 58px;}
.course_syllabus_input{width:120px;}
.name_input{ border:1px solid #64bdd9; height:16px; width:310px; background:#fff; margin-bottom:10px; padding:5px;}
a.Blue-btn{ display:block; margin-right:15px;width:65px; height:22px; background-color:#ffffff; line-height:24px; vertical-align:middle; text-align:center; border:1px solid #3598db; color:#3598db; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;}
a:hover.Blue-btn{ background:#3598db; color:#fff;}
.c_white {color:#fff;}