From 2bb59ffd79e74fc78002f7e8064502b0b392ee35 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 27 May 2015 14:58:55 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E4=BD=9C=E5=93=81=E8=AF=84=E8=AE=BA?= =?UTF-8?q?=E5=9B=9E=E5=A4=8D=E4=BB=A5=E5=8F=8A=E7=9B=B8=E5=85=B3=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E5=88=B7=E6=96=B0=202=E3=80=81=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E5=9B=9E=E5=A4=8D=E6=A1=86=E5=AE=BD=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 9 +++-- app/models/journals_for_message.rb | 1 + app/models/student_works_score.rb | 2 +- .../student_work/_add_score_reply.html.erb | 4 +++ app/views/student_work/_jour_replay.html.erb | 20 +++++++++++ app/views/student_work/_show.html.erb | 35 ++++++------------- app/views/student_work/add_score_reply.js.erb | 2 ++ public/stylesheets/courses.css | 2 +- 8 files changed, 46 insertions(+), 29 deletions(-) create mode 100644 app/views/student_work/_add_score_reply.html.erb create mode 100644 app/views/student_work/_jour_replay.html.erb create mode 100644 app/views/student_work/add_score_reply.js.erb diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index a1ea891a5..98ebc0705 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -103,13 +103,18 @@ class StudentWorkController < ApplicationController #添加评分的回复 def add_score_reply - respond_to do |format| - format.js + @score = StudentWorksScore.find params[:id] + @jour = @score.journals_for_messages.new(:user_id => User.current.id,:notes =>params[:message], :reply_id => 0) + if @jour.save + respond_to do |format| + format.js + end end end #删除评分的回复 def destroy_score_reply + respond_to do |format| format.js end diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index 239a15881..b15c9b2d1 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -29,6 +29,7 @@ class JournalsForMessage < ActiveRecord::Base belongs_to :jour, :polymorphic => true belongs_to :user belongs_to :homework_attach + belongs_to :student_works_score belongs_to :at_user, :class_name => "User", :foreign_key => 'reply_id' acts_as_event :title => Proc.new {|o| "#{l(:label_my_message)}"}, diff --git a/app/models/student_works_score.rb b/app/models/student_works_score.rb index e44cef6ac..8fa14f8de 100644 --- a/app/models/student_works_score.rb +++ b/app/models/student_works_score.rb @@ -4,7 +4,7 @@ class StudentWorksScore < ActiveRecord::Base belongs_to :user belongs_to :student_work - has_many :journals_for_messages, :dependent => :destroy + has_many :journals_for_messages, :as => :jour, :dependent => :destroy acts_as_attachable end diff --git a/app/views/student_work/_add_score_reply.html.erb b/app/views/student_work/_add_score_reply.html.erb new file mode 100644 index 000000000..99e9c3793 --- /dev/null +++ b/app/views/student_work/_add_score_reply.html.erb @@ -0,0 +1,4 @@ +<%= form_for('', :remote => true, :method => :post,:url => add_score_reply_student_work_path(score.id)) do |f|%> + <%= f.text_area 'message', :class => 'ping_text', :placeholder => l(:text_caracters_maximum,:count=>250),:maxlength => 250 %> + 回复 +<% end%> \ No newline at end of file diff --git a/app/views/student_work/_jour_replay.html.erb b/app/views/student_work/_jour_replay.html.erb new file mode 100644 index 000000000..d673fb8b0 --- /dev/null +++ b/app/views/student_work/_jour_replay.html.erb @@ -0,0 +1,20 @@ +
+ <%= jour.notes%> +
+- <%= jour.comment%> -
-