From 4a925201eba6e0d371f82e016dd30faeba24d693 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 21 Feb 2017 17:23:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E4=BB=BB=E5=8A=A1=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E4=BA=8C=E7=BA=A7=E5=9B=9E=E5=A4=8D=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/training_tasks_controller.rb | 27 ++++++++++++++----- .../training_tasks/_issue_replies.html.erb | 2 +- .../_training_tasks_reply_ke_form.html.erb | 2 +- config/routes.rb | 6 ++--- 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/app/controllers/training_tasks_controller.rb b/app/controllers/training_tasks_controller.rb index 89f6f3e0d..aca59a68e 100644 --- a/app/controllers/training_tasks_controller.rb +++ b/app/controllers/training_tasks_controller.rb @@ -425,14 +425,29 @@ class TrainingTasksController < ApplicationController if new_jour.save update_user_activity(@training_task.class, @training_task.id) update_forge_activity(@training_task.class, @training_task.id) - end - respond_to do |format| - if params[:is_issue_show] - format.js{ redirect_to training_task_path(@training_task) } - else - format.js + respond_to do |format| + if params[:is_issue_show] + format.js{ redirect_to training_task_path(@training_task) } + else + format.js + end end end +=begin + @journals = @training_task.journals.includes(:user, :details).reorder("#{Journal.table_name}.id desc").all + @journals = get_no_children_comments_all @journals + @journals.each_with_index {|j,i| j.indice = i+1} + @journals.reject!(&:private_notes?) unless User.current.allowed_to?(:view_private_notes, @training_task.project) + @journals.reverse! if User.current.wants_comments_in_reverse_order? + @journal = Journal.new(:journalized => @training_task) + respond_to do |format| + #if params[:is_issue_show] + # format.js{ redirect_to training_task_path(@training_task) } + #else + format.js + #end + end +=end end end diff --git a/app/views/training_tasks/_issue_replies.html.erb b/app/views/training_tasks/_issue_replies.html.erb index ae955d5fe..3062612b9 100644 --- a/app/views/training_tasks/_issue_replies.html.erb +++ b/app/views/training_tasks/_issue_replies.html.erb @@ -11,7 +11,7 @@ <%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33"), user_path(comment.user_id), :alt => "用户头像" %>
- <%= render :partial => 'users/news_contents', :locals => {:comment => comment, :type => 'Issue', :user_activity_id => issue.id}%> + <%= render :partial => 'users/news_contents', :locals => {:comment => comment, :type => 'TrainingTask', :user_activity_id => issue.id}%>
<% if comment.details.any? %> diff --git a/app/views/training_tasks/_training_tasks_reply_ke_form.html.erb b/app/views/training_tasks/_training_tasks_reply_ke_form.html.erb index f7a199efb..b3eb316af 100644 --- a/app/views/training_tasks/_training_tasks_reply_ke_form.html.erb +++ b/app/views/training_tasks/_training_tasks_reply_ke_form.html.erb @@ -7,7 +7,7 @@
<% if User.current.logged? %>
- <%= form_for('new_form', :url => add_reply_training_tasks_path(@training_task.id, :is_issue_show => true, :id => @training_task.id), :method => "post", :remote => true) do |f|%> + <%= form_for('new_form', :url => add_reply_training_task_path(@training_task, :is_issue_show => true), :method => "post", :remote => true) do |f|%>
diff --git a/config/routes.rb b/config/routes.rb index a0ee7ea2b..276ee5954 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1101,13 +1101,13 @@ RedmineApp::Application.routes.draw do resources :training_tasks do member do post 'complete_training_task' - end - collection do + post 'add_reply' post 'add_journal' post 'add_journal_in_org' get 'delete_journal' get 'reply' - post 'add_reply' + end + collection do end end