From 08bfb8e80a20e6702410f77eb450b45f11bff70d Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 26 Jun 2014 17:49:23 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=95=99=E5=B8=88=E8=AF=84?=
=?UTF-8?q?=E5=88=86=E5=90=8E=E6=98=9F=E6=98=9F=E6=98=BE=E7=A4=BA=E4=B8=8D?=
=?UTF-8?q?=E6=AD=A3=E5=B8=B8=E7=9A=84BUG?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/homework_attach_controller.rb | 10 ++
app/views/bids/_homework.html.erb | 4 +-
.../_comprehensive_evaluation.html.erb | 2 +-
.../_evaluation_add_jour.html.erb | 93 +++++++++++++++++++
config/routes.rb | 2 +-
5 files changed, 106 insertions(+), 5 deletions(-)
create mode 100644 app/views/homework_attach/_evaluation_add_jour.html.erb
diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb
index 8e0e7f087..83a6aa05f 100644
--- a/app/controllers/homework_attach_controller.rb
+++ b/app/controllers/homework_attach_controller.rb
@@ -300,6 +300,16 @@ class HomeworkAttachController < ApplicationController
end
end
+ #教师综评
+ def comprehensive_evaluation_jour
+ @homework = HomeworkAttach.find(params[:jour_id])
+ @add_jour = @homework.addjours User.current.id, params[:new_form][:user_message],0,params[:is_comprehensive_evaluation]
+ respond_to do |format|
+ format.html { redirect_to homework_attach_path @homework }
+ format.json { head :no_content }
+ end
+ end
+
#获取指定作业的平均得分
def score
#stars_reates = @homework.rates(:quality)
diff --git a/app/views/bids/_homework.html.erb b/app/views/bids/_homework.html.erb
index b53e06580..a013facbc 100644
--- a/app/views/bids/_homework.html.erb
+++ b/app/views/bids/_homework.html.erb
@@ -28,9 +28,7 @@
}
-<% if User.current.logged? && (!Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.nil? &&
- (Member.where('user_id = ? and project_id = ?', User.current.id,
- @bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?',5, 10, 7)).size >0) && cur_user_homework_for_bid(@bid).count == 0 %>
+<% if User.current.logged? && User.current.member_of_course?(@bid.courses.first) && cur_user_homework_for_bid(@bid).count == 0 && is_cur_course_student(@bid.courses.first) %>
<%#= link_to l(:label_commit_homework), new_submit_homework_path, :onclick => "$('#put-bid-form').slideToggle(); this.blur(); return false;" %>
<%= link_to l(:label_course_new_homework),new_homework_attach_path %> (每一个作业都可以是一个精美的作品)
diff --git a/app/views/homework_attach/_comprehensive_evaluation.html.erb b/app/views/homework_attach/_comprehensive_evaluation.html.erb
index 786659d95..b9ae1b496 100644
--- a/app/views/homework_attach/_comprehensive_evaluation.html.erb
+++ b/app/views/homework_attach/_comprehensive_evaluation.html.erb
@@ -17,7 +17,7 @@
<%= render :partial => 'evaluation', :locals => {:homework => homework} %>
- <%= render :partial => 'addjour', :locals => {:homework_attach => homework, :sta => 0,:is_comprehensive_evaluation => 1} %>
+ <%= render :partial => 'evaluation_add_jour', :locals => {:homework_attach => homework, :sta => 0,:is_comprehensive_evaluation => 1} %>
<% else %>
diff --git a/app/views/homework_attach/_evaluation_add_jour.html.erb b/app/views/homework_attach/_evaluation_add_jour.html.erb
new file mode 100644
index 000000000..aacbf4c12
--- /dev/null
+++ b/app/views/homework_attach/_evaluation_add_jour.html.erb
@@ -0,0 +1,93 @@
+
+
+
+
+<%= form_for('new_form', :method => :post,
+ :url => {:controller => 'homework_attach',
+ :action => 'comprehensive_evaluation_jour',
+ :jour_id => homework_attach.id,
+ :is_comprehensive_evaluation => is_comprehensive_evaluation,
+ :sta => sta}) do |f|%>
+
+
+ <%= render :partial => 'words/pre_show', :locals => {:content => @content} %>
+
+
+ <% if User.current.logged? %>
+
+
+ <%= f.text_area 'user_message', :rows => 3, :cols => 65, :value => "#{l(:label_leave_a_message)}",
+ :onfocus => "clearInfo('new_form_user_message','#{l(:label_leave_a_message)}')",
+ :onblur => "showInfo('new_form_user_message','#{l(:label_leave_a_message)}')",
+ :style => "resize: none;", :class => 'noline'%> |
+
+
+ <%= f.text_field :reference_user_id, :style=>"display:none"%>
+
+
+ <%= 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), :name => nil, :class => "enterprise",
+ :onclick => "clearMessage('new_form_user_message');",
+ :onmouseout => "this.style.backgroundPosition = 'left top'",
+ :onmouseover => "this.style.backgroundPosition = 'left -31px'" %> |
+
+
+ <% else %>
+
+ <%= l(:label_user_login_tips) %>
+ <%= link_to l(:label_user_login_new), signin_path %>
+
+ <% end %>
+<% end %>
diff --git a/config/routes.rb b/config/routes.rb
index e4a931474..ad493bce8 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -34,7 +34,7 @@ RedmineApp::Application.routes.draw do
match 'addjours', via: [:get, :post]
match 'add_jour_reply', via: [:get,:post]
match 'destroy_jour', via: [:get,:post]
-
+ match 'comprehensive_evaluation_jour', via: [:get,:post]
end
member do
match 'add_homework_users', via:[:get,:post]