Merge branch 'Homework' of http://repository.trustie.net/xianbo/trustie2 into Homework

This commit is contained in:
sw 2014-11-03 18:54:50 +08:00
commit 1ec6b53d76
13 changed files with 124 additions and 50 deletions

View File

@ -368,7 +368,7 @@ class HomeworkAttachController < ApplicationController
#@limit = 10
#@jours留言 is null条件用以兼容历史数据
@jours = @homework.journals_for_messages.where("is_comprehensive_evaluation = 3 or is_comprehensive_evaluation is null").order("created_on DESC")
@jour = paginateHelper @jours,10
@jour = paginateHelper @jours,5
#@feedback_count = @jours.count
#@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
#@offset ||= @feedback_pages.offset
@ -393,12 +393,14 @@ class HomeworkAttachController < ApplicationController
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 #是否开启了匿评
@is_anonymous_comments = @homework.bid.comment_status == 1 #是否开启了匿评
if !User.current.member_of_course?(@homework.bid.courses.first)
@is_comprehensive_evaluation = 3 #留言
elsif is_student && is_anonymous_comments #是学生且开启了匿评
elsif is_student && @is_anonymous_comments && !@has_evaluation#是学生且开启了匿评且未进行评分
@is_comprehensive_evaluation = 2 #匿评
elsif is_student && !is_anonymous_comments #是学生未开启匿评
elsif is_student && @is_anonymous_comments && @has_evaluation #是学生且开启了匿评,但已评分
@is_comprehensive_evaluation = 3 #留言
elsif is_student && !@is_anonymous_comments #是学生未开启匿评
@is_comprehensive_evaluation = 3 #留言
elsif is_teacher
@is_comprehensive_evaluation = 1 #教师评论
@ -417,7 +419,30 @@ class HomeworkAttachController < ApplicationController
#删除留言
def destroy_jour
@journal_destroyed = JournalsForMessage.delete_message(params[:object_id])
@homework = HomeworkAttach.find(params[:jour_id])
@journal_destroyed = JournalsForMessage.find(params[:object_id])
@is_comprehensive_evaluation = @journal_destroyed.is_comprehensive_evaluation
@journal_destroyed.destroy
if @is_comprehensive_evaluation == 3
@jours = @homework.journals_for_messages.where("is_comprehensive_evaluation = 3 or is_comprehensive_evaluation is null").order("created_on DESC")
@jour = paginateHelper @jours,5
elsif @is_comprehensive_evaluation == 2
annymous_users = @homework.homework_evaluations.map(&:user)
unless annymous_users.nil? || annymous_users.count == 0
@anonymous_comments = @homework.journals_for_messages.where("is_comprehensive_evaluation = 2 and user_id in #{convert_array(annymous_users)}").order("created_on DESC")
end
elsif @is_comprehensive_evaluation == 1
teachers = searchTeacherAndAssistant @course
@comprehensive_evaluation = []
teachers.each do|teacher|
temp = @homework.journals_for_messages.where("is_comprehensive_evaluation = 1 and user_id = #{teacher.user_id}").order("created_on DESC").first
@comprehensive_evaluation << temp if temp
end
end
respond_to do |format|
format.js
end
@ -429,6 +454,7 @@ class HomeworkAttachController < ApplicationController
@add_jour = @homework.addjours User.current.id, params[:new_form][:user_message],0,params[:is_comprehensive_evaluation]
if @add_jour.is_comprehensive_evaluation == 3
@jours = @homework.journals_for_messages.where("is_comprehensive_evaluation = 3 or is_comprehensive_evaluation is null").order("created_on DESC")
@jour = paginateHelper @jours,5
elsif @add_jour.is_comprehensive_evaluation == 2
annymous_users = @homework.homework_evaluations.map(&:user)
unless annymous_users.nil? || annymous_users.count == 0

View File

@ -13,9 +13,13 @@
$('#' + id).val(content);
}
}
function submit1(button)
{
$('#jours_submit').parent().submit();
}
</script>
<%= form_for('bid_message', :remote => true, :method => :post,
<%= form_for('bid_message', :id=>"bid_message_form",:remote => true, :method => :post,
:url => {:controller => 'bids',
:action => 'create',
:id => bid,
@ -34,16 +38,16 @@
<td><%= f.text_area 'message', :rows => 3, :cols => 65, :placeholder => l(:label_max_length), :style => "resize: none;", :class => 'noline'%></td>
<% end %>
</tr>
</table>
<%= f.text_field :reference_user_id, :style=>"display:none"%>
<!-- modified by bai 525px -->
<table border="0" width="95%" align="center">
<tr>
<td align="right"> <%= submit_tag l(:button_leave_meassge), :name => nil , :class => "bid_btn", :onmouseout => "this.style.backgroundPosition = 'left top'", :onmouseover => "this.style.backgroundPosition = 'left -31px'"%>
<%= submit_tag l(:button_clear_meassge), :name => nil, :onclick => "clearMessage('bid_message_message');", :type => 'button', :class => "bid_btn", :onmouseout => "this.style.backgroundPosition = 'left top'", :onmouseover => "this.style.backgroundPosition = 'left -31px'" %> </td>
<td><%= f.text_field :reference_user_id, :style=>"display:none"%>
<a href="#" class="ping_sub" onclick = "clearMessage('bid_message_message');"><%= l(:button_clear_meassge) %></a>
<a href="#" class="ping_sub" id="jours_submit" onclick="submit1();"><%= l(:label_responses) %></a></td>
</tr>
</table>
<!-- modified by bai 525px -->
<!-- end -->
<% else %>

View File

@ -49,6 +49,11 @@
$('#' + id).val(content);
}
}
function submit1(button)
{
$('#jours_submit').parent().submit();
}
</script>
<%= form_for('new_form', :remote => true, :method => :post,
@ -67,14 +72,8 @@
:style => "resize: none;", :class => 'noline', :placeholder => l(:text_caracters_maximum,:count=>250)%>
<%= f.text_field :reference_user_id, :style=>"display:none"%>
<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'" %>
<a href="#" class="ping_sub1" id="jours_submit" onclick="submit1();"><%= l(:label_submit_comments) %></a>
</div>
<% else %>
<div style="font-size: 14px;margin:10px;text-align: center">

View File

@ -2,11 +2,11 @@
<div id="ping_tb_" class="ping_tb_">
<ul>
<li id="ping_tb_4" class="ping_normaltab" onmouseover="i:HoverLi(4);">
<%= l(:label_teacher_comments) %><span class="c_red"><%= @comprehensive_evaluation.nil? ? 0 : @comprehensive_evaluation.count %></span></li>
<%= l(:label_teacher_comments) %><span class="c_red" id="jour_count_4"><%= @comprehensive_evaluation.nil? ? 0 : @comprehensive_evaluation.count %></span></li>
<li id="ping_tb_5" class="ping_normaltab" onmouseover="i:HoverLi(5);">
<%= l(:label_anonymous_comments) %><span class="c_red"><%= @anonymous_comments.nil? ? 0 : @anonymous_comments.count %></span></li>
<%= l(:label_anonymous_comments) %><span class="c_red" id="jour_count_5" ><%= @anonymous_comments.nil? ? 0 : @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.nil? ? 0 : @jours.count %></span></li>
<%= l(:label_responses) %><span class="c_red" id="jour_count_3"><%= @jours.nil? ? 0 : @jours.count %></span></li>
</ul>
</div>
<div class="cl"></div>

View File

@ -24,20 +24,31 @@
<div class="ping_disfoot">
<% ids = 'project_respond_form_'+ jour.id.to_s%>
<span>
<% 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,:jour_id =>@homework.id },
:remote => true, :confirm => l(:text_are_you_sure), :title => l(:button_delete)) %>
<% end %>
<%= 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 id='<%= ids %>' class="respond-form">
<%= render :partial => 'words/new_respond', :locals => {:journal => jour, :m_reply_id => jour} %>
</div>
<div style="clear: both;"></div>
<div>
<%= render :partial => "words/journal_reply", :locals => {:journal => jour } %>
</div>
</div>
<div class="cl"></div>
</div>
<div class="cl"></div>
</div>
<% end %>
<% if is_jour%>
<div class="dis">
<ul class="wlist"><%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => true, :flag => true%></ul>
</div>
<% end %>

View File

@ -15,18 +15,32 @@
<div class="ping_con">
<h2><%= @homework.name %></h2>
<ul>
<li><%= l(:label_create_person) %><span class="c_grey"><%= link_to @homework.user, user_path(@homework.user)%></span></li>
<li><%= l(:label_create_person) %>
<span class="c_grey">
<% if @is_anonymous_comments && @is_comprehensive_evaluation != 1 %>
<%= l(:label_anonymous) %>
<% else %>
<%= link_to @homework.user, user_path(@homework.user)%>
<% end %>
</span>
</li>
<li style=" margin-left:130px;"><%= l(:label_activity_time) %><span class="c_grey" ><%=format_time @homework.created_at %></span></li>
</ul>
<div class="cl"></div>
<% if @homework.users.count > 0 %>
<div><%= l(:label_participation_person) %>
<% if @is_anonymous_comments && @is_comprehensive_evaluation != 1 %>
<%= l(:label_anonymous) %>
<%else%>
<% @homework.users.each do |homework_user| %>
<span class="c_grey"><%= link_to homework_user, user_path(homework_user)%></span>
<% if @homework.users.count > 1 && homework_user != @homework.users.last %>
、&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<% end %>
<% end %>
<% end %>
</div>
<% end %>
<p>
@ -52,12 +66,10 @@
<div class="ping_star" id="star_score">
<%= render :partial => 'show_star',:locals => {:is_comprehensive_evaluation => @is_comprehensive_evaluation,:totle_score => @totle_score,:has_evaluation => @has_evaluation ,
:can_anonymous_comments=>can_anonymous_comments,:homework => @homework} %>
:homework => @homework} %>
</div>
<div class="cl"></div>
<%= 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--->

View File

@ -3,7 +3,7 @@
<%= render :partial => 'show_score', locals: {:stars => totle_score} %>
<% elsif is_comprehensive_evaluation == 2 %>
<%= l(:label_work_rating) %>
<% if has_evaluation || !can_anonymous_comments %>
<% if has_evaluation %>
<%= render :partial => 'show_score', locals: {:stars => totle_score} %>
<% else %>
<%= rating_for homework, dimension: :quality, class: 'rateable div_inline' %>

View File

@ -3,17 +3,20 @@
//$('#comprehensive_evaluation').html('<#%= escape_javascript(render(:partial => 'comprehensive_evaluation',
//:locals => {:comprehensive_evaluation => @comprehensive_evaluation,:homework => @homework,:teaher_score => @teaher_score} )) %>');
HoverLi(4);
$('#jour_count_4').html('<%= @comprehensive_evaluation.count %>')
$('#tbc_04').html('<%= escape_javascript(render(:partial => 'homework_attach/jour',:locals => {:jours => @comprehensive_evaluation,:show_score => true,:show_name => true,:is_jour => false})) %>')
//匿评
<% elsif @add_jour.is_comprehensive_evaluation == 2 %>
// $('#message').html('<#%= escape_javascript(render(:partial => 'showjour', :locals => {:jour =>@jour, :state => false,:homework => @homework} )) %>');
// $('#pre_show').html('<#%= escape_javascript(render(:partial => 'pre_show', :locals => {:content => nil})) %>');
HoverLi(5);
$('#jour_count_5').html('<%= @anonymous_comments.count %>')
$('#tbc_05').html('<%= escape_javascript(render(:partial => 'homework_attach/jour',:locals => {:jours => @anonymous_comments,:show_score => true,:show_name => false,:is_jour => false})) %>')
//留言
<% else %>
HoverLi(3);
$('#tbc_03').html('<%= escape_javascript(render(:partial => 'homework_attach/jour',:locals => {:jours => @jours,:show_score => false,:show_name => true,:is_jour => true})) %>')
$('#jour_count_3').html('<%= @jours.count %>')
$('#tbc_03').html('<%= escape_javascript(render(:partial => 'homework_attach/jour',:locals => {:jours => @jour,:show_score => false,:show_name => true,:is_jour => true})) %>')
<% end %>
$('#new_form_user_message').val("");
$('#new_form_reference_user_id').val("");

View File

@ -1,8 +1,24 @@
<% if @journal_destroyed.nil? %>
alert('<%=l(:notice_failed_delete)%>');
<% else %>
var destroyedItem = $('#word_li_<%=@journal_destroyed.id%>')
destroyedItem.fadeOut(600,function(){
destroyedItem.remove();
});
//教师评论
<% if @is_comprehensive_evaluation == 1 %>
//$('#comprehensive_evaluation').html('<#%= escape_javascript(render(:partial => 'comprehensive_evaluation',
//:locals => {:comprehensive_evaluation => @comprehensive_evaluation,:homework => @homework,:teaher_score => @teaher_score} )) %>');
HoverLi(4);
$('#jour_count_4').html('<%= @comprehensive_evaluation.count %>')
$('#tbc_04').html('<%= escape_javascript(render(:partial => 'homework_attach/jour',:locals => {:jours => @comprehensive_evaluation,:show_score => true,:show_name => true,:is_jour => false})) %>')
//匿评
<% elsif @is_comprehensive_evaluation == 2 %>
// $('#message').html('<#%= escape_javascript(render(:partial => 'showjour', :locals => {:jour =>@jour, :state => false,:homework => @homework} )) %>');
// $('#pre_show').html('<#%= escape_javascript(render(:partial => 'pre_show', :locals => {:content => nil})) %>');
HoverLi(5);
$('#jour_count_5').html('<%= @anonymous_comments.count %>')
$('#tbc_05').html('<%= escape_javascript(render(:partial => 'homework_attach/jour',:locals => {:jours => @anonymous_comments,:show_score => true,:show_name => false,:is_jour => false})) %>')
//留言
<% else %>
HoverLi(3);
$('#jour_count_3').html('<%= @jours.count %>')
$('#tbc_03').html('<%= escape_javascript(render(:partial => 'homework_attach/jour',:locals => {:jours => @jour,:show_score => false,:show_name => true,:is_jour => true})) %>')
<% end %>
<% end %>

View File

@ -1,4 +1,4 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show',:locals => {:comprehensive_evaluation => @comprehensive_evaluation,:homework => @homework, :teaher_score => @teaher_score,:can_anonymous_comments => true}) %>');
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show',:locals => {:comprehensive_evaluation => @comprehensive_evaluation,:homework => @homework, :teaher_score => @teaher_score}) %>');
showModal('ajax-modal', '503px');
$('#ajax-modal').css('height','569px');
$('#ajax-modal').siblings().remove();

View File

@ -1851,3 +1851,4 @@ en:
label_teacher_comments: Teacher comments
label_anonymous_comments: Anonymous comments
label_anonymous: Anonymous
label_submit_comments: Submit_comments

View File

@ -2183,3 +2183,4 @@ zh:
label_teacher_comments: 教师评论
label_anonymous_comments: 匿评
label_anonymous: 匿名
label_submit_comments: 提交评论

View File

@ -83,7 +83,8 @@ a.wzan_visited{background:url(images/pic_zan.png) 0 0 no-repeat;}
.ping_star span a{ float:right; width:20px; height:20px; background:url(images/star.png) -2px 0 no-repeat; margin-right:3px;}
.ping_star span a:hover{background:url(images/star.png) -24px 0 no-repeat;}
.ping_con textarea{ width:455px; height:76px; border:1px solid #15bccf; margin-bottom:5px; color:#666; font-size:12px;}
a.ping_sub{ float:right; height:22px; width:60px; background:#15bccf; color:#fff; text-align:center;}
a.ping_sub{ float:right; height:22px; width:60px; margin-right:20px; background:#15bccf; color:#fff; text-align:center;}
a.ping_sub1{ float:right; height:22px; width:60px; background:#15bccf; color:#fff; text-align:center;}
a:hover.ping_sub{ background:#14a8b9;}
.recall{ border-top:1px solid #CCC; padding:5px 0;}
.recall_head{ float:left;}