Merge branch 'Homework' of http://repository.trustie.net/xianbo/trustie2 into Homework
This commit is contained in:
commit
66641e6507
|
@ -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
|
||||
|
|
|
@ -84,4 +84,10 @@ module HomeworkAttachHelper
|
|||
def praise_homework_count obj_id
|
||||
PraiseTread.where("praise_tread_object_id = #{obj_id} AND praise_tread_object_type = 'HomeworkAttach'").count
|
||||
end
|
||||
|
||||
#获取用户对作业的评分
|
||||
def get_homework_score user, homework
|
||||
seems_rateable_rate = HomeworkAttach.find_by_sql("SELECT * FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = #{homework.id} AND rater_id = #{user.id}")
|
||||
seems_rateable_rate.nil? || seems_rateable_rate.count == 0 ? 0:seems_rateable_rate[0].stars
|
||||
end
|
||||
end
|
|
@ -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,
|
||||
|
|
|
@ -63,27 +63,19 @@
|
|||
</div>
|
||||
|
||||
<% if User.current.logged? %>
|
||||
<table border="0" width="525px" align="center" >
|
||||
<tr>
|
||||
<td><%= f.text_area 'user_message', :rows => 3, :cols => 65, :value => "#{l(:label_leave_a_message)}",
|
||||
:onfocus => "clearInfo('new_form_user_message','#{l(:label_leave_a_message)}')",
|
||||
:onblur => "showInfo('new_form_user_message','#{l(:label_leave_a_message)}')",
|
||||
:style => "resize: none;", :class => 'noline'%></td>
|
||||
</tr>
|
||||
</table>
|
||||
<%= f.text_area 'user_message', :rows => 3, :cols => 65,
|
||||
:style => "resize: none;", :class => 'noline', :placeholder => l(:text_caracters_maximum,:count=>250)%>
|
||||
<%= f.text_field :reference_user_id, :style=>"display:none"%>
|
||||
<table border="0" width="525px" align="center">
|
||||
<tr>
|
||||
<td align="right"> <%= submit_tag l(:button_leave_meassge),
|
||||
<div style="float:right">
|
||||
<%= submit_tag l(:button_leave_meassge),
|
||||
:name => nil , :class => "enterprise",
|
||||
:onmouseout => "this.style.backgroundPosition = 'left top'",
|
||||
:onmouseover => "this.style.backgroundPosition = 'left -31px'"%>
|
||||
<%= submit_tag l(:button_clear_meassge), :name => nil, :class => "enterprise",
|
||||
:onclick => "clearMessage('new_form_user_message');",
|
||||
:onmouseout => "this.style.backgroundPosition = 'left top'",
|
||||
:onmouseover => "this.style.backgroundPosition = 'left -31px'" %> </td>
|
||||
</tr>
|
||||
</table>
|
||||
:onmouseover => "this.style.backgroundPosition = 'left -31px'" %>
|
||||
</div>
|
||||
<% else %>
|
||||
<div style="font-size: 14px;margin:10px;text-align: center">
|
||||
<%= l(:label_user_login_tips) %>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<div class="ping_discon" style="width: 85%;">
|
||||
<div class="ping_distop">
|
||||
<!-- <a style=" font-weight:bold; color:#15bccf; margin-right:30px; background:none;" target="_blank" href="#">gugu01</a> -->
|
||||
<span><%= link_to journal.user, user_path(journal.user),:style => " font-weight:bold; color:#15bccf; margin-right:30px; background:none;", :target => "_blank"%></span><span style="color:#a6a6a6; margin-right:40px; margin-left:30px;">2014-10-24</span>
|
||||
<span><%= link_to journal.user, user_path(journal.user),:style => " font-weight:bold; color:#15bccf; margin-right:30px; background:none;", :target => "_blank"%></span><span style="color:#a6a6a6; margin-right:40px; margin-left:30px;"><%= journal.created_on %></span>
|
||||
<div class="cl"></div>
|
||||
<p><%= textilizable journal.notes%></p>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
<div class="ping_C">
|
||||
<div class="ping_dispic"><a target="_blank" href="#"><%= image_tag(url_to_avatar(jour.user)) %></a></div>
|
||||
<div class="ping_discon">
|
||||
<div class="ping_distop">
|
||||
<span><%= link_to jour.user, user_path(jour.user),:style => " font-weight:bold; color:#15bccf; margin-right:30px; background:none;", :target => "_blank"%></span>
|
||||
<span style="color:#a6a6a6; margin-right:40px; margin-left:30px;"><%= jour.created_on %></span><span style="font-weight:bold; color:#a6a6a6; ">
|
||||
<%= l(:label_work_rating) %>:
|
||||
<%= render :partial => 'show_score', locals: {:stars => get_homework_score(jour.user,@homework ) } %>
|
||||
</span>
|
||||
<div class="cl"></div>
|
||||
<p><%= textilizable jour.notes%></p>
|
||||
</div>
|
||||
<div class="ping_disfoot">
|
||||
<% ids = 'project_respond_form_'+ jour.id.to_s%>
|
||||
<span>
|
||||
<%= link_to l(:label_projects_feedback_respond),'',
|
||||
{:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), '#{l(:label_reply_plural)} #{jour.user.name}: '); $('##{ids} textarea') ;return false;"}
|
||||
%>
|
||||
<% if jour.user==User.current|| User.current.admin? %>
|
||||
<%= link_to(l(:label_bid_respond_delete), {:controller => 'homework_attach', :action => 'destroy_jour', :object_id => jour, :user_id => jour.user},
|
||||
:remote => true, :confirm => l(:text_are_you_sure), :title => l(:button_delete)) %>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
|
@ -1,9 +1,11 @@
|
|||
<% reply_allow = JournalsForMessage.create_by_user? User.current %>
|
||||
|
||||
<script type="text/javascript" language="javascript">
|
||||
//<!CDATA[
|
||||
function g(o){return document.getElementById(o);}
|
||||
function HoverLi(n){
|
||||
//如果有N个标签,就将i<=N;
|
||||
for(var i=1;i<=2;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;
|
||||
//]]>
|
||||
|
@ -49,112 +51,64 @@
|
|||
</p>
|
||||
|
||||
<div class="ping_star">
|
||||
<% if @is_comprehensive_evaluation == 3 %>
|
||||
<%= l(:label_work_rating) %>:
|
||||
<%= render :partial => 'show_score', locals: {:stars => @totle_score} %>
|
||||
<% elsif @is_comprehensive_evaluation == 2 %>
|
||||
<%= l(:label_work_rating) %>:
|
||||
<% if @has_evaluation || !can_anonymous_comments %>
|
||||
<%= render :partial => 'show_score', locals: {:stars => @totle_score} %>
|
||||
<% else %>
|
||||
<%= rating_for @homework, dimension: :quality, class: 'rateable div_inline' %>
|
||||
<% end %>
|
||||
|
||||
<% elsif @is_comprehensive_evaluation == 1%>
|
||||
<%= l(:label_work_rating) %>:
|
||||
<%= rating_for @homework, dimension: :quality, class: 'rateable div_inline' %>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<textarea id="ta_msg_content" name="content" placeholder="最多250个字"></textarea>
|
||||
<a href="#" class="ping_sub">提交评论</a>
|
||||
<%= render :partial => 'addjour', :locals => {:homework_attach => @homework, :sta => 0, :is_comprehensive_evaluation => @is_comprehensive_evaluation} %>
|
||||
<!-- <textarea id="ta_msg_content" name="content" placeholder="最多250个字"></textarea>
|
||||
<a href="#" class="ping_sub">提交评论</a> -->
|
||||
<div class="cl"></div>
|
||||
</div><!---ping_con end--->
|
||||
|
||||
<div class="ping_list">
|
||||
<div id="ping_tb_" class="ping_tb_">
|
||||
<ul>
|
||||
<li id="ping_tb_1" class="ping_hovertab" onmouseover="x:HoverLi(1);">
|
||||
全部评论(<span class="c_red">30</span>)</li>
|
||||
<li id="ping_tb_2" class="ping_normaltab" onmouseover="i:HoverLi(2);">
|
||||
教师评论(<span class="c_red">30</span>)</li>
|
||||
<li id="ping_tb_4" class="ping_normaltab" onmouseover="i:HoverLi(4);">
|
||||
<%= l(:label_teacher_comments) %>(<span class="c_red"><%= @comprehensive_evaluation.count == 0 ? 0:1 %></span>)</li>
|
||||
<li id="ping_tb_5" class="ping_normaltab" onmouseover="i:HoverLi(5);">
|
||||
<%= l(:label_anonymous_comments) %>(<span class="c_red"><%= @anonymous_comments.count %></span>)</li>
|
||||
<li id="ping_tb_3" class="ping_hovertab" onmouseover="x:HoverLi(3);">
|
||||
<%= l(:label_responses) %>(<span class="c_red"><%= @jours.count %></span>)</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="ping_ctt">
|
||||
<div class="ping_dis" id="tbc_01">
|
||||
<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 class="cl"></div>
|
||||
<div class="recall">
|
||||
<div class="recall_head"><a href="#" target="_blank"><img src="images/225905790.jpg" width="30" height="30"></a></div>
|
||||
<div class="recall_con">
|
||||
<a href="#">jack</a> 回复 <a href="#">jack</a>:
|
||||
<p>我们尽快修复,此问题已发现原因,测试后我们尽快上线。谢谢反馈!!</p>
|
||||
<span style="float:left; color:#a6a6a6;">2014-10-31</span>
|
||||
<div class="ping_disfoot"><a href="#">删除</a><a href="#">回复</a></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="recall">
|
||||
<div class="recall_head"><a href="#" target="_blank"><img src="images/225905790.jpg" width="30" height="30"></a></div>
|
||||
<div class="recall_con">
|
||||
<a href="#">jack</a> 回复 <a href="#">jack</a>:
|
||||
<p>我们尽快修复,此问题已发现原因,测试后我们尽快上线。谢谢反馈!!</p>
|
||||
<span style="float:left; color:#a6a6a6;">2014-10-31</span>
|
||||
<div class="ping_disfoot"><a href="#">删除</a><a href="#">回复</a></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</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 class="ping_dis" id="tbc_03">
|
||||
<% @jours.each do |jour| %>
|
||||
<%= render :partial => 'homework_attach/jour',:locals => {:jour => jour} %>
|
||||
<% end %>
|
||||
</div><!--全部评论end-->
|
||||
|
||||
<div class="ping_undis" id="tbc_02">
|
||||
<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 class="ping_undis" id="tbc_04">
|
||||
<% if @comprehensive_evaluation.count > 0 %>
|
||||
<%= render :partial => 'homework_attach/jour',:locals => {:jour => @comprehensive_evaluation.first} %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="ping_disfoot"><a href="#">删除</a><a href="#">回复</a></div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="ping_undis" id="tbc_05">
|
||||
<%= @anonymous_comments.each do |jour| %>
|
||||
<%= render :partial => 'homework_attach/jour',:locals => {:jour => jour} %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div><!---ping_list end--->
|
||||
</div>
|
|
@ -1,4 +1,4 @@
|
|||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show',:locals => {:comprehensive_evaluation => @comprehensive_evaluation,:homework => @homework, :teaher_score => @teaher_score}) %>');
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show',:locals => {:comprehensive_evaluation => @comprehensive_evaluation,:homework => @homework, :teaher_score => @teaher_score,:can_anonymous_comments => false}) %>');
|
||||
showModal('ajax-modal', '503px');
|
||||
$('#ajax-modal').css('height','569px');
|
||||
|
||||
|
|
|
@ -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
|
|
@ -2180,3 +2180,5 @@ zh:
|
|||
label_participation_person: 参与人员
|
||||
label_homework_without_description: 该作业无任何描述!
|
||||
label_sure_exit_homework: 是否确认退出该作业
|
||||
label_teacher_comments: 教师评论
|
||||
label_anonymous_comments: 匿评
|
15
db/schema.rb
15
db/schema.rb
|
@ -178,6 +178,13 @@ ActiveRecord::Schema.define(:version => 20141102054414) do
|
|||
|
||||
add_index "changesets_issues", ["changeset_id", "issue_id"], :name => "changesets_issues_ids", :unique => true
|
||||
|
||||
create_table "class_members", :force => true do |t|
|
||||
t.integer "member_id"
|
||||
t.integer "course_class_id"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "code_review_assignments", :force => true do |t|
|
||||
t.integer "issue_id"
|
||||
t.integer "change_id"
|
||||
|
@ -310,6 +317,14 @@ ActiveRecord::Schema.define(:version => 20141102054414) do
|
|||
t.integer "container_id", :default => 0
|
||||
end
|
||||
|
||||
create_table "course_classes", :force => true do |t|
|
||||
t.string "name"
|
||||
t.text "explain"
|
||||
t.integer "course_id"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "course_infos", :force => true do |t|
|
||||
t.integer "course_id"
|
||||
t.integer "user_id"
|
||||
|
|
|
@ -109,7 +109,7 @@ a:hover.ping_sub{ background:#14a8b9;}
|
|||
.ping_C{border-bottom:1px dashed #CCC; padding:5px;}
|
||||
.ping_dispic a{ display:block; height:46px; width:46px; border:1px solid #CCC; padding:1px; float:left;}
|
||||
.ping_dispic img{ height:46px; width:46px;}
|
||||
.ping_discon{ float:left; width:384px; margin-left:15px;}
|
||||
.ping_discon{ float:left; width:372px; margin-left:15px;}
|
||||
.ping_distop span{ float:left;}
|
||||
.ping_distop p{ color:#5f5f5f;}
|
||||
.ping_disfoot a{ float:right; color:#15bccf; margin-left:5px;}
|
||||
|
|
Loading…
Reference in New Issue