diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb index 8e0e7f08..83a6aa05 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 b53e0658..a013facb 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 786659d9..b9ae1b49 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 00000000..aacbf4c1 --- /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 e4a93147..ad493bce 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]