Merge branch 'develop' into dev_daiao

This commit is contained in:
daiao 2017-09-30 22:35:10 +08:00
commit c728f4caa1
23 changed files with 252 additions and 251 deletions

View File

@ -50,17 +50,18 @@ class CoursesController < ApplicationController
@syllabuses_num = Course.all.count
#@syllabus_count = all_syllabuses.count
# 我创建的课堂
create_syllabuses = Course.where(:tea_id => @user.id)
#create_syllabuses = Course.where(:tea_id => @user.id)
# 我参与的课堂
join_syllabuses = @user.courses.where("is_delete = 0 and tea_id != #{@user.id}")
@join_syllabuses_count = join_syllabuses.where(:is_end => 0, :is_delete => 0).count
@create_syllabuses_count = create_syllabuses.where(:is_end => 0, :is_delete => 0).count
#join_syllabuses = @user.courses.where("is_delete = 0 and tea_id != #{@user.id}")
# @join_syllabuses_count = @user.courses.not_deleted_not_end.order("updated_at desc").select{ |course| !@user.has_teacher_role(course)}.count
# @create_syllabuses_count = @user.courses.not_deleted_not_end.order("updated_at desc").select{ |course| @user.has_teacher_role(course)}.count
@my_courses_count = @user.courses.not_deleted_not_end.count
# 页面筛选的课程
if @select == "create"
@syllabuses = create_syllabuses.where("is_end = 0 and is_delete = 0 and name like '%#{@search}%'")
@syllabuses = @user.courses.not_deleted_not_end.where("name like '%#{@search}%'").order("updated_at desc").select{ |course| @user.has_teacher_role(course)}
elsif @select == "join"
@syllabuses = join_syllabuses.where("is_end = 0 and is_delete = 0 and tea_id != #{@user.id} and name like '%#{@search}%'")
@syllabuses = @user.courses.not_deleted_not_end.where("name like '%#{@search}%'").order("updated_at desc").select{ |course| !@user.has_teacher_role(course)}
elsif @select == "end"
# 归档的课堂
end_syllabuses = Course.where("is_end = 1 and name like '%#{@search}%'")

View File

@ -406,10 +406,15 @@ class MessagesController < ApplicationController
def sticky_topic
(render_403; return false) unless (User.current.admin? || User.current.allowed_to?(:as_teacher, @course))
@topic.update_attributes(:sticky => @topic.sticky == 1 ? 0 : 1)
if params[:is_board]
redirect_to course_boards_path(@course)
else
redirect_to board_message_path(@topic.board_id, @topic)
respond_to do |format|
format.js
format.html{
if params[:is_board]
redirect_to course_boards_path(@course)
else
redirect_to board_message_path(@topic.board_id, @topic)
end
}
end
end

View File

@ -14,6 +14,24 @@ class ShixunsController < ApplicationController
CODES = %W(2 3 4 5 6 7 8 9 A B C D E F G H J K L N M O P Q R S T U V W X Y Z)
DCODES = %W(2 3 4 5 6 7 8 9 a b c f e f g h i j k l m n o p q r s t u v w x y z)
# 获取版本库文件目录
def search_file_list
path = params[:path]
@path = to_path_param(path)
g = Gitlab.client
@dir = g.trees(@shixun.gpid, :path => @path).map{|tree|[tree.type, (@path.blank? ? tree.name : "#{@path}"+"/"+tree.name )]}
logger.info("dir is ##{@dir}")
respond_to do |format|
format.js
end
# render :json => {:dir => @dir}
end
def achieve_ways
@repository = @shixun.repository
@entries = @repository.entries(@path, @rev)
# @entries = Gitlab.client.trees(@shixun.gpid).map{|tree| tree.name}
end
def statistics_students
pub_shixun = ApplyAction.where(:container_type => "ApplyShixun", :status => 1, :container_id => @shixun.id).last
@ -122,7 +140,7 @@ class ShixunsController < ApplicationController
@content = params[:content]
code_file = g.edit_file(@shixun.gpid, :content => params[:content], :file_path => @path, :branch_name => @rev, :commit_message => "shixun entry")
# if @shixun.try(:status).to_i < 2
shixun_modify_status_without_publish(@shixun, 1)
# shixun_modify_status_without_publish(@shixun, 1)
# end
respond_to do |format|
format.js
@ -751,13 +769,13 @@ class ShixunsController < ApplicationController
end
def shixun_discuss
@discusses = @shixun.discusses.reorder("created_at desc")
@discusses = @shixun.discusses.where(:parent_id => nil).reorder("created_at desc")
@discusses_count = @discusses.count
#@limit = 15
#@is_remote = true
#@discusses_pages = Paginator.new @discusses_count, @limit, params['page'] || 1
# @offset ||= @discusses_pages.offset
#@discusses = paginateHelper @discusses, @limit
@limit = 15
@is_remote = true
@discusses_pages = Paginator.new @discusses_count, @limit, params['page'] || 1
@offset ||= @discusses_pages.offset
@discusses = paginateHelper @discusses, @limit
#@game_challenge = params[:challenge_id].blank? ? Challenge.find(@discusses.challenge_id) : Challenge.find(params[:challenge_id])
@game_challenge = Challenge.find(params[:challenge_id].to_i)
end

View File

@ -690,7 +690,7 @@ class StudentWorkController < ApplicationController
@score = student_work_score @work,User.current
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
if (@homework.homework_detail_manual.comment_status == 3 || @homework.homework_detail_manual.comment_status == 4) && !@is_teacher && @work.user != User.current
@student_work_scores = @work.student_works_scores.where("user_id = #{User.current.id} and reviewer_role = 3").order("updated_at desc")
@student_work_scores = StudentWorksScore.where(:id => @work.student_works_scores.where("user_id = #{User.current.id} and reviewer_role = 3").select("max(id)"))
else
@student_work_scores = student_work_score_record(@work)
end
@ -995,7 +995,9 @@ class StudentWorkController < ApplicationController
@work = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:id => @work.id).first
@score = @new_score
if @homework.homework_detail_manual.comment_status == 3 && !@is_teacher && @work.user != User.current
@student_work_scores = @work.student_works_scores.where("user_id = #{User.current.id} and reviewer_role = 3").order("updated_at desc")
@st_cover = @work.student_works_scores.where("user_id = #{User.current.id} and reviewer_role = 3").count > 1 ? 1 : 0
@student_work_scores = StudentWorksScore.where(:id => @work.student_works_scores.where("user_id = #{User.current.id} and reviewer_role = 3").select("max(id)"))
#@student_work_scores = @work.student_works_scores.where("user_id = #{User.current.id} and reviewer_role = 3").order("updated_at desc")
else
@student_work_scores = student_work_score_record(@work)
end

View File

@ -140,13 +140,13 @@ module StudentWorkHelper
end
end
#获取学生作品的评分记录:同一个教师或教辅只显示未隐藏的评分
#获取学生作品的评分记录:同一个教师或教辅只显示未隐藏的评分、匿评多次评分只取最新一条
def student_work_score_record work
# sql = "SELECT MAX(id) id FROM student_works_scores WHERE (reviewer_role = 2 OR reviewer_role = 1) AND score IS NOT NULL AND is_hidden = 0 AND student_work_id = #{work.id} GROUP BY user_id"
# tea_ts_ids = StudentWorksScore.find_by_sql sql
# tea_ts_ids = tea_ts_ids.empty? ? "(-1)" : "(" + tea_ts_ids.map{|tea| tea.id}.join(",") + ")"
# scores = work.student_works_scores.where("score IS NULL or reviewer_role = 3 or id in #{tea_ts_ids}").order("updated_at desc")
scores = work.student_works_scores.where(:is_hidden => false).order("created_at desc")
sql = "SELECT MAX(id) id FROM student_works_scores WHERE reviewer_role = 3 AND score IS NOT NULL AND is_hidden = 0 AND student_work_id = #{work.id} GROUP BY user_id"
st_ts_ids = StudentWorksScore.find_by_sql sql
st_ts_ids = st_ts_ids.empty? ? "(-1)" : "(" + st_ts_ids.map{|tea| tea.id}.join(",") + ")"
scores = work.student_works_scores.where("is_hidden = 0 and(reviewer_role = 1 or reviewer_role = 2 or id in #{st_ts_ids})").order("updated_at desc")
#scores = work.student_works_scores.where(:is_hidden => false).order("created_at desc")
return scores
end

View File

@ -18,12 +18,15 @@
<div id="shixun_form">
<li class="clearfix">
<label class="panel-form-label fl"><span class="c_red mr5">*</span>文件路径:</label>
<%= f.text_field :path, :class => "panel-form-width-690 panel-box-sizing fl", :no_label => true, :placeholder => "进入实训后将默认打开该文件src/test/welcome.java", :maxlength => "256" %>
<%= f.text_field :path, :class => "panel-form-width-690 panel-box-sizing fl", :id => "shixun_file_path", :no_label => true, :placeholder => "进入实训后将默认打开该文件src/test/welcome.java", :maxlength => "256" %>
<!--<input id="shixun_file_path" class="panel-form-width-690 panel-box-sizing fl">-->
<span style="display: none" class="c_red ml95" id="challenge_file_path">文件路径不能为空</span>
</li>
<li class="clearfix">
<label class="panel-form-label fl"><span class="c_red mr5">*</span>执行文件:</label>
<%= f.text_field :exec_path, :class => "panel-form-width-690 panel-box-sizing fl", :no_label => true, :placeholder => "输入关卡需要执行的文件路径src/test/main.java", :maxlength => "256" %>
<%= f.text_field :exec_path, :class => "panel-form-width-690 panel-box-sizing fl",:id => "shixun_file_path_play", :no_label => true, :placeholder => "输入关卡需要执行的文件路径src/test/main.java", :maxlength => "256" %>
<span style="display: none" class="c_red ml95" id="challenge_execfile_path">执行文件不能为空</span>
</li>
<li class="clearfix">
@ -100,6 +103,24 @@
bt.LEFT_DELIMITER = '<!';
bt.RIGHT_DELIMITER = '!>';
// 获取版本库路径
$("#shixun_file_path").on('click', function (e) {
file_path();
$(this).addClass("change");
});
$("#shixun_file_path_play").on('click', function (e) {
file_path();
$(this).addClass("change");
});
function file_path(){
data = 0;
$.ajax({
url: '<%= search_file_list_shixun_path(@shixun) %>',
dataType: "script"
});
}
$("#shixun_form").on('click', 'a.test_icon_add', function () {
var html = bt('t:test-answer-list', null);
$(this).parent().parent('.clearfix').after(html);
@ -155,8 +176,8 @@
$(inputs_labels[j]).html("组" + (j + 1));
}
});
});
// 判断测试集是否锁定, 0未锁定1锁定
function test_set_whether_lock(){
var lock = document.getElementsByName("test_set[lock][]");

View File

@ -15,7 +15,7 @@
</div>
<ul class="task-index-head-info clearfix">
<li><span class="color-orange font-bd" id="all_syllabuses"><%= @syllabuses_num %></span><br/><span >全部</span></li>
<li><span class="color-orange font-bd" id="my_syllabuses"><%= @create_syllabuses_count + @join_syllabuses_count %></span><br/><span>我的课堂</span></li>
<li><span class="color-orange font-bd" id="my_syllabuses"><%= @my_courses_count %></span><br/><span>我的课堂</span></li>
<%= link_to "+&nbsp;新建".html_safe, new_course_path, :class => "fr font-16 white-btn orange-btn mt10" %>
<%= link_to "+&nbsp;加入课堂".html_safe, join_private_courses_courses_path, :remote => true, :method => "post", :class => "fr mr30 font-16 white-btn orange-btn mt10" %>
<!-- <li><span class="color-orange font-bd"><%#= @create_syllabuses_count %></span><br/><span>你已创建</span></li>-->

View File

@ -81,7 +81,7 @@
<div class="-layout-h -padding-h-16 -horizontal -footer-left" id="bottom_points" style = "position:relative;">
<ul class="-task-ml80 -layout" style="overflow:hidden;align-items:flex-end;flex-wrap:wrap;">
<%= render :partial => "games/shixun_comment_block" %>
<!-- <li class="fl mt10 ml20 " style="width:54px;margin-bottom:10px;"><a href="javascript:void(0);" onclick="send_dis_to_shixun()" class="course-bth-blue color_white">发送</a></li>-->
<li class="fl mt10 ml20 " style="width:54px;margin-bottom:10px;"><a href="javascript:void(0);" onclick="send_dis_to_shixun()" class="course-bth-blue color_white">发送</a></li>
<li class="fl ml20 mt15" style="width:85px;margin-bottom:10px;">
<span data-tip-left="<%= @praise.nil? ? "点赞" : "取消点赞" %>" onclick="game_praise('<%= @game_challenge.id %>', '<%= @game_challenge.class %>')" id="game_praise_tread" class="pt5 color-grey mr20">
<i class="fa fa-thumbs-up font-20 mr3 <%= @praise.nil? ? "" : "color-light-green" %>" alt="赞" ></i><span class="font-12 font-bd" id="game_praise_count"><%= @praise_count %></span>

View File

@ -41,7 +41,7 @@
<% if challenge.st == 0 %>
<span class="color-dark-grey font-12 mr15 info-partly" id="shixun_exp_<%=challenge.id %>">经验值<span class="ml5"><%= challenge.score.to_i %></span></span>
<span class="color-dark-grey font-12 mr15 info-partly" id="shixun_grade_<%=challenge.id %>">金币<span class="ml5"><%= challenge.score.to_i %></span></span>
<span class="color-dark-grey font-12 mr15 info-partly" id="shixun_tag_<%=challenge.id %>">技能标签<span class="ml5"><%= challenge.challenge_tags.count %></span></span>
<span class="color-dark-grey font-12 mr15 info-partly" id="shixun_tag_<%=challenge.id %>">技能标签<span class="ml5"><%= challenge.challenge_tags.count == 0 ? "无" : challenge.challenge_tags.count %></span></span>
<% else %>
<span class="color-dark-grey font-12 mr15 info-partly" id="shixun_exp_<%=challenge.id %>">经验值<span class="ml5"><%= challenge.choose_score.to_i %></span></span>
<span class="color-dark-grey font-12 mr15 info-partly" id="shixun_grade_<%=challenge.id %>">金币<span class="ml5"><%= challenge.choose_score.to_i %></span></span>

View File

@ -1,27 +1,13 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false, prettify: false, init_activity: true) %>
<% end %>
<li class="comment-input fl" id="shixun_comment_block" style="width: 80%;;">
<!-- <%#= form_for('', :url => {:controller => 'discusses', :action => 'create', :dis_id => @shixun.id, :dis_type => "Shixun", :challenge_id => @game_challenge.try(:id)}, :method => "post", :remote => true, :html => {:id => 'new_comment_form'}) do |f| %>
<textarea id="comment_news" name="content" placeholder="我想说点什么~" MultiLine = True ScrollBars = 2 type="text"></textarea>
<input type="hidden" id="dis_reply_id" name="reply_id" value="">
<%# end %>-->
<div nhname='new_message_<%= @shixun.id%>' class="fr" style="display:none; width: 99%;">
<%= form_for('discuss', :url => {:controller => 'discusses', :action => 'create', :dis_id => @shixun.id, :dis_type => "Shixun", :challenge_id => @game_challenge.try(:id)}, :method => "post", :remote => true, :html => {:id => 'new_comment_form'}) do |f| %>
<div nhname='toolbar_container_<%= @shixun.id%>'></div>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= @shixun.id %>' name="content"></textarea>
<a id="new_message_submit_btn_<%= @shixun.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="mt10 task-btn task-btn-blue fr">发送</a>
<div class="cl"></div>
<p nhname='contentmsg_<%= @shixun.id%>'></p>
<% end%>
</div>
<li class="comment-input fl" id="shixun_comment_block">
<%= form_for('', :url => {:controller => 'discusses', :action => 'create', :dis_id => @shixun.id, :dis_type => "Shixun", :challenge_id => @game_challenge.try(:id)}, :method => "post", :remote => true, :html => {:id => 'new_comment_form'}) do |f| %>
<textarea id="comment_news" name="content" placeholder="我想说点什么~" MultiLine = True ScrollBars = 2 type="text"></textarea>
<input type="hidden" id="dis_reply_id" name="reply_id" value="">
<% end %>
</li>
<script>
$(function(){
//autoTextarea(document.getElementById("comment_news"),0,150);
sd_create_editor_from_shixun_data(<%= @shixun.id %>, null, "100%", "<%= @shixun.class.to_s %>");
autoTextarea(document.getElementById("comment_news"),0,150);
});
var click = true;
function send_dis_to_shixun(){

View File

@ -1,132 +1,21 @@
<% no_children_comments = get_no_children_comments_all @discusses %>
<div class="fit -scroll">
<div class="-layout-v -fit">
<div class="-flex -scroll panel-box-sizing new_li task-padding10" id="game_comment_show" style="padding: 0px;">
<div class="panel-comment_item">
<% if @discusses.blank? %>
<div class="-flex -scroll panel-box-sizing new_li task-padding10" id="game_comment_show" style="padding: 10px 15px;">
<div id="comments_content">
<% if @shixun.discusses.blank? %>
<%= render :partial => "welcome/no_data" %>
<% else %>
<% no_children_comments.each do |comment| %>
<% unless comment.nil? %>
<script type="text/javascript">
$(function(){
showNormalImage('reply_content_<%= comment.id %>');
autoUrl('reply_content_<%= comment.id %>');
});
</script>
<div class="comment_item_cont clearfix" style="padding:10px 10px">
<div class="J_Comment_Face fl">
<%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 50, :height => 50, :alt => "用户头像"), user_url_in_org(comment.creator_user), :target => '_blank' %>
</div>
<div class="t_content fl" style="width: 87%;">
<div class="J_Comment_Reply">
<div class="comment_orig_content" style="margin:0px">
<% if !comment.parent.nil? %>
<% parents_rely = [] %>
<% parents_rely = get_reply_parents parents_rely, comment %>
<% length = parents_rely.length %>
<div id="comment_reply_<%= comment.id %>" class="mb5">
<% if length <= 5 %>
<%=render :partial => 'student_work/homework_reply', :locals => {:comment => comment.parent, :parent_id => comment.id, :user_activity_id => @game_challenge.id, :type => @game_challenge.class.to_s} %>
<% else %>
<div class="orig_cont clearfix">
<div class="orig_cont clearfix">
<div class="orig_cont clearfix">
<div class="orig_cont clearfix">
<div class="orig_cont clearfix">
<%=render :partial => 'student_work/homework_reply_detail', :locals => {:comment => parents_rely[length - 1], :type => @game_challenge.class.to_s, :user_activity_id => @game_challenge.id, :parent_id => comment.id} %>
</div>
<div class="orig_cont_hide clearfix">
<i class="fa fa-long-arrow-down mr5"></i>
<%= link_to '点击展开隐藏楼层', show_all_replies_users_path(:comment => comment, :type => comment.class, :user_activity_id => @game_challenge.id, :parent_id => comment.id),:remote=>true, :class => '' %>
</div>
<%=render :partial => 'student_work/homework_reply_detail', :locals => {:comment => parents_rely[3], :type => @game_challenge.class.to_s, :user_activity_id => @game_challenge.id, :parent_id => comment.id} %>
</div>
<%=render :partial => 'student_work/homework_reply_detail', :locals => {:comment => parents_rely[2], :type => @game_challenge.class.to_s, :user_activity_id => @game_challenge.id, :parent_id => comment.id} %>
</div>
<%=render :partial => 'student_work/homework_reply_detail', :locals => {:comment => parents_rely[1], :type => @game_challenge.class.to_s, :user_activity_id => @game_challenge.id, :parent_id => comment.id} %>
</div>
<%=render :partial => 'student_work/homework_reply_detail', :locals => {:comment => parents_rely[0], :type => @game_challenge.class.to_s, :user_activity_id => @game_challenge.id, :parent_id => comment.id} %>
</div>
<% end %>
</div>
<% end %>
<!--onmouseover="$('#delete_reply_<%#=activity.id %>_<%#=comment.id %>').show();" onmouseout="$('#delete_reply_<%#=activity.id %>_<%#=comment.id %>').hide();"-->
<div class="comment_content clearfix" >
<div class="color-grey3"><%= comment.content.html_safe %></div>
<div class="">
<div class="cl"></div>
<div id="reply_message_<%= comment.id%>" class="reply_to_message"></div>
</div>
</div>
<!--回复end-->
</div>
</div>
<div class="J_Comment_Info clearfix">
<div class="t_info fl">
<%= link_to comment.creator_user.show_real_name, user_url_in_org(comment.creator_user), :class => "content-username hide fl" %>
<span class="t_area fl"><%= time_from_now(comment.respond_to?(:created_on) ? comment.created_on : comment.created_at) %></span>
</div>
<p class="fr mr10 orig_reply">
<% if comment.creator_user == User.current || User.current.admin? || User.current.manager_of_shixun?(comment.dis_id) %>
<a href="javascript:void(0);" class="color-grey" id="delete_reply_<%=@game_challenge.id %>_<%=comment.id %>" onclick="delete_confirm_box_2('<%= discuss_path(comment, :challenge_id => @game_challenge) %>', '确定要删除该条回复吗?')"><i class="fa fa-trash-o mr5"></i>删除</a>
<% end %>
<span class="ml5 mr5 color-grey">|</span>
<%= link_to(
'<i class="fa fa-mail-reply mr5"></i>回复'.html_safe,
{:controller => 'users' ,:action => 'reply_to',:reply_id => comment.id, :type => @game_challenge.class.to_s, :user_activity_id => @game_challenge.id},
:remote => true,
:method => 'get',
:title => l(:button_reply),:class => "color-grey") %>
<span class="ml5 mr5 color-grey">|</span>
<span class="reply_praise_count_<%= comment.id %>">
<%=render :partial=> "praise_tread/edu_praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
</span>
</p>
</div>
</div>
<div class="cl"></div>
</div>
<% end %>
<% end %>
<% end %>
</div>
</div>
</div>
</div>
<script>
function ThumbUp(item){
$(item).toggleClass("orange-btn");
$(item).toggleClass("orange-bg-btn");
if($(item).attr("attr-thumb")=="0"){
$(item).find("span").html(parseInt($(item).find("span").html())+1);
$(item).attr("attr-thumb","1");
}else{
$(item).find("span").html(parseInt($(item).find("span").html())-1);
$(item).attr("attr-thumb","0");
}
}
</script>
<% if false %>
<div class="fit -scroll">
<div class="-layout-v -fit">
<div class="-flex -scroll panel-box-sizing new_li task-padding10" id="game_comment_show" style="padding: 10px 15px;">
<div id="comments_content">
<% if @shixun.discusses.blank? %>
<%= render :partial => "welcome/no_data" %>
<% else %>
<% @discusses.each do |dis| %>
<div class="comments_item_content comment_item_bottom clearfix mt5" onmouseover="$('#discuss_opr_<%= dis.id %>').show();$('#child_discuss_opr_<%= dis.id %>').show();" onmouseout="$('#discuss_opr_<%= dis.id %>').hide();$('#child_discuss_opr_<%= dis.id %>').hide();">
<%= link_to image_tag(url_to_avatar(dis.user), :alt => "头像", :width => 35, :height => 35), user_path(dis.user),:class => "fl mt5", :target => '_blank' %>
<div class="fl comment_item_one ml10">
<p class="clearfix">
<%= link_to dis.user.show_name, user_path(dis.user), :class => "fl link-color-grey mr20" ,:style => "display: block" %>
<span class="fl color-grey font-12 mt3 mr20"><%= time_from_now dis.created_at %></span>
<% if dis.try(:challenge_id).present? %>
<span class="fl color-grey font-12 mt3">[第<%= Challenge.find(dis.try(:challenge_id)).try(:position) %>关]</span>
<% end %>
<span class="fr color-grey font-12 color_Purple_grey" id="dis_praise_<%= dis.id %>">
<% @discusses.each do |dis| %>
<div class="comments_item_content comment_item_bottom clearfix mt5" onmouseover="$('#discuss_opr_<%= dis.id %>').show();$('#child_discuss_opr_<%= dis.id %>').show();" onmouseout="$('#discuss_opr_<%= dis.id %>').hide();$('#child_discuss_opr_<%= dis.id %>').hide();">
<%= link_to image_tag(url_to_avatar(dis.user), :alt => "头像", :width => 35, :height => 35), user_path(dis.user),:class => "fl mt5", :target => '_blank' %>
<div class="fl comment_item_one ml10">
<p class="clearfix">
<%= link_to dis.user.show_name, user_path(dis.user), :class => "fl link-color-grey mr20" ,:style => "display: block" %>
<span class="fl color-grey font-12 mt3 mr20"><%= time_from_now dis.created_at %></span>
<% if dis.try(:challenge_id).present? %>
<span class="fl color-light-green font-12 mt3">[第<%= Challenge.find(dis.try(:challenge_id)).try(:position) %>关]</span>
<% end %>
<span class="fr color-grey font-12 color_Purple_grey" id="dis_praise_<%= dis.id %>">
<%= render :partial => "discusses/dis_praise", :locals => {:discuss => dis} %>
</span>
<span class="fr none mt5 mr10" id="discuss_opr_<%= dis.id %>">
@ -138,15 +27,15 @@
<% end %>
</span>
</p>
<p class="mb10"><%= dis.content %></p>
</p>
<p class="mb10"><%= dis.content %></p>
<div class="cl"></div>
<% dis.children.each do |child| %>
<div class="comments_return comment_item_top">
<p class="clearfix comment_item_left_green return_item pl5">
<span class="fl color-grey mr20">老师回复</span>
<span class="fl color-grey font-12"><%= time_from_now child.created_at %></span>
<div class="cl"></div>
<% dis.children.each do |child| %>
<div class="comments_return comment_item_top">
<p class="clearfix comment_item_left_green return_item pl5">
<span class="fl color-grey mr20">老师回复</span>
<span class="fl color-grey font-12"><%= time_from_now child.created_at %></span>
<span class="fr color-grey font-12 color_Purple_grey" id="dis_praise_<%= child.id %>">
<%= render :partial => "discusses/dis_praise", :locals => {:discuss => child} %>
</span>
@ -155,9 +44,9 @@
<a href="javascript:void(0);" onclick="delete_confirm_box_2('<%= discuss_path(dis) %>', '确定要删除该条回复吗?')" class="fr font-12 link-color-green">删除</a>
<% end %>
</span>
</p>
<p class="pl8 mb10"><%= child.content %></p>
<!--<p class="fl pl8">
</p>
<p class="pl8 mb10"><%= child.content %></p>
<!--<p class="fl pl8">
<span class="fl color-grey"><%#= time_from_now child.created_at %></span>
</p>
<p class="fr pl8 none" id="child_discuss_opr_<%#= dis.id %>">
@ -165,43 +54,40 @@
<a href="javascript:void(0);" onclick="delete_confirm_box_2('<%#= discuss_path(dis) %>', '确定要删除该条回复吗?')" class="fr font-12 link-color-green">删除</a>
<%# end %>
</p>-->
<div class="cl"></div>
</div>
<% end %>
</div>
</div>
<% end %>
<div style="text-align:center;" class="new_expand">
<div class="pages_user_show" style="width:auto; display:inline-block;margin: 18px 0;">
<ul id="homework_pository_ref_pages">
<%= pagination_links_full @discusses_pages, @discusses_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %>
</ul>
<div class="cl"></div>
<div class="cl"></div>
</div>
<% end %>
</div>
</div>
<% end %>
</div>
<!--评论区域的分页-->
</div>
<div style="text-align:center;" class="new_expand">
<div class="pages_user_show" style="width:auto; display:inline-block;margin: 18px 0;">
<ul id="homework_pository_ref_pages">
<%= pagination_links_full @discusses_pages, @discusses_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %>
</ul>
<div class="cl"></div>
</div>
</div>
<% end %>
</div>
<!--评论区域的分页-->
</div>
<% end %>
</div>
</div>
<script>
//二次回复的提示结构
var $points = $("<div class = \"points-data-tip-top\">"+
"<div class = \"data-tip-top\">请在此输入回复</div>"+
"<div class = \"data-tip-top1 \">请在此输入回复</div>"+
"</div>").appendTo("#bottom_points");
$("#reversion").click(function(){
$points.show();
});
$("#comment_news").blur(function(){
$points.hide();
$("#comment_news").bind("input propertychange",function(){
if($("#comment_news").val() != ''){
$points.hide();
}
});
function shixun_editor_focus(id, dis_id){
window.scrollTo(0,document.body.scrollHeight);
$("textarea[nhname='new_message_textarea_"+id+"']").focus();
$("#dis_reply_id").val(dis_id);
}
</script>

View File

@ -36,10 +36,12 @@
<%= link_to had_uncommit_studentwork_count(homework_common), student_work_index_path(:homework => homework_common.id, :tab => 2, :status => ['0']), :class => 'color-orange03 mr5', :target => '_blank' %>
未交
</span>
<span class="ml50">
<%= link_to had_unevaluate_count(homework_common), student_work_index_path(:homework => homework_common.id, :tab => 2, :comment => ['0']), :class => 'color-orange03 mr5', :target => '_blank' %>
未评
</span>
<% if homework_common.homework_type != 4 %>
<span class="ml50">
<%= link_to had_unevaluate_count(homework_common), student_work_index_path(:homework => homework_common.id, :tab => 2, :comment => ['0']), :class => 'color-orange03 mr5', :target => '_blank' %>
未评
</span>
<% end %>
<% else %>
<span class="ml50">
<%= link_to had_commit_studentwork_count(homework_common), student_work_index_path(:homework => homework_common.id, :tab => 2), :class => 'color-orange03 mr5', :target => '_blank' %>

View File

@ -37,7 +37,6 @@
<% if User.current.admin? || User.current.allowed_to?(:as_teacher, @course) %>
<a href="<%= sticky_topic_board_message_path(@topic.board_id, @topic) %>" class="mr10" data-tip-down="<%= @topic.sticky == 1 ? '取消置顶' : '置顶' %>"><i class="fa <%= @topic.sticky == 1 ? 'fa-arrow-circle-o-down' : 'fa-arrow-circle-o-up' %>"></i></a>
<% end %>
<a href="javascript:void(0);" class="mr10" data-tip-down="发送" onclick="show_send(<%= @topic.id %>, <%= User.current.id %>, 'message');"><i class="fa fa-send-o"></i></a>
<% if User.current.admin? || User.current.allowed_to?(:as_teacher, @course) || User.current == @topic.author %>
<a href="<%= edit_board_message_path(@topic.board_id, @topic) %>" class="mr10" data-tip-down="编辑"><i class="fa fa-pencil"></i></a>
<a href="javascript:void(0);" onclick="delete_confirm_box_3('<%= delete_board_message_path(@topic.board_id, @topic) %>', '确定要删除该帖子吗?')" class="mr10" data-tip-down="删除"><i class="fa fa-trash-o"></i></a>

View File

@ -0,0 +1 @@
$("#user_activity_<%= params[:user_activity_id]%>").replaceWith("<%= j(render :partial => 'users/course_message', :locals => {:activity => @topic, :user_activity_id => params[:user_activity_id],:is_course=>1,:is_board=>0}) %>");

View File

@ -0,0 +1,71 @@
<!-------------------文件路径--------------------------->
<div class="task-popup newteacher" style="width:600px;">
<div class="task-popup-title clearfix task-popup-bggrey">
<h3 class="fl ">文件路径</h3>
<a href="javascript:void(0);" class="pop_close"><i class="fa fa-times-circle font-18 link-color-grey fr mt5"></i></a>
</div>
<div class="task_popup_con">
<div class="newupload_conbox clearfix">
<ul style = "height:200px;overflow-y:auto;background:#f5f5f5; padding:10px;">
<% if @path.present? %>
<a class="f14 fb" href="<%= search_file_list_shixun_path(@shixun) %>" data-remote="true">根目录/</a>
<%
dirs = @path.split('/')
link_path = ''
dirs.each do |dir|
next if dir.blank?
link_path << '/' unless link_path.empty?
link_path << "#{dir}"
%>
<%= link_to (h(dir)+'/'), search_file_list_shixun_path(@shixun, :path => to_path_param(to_path_param(link_path))), :class => "f14 fb", :remote => true %>
<% end %>
<% end %>
<% if @dir.present? %>
<% @dir.each do |entry| %>
<li class = "entry">
<div class="filename_no_report hidden">
<% if entry[0] == "tree" %>
<%= link_to h(entry[1]), search_file_list_shixun_path(@shixun, :path => to_path_param(entry[1])), :class => 'old-icon old-icon-folder', :remote => true %>
<% else %>
<a href="javascript:void(0);" class="old-icon old-icon-file"><%= h(entry[1]) %></a>
<% end %>
</div>
</li>
<% end %>
<% else %>
指定文件路径前,请先在版本库中提交代码
<% end %>
</ul>
<div class = "clearfix mt20">
<label class="panel-form-label fl" style = "width:120px;text-align:left;">选中的文件路径:</label>
<input id = "points_tusi" placeholder = "选中的文件路径" class = "fl panel-form-width-200 panel-box-sizing" style = "width:440px;"/>
</div>
<a href="javascript:void(0);" class="task-btn task-btn-blue fr" style="margin-top: 20px;margin-left:20px;" id = "add_path">确定</a>
<a href="javascript:void(0);" class="pop_close task-btn mb10 fr" style="margin-top: 20px;" id = "back_page">取消</a>
</div>
</div>
</div>
<script>
var $Path = '';
$(".old-icon-file").click(function(){
$Path = $(this).html();
$("#points_tusi").val($Path);
});
$("#add_path").click(function(){
if($("#shixun_file_path").hasClass("change")){
$("#shixun_file_path").val($("#points_tusi").val());
$("#shixun_file_path").removeClass("change");
}
if($("#shixun_file_path_play").hasClass("change")){
$("#shixun_file_path_play").val($("#points_tusi").val());
$("#shixun_file_path_play").removeClass("change");
}
$("#popupWrap").hide();
});
$("#back_page").click(function(){
$("#popupWrap").hide();
})
</script>

View File

@ -90,6 +90,10 @@
<input type="radio" class="undis" name="language" id="language_Dynamips" value="Dynamips">
<label for="language_Dynamips">Dynamips</label>
</li>
<li class="fl">
<input type="radio" class="undis" name="language" id="language_verilog" value="verilog">
<label for="language_verilog">verilog</label>
</li>
</ul>
</div>
</div>
@ -98,7 +102,7 @@
<div class="fl" style="margin-top:7px">
<li class="edu-dropdown fl ml15 mr5" id="first_select" style="width: 70px">
<a href="javascript:void(0);" class="edu-dropdown-toggle color-grey3" id="all_status">所有状态<i class="fa fa-caret-down ml5"></i></a>
<ul class="edu-dropdown-menu color" id="all_status_list" style="display: none;">
<ul class="edu-dropdown-menu" id="all_status_list" style="display: none;">
<li>
<input type="radio" class="undis" name="shixun_status" id="status_0" value="0">
<label for="status_0">所有状态</label>
@ -119,7 +123,7 @@
</li>
<li class="edu-dropdown fl ml15 mr5" id="thirdly_select" style="width: 70px">
<a href="javascript:void(0);" class="edu-dropdown-toggle color-grey3" id="all_languge">所有难度<i class="fa fa-caret-down ml5"></i></a>
<ul class="edu-dropdown-menu color" id="all_trainee_list" style="display: none;">
<ul class="edu-dropdown-menu" id="all_trainee_list" style="display: none;">
<li>
<input type="radio" class="undis" name="trainee" id="trainee_0" value="">
<label for="trainee_0">所有难度</label>
@ -144,7 +148,7 @@
</li>
<li class="edu-dropdown fl ml15 mr5" id="second_select">
<a href="javascript:void(0);" class="edu-dropdown-toggle color-grey3" id="all_progress">所有进展<i class="fa fa-caret-down ml5"></i></a>
<ul class="edu-dropdown-menu color" id="all_progress_list" style="display: none;">
<ul class="edu-dropdown-menu" id="all_progress_list" style="display: none;">
<li>
<input type="radio" class="undis" name="status" id="progress_1" value="1">
<label for="progress_1">所有进展</label>

View File

@ -0,0 +1,2 @@
var htmlvalue = "<%= escape_javascript( render :partial => 'shixuns/achieve_ways') %>";
pop_box_new(htmlvalue, 600, 400);

View File

@ -1,3 +1,3 @@
$("#student_work_score_div").html("<%= escape_javascript(render :partial => 'student_work/student_work_score_div') %>");
$('#score_<%= @work.id%>').peSlider({range: 'min'});
notice_box("提交成功");
notice_box("<%= (@st_cover && @st_cover == 1) ? '评分已更新' : '提交成功' %>");

View File

@ -234,17 +234,19 @@
</div>
</li>
<input id="homework_id" type="hidden" value="<%= @homework.id %>">
<li class="clearfix">
<span class="ml33 fl mr10 color-grey">你的评阅:</span>
<span class="fl mr25">
<a href="javascript:void(0);" id="comment_no_limit" class="<%= @comment.blank? ? 'color-orange03' : '' %>">不限</a>
</span>
<% has_comment = User.current.student_works_scores.where(:student_work_id => @homework.student_works.map(&:id), :reviewer_role => [1, 2]).group_by(&:student_work_id).count %>
<input id="not_comment" class="magic-checkbox fl" type="checkbox" value="0" name="comment[]" <%= !@comment.blank? && @comment.include?('0') ? 'checked' : '' %>>
<label for="not_comment" class="fl mr25">未评<span>(<%= @homework.student_works.count - has_comment %>)</span></label>
<input id="has_comment" class="magic-checkbox fl" type="checkbox" value="1" name="comment[]" <%= !@comment.blank? && @comment.include?('1') ? 'checked' : '' %>>
<label for="has_comment" class="fl mr25">已评<span>(<%= has_comment %>)</span></label>
</li>
<% if @homework.homework_type != 4 %>
<li class="clearfix">
<span class="ml33 fl mr10 color-grey">你的评阅:</span>
<span class="fl mr25">
<a href="javascript:void(0);" id="comment_no_limit" class="<%= @comment.blank? ? 'color-orange03' : '' %>">不限</a>
</span>
<% has_comment = User.current.student_works_scores.where(:student_work_id => @homework.student_works.map(&:id), :reviewer_role => [1, 2]).group_by(&:student_work_id).count %>
<input id="not_comment" class="magic-checkbox fl" type="checkbox" value="0" name="comment[]" <%= !@comment.blank? && @comment.include?('0') ? 'checked' : '' %>>
<label for="not_comment" class="fl mr25">未评<span>(<%= @homework.student_works.count - has_comment %>)</span></label>
<input id="has_comment" class="magic-checkbox fl" type="checkbox" value="1" name="comment[]" <%= !@comment.blank? && @comment.include?('1') ? 'checked' : '' %>>
<label for="has_comment" class="fl mr25">已评<span>(<%= has_comment %>)</span></label>
</li>
<% end %>
<li class="clearfix">
<span class="ml33 fl mr10 color-grey">作品状态:</span>
<span class="fl mr25">

View File

@ -52,21 +52,16 @@
<ul>
<li class="homepagePostSettingIcon"><i class="fa fa-bars color-grey9"></i>
<ul class="homepagePostSettiongText">
<% if activity.author.id == User.current.id%>
<li>
<%= link_to(
l(:button_edit),
edit_board_message_path(activity.id,:board_id=>activity.board_id,:is_course=>is_course,:is_board=>is_board),
:class => 'postOptionLink'
) if activity.course_editable_by?(User.current) %>
</li>
<% if activity.course_destroyable_by?(User.current) %>
<li>
<a href="javascript:void(0);" class="postOptionLink" onclick="delete_confirm_box_3('<%= delete_board_message_path(activity.id,:board_id=>activity.board_id,:is_course=>is_course,:is_board=>is_board) %>', '确定要删除该条回复吗?')">删除</a>
</li>
<% end %>
<li><a href="javascript:void(0)" onclick="show_send(<%= activity.id %>, <%= User.current.id %>, 'message');" class="postOptionLink">发&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;送</a></li>
<% if User.current.admin? || User.current.allowed_to?(:as_teacher, @course) %>
<li><a href="<%= sticky_topic_board_message_path(activity.board_id, activity, :is_board => false, :user_activity_id => user_activity_id) %>" data-remote="true" class="postOptionLink"><%= activity.sticky == 1 ? '取消置顶' : '置&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;顶'.html_safe %></a></li>
<% end %>
<% if User.current.admin? || User.current.allowed_to?(:as_teacher, @course) || User.current == activity.author %>
<li><a href="<%= edit_board_message_path(activity.board_id, activity) %>" class="postOptionLink">编&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;辑</a></li>
<li>
<a href="javascript:void(0);" onclick="delete_confirm_box_3('<%= delete_board_message_path(activity.board_id, activity,:is_course=>is_course,:is_board=>is_board) %>', '确定要删除该帖子吗?')" class="postOptionLink">删&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;除</a>
</li>
<% end %>
<li><%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{activity.id}, #{User.current.id}, 'message');", :class => "postOptionLink" %></li>
</ul>
</li>
</ul>

View File

@ -107,6 +107,8 @@ RedmineApp::Application.routes.draw do
get 'search_user_courses'
post 'send_to_course'
get 'statistics_students'
get 'search_file_list'
get 'achieve_ways'
end
collection do
get 'shixun_courses'
@ -250,6 +252,11 @@ RedmineApp::Application.routes.draw do
get 'add_departments_part'
post 'save_school'
post 'update_user_message'
post 'add_auto_users_trial'
post 'create_auto_users_trial'
match 'update_auto_users_trial', :via => [:get, :post]
match 'account', :via => [:get, :post]
post 'shixun_can_copy'
end
end
# Enable Grack support

View File

@ -58,7 +58,6 @@ $colors: #fff, #0072B5, #2C3E50;
.edu-dropdown-menu li{ height:30px; line-height:30px; display: block; padding:0 15px; text-align: left;}
.edu-dropdown-menu li label{ cursor: pointer;}
.edu-dropdown-menu li:hover{ color: #FF7500!important;}
.edu-dropdown-menu.color li:hover{ color: #ff7500!important;}
/*.edu-dropdown:hover .edu-dropdown-menu{ display: block;}*/
.animate{ -webkit-transition: all .3s; -moz-transition: all .3s; -ms-transition: all .3s; -ms-transition: all .3s;
transition: all .3s; backface-visibility:hidden; -webkit-backface-visibility:hidden; /* Chrome and Safari */ -moz-backface-visibility:hidden; /* Firefox */ -ms-backface-visibility:hidden; /* Internet Explorer */}

View File

@ -70,7 +70,7 @@ a.rightbar-pause{ color:#29bd8b; font-size: 18px; margin-right:15px; margin-top:
.panel-inner-title{ font-size: 14px; color: #666; max-width:85%; line-height:30px;word-wrap: break-word; margin-bottom: 10px}
.panel-footer{ min-width:1000px; height: 210px!important;}
/* 弹框 */
.task-popup-text-center{ text-align: center; color: #666;}
.task-popup-text-center{ text-align: center; color: #333;}
.task-popup-title{ border-bottom: 1px solid #eee; padding:10px 15px; }
.task-popup-content{ padding:0px 15px 15px 15px;}
.task-popup-submit{ margin: 0 auto 15px; width: 120px;}
@ -430,11 +430,11 @@ html>body #ajax-indicator-base { position: fixed; }
/*二次回复的提示语的样式*/
.points-data-tip-top{position:absolute;left:100px;top:-30px;opacity:.7;width:150px;height:30px;z-index:9999;display:none;}
.data-tip-top{position:relative;box-shadow:0px 0px 8px #000;backgund:#000;color:#fff;word-wrap: break-word;
.data-tip-top1{position:relative;box-shadow:0px 0px 8px #000;background:#000;color:#fff;word-wrap: break-word;
text-align:center;border-radius:4px;padding:0 10px;border:1px solid #000;}
.data-tip-top:after,.data-tip-top:before{position: absolute;content:'';width:0;height:0;left: 45%;bottom:-10px;border-left: 5px solid transparent;
.data-tip-top1:after,.data-tip-top1:before{position: absolute;content:'';width:0;height:0;left: 45%;bottom:-10px;border-left: 5px solid transparent;
border-right: 5px solid transparent;border-top: 10px solid #000;}
.data-tip-top:before{bottom:-11px;}
.data-tip-top1:before{bottom:-11px;}
/*选择题tab切换*/
.nav_option li{overflow: hidden;width: 110px; text-align: center;cursor: pointer;height: 38px;line-height: 38px;border-top-right-radius: 5px;border-top-left-radius: 5px;border:1px solid #e2e2e2;border-bottom: 0px;color: #FF7500;border-right: none;}
.nav_option li:last-child{border-right: 1px solid #e2e2e2;}