Merge branch 'daiao_dev' into dev_shcool

This commit is contained in:
huang 2016-07-27 10:54:38 +08:00
commit 29edd60ce6
19 changed files with 98 additions and 31 deletions

View File

@ -381,14 +381,32 @@ class StudentWorkController < ApplicationController
@is_evaluation = @homework.homework_detail_manual && @homework.homework_detail_manual.comment_status == 2 && !@is_teacher #是不是匿评
@show_all = false
course_group = CourseGroup.find_by_id(@group) if @group
if course_group
group_students = course_group.users
if group_students.empty?
student_in_group = '(0)'
# 0表示没有分组的学生-1表示所有分组的学生
if @group
if @group == "0"
none_group_students = @course.members.select{ |member| member.course_group_id == 0 }
if none_group_students.empty?
student_in_group = '(0)'
else
student_in_group = '(' + none_group_students.map{ |member| member.user_id }.join(',') + ')'
end
elsif @group == "-1"
all_group_students = @course.members.select{ |member| member.course_group_id }
if all_group_students.empty?
student_in_group = '(0)'
else
student_in_group = '(' + all_group_students.map{ |member| member.user_id }.join(',') + ')'
end
else
student_in_group = '(' + group_students.map{|user| user.id}.join(',') + ')'
course_group = CourseGroup.find_by_id(@group)
group_students = course_group.users
if group_students.empty?
student_in_group = '(0)'
else
student_in_group = '(' + group_students.map{ |user| user.id }.join(',') + ')'
end
end
#开放作品 || 老师 || 超级管理员 || 禁用匿评&&作业截止&&已提交作品 显示所有列表
if (@homework.is_open == 1 && @course.is_public == 1) || (@homework.is_open == 1 && @course.is_public == 0 && User.current.member_of_course?(@course)) || @is_teacher || User.current.admin? || (User.current.member_of_course?(@course) && @homework.anonymous_comment == 1 && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && !@homework.student_works.has_committed.where(:user_id => User.current.id).empty?)
if @order == 'lastname'

View File

@ -88,7 +88,7 @@ class SyllabusesController < ApplicationController
end
def destroy
if @syllabus && @syllabus.courses.empty?
if @syllabus && @syllabus.courses.not_deleted.empty?
@syllabus.destroy
redirect_to user_courselist_user_path(User.current.id)
end

View File

@ -591,6 +591,26 @@ module CoursesHelper
Course.tagged_with(tag_name).order('updated_at desc')
end
# 获取动态列表名称
def get_acts_list_type type
case type
when "homework"
l(:label_homework_acts)
when "news"
l(:label_news_acts)
when "attachment"
l(:label_attachment_acts)
when "message"
l(:label_message_acts)
when "journalsForMessage"
l(:label_journalsForMessage_acts)
when "poll"
l(:label_poll_acts)
else
l(:label_all_cats)
end
end
#分班下拉框
def course_group_option course
type = []

View File

@ -101,6 +101,10 @@ module StudentWorkHelper
if course.course_groups && !course.course_groups.empty?
base = []
base << l(:label_chose_group)
base << -1
result << base
base = []
base << l(:label_no_group)
base << 0
result << base
course.course_groups.each do |group|

View File

@ -130,12 +130,14 @@
<p id="subjectmsg"></p>
</div>
<div id="topic_editor" style="display: none;">
<%if User.current.member_of_course?(course)%>
<%if User.current.member_of_course?(course) %>
<div class="mt10">
<%= f.check_box :sticky, :value => topic.sticky%>
<%= label_tag 'message_sticky', l(:label_board_sticky) %>
<%= f.check_box :locked, :value => topic.locked%>
<% if User.current.id == course.tea_id %>
<%= f.check_box :sticky, :value => topic.sticky %>
<%= label_tag 'message_sticky', l(:label_board_sticky) %>
<%= f.check_box :locked, :value => topic.locked %>
<%= label_tag 'message_locked', l(:label_board_locked) %>
<% end %>
<div class="cl"></div>
</div>
<% end %>

View File

@ -1,7 +1,7 @@
<% @members.each do |member| %>
<li >
<%#= link_to_user_header member.principal,true,:class => "w150 c_orange fl" %>
<%= link_to "#{member.principal}#{member.principal.show_name}", user_path(member.principal), :class => "w150 linkBlue fl" %>
<%= link_to "#{member.principal}#{member.principal.show_name}", user_path(member.principal), :class => "w150 linkBlue fl", :style=>"white-space: nowrap;overflow: hidden;text-overflow: ellipsis;", :title => "#{member.principal}#{member.principal.show_name}" %>
<span class="w150 fl">
<%= zh_course_role(h member.roles.sort.collect(&:to_s).join(', ')) %>
<%= form_for(member, {:as => :membership, :remote => true, :url => membership_path(member),

View File

@ -9,7 +9,8 @@
<input type="hidden" value="<%= @type%>" name="type" id="user_activities_type">
<div class="homepageRight mt0 ml10">
<div class="homepageRightBanner">
<div class="NewsBannerName">班级动态</div>
<div class="NewsBannerName">
<%= get_acts_list_type @type %></div>
<ul class="resourcesSelect">
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
<ul class="homepagePostType" style="width:90px; left:-80px;">

View File

@ -8,7 +8,7 @@
$("#poll_question_standard_answer_<%=exercise_question.id %>").val("<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s)%>")
$("#poll_answers_<%=exercise_question.id%>").html("<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>" +
"<li class='ur_item'>" +
"<label name='select_items' class='w56'>选项<%=convert_to_char (index+1).to_s %><span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>" +
"<label name='select_items' class='w60'>选项<%=convert_to_char (index+1).to_s %><span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>" +
"<input maxlength='200' type='text' name='question_answer[<%=exercise_choice.id %>]' placeholder='输入选项内容' value='<%=exercise_choice.choice_text %>'/>" +
"<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>" +
"<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>" +

View File

@ -8,7 +8,7 @@
$("#poll_question_standard_answer_<%=exercise_question.id %>").val("<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s)%>")
$("#poll_answers_<%=exercise_question.id%>").html("<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>" +
"<li class='ur_item'>" +
"<label name='select_items' class='w56'>选项<%=convert_to_char (index+1).to_s %><span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>" +
"<label name='select_items' class='w60'>选项<%=convert_to_char (index+1).to_s %><span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>" +
"<input maxlength='200' type='text' name='question_answer[<%= exercise_choice.id %>]' placeholder='输入选项内容' value='<%=exercise_choice.choice_text %>'/>" +
"<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>" +
"<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>" +
@ -34,7 +34,7 @@
<div id="poll_answers_<%=exercise_question.id%>">
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
<li class="ur_item">
<label name='select_items' class='w56'>选项<%=convert_to_char (index+1).to_s %><span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<label name='select_items' class='w60'>选项<%=convert_to_char (index+1).to_s %><span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input maxlength="200" type='text' name='question_answer[<%= exercise_choice.id %>]' placeholder='输入选项内容' value="<%=exercise_choice.choice_text %>">
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>

View File

@ -171,7 +171,7 @@
//单选题
function add_single_answer(doc)
{
var li = doc.parent().after("<li class='ur_item'><label name='select_items' class='w56'>选项&nbsp;<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label><input maxlength='200' type='text' name='question_answer["+new Date().getTime()+"]' placeholder='输入选项内容'/>" +
var li = doc.parent().after("<li class='ur_item'><label name='select_items' class='w60'>选项&nbsp;<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label><input maxlength='200' type='text' name='question_answer["+new Date().getTime()+"]' placeholder='输入选项内容'/>" +
"<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a><a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>"+
"</li><div class='cl'></div>");
var select_items =$("label[name='select_items']",li.parent());

View File

@ -18,28 +18,28 @@
<div class="cl"></div>
<div>
<li class="ur_item">
<label name='select_items' class='w56'>选项A<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<label name='select_items' class='w60'>选项A<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input maxlength="200" type='text' name='question_answer[0]' placeholder='输入选项内容'>
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
</li>
<div class="cl"></div>
<li class="ur_item">
<label name='select_items' class='w56'>选项B<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<label name='select_items' class='w60'>选项B<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input maxlength="200" type='text' name='question_answer[1]' placeholder='输入选项内容'>
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
</li>
<div class="cl"></div>
<li class="ur_item">
<label name='select_items' class='w56'>选项C<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<label name='select_items' class='w60'>选项C<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input maxlength="200" type='text' name='question_answer[2]' placeholder='输入选项内容'>
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
</li>
<div class="cl"></div>
<li class="ur_item">
<label name='select_items' class='w56'>选项D<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<label name='select_items' class='w60'>选项D<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input maxlength="200" type='text' name='question_answer[3]' placeholder='输入选项内容'>
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>

View File

@ -54,28 +54,28 @@
'<input value="<%= score %>" id="question_score" type="text" name="question_score" style="width:40px; text-align:center; padding-left:0px;"/>分'+
'</li><div>'+
'<li class="ur_item">'+
'<label name="select_items" class="w56">选项A<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<label name="select_items" class="w60">选项A<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[0]" placeholder="输入选项内容"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label name="select_items" class="w56">选项B<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<label name="select_items" class="w60">选项B<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[1]" placeholder="输入选项内容"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label name="select_items" class="w56">选项C<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<label name="select_items" class="w60">选项C<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[2]" placeholder="输入选项内容"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label name="select_items" class="w56">选项D<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<label name="select_items" class="w60">选项D<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[3]" placeholder="输入选项内容"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+

View File

@ -38,7 +38,7 @@
<%= render :partial => 'users/show_detail_info', :locals => {:user => User.find(act.user_id)} %>
</div>
<div class="homepagePostDes">
<div class="homepagePostTo"><%= link_to User.find(act.user_id), user_url_in_org(act.user_id) %>&nbsp;&nbsp;创建了 <a href="<%= organization_path(@organization)%>" class="newsBlue ml10"><%= Organization.find(act.org_act_id).name %>
<div class="homepagePostTo"><%= link_to User.find(act.user_id), user_url_in_org(act.user_id),:class => "newsBlue mr15" %>&nbsp;&nbsp;创建了 <a href="<%= organization_path(@organization)%>" class="newsBlue ml10"><%= Organization.find(act.org_act_id).name %>
| 组织</a></div>
<div class="homepagePostDate"> 创建时间:<%= format_activity_day(act.created_at) %> <%= format_time(act.created_at, false) %> </div>
</div>

View File

@ -59,9 +59,14 @@
<li >
<span class="tit_fb ">内容:</span>
<div class="showHworkP break_word upload_img" id="student_work_img_<%=work.id %>">
<%= work.description.html_safe if work.description%>
</div>
<% com_contents = work.work_status %>
<% if com_contents != 0 && work.description %>
<div class="showHworkP break_word upload_img" id="student_work_img_<%= work.id %>">
<%= work.description.html_safe %>
</div>
<% else %>
<span style="color: #999999">该作品未在线下完成提交</span>
<% end %>
<div class="cl"></div>
</li>
<li >

View File

@ -1,6 +1,6 @@
<br>
<div style='width:470px;text-align:center;font-family: "微软雅黑","宋体"' class="f14">
<% if @syllabus.courses.empty? %>
<% if @syllabus.courses.not_deleted.empty? %>
确认删除该课程吗?
<% else %>
该课程下已经存在班级,不能删除。
@ -8,7 +8,7 @@
</div>
</br>
<div style='width:164px; margin:0 auto; text-align:center; font-family: "微软雅黑","宋体"'>
<% if @syllabus.courses.empty? %>
<% if @syllabus.courses.not_deleted.empty? %>
<%=link_to '确认', syllabus_path(@syllabus), :class => 'Blue-btn fl', :method => 'delete'%>
<a href='javascript:void(0);' class='Blue-btn fl' onclick='hideModal()'>关闭</a>
<% else %>

View File

@ -29,6 +29,16 @@ zh:
label_upload_files: 上传资源
label_apply_join_course: 申请加入班级
label_apply_for_homework: 申请引用作业
#动态名称
label_homework_acts: 作业动态
label_news_acts: 通知动态
label_attachment_acts: 资源库动态
label_message_acts: 论坛动态
label_journalsForMessage_acts: 留言动态
label_poll_acts: 问卷动态
label_all_cats: 全部动态
#
# 课程托管平台主页
#

View File

@ -2103,6 +2103,7 @@ zh:
label_file_lost_list: 缺失文件列表
lable_unset: 未设置
label_chose_group: 请选择分班
label_no_group: 暂无
label_hostedz_organization: 主办单位
label_hosted_by: 国防科学技术大学并行与分布处理国家重点实验室

View File

@ -0,0 +1,5 @@
class AddStudentIdToApplyAddSchool < ActiveRecord::Migration
def change
add_column :apply_add_schools, :user_id, :integer
end
end

View File

@ -1,5 +1,6 @@
#coding=utf-8
#
require 'uglifier'
def compress(srcs, outfile)
wechat_path = File.join(Rails.root, "public", "javascripts", "wechat")