班级名称命名和显示规范调整
This commit is contained in:
parent
07b97c8eb9
commit
d1bfdde261
|
@ -829,11 +829,11 @@ class CoursesController < ApplicationController
|
|||
end
|
||||
if @course
|
||||
#发送微信消息
|
||||
count = ShieldWechatMessage.where("container_type='User' and container_id=#{User.current.id} and shield_type='Course' and shield_id=#{@course.id}").count
|
||||
if count == 0
|
||||
ss = SyllabusesService.new
|
||||
ss.send_wechat_create_class_notice User.current,@course
|
||||
end
|
||||
# count = ShieldWechatMessage.where("container_type='User' and container_id=#{User.current.id} and shield_type='Course' and shield_id=#{@course.id}").count
|
||||
# if count == 0
|
||||
# ss = SyllabusesService.new
|
||||
# ss.send_wechat_create_class_notice User.current,@course
|
||||
# end
|
||||
respond_to do |format|
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
format.html {redirect_to course_url(@course)}
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
<li>
|
||||
<span class="sy_sq_orange fl mr5 mt5"><%= i+1 %></span>
|
||||
<div class="fl" style="width:185px;">
|
||||
<%= link_to e_course.syllabus.title, syllabus_path(e_course.syllabus_id), :target => '_blank', :class => "sy_class_ltitle"%>
|
||||
<font class="fb c_grey">·</font>
|
||||
<%=link_to e_course.name, course_path(e_course.id), :class => "sy_class_ltitle mb10" %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -18,13 +18,13 @@
|
|||
<div class="cl"></div>
|
||||
<li class="mt10 ml45">
|
||||
<label><span class="c_red">*</span> <%= l(:label_tags_course_name)%> :</label>
|
||||
<input type="text" name="course[name]" id="new_course_name" class="courses_input w289" maxlength="100" placeholder="例如:计算机系2016秋季A班" onkeyup="regex_course_name('new');">
|
||||
<input type="text" name="course[name]" id="new_course_name" class="courses_input w289" maxlength="100" placeholder="例如:软件工程计算机系2016秋季A班" onkeyup="regex_course_name('new');">
|
||||
<div class="cl"></div>
|
||||
<span class="c_red ml80" id="new_course_name_notice" style="display: none;">班级名称不能为空且至少有两个字符</span>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ml125 mb5 fontGrey3"><span class="success-icon mr25">正确示例:计算机系2016秋季A班</span></li>
|
||||
<li class="ml125 mb10 fontGrey3"><span class="error-icon">错误示例:软件工程 - 计算机系2016秋季A班</span></li>
|
||||
<li class="ml125 mb5 fontGrey3"><span class="success-icon mr25">正确示例:软件工程计算机系2016秋季A班</span></li>
|
||||
<li class="ml125 mb10 fontGrey3"><span class="error-icon">错误示例:计算机系2016秋季A班</span></li>
|
||||
<!--<li class="ml125 mt10 mb10 fontGrey2" style="max-width: 544px;">班级是一个由教师、助教(教辅)和学生组成的临时的教学群体,在规定的时间内(如一个学期)完成一门课程规定的教学任务。本质上,一门课程就是一个教学计划。</li>-->
|
||||
<li class="mt10 ml45">
|
||||
<label><span class="c_red">*</span> <%= l(:label_class_period)%> :</label>
|
||||
|
|
|
@ -39,14 +39,15 @@
|
|||
</li>
|
||||
<li class="ml45 mb10">
|
||||
<label><span class="c_red">*</span> <%= l(:label_tags_syllabus_name)%> :</label>
|
||||
<span><%=@course.syllabus.title %></span>
|
||||
<span id="edit_syllabus_id"><%=@course.syllabus.title %></span>
|
||||
<%#= select_tag :syllabus_id,options_for_select(course_syllabus_option,@course.syllabus_id), {:id=>"edit_syllabus_id", :class=>"syllabus_input", :style=>'width:210px'} %>
|
||||
<!--<span class="c_red" id="edit_syllabus_notice">如果列表中没有对应的课程,请您先<%#=link_to '创建课程', new_syllabus_path(),:target => '_blank', :class => 'ml5 green_btn_share c_white'%>,然后【刷新】</span>-->
|
||||
</li>
|
||||
<li class="ml45">
|
||||
<label><span class="c_red">*</span> <%= l(:label_tags_course_name)%> :</label>
|
||||
<input type="text" name="course[name]" id="edit_course_name" autocomplete="off" class="courses_input" maxlength="100" onkeyup="regex_course_name('edit');" value="<%= @course.name%>">
|
||||
<span class="c_red" id="edit_course_name_notice" style="display: none;">班级名称不能为空</span>
|
||||
<div class="cl"></div>
|
||||
<span class="c_red ml80" id="edit_course_name_notice" style="display: none;">班级名称不能为空</span>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ml45">
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<%= link_to(@course.teacher.show_name, user_path(@course.teacher), :class => 'sy_cgrey') %>
|
||||
>
|
||||
<% if @course.syllabus %>
|
||||
<%=link_to @course.syllabus.title, syllabus_path(@course.syllabus_id), :class => 'sy_cgrey' %>
|
||||
<%=link_to @course.syllabus.title, syllabus_path(@course.syllabus_id), :class => 'sy_cgrey', :title => '课程名称' %>
|
||||
>
|
||||
<% end %>
|
||||
<%=link_to @course.name, course_path(@course), :class => 'sy_cgrey' %>
|
||||
|
@ -55,8 +55,6 @@
|
|||
<div class="sy_class_info fl ml15">
|
||||
<div class="sy_class_titbox">
|
||||
<h3 class="fl sy_class_title">
|
||||
<%= link_to @course.syllabus.title, syllabus_path(@course.syllabus_id), :class =>'c_dark', :target => '_blank'%>
|
||||
<font class="fb">·</font>
|
||||
<%=@course.name %>
|
||||
</h3>
|
||||
<span class="<%= @course.is_public == 0 ? 'hw_icon_private' : 'hw_icon_open' %> fl mr20 mt3"></span>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<span class="user_icons_class"></span>
|
||||
<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,course)) %>
|
||||
<p href="javascript:void(0);" id="show_course_<%= course.id %>" class="course_list_menu" >
|
||||
<%= link_to course.syllabus.title + course.name, course_path(course.id,:host=>Setting.host_course), :target => '_blank', :class => 'hidden', :style => 'display:block;'%>
|
||||
<%= link_to course.name, course_path(course.id,:host=>Setting.host_course), :target => '_blank', :class => 'hidden', :style => 'display:block;'%>
|
||||
</p>
|
||||
<div class="sub-menu-title c_dark">
|
||||
<em></em>
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
<div class="homepagePostTo break_word mt-4">
|
||||
<%= link_to homework.user.show_name, user_activities_path(homework.user_id), :class => "newsBlue mr15"%>
|
||||
TO
|
||||
<%=link_to homework.course.syllabus.title, syllabus_path(homework.course.syllabus_id), :class => 'newsBlue ml15', :target => '_blank' %>
|
||||
<span class="fb" style="color: #269ac9"> • </span>
|
||||
<%= link_to homework.course.name, course_path(homework.course_id), :class => "newsBlue"%>
|
||||
</div>
|
||||
<div class="homepagePostTitle hidden fl m_w505">
|
||||
|
|
|
@ -20,14 +20,10 @@
|
|||
<div class="fl">
|
||||
<% if course.is_public == 0 && !User.current.member_of_course?(course) && !User.current.admin? %>
|
||||
<h3 class="sy_classlist_title fl">
|
||||
<%= link_to @syllabus.title, syllabus_path(@syllabus.id), :style => 'color:#000', :target => '_blank' %>
|
||||
<font class="fb"> · </font>
|
||||
<%=course.name %>(<%=current_time_and_term_short(course) %>)
|
||||
</h3>
|
||||
<% else %>
|
||||
<h3 class="sy_classlist_title fl">
|
||||
<%= link_to @syllabus.title, syllabus_path(@syllabus.id), :style => 'color:#000', :target => '_blank' %>
|
||||
<font class="fb"> · </font>
|
||||
<%= link_to course.name+"("+current_time_and_term_short(course)+")", course_path(course.id,:host=>Setting.host_course),
|
||||
:style => 'color:#000',:id => "show_course_#{course.id}", :target => '_blank', :title => (course.is_public? ? "公开班级:":"私有班级:")+course.name+"("+current_time_and_term(course)+")"%>
|
||||
</h3>
|
||||
|
|
|
@ -12,8 +12,6 @@
|
|||
<%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %>
|
||||
<% end %>
|
||||
TO
|
||||
<%=link_to activity.course.syllabus.title, syllabus_path(activity.course.syllabus_id), :class => 'newsBlue ml15', :target => '_blank' %>
|
||||
<span class="fb" style="color: #269ac9"> • </span>
|
||||
<%= link_to activity.course.name.to_s+" | 班级资源", course_files_path(activity.course), :class => "newsBlue" %>
|
||||
</div>
|
||||
<div class="homepagePostTitle break_word" >
|
||||
|
|
|
@ -12,8 +12,6 @@
|
|||
<%= link_to activity.try(:teacher).try(:realname), user_path(activity.tea_id), :class => "newsBlue mr15" %>
|
||||
<% end %>
|
||||
TO
|
||||
<%=link_to activity.syllabus.title, syllabus_path(activity.syllabus_id), :class => 'newsBlue ml15', :target => '_blank' %>
|
||||
<span class="fb" style="color: #269ac9"> • </span>
|
||||
<%= link_to activity.name.to_s+" | 班级", course_path(activity.id,:host=>Setting.host_course), :class => "newsBlue" %>
|
||||
</div>
|
||||
<div class="homepagePostTitle break_word" >
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
<div class="homepagePostTo break_word">
|
||||
<%= link_to activity.user.show_name, user_path(activity.user_id,:host=>Setting.host_user), :class => "newsBlue mr15" %>
|
||||
TO <!--+"(课程名称)" -->
|
||||
<%=link_to activity.course.syllabus.title, syllabus_path(activity.course.syllabus_id), :class => 'newsBlue ml15', :target => '_blank' %>
|
||||
<span class="fb" style="color: #269ac9"> • </span>
|
||||
<% if hw_status == 3 || hw_status == 5 %>
|
||||
<%= link_to activity.course.name, course_path(activity.course_id), :class => "newsBlue"%>
|
||||
<% else %>
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
<%= link_to activity.user.show_name, user_path(activity.user_id), :class => "newsBlue mr15" %>
|
||||
TO
|
||||
<% course=Course.find(activity.jour_id) %>
|
||||
<%=link_to course.syllabus.title, syllabus_path(course.syllabus_id), :class => 'newsBlue ml15', :target => '_blank' %>
|
||||
<span class="fb" style="color: #269ac9"> • </span>
|
||||
<%= link_to course.name.to_s+" | 班级留言", course_feedback_path(course), :class => "newsBlue" %>
|
||||
</div>
|
||||
<!--<div class="homepagePostTitle break_word list_style upload_img">
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
<div class="homepagePostTo break_word">
|
||||
<%= link_to activity.author.show_name, user_path(activity.author_id, :host=>Setting.host_user), :class => "newsBlue mr15" %>
|
||||
TO
|
||||
<%=link_to activity.course.syllabus.title, syllabus_path(activity.course.syllabus_id), :class => 'newsBlue ml15', :target => '_blank' %>
|
||||
<span class="fb" style="color: #269ac9"> • </span>
|
||||
<%= link_to activity.course.name.to_s+" | #{activity.board.parent.nil? ? '班级讨论区' : activity.board.name}", course_boards_path(activity.course,:host=> Setting.host_course), :class => "newsBlue mr5"%>
|
||||
</div>
|
||||
<div class="homepagePostTitle hidden m_w530 fl">
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
<div class="homepagePostTo break_word">
|
||||
<%= link_to activity.author.show_name, user_path(activity.author_id), :class => "newsBlue mr15" %>
|
||||
TO <!--+"(课程名称)"-->
|
||||
<%=link_to activity.course.syllabus.title, syllabus_path(activity.course.syllabus_id), :class => 'newsBlue ml15', :target => '_blank' %>
|
||||
<span class="fb" style="color: #269ac9"> • </span>
|
||||
<%= link_to activity.course.name.to_s+" | 班级通知", course_news_index_path(activity.course), :class => "newsBlue" %>
|
||||
</div>
|
||||
<div class="homepagePostTitle break_word hidden fl m_w600"> <!--+"(通知标题)"-->
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
<% end %>
|
||||
TO
|
||||
<% course = Course.find(activity.polls_group_id) %>
|
||||
<%=link_to course.syllabus.title, syllabus_path(course.syllabus_id), :class => 'newsBlue ml15', :target => '_blank' %>
|
||||
<span class="fb" style="color: #269ac9"> • </span>
|
||||
<%= link_to course.name.to_s+" | 问卷", poll_index_path(:polls_type => "Course", :polls_group_id => activity.polls_group_id), :class => "newsBlue" %>
|
||||
<!--<a href="javascript:void(0);" class="newsBlue ml15">分布式计算环境(课程名称)</a>-->
|
||||
</div>
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
<div class="sy_cgrey">
|
||||
<span class="fl">来源:</span>
|
||||
<p class="fl hw_list_classname mr15">
|
||||
<%=link_to homework.course.syllabus.title, syllabus_path(homework.course.syllabus_id), :class => 'hw_cgrey', :target => '_blank' %>
|
||||
<span> • </span>
|
||||
<%=link_to homework.course.name.to_s + "(#{current_time_and_term_short(homework.course)})", course_path(homework.course), :class => 'hw_cgrey', :target => '_blank' %>
|
||||
</p>
|
||||
<% if type == "2" %>
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
<p class="sy_cgrey clear">
|
||||
<span class="fl">来源:</span>
|
||||
<span class="hw_classname mr15 fl">
|
||||
<%=link_to homework.course.syllabus.title, syllabus_path(homework.course.syllabus_id), :class => 'hw_cgrey', :target => '_blank' %>
|
||||
<span> • </span>
|
||||
<%= link_to homework.course.name, course_path(homework.course), :target => '_blank', :class => 'hw_cgrey' %>
|
||||
</span>
|
||||
<span class="mr15 fl">类别:<%=homework.homework_type_ch %></span>
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
<p class="sy_cgrey clear">
|
||||
<span class=" fl">来源:</span>
|
||||
<span class="hw_classname fl mr15">
|
||||
<%=link_to homework.course.syllabus.title, syllabus_path(homework.course.syllabus_id), :class => 'hw_cgrey', :target => '_blank' %>
|
||||
<span> • </span>
|
||||
<%= link_to homework.course.name, course_path(homework.course), :target => '_blank', :class => 'hw_cgrey' %>
|
||||
</span>
|
||||
<span class="mr15 fl">类别:<%=homework.homework_type_ch %></span>
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
<div class="homepagePostTo">
|
||||
<%= link_to homework_common.user.show_name, user_activities_path(homework_common.user_id), :class => "newsBlue mr15"%>
|
||||
TO
|
||||
<%=link_to homework_common.course.syllabus.title, syllabus_path(homework_common.course.syllabus_id), :class => 'newsBlue ml15', :target => '_blank' %>
|
||||
<span class="fb" style="color: #269ac9"> • </span>
|
||||
<%= link_to homework_common.course.name, course_path(homework_common.course_id), :class => "newsBlue"%>
|
||||
</div>
|
||||
<span class="homepagePostTitle hidden fl m_w505">
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
class UpdateCourseName < ActiveRecord::Migration
|
||||
def up
|
||||
count = Course.all.count / 30 + 2
|
||||
transaction do
|
||||
for i in 1 ... count do i
|
||||
Course.page(i).per(30).each do |course|
|
||||
if course.syllabus && !course.syllabus.title.nil?
|
||||
if course.name.index(course.syllabus.title) != 0
|
||||
course.update_column("name", course.syllabus.title+course.name)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
16
db/schema.rb
16
db/schema.rb
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20161028053000) do
|
||||
ActiveRecord::Schema.define(:version => 20161111070615) do
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
|
@ -516,6 +516,20 @@ ActiveRecord::Schema.define(:version => 20161028053000) do
|
|||
t.integer "container_id", :default => 0
|
||||
end
|
||||
|
||||
create_table "course_class_post", :id => false, :force => true do |t|
|
||||
t.integer "班级id", :default => 0, :null => false
|
||||
t.string "班级名"
|
||||
t.integer "帖子id", :default => 0, :null => false
|
||||
t.integer "主贴id"
|
||||
t.string "帖子标题", :default => "", :null => false
|
||||
t.text "帖子内容"
|
||||
t.integer "帖子用户id"
|
||||
t.integer "帖子回复数", :default => 0, :null => false
|
||||
t.integer "最后回帖id"
|
||||
t.datetime "发帖时间", :null => false
|
||||
t.datetime "帖子更新时间", :null => false
|
||||
end
|
||||
|
||||
create_table "course_contributor_scores", :force => true do |t|
|
||||
t.integer "course_id"
|
||||
t.integer "user_id"
|
||||
|
|
|
@ -77,11 +77,22 @@ function hidden_homework_score_form()
|
|||
function regex_course_name(str)
|
||||
{
|
||||
var name = $.trim($("#"+str+"_course_name").val());
|
||||
var syl_title = "";
|
||||
if($("#new_syllabus_id").length > 0){
|
||||
syl_title = $("#new_syllabus_id").find("option:selected").text();
|
||||
} else{
|
||||
syl_title = $("#edit_syllabus_id").html();
|
||||
}
|
||||
if(name.length < 2)
|
||||
{
|
||||
$("#"+str+"_course_name_notice").show();
|
||||
return false;
|
||||
}
|
||||
else if(name.indexOf(syl_title) != 0){
|
||||
$("#"+str+"_course_name_notice").html("请参照正确示例规范,应该以课程名称开头命名");
|
||||
$("#"+str+"_course_name_notice").show();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#"+str+"_course_name_notice").hide();
|
||||
|
@ -185,7 +196,7 @@ function regex_course_password(str)
|
|||
}
|
||||
//验证课程大纲
|
||||
function regex_syllabus_option(str) {
|
||||
if(document.getElementById(str + "_syllabus_id")) {
|
||||
if(str == "new" && document.getElementById(str + "_syllabus_id")) {
|
||||
var obj = document.getElementById(str + "_syllabus_id");
|
||||
var syllabus = obj.options[obj.selectedIndex];
|
||||
if(parseInt(syllabus.value) == 0) {
|
||||
|
|
Loading…
Reference in New Issue