1、老师评分、学生匿评增加附件上传,可上传批改后的作业

2、修改作业列表作业数不显示
This commit is contained in:
sw 2015-04-28 12:21:35 +08:00
parent b3fb7914e2
commit 9b15cbd6ee
12 changed files with 65 additions and 14 deletions

View File

@ -444,14 +444,15 @@ class HomeworkAttachController < ApplicationController
homework = @homework homework = @homework
is_teacher = @is_teacher ? 1 : 0 is_teacher = @is_teacher ? 1 : 0
#保存评分@homework.rate(@m_score.to_i,User.current.id,:quality, (@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 rate = @homework.rates(:quality).where(:rater_id => User.current.id, :is_teacher_score => is_teacher).first
if rate if rate
rate.stars = @m_score rate.stars = @m_score
rate.save!
else 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 end
rate.save!
if homework.is_teacher_score == 0 if homework.is_teacher_score == 0
if is_teacher == 1 if is_teacher == 1
@ -472,11 +473,23 @@ class HomeworkAttachController < ApplicationController
end end
#保存评论 #保存评论
@is_comprehensive_evaluation = @is_teacher ? 1 : (@is_anonymous_comments ? 2 : 3) #判断当前评论是老师评论?匿评?留言
if params[:new_form] && params[:new_form][:user_message] #有没有留言 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 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 else
@homework.addjours User.current.id, "",0,@is_comprehensive_evaluation if @is_teacher 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 end
@teacher_stars = @stars_reates.where("is_teacher_score = 1") #老师评分列表 @teacher_stars = @stars_reates.where("is_teacher_score = 1") #老师评分列表

View File

@ -52,7 +52,7 @@ class JournalsForMessage < ActiveRecord::Base
:permission => :view_course_journals_for_messages, :permission => :view_course_journals_for_messages,
:timestamp => "#{self.table_name}.updated_on", :timestamp => "#{self.table_name}.updated_on",
:find_options => {:include => :course } :find_options => {:include => :course }
acts_as_attachable
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy

View File

@ -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>

View File

@ -57,7 +57,6 @@
<div class="dis" id="tbc_01"> <div class="dis" id="tbc_01">
<%= render :partial => 'homework_attach/homeworks_list', <%= render :partial => 'homework_attach/homeworks_list',
:locals => {:homeworks => @homework_list, :locals => {:homeworks => @homework_list,
:homework_count => @obj_count,
:remote => false, :remote => false,
:not_batch_homework => @not_batch_homework,:is_student_batch_homework => @is_student_batch_homework}%> :not_batch_homework => @not_batch_homework,:is_student_batch_homework => @is_student_batch_homework}%>
</div> </div>

View File

@ -52,6 +52,16 @@
:style => "resize: none;", :class => 'noline', :placeholder => l(:text_caracters_maximum,:count=>250), :style => "resize: none;", :class => 'noline', :placeholder => l(:text_caracters_maximum,:count=>250),
:maxlength => 250 %> :maxlength => 250 %>
<%= f.text_field :reference_user_id, :style=>"display:none"%> <%= 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"> <div style="float:right">
<a href="javascript:" class="ping_sub1" id="jours_submit" onclick="submit_jours(<%= @is_teacher%>);"> <a href="javascript:" class="ping_sub1" id="jours_submit" onclick="submit_jours(<%= @is_teacher%>);">
<%= l(:label_confirmation) %> <%= l(:label_confirmation) %>

View File

@ -9,7 +9,7 @@
<span> <span>
<%= l(:label_homework_list)%> <%= l(:label_homework_list)%>
(<font color="#CC0000"> (<font color="#CC0000">
<%= homework_count%> <%= homeworks.count%>
</font>) </font>)
<% <%
url= get_batch_homeworks_homework_attach_index_path(:bid_id => @bid.id) if is_batch_homeworks url= get_batch_homeworks_homework_attach_index_path(:bid_id => @bid.id) if is_batch_homeworks

View File

@ -13,7 +13,7 @@
<%= format_time(jour.created_on) %> <%= format_time(jour.created_on) %>
</span> </span>
<div class="cl"></div> <div class="cl"></div>
<p><%= textilizable jour.notes%></p> <%= textilizable jour.notes%>
</div> </div>
<div class="ping_disfoot"> <div class="ping_disfoot">
<% ids = 'project_respond_form_'+ jour.id.to_s%> <% ids = 'project_respond_form_'+ jour.id.to_s%>

View File

@ -39,7 +39,15 @@
<% notes = textilizable(jour.nil? ? "" : jour.notes)%> <% notes = textilizable(jour.nil? ? "" : jour.notes)%>
<%= notes.empty? ? "<p></p>".html_safe : notes%> <%= notes.empty? ? "<p></p>".html_safe : notes%>
</div> </div>
<div class="cl"></div>
<% unless jour.nil? %> <% 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%> <% ids = 'project_respond_form_'+ jour.id.to_s%>
<div class="ping_disfoot"> <div class="ping_disfoot">
<span> <span>

View File

@ -3,11 +3,13 @@
HoverLi(4); HoverLi(4);
$('#jour_count_4').html('<%= @teacher_stars.count %>'); $('#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})) %>'); $('#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 %> <% elsif @is_anonymous_comments %>
HoverLi(5); HoverLi(5);
$('#jour_count_5').html('<%= @student_stars.count %>'); $('#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})) %>'); $('#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 %> <% else %>
HoverLi(3); HoverLi(3);

View File

@ -18,6 +18,7 @@
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %> <%= javascript_heads %>
<%= heads_for_theme %> <%= heads_for_theme %>
<%= javascript_include_tag "attachments" %>
<%= call_hook :view_layouts_base_html_head %> <%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags --> <!-- page specific tags -->
<%= yield :header_tags -%> <%= yield :header_tags -%>

View File

@ -10,6 +10,7 @@ h4 {border-bottom: 1px dotted #bbb;}
/*上传图片处理*/ /*上传图片处理*/
.upload_img img{max-width: 100%;} .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; } ul.wlist{ float:right; border-bottom:none; height:30px; margin-top:20px; }

View File

@ -246,7 +246,7 @@ a:hover.tijiao{ background:#0f99a9;}
/* 创建作品 homework */ /* 创建作品 homework */
.hwork_new{ color:#4c4c4c;} .hwork_new{ color:#4c4c4c;}
.c_red{ color:#F00;} .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_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_text{ border:1px solid #64bdd9; height:100px;width:555px; background:#fff; margin-left:5px; padding:5px; margin-bottom:10px;}
.hwork_new ul li{ } .hwork_new ul li{ }