shou页面的展示以及留言功能

This commit is contained in:
sw 2015-09-17 16:04:16 +08:00
parent 47cdf1231d
commit c4abe6b413
8 changed files with 115 additions and 101 deletions

View File

@ -191,7 +191,8 @@ class StudentWorkController < ApplicationController
def show
@score = student_work_score @work,User.current
@is_teacher = User.current.allowed_to?(:as_teacher,@course)
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
@student_work_scores = @work.student_works_scores.order("updated_at desc")
respond_to do |format|
format.js
end

View File

@ -6,9 +6,9 @@
</a>
<% if jour.user==User.current || User.current.admin? %>
<%= link_to(l(:label_bid_respond_delete), destroy_score_reply_student_work_index_path(:jour_id => jour.id),
:remote => true, :confirm => l(:text_are_you_sure), :title => l(:button_delete), :class => "fr c_purple") %>
:remote => true, :confirm => l(:text_are_you_sure), :title => l(:button_delete), :class => "fr linkBlue mr5") %>
<% end %>
<span class=" fr c_grey mr10">
<span class=" fr c_grey mr20">
<%=format_time jour.created_on %>
</span>
<div class="cl mb5"></div>

View File

@ -1,72 +1,74 @@
<div class="show_hwork_arrow"></div>
<div class="show_hwork">
<ul>
<li class="fl">
<span class="tit_fb">上交时间:</span>
<%=format_time @work.created_at %>
</li>
<div class="showHwork">
<ul>
<li class="fl" >
<span class="tit_fb">上交时间:</span>
<%=format_time @work.created_at %>
</li>
<% if !@is_teacher && @work.user == User.current && (@homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 1) %>
<!-- 我的作业 && (非匿评作业 || 为开启匿评),显示编辑和删除按钮 -->
<li class="fr" >
<%= link_to("", student_work_path(@work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del") %>
</li>
<li class="fr" >
<%= link_to "",edit_student_work_path(@work),:class => "pic_edit"%>
</li>
<% end%>
<% if (@homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3) && @work.user != User.current%>
<!-- 普通作业或者编程作业,或者是匿评结束阶段,显示点赞按钮 -->
<li class="fr" id="student_work_praise_<%= @work.id%>">
<%= render :partial => 'student_work_praise' %>
</li>
<% end%>
<div class="cl"></div>
<!--<li >-->
<!--<span class="tit_fb"> 参与人员:</span>-->
<!--程梦雯&nbsp;&nbsp;王强-->
<!--</li>-->
<% if @work.project%>
<li >
<span class="tit_fb"> 关联项目:</span>
<%= link_to( @work.project.name, project_path(@work.project.id), :class => "c_blue02" )%>
</li>
<% end%>
<li >
<span class="tit_fb ">内容:</span>
<div class="show_hwork_p break_word">
<%= text_format(@work.description) if @work.description%>
</div>
<% if @work.user == User.current && @homework.homework_detail_manual.comment_status == 1 %>
<!-- 我的作业 && 匿评作业 && 未开启匿评,显示编辑和删除按钮 -->
<li class="fr" >
<%= link_to("", student_work_path(@work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del") %>
</li>
<li class="fr" >
<%= link_to "",edit_student_work_path(@work),:class => "pic_edit"%>
</li>
<% end%>
<% if @homework.homework_detail_manual.comment_status == 3 && @work.user != User.current%>
<!-- 匿评结束阶段,显示点赞按钮 -->
<li class="fr" id="student_work_praise_<%= @work.id%>">
<%= render :partial => 'student_work_praise' %>
</li>
<% end%>
<div class="cl"></div>
</li>
<li >
<span class="tit_fb"> 附件:</span>
<% if @work.attachments.empty?%>
<span style="color: #999999">尚未提交附件</span>
<% else%>
<div class="fl">
<%= render :partial => 'work_attachments', :locals => {:attachments => @work.attachments} %>
<!--<li ><span class="tit_fb"> 参与人员:</span>程梦雯&nbsp;&nbsp;王强</li>-->
<% if @work.project%>
<li >
<span class="tit_fb"> 关联项目:</span>
<%= 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">
<%= text_format(@work.description) if @work.description%>
</div>
<div class="cl"></div>
</li>
<li >
<span class="tit_fb"> 附件:</span>
<% if @work.attachments.empty?%>
<span style="color: #999999">尚未提交附件</span>
<% else%>
<div class="fl" style="width: 90%;">
<%= render :partial => 'work_attachments', :locals => {:attachments => @work.attachments} %>
</div>
<% end%>
<div class="cl"></div>
</li>
<li >
<% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && @work.user != User.current )%>
<!-- 老师 || 开启匿评状态 && 不是当前用户自己的作品 -->
<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 class="ping_box fl" id="score_list_<%= @work.id%>" style="<%= @work.student_works_scores.empty? ? 'padding:0px;' : ''%>">
<%@student_work_scores.each do |score|%>
<div id="work_score_<%= score.id%>">
<%= render :partial => 'student_work_score',:locals => {:score => score,:is_last => score == @student_work_scores.last}%>
</div>
<% end%>
</li>
</div>
<!---ping_box end--->
<a href="javascript:void(0);" class="fr linkBlue mt5 mb5" onclick="$('#about_hwork_<%= @work.id%>').html('');">收起</a>
<div class="cl"></div>
<% if @is_teacher || (@homework.homework_type == 1 && @homework.homework_detail_manual.comment_status == 2 && @work.user != User.current )%>
<!-- 老师 || 匿评作业 && 开启匿评状态 && 不是当前用户自己的作品 -->
<div id="add_student_score_<%= @work.id%>" class="mt10 evaluation">
<%= render :partial => 'add_score',:locals => {:work => @work,:score => @score}%>
</div>
<% end%>
</ul>
<div class="ping_box mt10" id="score_list_<%= @work.id%>" style="<%= @work.student_works_scores.empty? ? 'padding:0px;' : ''%>">
<%@work.student_works_scores.order("updated_at desc").each do |score|%>
<div id="work_score_<%= score.id%>">
<%= render :partial => 'student_work_score',:locals => {:score => score}%>
</div>
<% end%>
</div><!---ping_box end--->
<a href="javascript:void(0);" class="fr c_blue mt5 mb5" onclick="$('#about_hwork_<%= @work.id%>').html('');">收起</a>
<div class="cl"></div>
</div><!---show_hwork end--->
</div>

View File

@ -1,22 +1,29 @@
<ul class="ping_box_ul ping_line">
<ul class="ping_box_ul <%= is_last ? '' : 'ping_line'%> fl">
<% show_real_name = @is_teacher || score.user == User.current || score.user.allowed_to?(:as_teacher,@course) %>
<%= link_to image_tag(url_to_avatar(show_real_name ? score.user : ""), :width => "34", :height => "34"), show_real_name ? user_path(score.user) : "javascript:void(0)",:class => "ping_pic fl" %>
<div class="ping_box_tit">
<%= link_to show_real_name ? score.user.show_name : "匿名", show_real_name ? user_path(score.user) : "javascript:void(0)", :title => show_real_name ? score.user.show_name : "匿评用户", :class => "c_blue fl" %>
<span class="ml5 fl"><%= student_work_score_role score%></span>
<div class="pingBoxTit">
<%= link_to show_real_name ? score.user.show_name : "匿名", show_real_name ? user_path(score.user) : "javascript:void(0)", :title => show_real_name ? score.user.show_name : "匿评用户", :class => "linkBlue fl" %>
<span class="ml5 fl">
<%= student_work_score_role score%>
</span>
<span class="ml20 fl">评分:</span>
<a href="javascript:void(0);" class="c_orange fl" ><%= score.score%>分</a>
<a href="javascript:void(0);" class="fr c_purple mr5" onclick="$('#add_score_reply_<%= score.id%>').slideToggle();">回复</a>
<span class=" fr c_grey mr20">
<%=format_time score.updated_at %>
</span>
<a href="javascript:void(0);" class="c_orange fl" >
<%= score.score%>分
</a>
<a href="javascript:void(0);" class="fr linkBlue mr5" onclick="$('#add_score_reply_<%= score.id%>').slideToggle();">回复</a>
<span class=" fr c_grey mr20">
<%=format_time score.updated_at %>
</span>
<div class="cl mb5"></div>
<p class="break_word">
<%= score.comment%>
</p>
<div class="cl"></div>
<%= render :partial => 'work_attachments', :locals => {:attachments => score.attachments} %>
<div class="cl"></div>
<div id="add_score_reply_<%= score.id%>" class="undis">
<%= render :partial => 'add_score_reply',:locals => {:score => score}%>
</div>
@ -27,6 +34,6 @@
<%= render :partial => 'jour_replay',:locals => {:jour => jour}%>
<% end%>
</div>
<div class="cl"></div>
</div>
<div class="cl"></div>
</ul>
</ul>

View File

@ -1,8 +1,8 @@
<% attachments.each_with_index do |attachment,i| %>
<div id="attachment_<%= attachment.id%>">
<%= link_to_short_attachment attachment, :class => 'link_file', :download => true -%>
<%= link_to('&nbsp;'.html_safe, attachment_path(attachment, :format => 'js'), :method => 'delete', :remote => true, :title => '删除', :class => 'remove-upload', :confirm => l(:text_are_you_sure)) if attachment.id && User.current == attachment.author %>
<span class="ml5">(<%= number_to_human_size attachment.filesize %>)</span>
<%= link_to_short_attachment attachment, :class => 'link_file_a fl', :download => true -%>
<%= link_to('&nbsp;'.html_safe, attachment_path(attachment, :format => 'js'), :method => 'delete', :remote => true, :title => '删除', :class => 'remove-upload fl', :confirm => l(:text_are_you_sure)) if attachment.id && User.current == attachment.author %>
<span class="ml5 fl">(<%= number_to_human_size attachment.filesize %>)</span>
<div class="cl"></div>
</div>
<% end -%>

View File

@ -17,6 +17,10 @@
$('#ajax-modal').parent().addClass("anonymos");
});
<% end%>
// $(function(){
// $('.animated').autosize();
// });
</script>
<div class="homepageRight mt0 ml10">

View File

@ -1,11 +1,11 @@
if($("#about_hwork_<%= @work.id%>").children().length > 0)
{$("#about_hwork_<%= @work.id%>").html("");}
else
{
<% if @homework.homework_type == 2%>
$("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'programing_work_show') %>");
<% else%>
$("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'show') %>");
<% end%>
$('#score_<%= @work.id%>').peSlider({range: 'min'});
}
if($("#about_hwork_<%= @work.id%>").children().length > 0){
$("#about_hwork_<%= @work.id%>").html("");
}
else{
<% if @homework.homework_type == 2%>
$("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'programing_work_show') %>");
<% else%>
$("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'show') %>");
<% end%>
$('#score_<%= @work.id%>').peSlider({range: 'min'});
}

View File

@ -692,15 +692,15 @@ a.hwork_center{ display:block; width:60px; text-align:center; margin-right:5px;}
.tit_fb{ font-weight:bold; width:66px; text-align:right; display:block; float:left;}
.ml160{ margin-left:160px;}
.show_hwork_p{ width:580px; float:left;}
.hwork_ping_text{ float:left; border:1px solid #e4e4e4; padding:5px; width:568px; height:35px;}
.ping_box{ width:626px; padding:10px; background:#f5f3f3; }
.hwork_ping_text{ float:left; border:1px solid #e4e4e4; padding:5px; width:615px; height:35px;}
.ping_box{ width:676px; padding:10px; background:#f5f3f3; }
a.ping_pic{ display:block; width:34px; height:34px; padding:2px; border:1px solid #e3e3e3;}
a:hover.ping_pic{border:1px solid #64bdd9;}
.ping_box_tit{ float:left; width:575px; margin-left:10px;}
.ping_box_ul{}
.ping_line{ border-bottom:1px dashed #CCCCCC; padding-bottom:8px; margin-bottom:8px;}
.ping_text{border:1px solid #CCCCCC; margin:5px; padding:5px; width:560px; height:20px; }
.ping_back_tit{ float:left; width:523px; margin-left:10px; }
.ping_text{border:1px solid #CCCCCC; margin:5px; padding:5px; width:610px; height:20px; }
.ping_back_tit{ float:left; width:578px; margin-left:10px; }
a.down_btn{ border:1px solid #CCC; color:#999; padding:0px 5px; font-size:12px; text-align:center; display:block;}
a:hover.down_btn{ background:#14ad5a; color:#fff; border:1px solid #14ad5a;}
.fr{ float:right;}
@ -800,8 +800,8 @@ a:hover.icon_remove{background:url(images/icons.png) -20px -338px no-repeat;}
.T_C{ text-align:center;}
.SearchIcon{background:url(../images/homepage_icon2.png) 676px -393px no-repeat; }
.SearchIcon:hover{background:url(../images/homepage_icon2.png) 676px -419px no-repeat; }
a.link_file{ background:url(../images/pic_file.png) 0 2px no-repeat; padding-left:20px; }
a:hover.link_file{ background:url(../images/pic_file.png) 0 -25px no-repeat; color:#3ca5c6;}
a.link_file_a{ background:url(../images/pic_file.png) 0 2px no-repeat; padding-left:20px; }
a:hover.link_file_a{ background:url(../images/pic_file.png) 0 -25px no-repeat; color:#3ca5c6;}
a.remove-upload {background: url(../images/delete.png) no-repeat 1px 50%;width: 1px;display: inline-block;padding-left: 16px;}
a.FilesName{ max-width:540px;overflow:hidden; white-space:nowrap; text-overflow:ellipsis; display:block;}
a.FilesName02{ max-width:665px;overflow:hidden; white-space:nowrap; text-overflow:ellipsis; display:block;}
@ -847,7 +847,7 @@ a.pro_mes_w{ height:20px; display:block; color:#999999;}
.rside_work_con{ width:650px;}
a.c_grey{ color:#999999;}
a:hover.c_grey{ color:#333;}
.link_file{ display:block; max-width:300px;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;}
.link_file_a{ display:block; max-width:450px;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;}
.last_time{width:auto; text-align:right; margin-right:70px;}
.link_file_box{ width:360px;}