Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop
This commit is contained in:
commit
8aba516d1e
|
@ -85,6 +85,14 @@ class HomeworkCommonController < ApplicationController
|
|||
homework_detail_manual = @homework.homework_detail_manual || HomeworkDetailManual.new
|
||||
@homework.end_time = params[:homework_common][:end_time] || Time.now
|
||||
@homework.course_id = params[:course_id]
|
||||
if params[:homework_type] && params[:homework_type].to_i != @homework.homework_type
|
||||
if @homework.homework_type == 2
|
||||
@homework.homework_detail_programing.destroy if @homework.homework_detail_programing
|
||||
@homework.homework_tests.destroy_all
|
||||
elsif @homework.homework_type == 3
|
||||
@homework.homework_detail_group.destroy if @homework.homework_detail_group
|
||||
end
|
||||
end
|
||||
@homework.homework_type = params[:homework_type].to_i || @homework.homework_type
|
||||
anonymous = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment].to_i : 1
|
||||
if anonymous != @homework.anonymous_comment
|
||||
|
|
|
@ -547,7 +547,7 @@ class StudentWorkController < ApplicationController
|
|||
@student_work = StudentWork.new
|
||||
#end
|
||||
respond_to do |format|
|
||||
format.html{ render :layout => "new_base_user"}
|
||||
format.html{ render :layout => "base_courses"}
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -633,7 +633,7 @@ class StudentWorkController < ApplicationController
|
|||
render_403
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html{ render :layout => "new_base_user"}
|
||||
format.html{ render :layout => "base_courses"}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,21 +14,30 @@ module CoursesHelper
|
|||
|
||||
|
||||
# 推荐的精品课程
|
||||
def excellent_course_recommend current_course
|
||||
q = "%#{current_course.name.strip}%"
|
||||
recomment_courses = []
|
||||
# 推荐过程过滤掉自身
|
||||
sql = "SELECT distinct c.* FROM course_activities cs, courses c where cs.course_id = c.id
|
||||
and (c.is_excellent =1 or c.excellent_option =1) and c.is_public = 1 and c.id != #{current_course.id} order by cs.updated_at desc;"
|
||||
ex_courses = Course.find_by_sql(sql)
|
||||
# 使用课程的tag去和课程名称进行匹配
|
||||
c_courses = ex_courses.select{|ex_course| ex_course.tags.any?{|tag| q.include?(tag.to_s)}}
|
||||
if c_courses.count < 3
|
||||
results = c_courses.length == 0 ? ex_courses.first(3) : (c_courses + ex_courses.first(3 - ex_courses.count))
|
||||
else
|
||||
results = c_courses.first(3)
|
||||
def excellent_course_recommend new_course
|
||||
q = "%#{new_course.name.strip}%"
|
||||
result = find_excelletn_course(q, new_course)
|
||||
end
|
||||
|
||||
# 查询符合条件的精品课程
|
||||
# 用新课程名去匹配精品课程中按课程名和Tag名
|
||||
def find_excelletn_course keywords, current_course
|
||||
# 获取tag匹配结果ID
|
||||
a_tags = []
|
||||
Course.where("is_excellent =? and is_public =?", 1, 1).each do |ec|
|
||||
if ec.tags.any?{|value| current_course.name.include?(value.to_s)}
|
||||
a_tags << ec.id
|
||||
end
|
||||
end
|
||||
results
|
||||
# 课程本身不能搜索显示自己
|
||||
excellent_ids = a_tags.uniq.delete_if{|i| i == current_course.id}
|
||||
sql = "SELECT distinct c.id FROM course_activities cs, courses c where cs.course_id = c.id
|
||||
and (c.is_excellent =1 or c.excellent_option =1) and c.is_public = 1 and c.id != #{current_course.id} order by cs.updated_at desc;"
|
||||
default_ids = Course.find_by_sql(sql).flatten.map { |c| c.id }
|
||||
excellent_ids << default_ids.flatten
|
||||
arr_result = excellent_ids.flatten.uniq.first(3)
|
||||
excellent_courses = Course.find(arr_result)
|
||||
return excellent_courses
|
||||
end
|
||||
|
||||
# 判断精品课程是否可见,非课程成员无法查看私有课程
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<div class="syllabus_courses_box">
|
||||
<% @stundet_works.each_with_index do |student_work, i| %>
|
||||
<div class="syllabus_courses_list" id="student_work_<%= student_work.id%>">
|
||||
<div class="syllabus_courses_list" id="student_work_<%= student_work.id%>" style="cursor: default;">
|
||||
<%= render :partial => 'evaluation_un_group_work', :locals => {:student_work => student_work} %>
|
||||
</div>
|
||||
<div id="about_hwork_<%= student_work.id %>"></div>
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hworkTip" style="display: none" id="work_click_<%= st.id%>"><em></em><span></span><font class="fontGrey2"><%= !st.student_work_projects.empty? ? '大作品评分即组长的评分' : '点击查看详情' %></font></div>
|
||||
<div class="hworkTip" style="display: none; left:700px; top:20px; white-space:nowrap; right:auto;" id="work_click_<%= st.id%>"><em></em><span></span><font class="fontGrey2"><%= !st.student_work_projects.empty? ? '大作品评分即组长的评分' : '点击查看详情' %></font></div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<div class="sy_courses_open f14 fontGrey3">
|
||||
<span class="icons_sy_close fl mr5" title="点击展开/收起详情"></span>
|
||||
<span class="icons_sy_close fl mr5" title="点击展开/收起详情" style="cursor: pointer;"></span>
|
||||
<span class="fl" style="width:280px;">
|
||||
<span class="hidden fl" style="max-width:240px;"><%=student_work.name %></span>
|
||||
<span class="fontGrey2 ml5 fl">
|
||||
|
@ -26,7 +26,7 @@
|
|||
<div class="flex-cell">助教:<span class="<%= score_color student_work.teaching_asistant_score%>"><%= student_work.teaching_asistant_score.nil? ? "--" : format("%.1f",student_work.teaching_asistant_score)%></span></div>
|
||||
<% if @homework.anonymous_comment == 0 %>
|
||||
<div class="flex-cell">匿评:
|
||||
<div class="<%= score_color student_work.student_score%> student_score_info" style="display: inline">
|
||||
<div class="<%= score_color student_work.student_score%> student_score_info pr" style="display: inline">
|
||||
<% if student_work.student_score.nil? %>
|
||||
<span title="该作品未被匿评">未参与</span>
|
||||
<% else %>
|
||||
|
@ -48,7 +48,7 @@
|
|||
<% end %>
|
||||
<div class="flex-cell">成绩:
|
||||
<% score = student_work.work_score %>
|
||||
<div class="<%= score_color score%> student_final_scor_info" style="display: inline">
|
||||
<div class="<%= score_color score%> student_final_scor_info pr" style="display: inline">
|
||||
<%= score.nil? ? "--" : format("%.1f",score<0 ? 0 : score)%>
|
||||
<% unless score.nil?%>
|
||||
<div class="g_infoNi none width180">
|
||||
|
|
|
@ -1,145 +0,0 @@
|
|||
<div class="show_hwork_arrow"></div>
|
||||
<div class="showHwork">
|
||||
<% is_teacher = User.current.allowed_to?(:as_teacher, @homework.course) || User.current.admin? %>
|
||||
<% pro = @homework.student_work_projects.where(:user_id => User.current.id).first %>
|
||||
<% is_my_work = pro && pro.student_work_id == work.id%>
|
||||
<ul>
|
||||
<li class="fl" >
|
||||
<span class="tit_fb">上交时间:</span>
|
||||
<%=format_time work.created_at %>
|
||||
</li>
|
||||
|
||||
<% if work.user == User.current && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") %>
|
||||
<!-- 我的作业 && 匿评作业 && 未开启匿评,显示编辑和删除按钮 -->
|
||||
<li class="fr" >
|
||||
<%= link_to("", student_work_path(work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del",:title=>"删除") %>
|
||||
</li>
|
||||
<li class="fr mr5" >
|
||||
<%= link_to "",edit_student_work_path(work),:class => "pic_edit",:title => "修改"%>
|
||||
</li>
|
||||
<% end%>
|
||||
<% if @homework.homework_detail_manual.comment_status == 3 && !is_my_work %>
|
||||
<!-- 匿评结束阶段,显示点赞按钮 -->
|
||||
<li class="fr" id="student_work_praise_<%= work.id%>">
|
||||
<%= render :partial => 'student_work_praise',:locals => {:work => work} %>
|
||||
</li>
|
||||
<% end%>
|
||||
<div class="cl"></div>
|
||||
|
||||
<!--<li ><span class="tit_fb"> 参与人员:</span>程梦雯 王强</li>-->
|
||||
|
||||
<% if work.student_work_projects && (@homework.homework_detail_manual.comment_status != 2 || is_my_work || is_teacher ) %>
|
||||
<div class="cl"></div>
|
||||
<li>
|
||||
<span class="tit_fb"> 参与人员:</span>
|
||||
<%= link_to(work.user.show_name+"(组长)", user_path(work.user.id), :class => "linkBlue" )%>
|
||||
<% members = work.student_work_projects.where("is_leader = 0") %>
|
||||
<% members.each do |member| if !members.empty? %>
|
||||
、<%=link_to((User.find member.user_id).show_name, user_path(member.user.id), :class => "linkBlue" ) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</li>
|
||||
<% if @homework.homework_detail_group.base_on_project == 1 %>
|
||||
<li>
|
||||
<span class="tit_fb"> 关联项目:</span>
|
||||
<% if work.project_id == 0 || work.project_id.nil? %>
|
||||
<span>暂无</span>
|
||||
<% elsif work.project.is_public || User.current.member_of?(work.project) || User.current.admin? %>
|
||||
<%= link_to( work.project.name, project_path(work.project.id), :class => "linkBlue" )%>
|
||||
<span class="ml5">(综合评分:<font class="c_red"><%=static_project_score(work.project.project_score).to_i %></font>)</span>
|
||||
<% else %>
|
||||
<span title ="该项目是私有的"><%=work.project.name %></span>
|
||||
<span class="ml5">(综合评分:<font class="c_red"><%=static_project_score(work.project.project_score).to_i %></font>)</span>
|
||||
<% end %>
|
||||
<%#= link_to( work.project.name, project_path(work.project.id), :class => "linkBlue" )%>
|
||||
</li>
|
||||
<% end %>
|
||||
<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>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li >
|
||||
<span class="tit_fb"> 附件:</span>
|
||||
<% com_attachments = work.attachments.where("attachtype IS NULL OR attachtype <> 7") %>
|
||||
<% if com_attachments.empty?%>
|
||||
<span style="color: #999999">尚未提交附件</span>
|
||||
<% else%>
|
||||
<div class="fl" style="width: 90%;">
|
||||
<%= render :partial => 'work_attachments_status', :locals => {:attachments => com_attachments, :status => @homework.homework_detail_manual.comment_status} %>
|
||||
</div>
|
||||
<% end%>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end%>
|
||||
|
||||
<li>
|
||||
<% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && !is_my_work)%>
|
||||
<!-- 老师 || 开启匿评状态 && 不是当前用户自己的作品 -->
|
||||
<div id="add_student_score_<%= work.id%>" class="mt10 evaluation">
|
||||
<%= render :partial => 'add_score',:locals => {:work => work,:score => score}%>
|
||||
</div>
|
||||
<% end%>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div id="revise_attachment">
|
||||
<%= render :partial => 'student_work/revise_attachment', :locals => {:work => work} %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div class="ping_box fl" id="score_list_<%= work.id%>" style="<%= work.student_works_scores.empty? ? 'padding:0px;' : ''%>">
|
||||
<%student_work_scores.each do |student_score|%>
|
||||
<div id="work_score_<%= student_score.id%>">
|
||||
<%= render :partial => 'student_work_score',:locals => {:score => student_score,:is_last => student_score == student_work_scores.last}%>
|
||||
</div>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<!---ping_box end--->
|
||||
<a href="javascript:void(0);" class="linkBlue mt5 mb5" style="margin-left:auto; margin-right: auto; display:block; width: 24px;" onclick="$('#about_hwork_<%= work.id%>').html('');">收起</a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('student_work_img_<%=work.id %>');
|
||||
<% if defined?(is_focus) && is_focus.to_i == 1 %>
|
||||
$("#upload_revise_attachment").click();
|
||||
<% end %>
|
||||
});
|
||||
function show_upload(){
|
||||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'student_work/upload_attachment' ,:locals => {:work=>work})%>');
|
||||
showModal('ajax-modal', '452px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='closeModal();' style='margin-left: 435px;' class='resourceClose'></a>");
|
||||
$('#ajax-modal').parent().css("top","40%").css("left","46%");
|
||||
$('#ajax-modal').parent().addClass("resourceUploadPopup");
|
||||
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
|
||||
}
|
||||
function regex_des() {
|
||||
if ($.trim($("#attachment_des").val()) == "") {
|
||||
$("#hint_message").text("附件描述不能为空");
|
||||
$("#hint_message").css('color','#ff0000');
|
||||
return false;
|
||||
} else {
|
||||
$("#hint_message").text("");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
function submit_revise_files(){
|
||||
if (regex_des()) {
|
||||
$("#upload_form").submit();
|
||||
}
|
||||
}
|
||||
function closeModal(){
|
||||
hideModal($(".uploadBoxContainer"));
|
||||
}
|
||||
function disable_choose(){
|
||||
if ($("#attachments_fields .attachment").size() >= 1) {
|
||||
$("#choose_revise_attach").attr("onclick","return false;").addClass(disable_link);
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -2,6 +2,7 @@
|
|||
<%= import_ke(enable_at: true, prettify: false, init_activity: false) %>
|
||||
<%= javascript_include_tag 'homework','baiduTemplate' %>
|
||||
<% end %>
|
||||
<div class="homepageRight mt0 ml10">
|
||||
<div class="homepageRightBanner mb10">
|
||||
<div class="NewsBannerName">编辑作品</div>
|
||||
</div>
|
||||
|
@ -83,6 +84,7 @@
|
|||
<% end%>
|
||||
</div><!----HomeWorkCon end-->
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
<% if @homework.homework_detail_group %>
|
||||
$(function(){
|
||||
|
|
|
@ -197,7 +197,8 @@
|
|||
});
|
||||
</script>
|
||||
|
||||
<div class="homepageRightBanner mb10">
|
||||
<div class="homepageRight mt0 ml10">
|
||||
<div class="homepageRightBanner mb10 ml10">
|
||||
<div class="NewsBannerName">提交作品</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
@ -297,4 +298,5 @@
|
|||
<div class="cl"></div>
|
||||
<% end%>
|
||||
</div><!----HomeWorkCon end-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue