diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 1a90efdbf..7135610c5 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -311,11 +311,12 @@ class ProjectsController < ApplicationController :is_readed => false} @jfm = Project.add_new_jour(nil, nil, project_id, options) + @save_succ = @jfm.errors.empty? # flash[:notice]=l(:label_projects_feedback_respond_success) respond_to do |format| - format.html { redirect_to :back } + # format.html { redirect_to :back } format.js #format.api { render_api_ok } end diff --git a/app/views/projects/_new_respond.html.erb b/app/views/projects/_new_respond.html.erb index 511d90db6..b7a58bf05 100644 --- a/app/views/projects/_new_respond.html.erb +++ b/app/views/projects/_new_respond.html.erb @@ -1,4 +1,4 @@ -<%= form_tag({:controller => 'projects', :action => 'project_respond'}) do %> +<%= form_tag({:controller => 'projects', :action => 'project_respond'}, :remote => true) do %> <%= text_area_tag 'project_respond', "", :class => 'noline', :required => true, :style => "resize: none;", :rows => 3, diff --git a/app/views/projects/feedback.html.erb b/app/views/projects/feedback.html.erb index a1d0c0763..bdbcfd070 100644 --- a/app/views/projects/feedback.html.erb +++ b/app/views/projects/feedback.html.erb @@ -1,3 +1,40 @@ +

<%= l(:label_user_response) %>

diff --git a/app/views/projects/project_respond.js.erb b/app/views/projects/project_respond.js.erb index e69de29bb..eb2ea7369 100644 --- a/app/views/projects/project_respond.js.erb +++ b/app/views/projects/project_respond.js.erb @@ -0,0 +1,14 @@ +<% if @save_succ %> + var pre_append = $('<%= j( + render :partial => "words/journal_reply_items", + :locals => {:reply => @jfm, :journal => @jfm.parent, :m_reply_id => @jfm} + ) %>').hide(); + $('#journal_reply_ul_<%=@jfm.m_parent_id%>').append(pre_append); + pre_append.fadeIn(600); + var textarea = $('#project_respond_form_<%=@jfm.m_reply_id.to_s%> textarea'); + textarea.val(''); + $('#project_respond_form_<%=@jfm.m_reply_id.to_s%>').hide(); + setMaxLengthItem(pre_append.find('textarea')[0]); +<% else %> + alert("<%= l(:label_feedback_fail) %>"); +<% end %> \ No newline at end of file