留言修改

This commit is contained in:
z9hang 2014-11-02 14:41:41 +08:00
parent ba742cd910
commit cb87d6337c
5 changed files with 65 additions and 8 deletions

View File

@ -366,16 +366,35 @@ class HomeworkAttachController < ApplicationController
#是否开启互评功能
@is_evaluation = @homework.bid.is_evaluation == 1 || @homework.bid.is_evaluation == nil
@limit = 10
@jours = @homework.journals_for_messages.where("is_comprehensive_evaluation is null").order("created_on DESC")
#@jours留言 is null条件用以兼容历史数据
@jours = @homework.journals_for_messages.where("is_comprehensive_evaluation = 3 or is_comprehensive_evaluation is null").order("created_on DESC")
@feedback_count = @jours.count
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
@offset ||= @feedback_pages.offset
@jour = @jours[@offset, @limit]
@comprehensive_evaluation = @homework.journals_for_messages.where("is_comprehensive_evaluation is not null").order("created_on DESC")
#@comprehensive_evaluation教师评论
@comprehensive_evaluation = @homework.journals_for_messages.where("is_comprehensive_evaluation = 1").order("created_on DESC")
#@anonymous_comments 匿评
@anonymous_comments = @homework.journals_for_messages.where("is_comprehensive_evaluation = 2").order("created_on DESC")
@totle_score = score_for_homework @homework
@teaher_score = teacher_score_for_homework @homework
is_student = is_cur_course_student @homework.bid.courses.first
is_teacher = is_course_teacher User.current,@homework.bid.courses.first
is_anonymous_comments = true #是否开启了匿评
if !User.current.member_of_course?(@homework.bid.courses.first)
@is_comprehensive_evaluation = 3 #留言
elsif is_student && is_anonymous_comments #是学生且开启了匿评
@is_comprehensive_evaluation = 2 #匿评
elsif is_student && !is_anonymous_comments #是学生未开启匿评
@is_comprehensive_evaluation = 3 #留言
elsif is_teacher
@is_comprehensive_evaluation = 1 #教师评论
else
@is_comprehensive_evaluation = 3
end
respond_to do |format|
format.html
format.js

View File

@ -14,6 +14,7 @@ class JournalsForMessage < ActiveRecord::Base
"is_readed", # 留言是否已读
"m_reply_count", # 留言的回复数量
"m_reply_id" # 回复某留言的留言id(a留言回复了b留言这是b留言的id)
"is_comprehensive_evaluation" # 1 教师评论、2 匿评、3 留言
acts_as_tree :foreign_key => 'm_parent_id', :counter_cache => :m_reply_count, :order => "#{JournalsForMessage.table_name}.created_on ASC"
belongs_to :project,

View File

@ -3,7 +3,7 @@
function g(o){return document.getElementById(o);}
function HoverLi(n){
//如果有N个标签,就将i<=N;
for(var i=3;i<=4;i++){g('ping_tb_'+i).className='ping_normaltab';g('tbc_0'+i).className='ping_undis';}g('tbc_0'+n).className='ping_dis';g('ping_tb_'+n).className='ping_hovertab';
for(var i=3;i<=5;i++){g('ping_tb_'+i).className='ping_normaltab';g('tbc_0'+i).className='ping_undis';}g('tbc_0'+n).className='ping_dis';g('ping_tb_'+n).className='ping_hovertab';
}
//如果要做成点击后再转到请将<li>中的onmouseover 改成 onclick;
//]]>
@ -62,10 +62,12 @@
<div class="ping_list">
<div id="ping_tb_" class="ping_tb_">
<ul>
<li id="ping_tb_3" class="ping_hovertab" onmouseover="x:HoverLi(3);">
全部评论(<span class="c_red">30</span></li>
<li id="ping_tb_4" class="ping_normaltab" onmouseover="i:HoverLi(4);">
教师评论(<span class="c_red">30</span></li>
<%= l(:label_teacher_comments) %><span class="c_red">30</span></li>
<li id="ping_tb_5" class="ping_normaltab" onmouseover="i:HoverLi(5);">
<%= l(:label_anonymous_comments) %><span class="c_red">30</span></li>
<li id="ping_tb_3" class="ping_hovertab" onmouseover="x:HoverLi(3);">
<%= l(:label_responses) %><span class="c_red">30</span></li>
</ul>
</div>
<div class="cl"></div>
@ -153,9 +155,40 @@
</div>
</div>
<div class="ping_undis" id="tbc_05">
<div class="ping_C">
<div class="ping_dispic"><a href="#" target="_blank"><img src="images/225905790.jpg" width="46" height="46"></a></div>
<div class="ping_discon">
<div class="ping_distop">
<span><a href="#" target="_blank" style=" font-weight:bold; color:#15bccf; margin-right:30px; background:none;">gugu01</a></span><span style="color:#a6a6a6; margin-right:40px; margin-left:30px;">2014-10-24</span><span style="font-weight:bold; color:#a6a6a6; ">评分:<a href="#"></a><a href="#"></a><a href="#"></a><a href="#"></a><a href="#"></a></span>
<div class="cl"></div>
<p>我写了一个验证身份证号码的程序它是以一定内存空间大概100M)换取cpu消耗然后它的运算量就降低了多了或者</p>
</div>
<div class="ping_disfoot"><a href="#">删除</a><a href="#">回复</a></div>
</div>
<div class="cl"></div>
</div>
<div class="ping_C">
<div class="ping_dispic"><a href="#" target="_blank"><img src="images/225905790.jpg" width="46" height="46"></a></div>
<div class="ping_discon">
<div class="ping_distop">
<span><a href="#" target="_blank" style=" font-weight:bold; color:#15bccf; margin-right:30px; background:none;">gugu01</a></span><span style="color:#a6a6a6; margin-right:40px; margin-left:30px;">2014-10-24</span><span style="font-weight:bold; color:#a6a6a6; ">评分:<a href="#"></a><a href="#"></a><a href="#"></a><a href="#"></a><a href="#"></a></span>
<div class="cl"></div>
<p>我写了一个验证身份证号码的程序它是以一定内存空间大概100M)换取cpu消耗然后它的运算量就降低了多了或者</p>
</div>
<div class="ping_disfoot"><a href="#">删除</a><a href="#">回复</a></div>
</div>
<div class="cl"></div>
</div>
</div>
</div>
</div><!---ping_list end--->
</div><!---ping_list end--->
</div>

View File

@ -1848,3 +1848,5 @@ en:
label_create_person: Create personnel
label_participation_person: The participation of personnel
label_homework_without_description: The homework without any description!
label_teacher_comments: Teacher comments
label_anonymous_comments: Anonymous comments

View File

@ -2179,3 +2179,5 @@ zh:
label_create_person: 创建人员
label_participation_person: 参与人员
label_homework_without_description: 该作业无任何描述!
label_teacher_comments: 教师评论
label_anonymous_comments: 匿评