From fea784cbccd82c6b474b5b63d758475549391d5d Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 27 May 2015 15:11:11 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E6=B7=BB=E5=8A=A0=E8=AF=84=E5=88=86?= =?UTF-8?q?=E5=9B=9E=E5=A4=8D=E8=B7=AF=E7=94=B1=E6=94=B9=E5=8F=98=202?= =?UTF-8?q?=E3=80=81=E5=88=A0=E9=99=A4=E5=9B=9E=E5=A4=8D=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=8F=8A=E7=95=8C=E9=9D=A2=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 10 ++++++---- app/views/student_work/_add_score_reply.html.erb | 2 +- app/views/student_work/_jour_replay.html.erb | 2 +- app/views/student_work/destroy_score_reply.js.erb | 1 + config/routes.rb | 4 ++-- public/stylesheets/courses.css | 2 +- 6 files changed, 12 insertions(+), 9 deletions(-) create mode 100644 app/views/student_work/destroy_score_reply.js.erb diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 98ebc0705..63ab4d0f0 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -103,7 +103,7 @@ class StudentWorkController < ApplicationController #添加评分的回复 def add_score_reply - @score = StudentWorksScore.find params[:id] + @score = StudentWorksScore.find params[:score_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| @@ -114,9 +114,11 @@ class StudentWorkController < ApplicationController #删除评分的回复 def destroy_score_reply - - respond_to do |format| - format.js + @jour = JournalsForMessage.find params[:jour_id] + if @jour.destroy + respond_to do |format| + format.js + end end end diff --git a/app/views/student_work/_add_score_reply.html.erb b/app/views/student_work/_add_score_reply.html.erb index 99e9c3793..2866b2da6 100644 --- a/app/views/student_work/_add_score_reply.html.erb +++ b/app/views/student_work/_add_score_reply.html.erb @@ -1,4 +1,4 @@ -<%= form_for('', :remote => true, :method => :post,:url => add_score_reply_student_work_path(score.id)) do |f|%> +<%= form_for('', :remote => true, :method => :post,:url => add_score_reply_student_work_index_path(:score_id => 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 index d673fb8b0..77fb476bf 100644 --- a/app/views/student_work/_jour_replay.html.erb +++ b/app/views/student_work/_jour_replay.html.erb @@ -1,4 +1,4 @@ -
+
<%= link_to image_tag(url_to_avatar(jour.user), :width => "32", :height => "32"), user_path(jour.user),:class => "st_img fl" %>
diff --git a/app/views/student_work/destroy_score_reply.js.erb b/app/views/student_work/destroy_score_reply.js.erb new file mode 100644 index 000000000..895e501bf --- /dev/null +++ b/app/views/student_work/destroy_score_reply.js.erb @@ -0,0 +1 @@ +$("#jour_replay_<%= @jour.id%>").remove(); \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 0bb3f6bed..ecdaac48c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -94,10 +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' + post 'add_score_reply' + get 'destroy_score_reply' end end diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index a4c19e0e4..f32387c19 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -646,7 +646,7 @@ a.hwork_name{ display:block;width:65px; text-align:center; margin-right:10px;} .tit_fb{ font-weight:bold; width:66px; text-align:right; display:block; float:left;} .ml160{ margin-left:160px;} .show_hwork_p{ width:580px; float:left;} -.hwork_ping_text{ float:left; border:1px solid #e4e4e4; padding:5px; width:568px; height:35px;} +.hwork_ping_text{ float:left; border:1px solid #e4e4e4; padding:5px; width:568px; height:50px;} .ping_box{ width:626px; padding:10px; background:#f5f3f3; } a.ping_pic{ display:block; width:34px; height:34px; padding:2px; border:1px solid #e3e3e3;} a:hover.ping_pic{border:1px solid #64bdd9;}