Merge branch 'cxt_course' into develop
Conflicts: db/schema.rb
This commit is contained in:
commit
88b838a89a
|
@ -0,0 +1,3 @@
|
|||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
|
|
@ -0,0 +1,3 @@
|
|||
// Place all the styles related to the syllabuses controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
|
@ -67,12 +67,15 @@ class AdminController < ApplicationController
|
|||
def excellent_all_courses
|
||||
name = params[:name]
|
||||
@order = ""
|
||||
if params[:order] == 'asc'
|
||||
courses = Course.find_by_sql("SELECT c.*,count(c.id) FROM courses c,course_activities ca WHERE c.id = ca.course_id AND c.name like '%#{name}%' GROUP BY c.id ORDER BY count(c.id) asc, c.id desc")
|
||||
@sort = ""
|
||||
if params[:sort] && (params[:order] == 'act')
|
||||
courses = Course.find_by_sql("SELECT c.*,count(c.id) FROM courses c,course_activities ca WHERE c.id = ca.course_id AND c.name like '%#{name}%' GROUP BY c.id ORDER BY count(c.id) #{params[:sort]}, c.id desc")
|
||||
@order = params[:order]
|
||||
elsif params[:order] == 'desc'
|
||||
courses = Course.find_by_sql("SELECT c.*,count(c.id) FROM courses c,course_activities ca WHERE c.id = ca.course_id AND c.name like '%#{name}%' GROUP BY c.id ORDER BY count(c.id) DESC, c.id desc")
|
||||
@sort = params[:sort]
|
||||
elsif params[:sort] && (params[:order] == 'time')
|
||||
courses = Course.find_by_sql("SELECT * FROM courses WHERE name like '%#{name}%' ORDER BY time #{params[:sort]},id desc")
|
||||
@order = params[:order]
|
||||
@sort = params[:sort]
|
||||
else
|
||||
courses = Course.like(name).order('created_at desc')
|
||||
end
|
||||
|
@ -99,6 +102,22 @@ class AdminController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
#取消精品
|
||||
def cancel_excellent_course
|
||||
@course = Course.find params[:id]
|
||||
unless @course.nil?
|
||||
if @course.is_excellent == 1 || @course.excellent_option == 1
|
||||
@course.update_column('is_excellent', 0)
|
||||
@course.update_column('excellent_option', 0)
|
||||
end
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html{
|
||||
redirect_to excellent_courses_url
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
#管理员界面课程资源列表
|
||||
def course_resource_list
|
||||
|
||||
|
|
|
@ -1096,7 +1096,8 @@ class StudentWorkController < ApplicationController
|
|||
all_student_ids = "(" + pro.members.map{|member| member.user_id}.join(",") + ")"
|
||||
end
|
||||
all_students = User.where("id in #{all_student_ids}")
|
||||
@commit_student_ids = @homework.student_work_projects.map{|student| student.user_id}
|
||||
student_work_id = @homework.student_work_projects.where("user_id=?",User.current.id).empty? ? -1 : @homework.student_work_projects.where("user_id=?",User.current.id).first.student_work_id
|
||||
@commit_student_ids = @homework.student_work_projects.where("student_work_id != #{student_work_id}").map{|student| student.user_id}
|
||||
@users = searchstudent_by_name all_students,name
|
||||
respond_to do |format|
|
||||
format.js
|
||||
|
@ -1115,6 +1116,20 @@ class StudentWorkController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def get_user_infor
|
||||
req = Hash.new(false)
|
||||
user = User.where("id = #{params[:user_id].to_i}").first
|
||||
if user
|
||||
req[:id] = user.id
|
||||
req[:name] = user.show_name
|
||||
req[:student_id] = user.user_extensions.student_id
|
||||
req[:valid] = true
|
||||
else
|
||||
req[:valid] = false
|
||||
end
|
||||
render :json => req
|
||||
end
|
||||
|
||||
private
|
||||
def searchstudent_by_name users, name
|
||||
mems = []
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
class SyllabusesController < ApplicationController
|
||||
|
||||
before_filter :is_logged, :only => [:index, :show]
|
||||
before_filter :find_syllabus, :only => [:show]
|
||||
def index
|
||||
user = User.current
|
||||
@syllabuses = user.syllabuses
|
||||
end
|
||||
|
||||
def show
|
||||
@courses = @syllabus.courses
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
def find_syllabus
|
||||
@syllabus = Syllabus.find params[:id]
|
||||
end
|
||||
|
||||
def is_logged
|
||||
redirect_to signin_path unless User.current.logged?
|
||||
end
|
||||
end
|
|
@ -130,8 +130,11 @@ class UsersController < ApplicationController
|
|||
onclick_time = User.current.onclick_time.onclick_time
|
||||
messages.each do |message_all|
|
||||
# 未读的消息存放在数组
|
||||
if (message_all.message_type != "SystemMessage"&& !message_all.message.nil? && message_all.message.viewed == 0) || (message_all.message_type == "SystemMessage"&& !message_all.message.nil? && message_all.message.created_at > onclick_time)
|
||||
@message_alls << message_all.message
|
||||
mess = message_all.message
|
||||
if (message_all.message_type != "SystemMessage"&& !mess.nil? && (mess.viewed == 0 || !mess.viewed)) || (message_all.message_type == "SystemMessage"&& !mess.nil? && mess.created_at > onclick_time)
|
||||
unless (message_all.message_type == 'CourseMessage' && mess && mess.course.is_delete == 1)
|
||||
@message_alls << mess
|
||||
end
|
||||
break if @message_alls.length == 5
|
||||
end
|
||||
end
|
||||
|
@ -154,33 +157,41 @@ class UsersController < ApplicationController
|
|||
update_message_viewed(@user)
|
||||
end
|
||||
# @new_message_count = forge_querys.count + forum_querys.count + course_querys.count + user_querys.count
|
||||
courses = @user.courses.where("is_delete = 1")
|
||||
course_ids = courses.empty? ? "(-1)" : "(" + courses.map{|course| course.id}.join(",") + ")"
|
||||
case params[:type]
|
||||
when nil
|
||||
# 系统消息为管理员发送,我的消息中包含有系统消息
|
||||
@message_alls = []
|
||||
messages = MessageAll.where("(user_id =? and message_type !=?) or message_type =?" ,@user.id, "SystemMessage", "SystemMessage").includes(:message).order("created_at desc")
|
||||
messages.each do |message_all|
|
||||
@message_alls << message_all.message
|
||||
mess = message_all.message
|
||||
unless (message_all.message_type == 'CourseMessage' && mess && mess.course.is_delete == 1)
|
||||
@message_alls << mess
|
||||
end
|
||||
end
|
||||
when 'unviewed'
|
||||
@message_alls = []
|
||||
messages = MessageAll.where("user_id =?", @user.id).includes(:message).order("created_at desc")
|
||||
messages = MessageAll.where("message_alls.user_id =?", @user.id).includes(:message).order("created_at desc")
|
||||
messages.each do |message_all|
|
||||
# 在点击或者刷新消息列表后未读的消息存放在数组
|
||||
if message_all.message_type != "SystemMessage"&& !message_all.message.nil? && message_all.message.viewed == 0
|
||||
@message_alls << message_all.message
|
||||
mess = message_all.message
|
||||
if message_all.message_type != "SystemMessage"&& !mess.nil? && (mess.viewed == 0 || !mess.viewed)
|
||||
unless (message_all.message_type == 'CourseMessage' && mess && mess.course.is_delete == 1)
|
||||
@message_alls << mess
|
||||
end
|
||||
end
|
||||
end
|
||||
#课程相关消息
|
||||
when 'homework'
|
||||
@message_alls = CourseMessage.where("course_message_type in ('HomeworkCommon','StudentWorksScore','JournalsForMessage','StudentWork','Exercise') and user_id =?", @user.id).order("created_at desc")
|
||||
@message_alls = CourseMessage.where("course_message_type in ('HomeworkCommon','StudentWorksScore','JournalsForMessage','StudentWork','Exercise') and user_id =? and course_id NOT IN #{course_ids}", @user.id).order("created_at desc")
|
||||
when 'course_message'
|
||||
@message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Message", @user.id).order("created_at desc")
|
||||
@message_alls = CourseMessage.where("course_message_type =? and user_id =? and course_id NOT IN #{course_ids}", "Message", @user.id).order("created_at desc")
|
||||
when 'course_news'
|
||||
# 课程通知包含发布的通知和回复的通知
|
||||
@message_alls = CourseMessage.where("course_message_type in ('News', 'Comment') and user_id =?", @user.id).order("created_at desc")
|
||||
@message_alls = CourseMessage.where("course_message_type in ('News', 'Comment') and user_id =? and course_id NOT IN #{course_ids}", @user.id).order("created_at desc")
|
||||
when 'poll'
|
||||
@message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Poll", @user.id).order("created_at desc")
|
||||
@message_alls = CourseMessage.where("course_message_type =? and user_id =? and course_id NOT IN #{course_ids}", "Poll", @user.id).order("created_at desc")
|
||||
#项目相关消息
|
||||
when 'issue'
|
||||
@message_alls = ForgeMessage.where("forge_message_type in ('Issue', 'Journal') and user_id =?" , @user.id).order("created_at desc")
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
module SyllabusesHelper
|
||||
end
|
|
@ -147,7 +147,9 @@ module UsersHelper
|
|||
|
||||
# 统计未读消息数
|
||||
def unviewed_message(user)
|
||||
course_count = CourseMessage.where("user_id =? and viewed =?", user, 0).count
|
||||
courses = user.courses.where("is_delete = 1")
|
||||
course_ids = courses.empty? ? "(-1)" : "(" + courses.map{|course| course.id}.join(",") + ")"
|
||||
course_count = CourseMessage.where("user_id =? and viewed =? and course_id not in #{course_ids}", user, 0).count
|
||||
forge_count = ForgeMessage.where("user_id =? and viewed =?", user, 0).count
|
||||
org_count = OrgMessage.where("user_id =? and viewed =?", user, 0).count
|
||||
user_feedback_count = UserFeedbackMessage.where("user_id =? and viewed =?", user, 0).count
|
||||
|
|
|
@ -24,6 +24,7 @@ class Course < ActiveRecord::Base
|
|||
#belongs_to :project, :class_name => 'Course', :foreign_key => :extra, primary_key: :identifier
|
||||
belongs_to :teacher, :class_name => 'User', :foreign_key => :tea_id # 定义一个方法teacher,该方法通过tea_id来调用User表
|
||||
belongs_to :school, :class_name => 'School', :foreign_key => :school_id #定义一个方法school,该方法通过school_id来调用School表
|
||||
belongs_to :syllabus
|
||||
# has_many :bid
|
||||
has_many :members, :include => [:principal, :roles], :conditions => "#{Principal.table_name}.type='User' AND #{Principal.table_name}.status=#{Principal::STATUS_ACTIVE}"
|
||||
has_many :memberships, :class_name => 'Member'
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class Syllabus < ActiveRecord::Base
|
||||
belongs_to :user
|
||||
has_many :courses
|
||||
attr_accessible :description, :title
|
||||
end
|
|
@ -90,6 +90,7 @@ class User < Principal
|
|||
has_many :homework_users
|
||||
has_many :homework_attaches, :through => :homework_users
|
||||
has_many :homework_evaluations
|
||||
has_many :syllabuses, :dependent => :destroy
|
||||
#问卷相关关关系
|
||||
has_many :poll_users, :dependent => :destroy
|
||||
has_many :poll_votes, :dependent => :destroy
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
<td class="center">
|
||||
<%= course.course_activities.count%>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= course.time %>
|
||||
</td>
|
||||
<td class="buttons">
|
||||
<%= link_to( course.is_excellent == 1 || course.excellent_option == 1 ? "取消精品" : "设为精品", { :controller => 'admin', :action => 'set_excellent_course', :id => course.id },:remote=>true, :class => 'icon-del') %>
|
||||
</td>
|
||||
|
|
|
@ -45,11 +45,14 @@
|
|||
<th style="width: 25px;">
|
||||
资源数
|
||||
</th>
|
||||
<th style="width: 50px;">
|
||||
<th style="width: 30px;">
|
||||
帖子数
|
||||
</th>
|
||||
<th style="width: 50px;" class = "<%= @order == 'desc' ? 'st_up' : (@order == 'asc' ? 'st_down' : '') %>">
|
||||
<%=link_to '动态数', excellent_all_courses_path(:order=> @order == "desc" ? 'asc' : 'desc') %>
|
||||
<th style="width: 30px;" class = "<%= @order == 'act' ? (@sort == 'desc' ? 'st_up' : (@sort == 'asc' ? 'st_down' : '')) : '' %>">
|
||||
<%=link_to '动态数', excellent_all_courses_path(:sort=> @sort == "desc" ? 'asc' : 'desc', :order => 'act') %>
|
||||
</th>
|
||||
<th style="width: 40px;" class = "<%= @order == 'time' ? (@sort == 'desc' ? 'st_up' : (@sort == 'asc' ? 'st_down' : '')) : '' %>">
|
||||
<%=link_to '开课学期', excellent_all_courses_path(:sort=> @sort == "desc" ? 'asc' : 'desc', :order => 'time') %>
|
||||
</th>
|
||||
<th style="width: 40px;">
|
||||
</tr>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<h3>
|
||||
<%=l(:label_excellent_courses_list)%>
|
||||
</h3>
|
||||
<%= render 'tab_excellent_courses' %>
|
||||
<%= render 'admin/tab_excellent_courses' %>
|
||||
|
||||
<h3>
|
||||
<%=l(:label_excellent_courses_list)%>
|
||||
|
@ -33,12 +33,14 @@
|
|||
<th style="width: 25px;">
|
||||
资源数
|
||||
</th>
|
||||
<th style="width: 70px;">
|
||||
<th style="width: 50px;">
|
||||
帖子数
|
||||
</th>
|
||||
<th style="width: 70px;">
|
||||
<th style="width: 50px;">
|
||||
动态数
|
||||
</th>
|
||||
<th style="width: 40px;">
|
||||
</tr>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
@ -74,6 +76,9 @@
|
|||
<td class="center">
|
||||
<%= course.course_activities.count%>
|
||||
</td>
|
||||
<td class="buttons">
|
||||
<%= link_to( course.is_excellent == 1 || course.excellent_option == 1 ? "取消精品" : "设为精品", { :controller => 'admin', :action => 'cancel_excellent_course', :id => course.id }, :class => 'icon-del') %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
|
|
|
@ -59,12 +59,12 @@
|
|||
<td class="center">
|
||||
<%= format_date(journal.created_on) %>
|
||||
</td>
|
||||
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title='<%=journal.notes %>'>
|
||||
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title='<%=strip_html(journal.notes) %>'>
|
||||
<%case journal.jour_type %>
|
||||
<% when 'Principal' %>
|
||||
<%= link_to(journal.notes.html_safe, feedback_path(journal.jour_id)) %>
|
||||
<%= link_to(strip_html(journal.notes), feedback_path(journal.jour_id)) %>
|
||||
<% when 'Course' %>
|
||||
<%= link_to(journal.notes.html_safe, course_feedback_path(journal.jour_id)) %>
|
||||
<%= link_to(strip_html(journal.notes), course_feedback_path(journal.jour_id)) %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="center">
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<script src="/javascripts/i18n/jquery.ui.datepicker-zh-CN.js" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#RSide").removeAttr("id");
|
||||
|
|
|
@ -63,4 +63,11 @@
|
|||
<%#end%>
|
||||
<% end%>
|
||||
<li class="polls_date fr mr10">截止时间:<%= format_time(exercise.end_time.to_s)%></li>
|
||||
<% if exercise.show_result == 1 %>
|
||||
<% if exercise.end_time <= Time.now %>
|
||||
<li><%= link_to l(:label_statistical_results), student_exercise_list_exercise_path(exercise.id,:course_id => @course.id), :class => "pollsbtn fr mr10"%></li>
|
||||
<% else %>
|
||||
<li class="pollsbtn fr mr10 pollsbtn_grey" title="截止时间未到,暂不能查看统计结果">统计结果</li>
|
||||
<%end%>
|
||||
<% end %>
|
||||
<% end%>
|
|
@ -20,7 +20,13 @@
|
|||
<div class="testDesEdit mt5"><%= exercise.exercise_description.nil? ? "" : exercise.exercise_description.html_safe%></div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="mb5">得分:<span class="c_red"><%=exercise_user.score %>分</span></div>
|
||||
<div>
|
||||
<div class="fl mb5">得分:<span class="c_red"><%=exercise_user.score %>分</span></div>
|
||||
<% if User.current.admin? || User.current.allowed_to?(:as_teacher,exercise.course) || (exercise.exercise_status == 3 && exercise.show_result == 1) %>
|
||||
<%= link_to '返回统计列表>>',student_exercise_list_exercise_path(exercise.id,:course_id => exercise.course.id) , :class => "fr linkBlue" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% mc_question_list = exercise.exercise_questions.where("question_type=1") %>
|
||||
<% mcq_question_list = exercise.exercise_questions.where("question_type=2") %>
|
||||
<% single_question_list = exercise.exercise_questions.where("question_type=3") %>
|
||||
|
|
|
@ -93,18 +93,33 @@
|
|||
url: '<%= url_for(:controller => 'student_work', :action => 'search_course_students') %>'+'?homework='+<%=@homework.id %>,
|
||||
type:'get'
|
||||
});
|
||||
<% if defined?(edit_mode) && edit_mode %>
|
||||
<% pro = @homework.student_work_projects.where("user_id = ?",User.current.id).first.project_id.to_i %>
|
||||
<% members = @homework.student_work_projects.where("project_id = ? and is_leader =?",pro,0) %>
|
||||
<% members.each do |member| %>
|
||||
var link = "<li id='choose_student_<%=member.user_id%>' onclick='delete_student(<%=member.user_id %>);'><%=member.user.show_name %>";
|
||||
<% unless member.user.user_extensions.student_id == "" %>
|
||||
link += "(<%=member.user.user_extensions.student_id %>)";
|
||||
<% end %>
|
||||
link += "</li>";
|
||||
$("#choose_students_list").append(link);
|
||||
<% end %>
|
||||
<% end %>
|
||||
var ids = $("#group_member_ids").val().split(',');
|
||||
if (ids.length > 1){
|
||||
for(var i=1; i<ids.length; i++) {
|
||||
if($("#choose_student_"+ids[i]).length == 0) {
|
||||
$.get(
|
||||
'/student_work/get_user_infor',
|
||||
{
|
||||
user_id: ids[i]
|
||||
},
|
||||
function (data) {
|
||||
if (data.valid) {
|
||||
var link = "<li id='choose_student_"+data.id+"' onclick='delete_student("+data.id+");'>"+data.name;
|
||||
if (data.student_id != "" ) {
|
||||
link += "("+data.student_id+")";
|
||||
}
|
||||
link += "</li>";
|
||||
$("#choose_students_list").append(link);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<% end %>
|
|
@ -1,7 +1,8 @@
|
|||
<div id="popbox02">
|
||||
<div class="ni_con">
|
||||
<p>
|
||||
当前作品未进行评分,是否确定提交?
|
||||
<%#A if work.teacher_score.nil? || work. %>
|
||||
您当次评阅未对作品进行评分,分数将取上次的评分结果,若没有评分记录则不评分,是否确定提交?
|
||||
</p>
|
||||
<div class="ni_btn">
|
||||
<a href="javascript:" class="tijiao" onclick="submit_teacher_score(<%=work.id %>);" style="margin-bottom: 20px;" >
|
||||
|
|
|
@ -2,12 +2,14 @@
|
|||
<span class="uploadText">评分设置</span>
|
||||
<div class="mt15">
|
||||
<span class="f14 fontGrey3 mr10">迟交扣分</span>
|
||||
<input type="text" name="late_penalty" id="late_penalty_num" placeholder="请输入0-50数值" class=" markInput" value="<%= homework.late_penalty%>" onkeyup="check_late_penalty('late_penalty_num')"/>
|
||||
<input type="text" name="late_penalty" id="late_penalty_num" placeholder="0-50" class=" markInput" value="<%= homework.late_penalty%>" onkeyup="check_late_penalty('late_penalty_num')"/>
|
||||
<span class="f12 c_red ml10">请输入0-50数值</span>
|
||||
</div>
|
||||
<% if homework.anonymous_comment == 0 %>
|
||||
<div>
|
||||
<div class="mt10">
|
||||
<span class="f14 fontGrey3 mr10">缺评扣分</span>
|
||||
<input type="text" name="absence_penalty" id="absence_penalty_num" placeholder="请输入0-50数值" class="markInput" value="<%= homework.homework_detail_manual.absence_penalty%>" onkeyup="check_late_penalty('absence_penalty_num')"/>
|
||||
<input type="text" name="absence_penalty" id="absence_penalty_num" placeholder="0-50" class="markInput" value="<%= homework.homework_detail_manual.absence_penalty%>" onkeyup="check_late_penalty('absence_penalty_num')"/>
|
||||
<span class="f12 c_red ml10">请输入0-50数值</span>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
@ -55,11 +57,23 @@
|
|||
</div>
|
||||
<div>
|
||||
<div class="courseSendSubmit">
|
||||
<a href="javascript:void(0);" class="sendSourceText" onclick="$('#ajax-modal').find('form').submit();clickCanel();">确定</a>
|
||||
<a href="javascript:void(0);" class="sendSourceText" onclick="set_score_rule_submit();">确定</a>
|
||||
</div>
|
||||
<div class="courseSendCancel">
|
||||
<a href="javascript:void(0);" class="sendSourceText linkGrey6" onclick="hideModal();">取消</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
function set_score_rule_submit() {
|
||||
if($("#late_penalty_num").val() == ""){
|
||||
$("#late_penalty_num").val("0");
|
||||
}
|
||||
if($("#absence_penalty_num").val() == ""){
|
||||
$("#absence_penalty_num").val("0");
|
||||
}
|
||||
$('#ajax-modal').find('form').submit();
|
||||
clickCanel();
|
||||
}
|
||||
</script>
|
|
@ -4,14 +4,21 @@
|
|||
<font class="f12 c_red">
|
||||
(<%= @student_work_count%>人已交)
|
||||
</font>
|
||||
<% my_work = @homework.student_works.where("user_id = #{User.current.id}").first %>
|
||||
<%# my_work = @homework.student_works.where("user_id = #{User.current.id}").first %>
|
||||
<% my_work = cur_user_works_for_homework @homework %>
|
||||
<% if !@is_teacher && my_work.nil? && User.current.member_of_course?(@course) %>
|
||||
<span class="f12 c_red">您尚未提交作品</span>
|
||||
<%=link_to "提交作品", new_student_work_url_without_domain(@homework.id),:class => 'blueCir ml5 f12' %>
|
||||
<% unless @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %>
|
||||
<%=link_to "提交作品", new_student_work_url_without_domain(@homework.id),:class => 'blueCir ml5 f12' %>
|
||||
<% end %>
|
||||
<% elsif !@is_teacher && my_work &&Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d") && !@stundet_works.empty?%>
|
||||
<span class="f12 c_red">您已提交且不可再修改,因为截止日期已过</span>
|
||||
<span class="f12 c_red">已提交且不可再修改,因为截止日期已过</span>
|
||||
<% elsif !@is_teacher && my_work &&Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.parse(Time.now.to_s).strftime("%Y-%m-%d") && !@stundet_works.empty?%>
|
||||
<span class="f12 c_red">您已提交,您还可以修改</span>
|
||||
<% if @homework.homework_type == 3 %>
|
||||
<span class="f12 c_red">组长已提交,组长还可修改</span>
|
||||
<% else %>
|
||||
<span class="f12 c_red">您已提交,您还可以修改</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</span>
|
||||
<%if @is_teacher || @homework.homework_detail_manual.comment_status == 3 || @homework.is_open == 1%>
|
||||
|
|
|
@ -103,21 +103,11 @@
|
|||
}
|
||||
|
||||
function popupRegex(){
|
||||
if($("#group_member_ids").length > 0) {
|
||||
if(regexStudentWorkMember(parseInt($.trim($("#min_num_member").html())),parseInt($.trim($("#max_num_member").html())))) {
|
||||
$('#ajax-modal').html("<div><p align='center' style='margin-top: 35px'>作品信息完整性校验中,请稍等...</p></div>");
|
||||
showModal('ajax-modal', '500px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("anonymos");
|
||||
}
|
||||
} else {
|
||||
$('#ajax-modal').html("<div><p align='center' style='margin-top: 35px'>作品信息完整性校验中,请稍等...</p></div>");
|
||||
showModal('ajax-modal', '500px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("anonymos");
|
||||
}
|
||||
$('#ajax-modal').html("<div><p align='center' style='margin-top: 35px'>作品信息完整性校验中,请稍等...</p></div>");
|
||||
showModal('ajax-modal', '500px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("anonymos");
|
||||
}
|
||||
|
||||
function nh_check_field(params){
|
||||
|
@ -140,6 +130,12 @@
|
|||
params.contentmsg.html('');
|
||||
}
|
||||
}
|
||||
if(!result) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
if($("#group_member_ids").length > 0) {
|
||||
result=regexStudentWorkMember(parseInt($.trim($("#min_num_member").html())),parseInt($.trim($("#max_num_member").html())));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -62,21 +62,11 @@
|
|||
}
|
||||
// 作品校验
|
||||
function popupRegex(){
|
||||
if($("#group_member_ids").length > 0) {
|
||||
if(regexStudentWorkMember(parseInt($.trim($("#min_num_member").html())),parseInt($.trim($("#max_num_member").html())))) {
|
||||
$('#ajax-modal').html("<div><p align='center' style='margin-top: 35px'>作品信息完整性校验中,请稍等...</p></div>");
|
||||
showModal('ajax-modal', '500px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("anonymos");
|
||||
}
|
||||
} else {
|
||||
$('#ajax-modal').html("<div><p align='center' style='margin-top: 35px'>作品信息完整性校验中,请稍等...</p></div>");
|
||||
showModal('ajax-modal', '500px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("anonymos");
|
||||
}
|
||||
$('#ajax-modal').html("<div><p align='center' style='margin-top: 35px'>作品信息完整性校验中,请稍等...</p></div>");
|
||||
showModal('ajax-modal', '500px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("anonymos");
|
||||
}
|
||||
|
||||
function nh_check_field(params){
|
||||
|
@ -99,6 +89,12 @@
|
|||
params.contentmsg.html('');
|
||||
}
|
||||
}
|
||||
if(!result) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
if($("#group_member_ids").length > 0) {
|
||||
result=regexStudentWorkMember(parseInt($.trim($("#min_num_member").html())),parseInt($.trim($("#max_num_member").html())));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
hideModal('#popbox02');
|
||||
$("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => {:container => @student_work, :has_program=>false,:has_group=>false})%>");
|
||||
$("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => {:container => @student_work, :has_program=>false,:has_group=>false})%>");
|
||||
$("#group_member_ids").val("<%=User.current.id %>");
|
|
@ -7,7 +7,8 @@ $("#all_students_list").empty();
|
|||
link += "</li>";
|
||||
$("#all_students_list").append(link);
|
||||
|
||||
var str = "";
|
||||
var str = $("#group_member_ids").val();
|
||||
/*var str = "";
|
||||
var lists = $("#choose_students_list li");
|
||||
if(lists.length > 0) {
|
||||
for(var i=0; i<lists.length; i++) {
|
||||
|
@ -17,7 +18,7 @@ $("#all_students_list").empty();
|
|||
str += ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
<% if user.id.to_i != User.current.id.to_i && (@commit_student_ids.find{|e| e.to_i == user.id.to_i}).nil? && user.member_of_course?(@course) %>
|
||||
if (str.indexOf(<%=user.id.to_s %>) < 0) {
|
||||
$("#student_<%=user.id %>").one("click",function choose_student() {
|
||||
|
|
|
@ -14,13 +14,23 @@
|
|||
<% course=Course.find(activity.jour_id) %>
|
||||
<%= link_to course.name.to_s+" | 课程留言", course_feedback_path(course), :class => "newsBlue ml15" %>
|
||||
</div>
|
||||
<div class="homepagePostTitle break_word list_style upload_img">
|
||||
<% if activity.parent %>
|
||||
<%= link_to activity.parent.notes.html_safe, course_feedback_path(course), :class => "postGrey" %>
|
||||
<% else %>
|
||||
<%= link_to activity.notes.html_safe, course_feedback_path(course), :class => "postGrey" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<!--<div class="homepagePostTitle break_word list_style upload_img">
|
||||
<%# if activity.parent %>
|
||||
<%#= link_to activity.parent.notes.html_safe, course_feedback_path(course), :class => "postGrey" %>
|
||||
<%# else %>
|
||||
<%#= link_to activity.notes.html_safe, course_feedback_path(course), :class => "postGrey" %>
|
||||
<%# end %>
|
||||
</div>-->
|
||||
<% if activity.parent %>
|
||||
<% content = activity.parent.notes %>
|
||||
<% else %>
|
||||
<% content = activity.notes %>
|
||||
<% end %>
|
||||
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %>
|
||||
<div class="cl"></div>
|
||||
<div id="intro_content_show_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
|
||||
<div id="intro_content_hide_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
|
||||
<div class="cl"></div>
|
||||
<div class="homepagePostDate fl">
|
||||
留言时间:<%= format_time(activity.created_on) %>
|
||||
</div>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<% if AtMessage === ma && ma.at_valid? %>
|
||||
<% if ma.class == AtMessage && ma.at_valid? %>
|
||||
<ul class="homepageNewsList fl">
|
||||
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.author), :width => "30", :height => "30"),user_path(ma.author) %></a></li>
|
||||
<li class="homepageNewsPubType fl">
|
||||
|
|
|
@ -3,11 +3,14 @@
|
|||
<div class="mt10">
|
||||
<span class="f14 fontGrey3 mr5">每组最小人数:</span>
|
||||
<input id="min_num" type="text" name="" class="markInput" value="<%=(edit_mode && homework.is_group_homework?) ? homework.homework_detail_group.min_num : 2 %>" />人
|
||||
<span class="c_red undis" id="min_num_notice"></span>
|
||||
</div>
|
||||
<div class="mt10">
|
||||
<span class="f14 fontGrey3 mr5">每组最大人数:</span>
|
||||
<input id="max_num" type="text" name="" class="markInput" value="<%=(edit_mode && homework.is_group_homework?) ? homework.homework_detail_group.max_num : 10 %>" />人
|
||||
<span class="c_red undis" id="max_num_notice"></span>
|
||||
</div>
|
||||
<p class="c_red undis" id="min_max_num_notice"></p>
|
||||
<div class="mb10 mt10">
|
||||
<label>
|
||||
<input type="checkbox" class="mr5" name="base_on_project" value="<%=(edit_mode && homework.is_group_homework?) ? homework.homework_detail_group.base_on_project : 1 %>" id="base_on_project"/>
|
||||
|
|
|
@ -16,22 +16,26 @@
|
|||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% if is_activity.to_i == 1 %>
|
||||
<div class="homepagePostTitle break_word list_style upload_img">
|
||||
<% if activity.parent %>
|
||||
<%= link_to activity.parent.notes.html_safe, feedback_path(activity.jour, :host=> Setting.host_user), :class => "postGrey" %>
|
||||
<% else %>
|
||||
<%= link_to activity.notes.html_safe, feedback_path(activity.jour, :host=> Setting.host_user), :class => "postGrey" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% else %>
|
||||
<%# if is_activity.to_i == 1 %>
|
||||
<!--<div class="homepagePostTitle break_word list_style upload_img">
|
||||
<%# if activity.parent %>
|
||||
<%#= link_to activity.parent.notes.html_safe, feedback_path(activity.jour, :host=> Setting.host_user), :class => "postGrey" %>
|
||||
<%# else %>
|
||||
<%#= link_to activity.notes.html_safe, feedback_path(activity.jour, :host=> Setting.host_user), :class => "postGrey" %>
|
||||
<%# end %>
|
||||
</div>-->
|
||||
<%# else %>
|
||||
<% if activity.parent %>
|
||||
<% content = activity.parent.notes %>
|
||||
<% else %>
|
||||
<% content = activity.notes %>
|
||||
<% end %>
|
||||
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<div id="intro_content_show_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
|
||||
<div id="intro_content_hide_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
|
||||
<div class="cl"></div>
|
||||
<%# end %>
|
||||
<div class="homepagePostDate fl">
|
||||
留言时间:<%= format_time(activity.created_on) %>
|
||||
</div>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
<%if jours %>
|
||||
<% jours.each do |jour|%>
|
||||
<% unless jour.private == 1 && (!User.current || (User.current && jour.jour_id != User.current.id && jour.user_id != User.current.id)) %>
|
||||
<% unless jour.private == 1 && (!User.current || (User.current && jour.jour_id != User.current.id && jour.user_id != User.current.id && !User.current.admin?)) %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
sd_create_editor_from_data(<%= jour.id%>, null, "100%", "<%=jour.class.to_s%>");
|
||||
|
|
|
@ -7,6 +7,15 @@
|
|||
$(function(){
|
||||
$("#RSide").removeAttr("id");
|
||||
$("#Container").css("width","1000px");
|
||||
<%if @homework.anonymous_comment == 0 && @homework.homework_detail_manual.comment_status != 1%>
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/new_student_work_alert') %>');
|
||||
showModal('ajax-modal', '360px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().css("top","65%").css("left","60%").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("anonymos_work");
|
||||
<% end%>
|
||||
});
|
||||
</script>
|
||||
<!-- 模板1开始,可以使用script(type设置为text/html)来存放模板片段,并且用id标示 -->
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
<% if (!@message_alls.nil? && @message_alls.count >0) %>
|
||||
<% if params[:type].nil? || params[:type] == "unviewed" %>
|
||||
<div class="newsReadSetting">
|
||||
有 <span class="c_red"><%= unviewed_message(@user) %></span> 条未读
|
||||
<% unless (unviewed_message(@user) == 0 || User.current != @user) %>
|
||||
<% count = unviewed_message(@user) %>
|
||||
有 <span class="c_red"><%= count %></span> 条未读
|
||||
<% unless (count == 0 || User.current != @user) %>
|
||||
<a href="javascript:void(0);" class="ml15"><%= link_to "全部设为已读", user_message_path(User.current, :viewed => 'all') %></a>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -330,6 +330,7 @@ RedmineApp::Application.routes.draw do
|
|||
post 'last_codecomparetime'
|
||||
post 'set_score_rule'
|
||||
get 'work_canrepeat'
|
||||
get 'get_user_infor'
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1020,6 +1021,7 @@ RedmineApp::Application.routes.draw do
|
|||
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'
|
||||
match 'admin/cancel_excellent_course/:id', :to => 'admin#cancel_excellent_course'
|
||||
get 'admin/course_resource_list'
|
||||
get 'admin/project_resource_list'
|
||||
match 'admin/users', :via => :get
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
class CreateSyllabuses < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :syllabuses do |t|
|
||||
t.string :title
|
||||
t.text :description
|
||||
t.references :user
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
add_index :syllabuses, :user_id
|
||||
end
|
||||
end
|
|
@ -0,0 +1,6 @@
|
|||
class AddSyllabusToCourse < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :courses, :syllabus_id, :integer
|
||||
add_index :courses, :syllabus_id
|
||||
end
|
||||
end
|
|
@ -550,7 +550,7 @@ function check_late_penalty(id)
|
|||
}
|
||||
else
|
||||
{
|
||||
obj.val("0");
|
||||
obj.val("");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -194,9 +194,11 @@ $(function(){
|
|||
$("#GroupPopupBox").dialog("open");
|
||||
$(".ui-dialog-titlebar").hide();
|
||||
$("a.popClose").on('click', function(){
|
||||
reset_group_attr();
|
||||
$("#GroupPopupBox" ).dialog("close");
|
||||
});
|
||||
$("#cancel_group").on('click', function(){
|
||||
reset_group_attr();
|
||||
$("#GroupPopupBox" ).dialog("close");
|
||||
});
|
||||
$('#min_num').focus();
|
||||
|
@ -351,29 +353,67 @@ $(function(){
|
|||
$("#GroupPopupBox").dialog("open");
|
||||
$(".ui-dialog-titlebar").hide();
|
||||
$("a.popClose").on('click', function () {
|
||||
reset_group_attr();
|
||||
$("#GroupPopupBox").dialog("close");
|
||||
});
|
||||
$("#cancel_group").on('click', function () {
|
||||
reset_group_attr();
|
||||
$("#GroupPopupBox").dialog("close");
|
||||
});
|
||||
$('#min_num').focus();
|
||||
}
|
||||
});
|
||||
|
||||
var reset_group_attr = function() {
|
||||
$("#min_num_notice").hide();
|
||||
$("#min_max_num_notice").hide();
|
||||
$("#max_num_notice").hide();
|
||||
if($("input[name=min_num]").length > 0 && $("input[name=max_num]").length > 0) {
|
||||
$("#min_num").val($("input[name=min_num]").val());
|
||||
$("#max_num").val($("input[name=max_num]").val());
|
||||
} else {
|
||||
$("#min_num").val(2);
|
||||
$("#max_num").val(10);
|
||||
}
|
||||
};
|
||||
var saveGroupAttr = function() {
|
||||
var valid = true;
|
||||
var base_on_project = 0;
|
||||
var min = $.trim($("#min_num").val());
|
||||
var max = $.trim($("#max_num").val());
|
||||
if(min.length <= 0) {
|
||||
var regex = /^\d+$/;
|
||||
if(!regex.test(min) || parseInt(min) <= 0) {
|
||||
$("#min_num_notice").html("请输入正整数");
|
||||
$("#max_num_notice").html("");
|
||||
$("#min_max_num_notice").html("");
|
||||
$("#min_num_notice").show();
|
||||
$("#min_num").focus();
|
||||
valid = false;
|
||||
return false;
|
||||
} else {
|
||||
$("#min_num_notice").html("");
|
||||
$("#min_num_notice").hide();
|
||||
}
|
||||
if(max.length <= 0) {
|
||||
if(!regex.test(max) || parseInt(max) <= 0) {
|
||||
$("#max_num_notice").html("请输入正整数");
|
||||
$("#min_num_notice").html("");
|
||||
$("#min_max_num_notice").html("");
|
||||
$("#max_num_notice").show();
|
||||
$("#max_num").focus();
|
||||
valid = false;
|
||||
return false;
|
||||
} else {
|
||||
$("#max_num_notice").html("");
|
||||
$("#max_num_notice").hide();
|
||||
}
|
||||
if(parseInt(min) > parseInt(max)) {
|
||||
$("#min_max_num_notice").html("最小人数不得大于最大人数");
|
||||
$("#min_num_notice").html("");
|
||||
$("#max_num_notice").html("");
|
||||
$("#min_max_num_notice").show();
|
||||
$("#max_num").focus();
|
||||
return false;
|
||||
} else {
|
||||
$("#min_max_num_notice").html("");
|
||||
$("#min_max_num_notice").hide();
|
||||
}
|
||||
if ($("#base_on_project").is(":checked")) {
|
||||
base_on_project = 1;
|
||||
|
|
|
@ -259,6 +259,24 @@ function regex_evaluation_end(){
|
|||
}
|
||||
}
|
||||
|
||||
//处理迟交、缺评扣分
|
||||
function check_late_penalty(id)
|
||||
{
|
||||
var obj = $("#" + id);
|
||||
var regex = /^\d+$/;
|
||||
if(regex.test(obj.val()))
|
||||
{
|
||||
if(obj.val() > 50)
|
||||
{
|
||||
obj.val("50");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
obj.val("");
|
||||
}
|
||||
}
|
||||
|
||||
//验证匿评数量
|
||||
function regex_evaluation_num(){
|
||||
var evaluation_num = $.trim($("#evaluation_num").val());
|
||||
|
@ -675,4 +693,4 @@ function register(){
|
|||
$('#user_password').blur();
|
||||
$('#user_password_confirmation').blur();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe SyllabusesController, :type => :controller do
|
||||
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
# Read about factories at https://github.com/thoughtbot/factory_girl
|
||||
|
||||
FactoryGirl.define do
|
||||
factory :syllabus do
|
||||
title "MyString"
|
||||
description "MyText"
|
||||
user nil
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Syllabus, :type => :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
Loading…
Reference in New Issue