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