Merge branch 'Homework' of http://repository.trustie.net/xianbo/trustie2 into Homework
This commit is contained in:
commit
2f8f8593eb
|
@ -512,6 +512,26 @@ class HomeworkAttachController < ApplicationController
|
||||||
|
|
||||||
@totle_score = score_for_homework @homework
|
@totle_score = score_for_homework @homework
|
||||||
@teaher_score = teacher_score_for_homework @homework
|
@teaher_score = teacher_score_for_homework @homework
|
||||||
|
stars_reates = @homework. rates(:quality)
|
||||||
|
is_student = is_cur_course_student @homework.bid.courses.first
|
||||||
|
is_teacher = is_course_teacher User.current,@homework.bid.courses.first
|
||||||
|
@has_evaluation = stars_reates.where("rater_id = ?",User.current).count > 0
|
||||||
|
@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 && !@has_evaluation#是学生且开启了匿评且未进行评分
|
||||||
|
@is_comprehensive_evaluation = 2 #匿评
|
||||||
|
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 #教师评论
|
||||||
|
else
|
||||||
|
@is_comprehensive_evaluation = 3
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js
|
format.js
|
||||||
end
|
end
|
||||||
|
|
|
@ -56,6 +56,7 @@ class WordsController < ApplicationController
|
||||||
reply_user_id = params[:reference_user_id]
|
reply_user_id = params[:reference_user_id]
|
||||||
reply_id = params[:reference_message_id] # 暂时不实现
|
reply_id = params[:reference_message_id] # 暂时不实现
|
||||||
content = params[:user_notes]
|
content = params[:user_notes]
|
||||||
|
@show_name = params[:show_name] == "true"
|
||||||
options = {:user_id => author_id,
|
options = {:user_id => author_id,
|
||||||
:status => true,
|
:status => true,
|
||||||
:m_parent_id => parent_id,
|
:m_parent_id => parent_id,
|
||||||
|
|
|
@ -96,13 +96,22 @@ module HomeworkAttachHelper
|
||||||
if array.nil? || array.count == 0
|
if array.nil? || array.count == 0
|
||||||
return "()"
|
return "()"
|
||||||
end
|
end
|
||||||
array.each do |member|
|
array.length.times do |i|
|
||||||
if member == array.last
|
if i == array.length - 1
|
||||||
ary += member.id.to_s + ")"
|
ary += array[i].id.to_s + ")"
|
||||||
else
|
else
|
||||||
ary += member.id.to_s + ","
|
if !(array[i].nil? || array[i].id.nil? || array[i].id.to_s == "")
|
||||||
|
ary += array[i].id.to_s + ","
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
#array.each do |member|
|
||||||
|
# if member == array.last
|
||||||
|
# ary += member.id.to_s + ")"
|
||||||
|
# else
|
||||||
|
# ary += member.id.to_s + ","
|
||||||
|
# end
|
||||||
|
#end
|
||||||
ary
|
ary
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -62,12 +62,12 @@
|
||||||
<% ids = 'project_respond_form_'+ journal.id.to_s%>
|
<% ids = 'project_respond_form_'+ journal.id.to_s%>
|
||||||
<% if reply_allow %>
|
<% if reply_allow %>
|
||||||
<div id='<%= ids %>' class="respond-form">
|
<div id='<%= ids %>' class="respond-form">
|
||||||
<%= render :partial => 'words/new_respond', :locals => {:journal => journal, :m_reply_id => journal} %>
|
<%= render :partial => 'words/new_respond', :locals => {:journal => journal, :m_reply_id => journal,:show_name => true} %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<div style="clear: both;"></div>
|
<div style="clear: both;"></div>
|
||||||
<div>
|
<div>
|
||||||
<%= render :partial => "words/journal_reply", :locals => {:journal => journal } %>
|
<%= render :partial => "words/journal_reply", :locals => {:journal => journal,:show_name => true } %>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -49,12 +49,12 @@
|
||||||
<% ids = 'project_respond_form_'+ journal.id.to_s%>
|
<% ids = 'project_respond_form_'+ journal.id.to_s%>
|
||||||
<% if reply_allow %>
|
<% if reply_allow %>
|
||||||
<div id='<%= ids %>' class="respond-form">
|
<div id='<%= ids %>' class="respond-form">
|
||||||
<%= render :partial => 'words/new_respond', :locals => {:journal => journal, :m_reply_id => journal} %>
|
<%= render :partial => 'words/new_respond', :locals => {:journal => journal, :m_reply_id => journal,:show_name => true} %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<div style="clear: both;"></div>
|
<div style="clear: both;"></div>
|
||||||
<div>
|
<div>
|
||||||
<%= render :partial => "words/journal_reply", :locals => {:journal => journal } %>
|
<%= render :partial => "words/journal_reply", :locals => {:journal => journal, :show_name => true} %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
|
|
|
@ -5,13 +5,18 @@
|
||||||
<%= link_to image_tag(url_to_avatar(jour.user)) , user_path(jour.user), :target =>"_blank" %>
|
<%= link_to image_tag(url_to_avatar(jour.user)) , user_path(jour.user), :target =>"_blank" %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<a><%= image_tag(url_to_avatar(nil))%></a>
|
<a><%= image_tag(url_to_avatar(nil))%></a>
|
||||||
<a><%= l(:label_anonymous) %></a>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<div class="ping_discon">
|
<div class="ping_discon">
|
||||||
<div class="ping_distop">
|
<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>
|
||||||
<span style="color:#a6a6a6; margin-right:40px; margin-left:30px;"><%= format_time(jour.created_on) %></span>
|
<% if show_name %>
|
||||||
|
<%= link_to jour.user, user_path(jour.user),:style => " font-weight:bold; color:#15bccf; margin-right:30px; background:none;", :target => "_blank"%>
|
||||||
|
<% else%>
|
||||||
|
<span style=" font-weight:bold; color:#15bccf; margin-right:30px; background:none;"><%= l(:label_anonymous) %></span>
|
||||||
|
<% end %>
|
||||||
|
</span>
|
||||||
|
<span style="color:#a6a6a6; margin-right:20px; margin-left:10px;"><%= format_time(jour.created_on) %></span>
|
||||||
<span style="font-weight:bold; color:#a6a6a6; ">
|
<span style="font-weight:bold; color:#a6a6a6; ">
|
||||||
<% if show_score %>
|
<% if show_score %>
|
||||||
<%= l(:label_work_rating) %>:
|
<%= l(:label_work_rating) %>:
|
||||||
|
@ -24,22 +29,22 @@
|
||||||
<div class="ping_disfoot">
|
<div class="ping_disfoot">
|
||||||
<% ids = 'project_respond_form_'+ jour.id.to_s%>
|
<% ids = 'project_respond_form_'+ jour.id.to_s%>
|
||||||
<span>
|
<span>
|
||||||
<% if jour.user==User.current|| User.current.admin? %>
|
<% if (jour.user==User.current|| User.current.admin?) && show_name %>
|
||||||
<%= link_to(l(:label_bid_respond_delete), {:controller => 'homework_attach', :action => 'destroy_jour', :object_id => jour, :user_id => jour.user,:jour_id =>@homework.id },
|
<%= 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)) %>
|
:remote => true, :confirm => l(:text_are_you_sure), :title => l(:button_delete)) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= link_to l(:label_projects_feedback_respond),'',
|
<%= 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;"}
|
{:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), ''); $('##{ids} textarea') ;return false;"} ##{l(:label_reply_plural)} #{jour.user.name}:
|
||||||
%>
|
%>
|
||||||
|
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div id='<%= ids %>' class="respond-form">
|
<div id='<%= ids %>' class="respond-form">
|
||||||
<%= render :partial => 'words/new_respond', :locals => {:journal => jour, :m_reply_id => jour} %>
|
<%= render :partial => 'words/new_respond', :locals => {:journal => jour, :m_reply_id => jour,:show_name=> show_name} %>
|
||||||
</div>
|
</div>
|
||||||
<div style="clear: both;"></div>
|
<div style="clear: both;"></div>
|
||||||
<div>
|
<div>
|
||||||
<%= render :partial => "words/journal_reply", :locals => {:journal => jour } %>
|
<%= render :partial => "words/journal_reply", :locals => {:journal => jour,:show_name=> show_name } %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
|
|
|
@ -69,7 +69,9 @@
|
||||||
:homework => @homework} %>
|
:homework => @homework} %>
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
|
<div id="add_jour">
|
||||||
<%= render :partial => 'addjour', :locals => {:homework_attach => @homework, :sta => 0, :is_comprehensive_evaluation => @is_comprehensive_evaluation} %>
|
<%= render :partial => 'addjour', :locals => {:homework_attach => @homework, :sta => 0, :is_comprehensive_evaluation => @is_comprehensive_evaluation} %>
|
||||||
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
</div><!---ping_con end--->
|
</div><!---ping_con end--->
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<% if is_comprehensive_evaluation == 3 %>
|
<% if is_comprehensive_evaluation == 3 || User.current == homework.user%>
|
||||||
<%= l(:label_work_rating) %>:
|
<%= l(:label_work_rating) %>:
|
||||||
<%= render :partial => 'show_score', locals: {:stars => totle_score} %>
|
<%= render :partial => 'show_score', locals: {:stars => totle_score} %>
|
||||||
<% elsif is_comprehensive_evaluation == 2 %>
|
<% elsif is_comprehensive_evaluation == 2 %>
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
<% elsif @add_jour.is_comprehensive_evaluation == 2 %>
|
<% elsif @add_jour.is_comprehensive_evaluation == 2 %>
|
||||||
// $('#message').html('<#%= escape_javascript(render(:partial => 'showjour', :locals => {:jour =>@jour, :state => false,:homework => @homework} )) %>');
|
// $('#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})) %>');
|
// $('#pre_show').html('<#%= escape_javascript(render(:partial => 'pre_show', :locals => {:content => nil})) %>');
|
||||||
|
$('#add_jour').html('<%= escape_javascript(render(:partial => 'addjour', :locals => {:homework_attach => @homework, :sta => 0, :is_comprehensive_evaluation => @is_comprehensive_evaluation})) %>')
|
||||||
HoverLi(5);
|
HoverLi(5);
|
||||||
$('#jour_count_5').html('<%= @anonymous_comments.count %>')
|
$('#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})) %>')
|
$('#tbc_05').html('<%= escape_javascript(render(:partial => 'homework_attach/jour',:locals => {:jours => @anonymous_comments,:show_score => true,:show_name => false,:is_jour => false})) %>')
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
<% id = "journal_reply_ul_" + journal.id.to_s%>
|
<% id = "journal_reply_ul_" + journal.id.to_s%>
|
||||||
<div id = '<%= id %>' >
|
<div id = '<%= id %>' >
|
||||||
<% fetch_user_leaveWord_reply(journal).each do |reply|%>
|
<% fetch_user_leaveWord_reply(journal).each do |reply|%>
|
||||||
<%= render :partial => "words/journal_reply_items", :locals => {:reply => reply, :journal => journal, :m_reply_id => reply} %>
|
<%= render :partial => "words/journal_reply_items", :locals => {:reply => reply, :journal => journal, :m_reply_id => reply,:show_name=> show_name} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -2,13 +2,22 @@
|
||||||
<% ids_r = 'reply_respond_form_'+ reply.id.to_s %>
|
<% ids_r = 'reply_respond_form_'+ reply.id.to_s %>
|
||||||
<div class="recall" id='word_li_<%=reply.id.to_s%>' onmouseover="$('#<%= ids_r %>').show()" onmouseout="$('#<%= ids_r %>').hide()">
|
<div class="recall" id='word_li_<%=reply.id.to_s%>' onmouseover="$('#<%= ids_r %>').show()" onmouseout="$('#<%= ids_r %>').hide()">
|
||||||
<div class="recall_head">
|
<div class="recall_head">
|
||||||
|
<% if show_name %>
|
||||||
<%= image_tag url_to_avatar(reply.user) %>
|
<%= image_tag url_to_avatar(reply.user) %>
|
||||||
|
<% else %>
|
||||||
|
<%= image_tag url_to_avatar(nil) %>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<div class="recall_con">
|
<div class="recall_con">
|
||||||
<% id = 'project_respond_form_'+ reply.id.to_s %>
|
<% id = 'project_respond_form_'+ reply.id.to_s %>
|
||||||
<%= link_to reply.user.name, user_path(reply.user) %>
|
<%= link_to reply.user.name, user_path(reply.user) %>
|
||||||
回复
|
回复
|
||||||
|
<% if show_name %>
|
||||||
<%= link_to reply.at_user.name,user_path(reply.at_user) %>
|
<%= link_to reply.at_user.name,user_path(reply.at_user) %>
|
||||||
|
<% else %>
|
||||||
|
<%= l(:label_anonymous) %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<span class="message-notes">
|
<span class="message-notes">
|
||||||
<%= reply.notes %>
|
<%= reply.notes %>
|
||||||
|
@ -25,14 +34,14 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if reply_allow %>
|
<% if reply_allow %>
|
||||||
<%= link_to l(:label_projects_feedback_respond),'',
|
<%= link_to l(:label_projects_feedback_respond),'',
|
||||||
{:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{id}'), $('##{id} textarea'), '#{l(:label_reply_plural)} #{m_reply_id.user.name}: '); return false;"} %>
|
{:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{id}'), $('##{id} textarea'), ''); return false;"} %>
|
||||||
<% end %>
|
<% end %> <!-- #{l(:label_reply_plural)} #{m_reply_id.user.name}: -->
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div id='<%=id%>' class="respond-form">
|
<div id='<%=id%>' class="respond-form">
|
||||||
<% if reply_allow %>
|
<% if reply_allow %>
|
||||||
<%= render :partial => "words/new_respond", :locals => {:journal => journal, :m_reply_id => m_reply_id} %>
|
<%= render :partial => "words/new_respond", :locals => {:journal => journal, :m_reply_id => m_reply_id,:show_name => show_name} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<div style="clear: both;"></div>
|
<div style="clear: both;"></div>
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
<%= hidden_field_tag 'reference_id', params[:reference_id], :value => journal.id %>
|
<%= hidden_field_tag 'reference_id', params[:reference_id], :value => journal.id %>
|
||||||
<%= hidden_field_tag 'reference_user_id', params[:reference_user_id], :value => m_reply_id.user.id %>
|
<%= hidden_field_tag 'reference_user_id', params[:reference_user_id], :value => m_reply_id.user.id %>
|
||||||
<%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => m_reply_id.id %>
|
<%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => m_reply_id.id %>
|
||||||
|
<%= hidden_field_tag 'show_name',params[:show_name],:value => show_name.nil? ? true : show_name %>
|
||||||
<%= submit_tag l(:button_projects_feedback_respond), :name => nil ,
|
<%= submit_tag l(:button_projects_feedback_respond), :name => nil ,
|
||||||
:class => "enterprise",
|
:class => "enterprise",
|
||||||
:style => "float: right; margin-top: 1px; margin-right: 4px;"%>
|
:style => "float: right; margin-top: 1px; margin-right: 4px;"%>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<% if @save_succ %>
|
<% if @save_succ %>
|
||||||
var pre_append = $('<%= j(
|
var pre_append = $('<%= j(
|
||||||
render :partial => "words/journal_reply_items",
|
render :partial => "words/journal_reply_items",
|
||||||
:locals => {:reply => @jfm, :journal => @jfm.parent, :m_reply_id => @jfm}
|
:locals => {:reply => @jfm, :journal => @jfm.parent, :m_reply_id => @jfm,:show_name => @show_name}
|
||||||
) %>').hide();
|
) %>').hide();
|
||||||
$('#journal_reply_ul_<%=@jfm.m_parent_id%>').append(pre_append);
|
$('#journal_reply_ul_<%=@jfm.m_parent_id%>').append(pre_append);
|
||||||
pre_append.fadeIn(600);
|
pre_append.fadeIn(600);
|
||||||
|
|
Loading…
Reference in New Issue