parent
1fe7c70955
commit
a0324f5e39
|
@ -72,7 +72,7 @@ class StudentWorkController < ApplicationController
|
|||
|
||||
end
|
||||
|
||||
#评分
|
||||
#添加评分,已评分则为修改评分
|
||||
def add_score
|
||||
score = student_work_score @work,User.current
|
||||
if score
|
||||
|
@ -101,13 +101,20 @@ class StudentWorkController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
#评分的回复
|
||||
#添加评分的回复
|
||||
def add_score_reply
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
#删除评分的回复
|
||||
def destroy_score_reply
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
#获取作业
|
||||
def find_homework
|
||||
|
|
|
@ -24,4 +24,16 @@ module StudentWorkHelper
|
|||
def student_work_score work,user
|
||||
StudentWorksScore.where(:user_id => user.id,:student_work_id => work.id).first
|
||||
end
|
||||
|
||||
#获取指定评分的角色
|
||||
def student_work_score_role score
|
||||
case score.reviewer_role
|
||||
when 1
|
||||
role = "教师"
|
||||
when 2
|
||||
role = "教辅"
|
||||
when 3
|
||||
role = "学生"
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,8 +1,10 @@
|
|||
class StudentWorksScore < ActiveRecord::Base
|
||||
#reviewer_role: 1:教师评分;2:教辅评分;3:学生匿评
|
||||
attr_accessible :student_work_id, :user_id, :score, :comment, :reviewer_role
|
||||
|
||||
belongs_to :user
|
||||
belongs_to :student_work
|
||||
has_many :journals_for_messages, :dependent => :destroy
|
||||
|
||||
acts_as_attachable
|
||||
end
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
</li>
|
||||
<li >
|
||||
<span class="tit_fb mt2"> 评分:</span>
|
||||
<input type="number" name="score" id="score_<%= work.id%>" value="<%= score.nil? ? 50 : score.score%>" min="0" max="100" size="4" data-units="dollars" />
|
||||
<input type="number" name="score" id="score_<%= work.id%>" value="<%= score.nil? ? 60 : score.score%>" min="0" max="100" size="4" data-units="dollars" />
|
||||
<span class=" ml5">分</span>
|
||||
<div class="cl"></div></li>
|
||||
<li >
|
||||
|
|
|
@ -3,73 +3,91 @@
|
|||
<ul>
|
||||
<li >
|
||||
<span class="tit_fb">上交时间:</span>
|
||||
<%=format_time work.created_at %>
|
||||
<%=format_time @work.created_at %>
|
||||
</li>
|
||||
<!--<li >-->
|
||||
<!--<span class="tit_fb"> 参与人员:</span>-->
|
||||
<!--程梦雯 王强-->
|
||||
<!--</li>-->
|
||||
<% if work.project%>
|
||||
<% if @work.project%>
|
||||
<li >
|
||||
<span class="tit_fb"> 关联项目:</span>
|
||||
<%= link_to( work.project.name, project_path(work.project.id), :class => "c_blue02" )%>
|
||||
<%= link_to( @work.project.name, project_path(@work.project.id), :class => "c_blue02" )%>
|
||||
</li>
|
||||
<% end%>
|
||||
<li >
|
||||
<span class="tit_fb ">内容:</span>
|
||||
<p class="show_hwork_p">
|
||||
<%= work.description%>
|
||||
<%= @work.description%>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li >
|
||||
<span class="tit_fb"> 附件:</span>
|
||||
<% if work.attachments.empty?%>
|
||||
<% if @work.attachments.empty?%>
|
||||
<span style="color: #999999">尚未提交附件</span>
|
||||
<% else%>
|
||||
<%= render :partial => 'work_attachments', :locals => {:attachments => work.attachments} %>
|
||||
<%= render :partial => 'work_attachments', :locals => {:attachments => @work.attachments} %>
|
||||
<% end%>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div id="add_student_score">
|
||||
<%= render :partial => 'add_score',:locals => {:work => work,:score => score}%>
|
||||
<%= render :partial => 'add_score',:locals => {:work => @work,:score => @score}%>
|
||||
</div>
|
||||
</ul>
|
||||
|
||||
<% unless @work.student_works_scores.empty?%>
|
||||
<div class="ping_box">
|
||||
<ul class="ping_box_ul ping_line">
|
||||
<a href="javascript:void(0);" class="ping_pic fl" >
|
||||
<img src="images/courses/pic_01.jpg" width="34" height="34" />
|
||||
</a>
|
||||
<div class="ping_box_tit">
|
||||
<a href="javascript:void(0);" class="c_blue fl" >jacknudt</a>
|
||||
<span class="ml5 fl">(教辅)</span>
|
||||
<span class="ml20 fl">评分:</span>
|
||||
<a href="javascript:void(0);" class="c_orange fl" >85分</a>
|
||||
<a href="javascript:void(0);" class="fr c_purple" >删除</a>
|
||||
<a href="javascript:void(0);" class="fr c_purple mr5" >回复</a>
|
||||
<span class=" fr c_grey mr20">一小时前</span>
|
||||
<div class="cl mb5"></div>
|
||||
<p >作品非常好,格式不正确,继续努力!</p>
|
||||
<textarea class="ping_text"></textarea>
|
||||
<a href="javascript:void(0);" class="fr blue_n_btn" >回复</a>
|
||||
|
||||
<div class="ping_back mt30">
|
||||
<a href="javascript:void(0);" class="st_img fl" ><img src="images/courses/pic_01.jpg" width="32" height="32" /></a>
|
||||
<div class="ping_back_tit">
|
||||
<a href="javascript:void(0);" class="c_blue fl" >程梦雯</a>
|
||||
<a href="javascript:void(0);" class="fr c_purple" >删除</a>
|
||||
<span class=" fr c_grey mr10">一小时前</span>
|
||||
<%@work.student_works_scores.each do |score|%>
|
||||
<ul class="ping_box_ul ping_line">
|
||||
<%= link_to image_tag(url_to_avatar(score.user), :width => "34", :height => "34"), user_path(score.user),:class => "ping_pic fl" %>
|
||||
<div class="ping_box_tit">
|
||||
<%= link_to score.user.show_name, user_path(score.user), :title => score.user.show_name, :class => "c_blue fl" %>
|
||||
<span class="ml5 fl">(<%= student_work_score_role score%>)</span>
|
||||
<span class="ml20 fl">评分:</span>
|
||||
<a href="javascript:void(0);" class="c_orange fl" ><%= score.score%>分</a>
|
||||
<a href="javascript:void(0);" class="fr c_purple mr5" >回复</a>
|
||||
<span class=" fr c_grey mr20">
|
||||
<%=format_time score.created_at %>
|
||||
</span>
|
||||
<div class="cl mb5"></div>
|
||||
<p >谢谢老师!</p>
|
||||
</div><!---ping_box_tit end--->
|
||||
<p class="break_word">
|
||||
<%= score.comment%>
|
||||
</p>
|
||||
|
||||
<%form_for "", add_score_reply_student_work_path(@work)%>
|
||||
<textarea class="ping_text undis"></textarea>
|
||||
<a href="javascript:void(0);" class="fr blue_n_btn undis" >回复</a>
|
||||
|
||||
<% score.journals_for_messages.each do |jour|%>
|
||||
<div class="ping_back mt10">
|
||||
<%= link_to image_tag(url_to_avatar(jour.user), :width => "32", :height => "32"), user_path(jour.user),:class => "st_img fl" %>
|
||||
<div class="ping_back_tit">
|
||||
<a href="javascript:void(0);" class="c_blue fl" >
|
||||
<%= link_to jour.user.show_name, user_path(jour.user), :title => jour.user.show_name, :class => "c_blue fl" %>
|
||||
</a>
|
||||
<% if jour.user==User.current || User.current.admin? %>
|
||||
<%= link_to(l(:label_bid_respond_delete), destroy_score_reply_student_work_index_path(:jour_id => jour.id),
|
||||
:remote => true, :confirm => l(:text_are_you_sure), :title => l(:button_delete), :class => "fr c_purple") %>
|
||||
<% end %>
|
||||
<span class=" fr c_grey mr10">
|
||||
<%=jour score.created_at %>
|
||||
</span>
|
||||
<div class="cl mb5"></div>
|
||||
<p class="break_word">
|
||||
<%= jour.comment%>
|
||||
</p>
|
||||
</div><!---ping_box_tit end--->
|
||||
<div class="cl"></div>
|
||||
</div><!---ping_back end--->
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div><!---ping_back end--->
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
</ul>
|
||||
<% end%>
|
||||
</div><!---ping_box end--->
|
||||
<a href="javascript:void(0);" class="fr c_blue mt5 mb5" onclick="$('#about_hwork_<%= work.id%>').html('');">收起</a>
|
||||
<%end%>
|
||||
<a href="javascript:void(0);" class="fr c_blue mt5 mb5" onclick="$('#about_hwork_<%= @work.id%>').html('');">收起</a>
|
||||
<div class="cl"></div>
|
||||
</div><!---show_hwork end--->
|
|
@ -1,27 +1,5 @@
|
|||
<div class="fl">
|
||||
<span id="attachments_fields<%= work.id%>" xmlns="http://www.w3.org/1999/html">
|
||||
<% if defined?(score) && score && score.saved_attachments %>
|
||||
<% score.attachments.each_with_index do |attachment, i| %>
|
||||
<span id="attachments_p<%= i %>">
|
||||
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename link_file', :readonly=>'readonly')%>
|
||||
<%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %>
|
||||
<span class="ispublic-label"><%= l(:field_is_public)%>:</span>
|
||||
<%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false,:class => 'is_public')%>
|
||||
<%= link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') unless attachment.id.nil? %>
|
||||
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% score.saved_attachments.each_with_index do |attachment, i| %>
|
||||
<span id="attachments_p<%= i %>">
|
||||
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%>
|
||||
<%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %>
|
||||
<span class="ispublic-label"><%= l(:field_is_public)%>:</span>
|
||||
<%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false,:class => 'is_public')%>
|
||||
<%= link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') unless attachment.id.nil? %>
|
||||
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</span>
|
||||
<div class="cl"></div>
|
||||
<span class="add_attachment" style="font-weight:normal;">
|
||||
|
|
|
@ -2,6 +2,6 @@ if($("#about_hwork_<%= @work.id%>").children().length > 0)
|
|||
{$("#about_hwork_<%= @work.id%>").html("");}
|
||||
else
|
||||
{
|
||||
$("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => @work,:score => @score}) %>");
|
||||
$("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'show') %>");
|
||||
$('#score_<%= @work.id%>').peSlider({range: 'min'});
|
||||
}
|
|
@ -94,9 +94,10 @@ RedmineApp::Application.routes.draw do
|
|||
resources :student_work do
|
||||
member do
|
||||
post 'add_score'
|
||||
post 'add_score_reply'
|
||||
end
|
||||
collection do
|
||||
|
||||
delete 'destroy_score_reply'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue