parent
b3fb7914e2
commit
9b15cbd6ee
|
@ -444,14 +444,15 @@ class HomeworkAttachController < ApplicationController
|
|||
homework = @homework
|
||||
is_teacher = @is_teacher ? 1 : 0
|
||||
#保存评分@homework.rate(@m_score.to_i,User.current.id,:quality, (@is_teacher ? 1 : 0))
|
||||
if @m_score
|
||||
@is_comprehensive_evaluation = @is_teacher ? 1 : (@is_anonymous_comments ? 2 : 3) #判断当前评论是老师评论?匿评?留言
|
||||
if @m_score && (@is_teacher || @is_anonymous_comments)
|
||||
rate = @homework.rates(:quality).where(:rater_id => User.current.id, :is_teacher_score => is_teacher).first
|
||||
if rate
|
||||
rate.stars = @m_score
|
||||
rate.save!
|
||||
else
|
||||
@homework.rates(:quality).new(:stars => @m_score, :rater_id => User.current.id, :is_teacher_score => is_teacher).save!
|
||||
rate = @homework.rates(:quality).new(:stars => @m_score, :rater_id => User.current.id, :is_teacher_score => is_teacher)
|
||||
end
|
||||
rate.save!
|
||||
|
||||
if homework.is_teacher_score == 0
|
||||
if is_teacher == 1
|
||||
|
@ -469,14 +470,26 @@ class HomeworkAttachController < ApplicationController
|
|||
end
|
||||
end
|
||||
homework.save!
|
||||
end
|
||||
end
|
||||
|
||||
#保存评论
|
||||
@is_comprehensive_evaluation = @is_teacher ? 1 : (@is_anonymous_comments ? 2 : 3) #判断当前评论是老师评论?匿评?留言
|
||||
if params[:new_form] && params[:new_form][:user_message] #有没有留言
|
||||
@homework.addjours(User.current.id, params[:new_form][:user_message],0,@is_comprehensive_evaluation) if @is_teacher
|
||||
else
|
||||
@homework.addjours User.current.id, "",0,@is_comprehensive_evaluation if @is_teacher
|
||||
if params[:new_form] && params[:new_form][:user_message] #有没有留言
|
||||
jour = @homework.journals_for_messages.where("is_comprehensive_evaluation = 1 and user_id = #{User.current.id}").order("created_on DESC").first
|
||||
if params[:new_form][:user_message] == ""
|
||||
if @is_teacher
|
||||
unless jour
|
||||
jour = @homework.addjours User.current.id, "",0,@is_comprehensive_evaluation
|
||||
end
|
||||
end
|
||||
else
|
||||
jour = @homework.addjours User.current.id, params[:new_form][:user_message],0,@is_comprehensive_evaluation
|
||||
end
|
||||
end
|
||||
|
||||
if jour
|
||||
jour.save_attachments(params[:attachments])
|
||||
render_attachment_warning_if_needed(jour)
|
||||
jour.save
|
||||
end
|
||||
|
||||
@teacher_stars = @stars_reates.where("is_teacher_score = 1") #老师评分列表
|
||||
|
|
|
@ -52,7 +52,7 @@ class JournalsForMessage < ActiveRecord::Base
|
|||
:permission => :view_course_journals_for_messages,
|
||||
:timestamp => "#{self.table_name}.updated_on",
|
||||
:find_options => {:include => :course }
|
||||
|
||||
acts_as_attachable
|
||||
|
||||
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
|
||||
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
<div class="attachments" style="font-weight:normal;">
|
||||
<% for attachment in attachments %>
|
||||
<div title="<%= attachment.filename%>" id = "attachment_" style="max-width: 300px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;float: left;">
|
||||
<%= link_to_short_attachment attachment, :class => 'link_file', :download => true, :length => 100 -%>
|
||||
</div>
|
||||
<% if attachment.is_text? %>
|
||||
<div style="float: left;">
|
||||
<%= link_to image_tag('magnifier.png'),
|
||||
{:controller => 'attachments',
|
||||
:action => 'show',
|
||||
:id => attachment,
|
||||
:filename => attachment.filename},
|
||||
:target => "_blank"%>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
|
@ -57,7 +57,6 @@
|
|||
<div class="dis" id="tbc_01">
|
||||
<%= render :partial => 'homework_attach/homeworks_list',
|
||||
:locals => {:homeworks => @homework_list,
|
||||
:homework_count => @obj_count,
|
||||
:remote => false,
|
||||
:not_batch_homework => @not_batch_homework,:is_student_batch_homework => @is_student_batch_homework}%>
|
||||
</div>
|
||||
|
|
|
@ -52,6 +52,16 @@
|
|||
:style => "resize: none;", :class => 'noline', :placeholder => l(:text_caracters_maximum,:count=>250),
|
||||
:maxlength => 250 %>
|
||||
<%= f.text_field :reference_user_id, :style=>"display:none"%>
|
||||
<div class="cl"></div>
|
||||
<% if @is_anonymous_comments || @is_teacher %>
|
||||
<strong style="float: left;">
|
||||
文件:
|
||||
</strong>
|
||||
<div id="homework_attach_jour_attachment">
|
||||
<%= render :partial => 'attachments/form' %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
<div style="float:right">
|
||||
<a href="javascript:" class="ping_sub1" id="jours_submit" onclick="submit_jours(<%= @is_teacher%>);">
|
||||
<%= l(:label_confirmation) %>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<span>
|
||||
<%= l(:label_homework_list)%>
|
||||
(<font color="#CC0000">
|
||||
<%= homework_count%>
|
||||
<%= homeworks.count%>
|
||||
</font>)
|
||||
<%
|
||||
url= get_batch_homeworks_homework_attach_index_path(:bid_id => @bid.id) if is_batch_homeworks
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<%= format_time(jour.created_on) %>
|
||||
</span>
|
||||
<div class="cl"></div>
|
||||
<p><%= textilizable jour.notes%></p>
|
||||
<%= textilizable jour.notes%>
|
||||
</div>
|
||||
<div class="ping_disfoot">
|
||||
<% ids = 'project_respond_form_'+ jour.id.to_s%>
|
||||
|
|
|
@ -39,7 +39,15 @@
|
|||
<% notes = textilizable(jour.nil? ? "" : jour.notes)%>
|
||||
<%= notes.empty? ? "<p></p>".html_safe : notes%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% unless jour.nil? %>
|
||||
<% unless jour.attachments.empty?%>
|
||||
<% options = {:author => true, :deletable => attach_delete(jour)} %>
|
||||
<%= render :partial => 'attachments/homework_jour_link',
|
||||
:locals => {:attachments => jour.attachments, :options => options} %>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
|
||||
<% ids = 'project_respond_form_'+ jour.id.to_s%>
|
||||
<div class="ping_disfoot">
|
||||
<span>
|
||||
|
|
|
@ -3,11 +3,13 @@
|
|||
HoverLi(4);
|
||||
$('#jour_count_4').html('<%= @teacher_stars.count %>');
|
||||
$('#tbc_04').html('<%= escape_javascript(render(:partial => 'homework_attach/review',:locals => {:review_list => @teacher_stars,:show_name => true,:show_jour => true})) %>');
|
||||
$("#homework_attach_jour_attachment").html('<%= escape_javascript(render :partial => 'attachments/form') %>');
|
||||
//匿评
|
||||
<% elsif @is_anonymous_comments %>
|
||||
HoverLi(5);
|
||||
$('#jour_count_5').html('<%= @student_stars.count %>');
|
||||
$('#tbc_05').html('<%= escape_javascript(render(:partial => 'homework_attach/review',:locals => {:review_list => @student_stars,:show_name => false || @is_teacher, :show_jour => false})) %>');
|
||||
$("#homework_attach_jour_attachment").html('<%= escape_javascript(render :partial => 'attachments/form') %>');
|
||||
//留言
|
||||
<% else %>
|
||||
HoverLi(3);
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||||
<%= javascript_heads %>
|
||||
<%= heads_for_theme %>
|
||||
<%= javascript_include_tag "attachments" %>
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<!-- page specific tags -->
|
||||
<%= yield :header_tags -%>
|
||||
|
|
|
@ -10,6 +10,7 @@ h4 {border-bottom: 1px dotted #bbb;}
|
|||
|
||||
/*上传图片处理*/
|
||||
.upload_img img{max-width: 100%;}
|
||||
.link_file{ background:url(../images/pic_file.png) 0 0px no-repeat !important; padding-left:20px !important; color:#64bdd9 !important; }
|
||||
|
||||
/****翻页***/
|
||||
ul.wlist{ float:right; border-bottom:none; height:30px; margin-top:20px; }
|
||||
|
|
|
@ -246,7 +246,7 @@ a:hover.tijiao{ background:#0f99a9;}
|
|||
/* 创建作品 homework */
|
||||
.hwork_new{ color:#4c4c4c;}
|
||||
.c_red{ color:#F00;}
|
||||
.hwork_input{ border:1px solid #64bdd9; height:22px; width:555px; background:#fff; margin-bottom:10px; padding:5px;}
|
||||
.hwork_input{ border:1px solid #64bdd9; height:22px; width:88%; background:#fff; margin-bottom:10px; padding:5px;}
|
||||
.hwork_input02{ border:1px solid #64bdd9; height:15px; width:140px; background:#fff; margin-bottom:10px; padding:5px;}
|
||||
.hwork_text{ border:1px solid #64bdd9; height:100px;width:555px; background:#fff; margin-left:5px; padding:5px; margin-bottom:10px;}
|
||||
.hwork_new ul li{ }
|
||||
|
|
Loading…
Reference in New Issue