diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 3bcfcf6fc..4b7f04547 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -223,9 +223,8 @@ class UsersController < ApplicationController # modified by fq def user_newfeedback @jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') - @jours.each do |jour| - jour.update_attribute(:status, false) - end + @jours.update_all(:is_readed => true, :status => false) + @limit = 10 @feedback_count = @jours.count @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index 0f11cc5e3..da5bbb8bd 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -41,31 +41,34 @@ class WordsController < ApplicationController end def create_reply - @params = params + user_id_str = request.headers["Referer"].match((%r|/[0-9]{1,}/|))[0] + user_id = user_id_str[1, user_id_str.size-2] + @user = User.find(user_id) parent_id = params[:reference_id] author_id = User.current.id reply_user_id = params[:reference_user_id] - reply_id = nil # 暂时不实现 + reply_id = params[:reference_message_id] # 暂时不实现 content = params[:user_notes] - @params.merge!({flag:'====', parent_id: parent_id, author_id: author_id, reply_user_id: reply_user_id, content: content}) options = {:user_id => author_id, :m_parent_id => parent_id, :m_reply_id => reply_id, :reply_id => reply_user_id, :notes => content, :is_readed => false} - jfm = User.current.add_jour(nil, nil, nil, options) + @jfm = @user.add_jour(nil, nil, nil, options) respond_to do |format| - format.html { - if jfm.errors.empty? - flash.notice = l(:label_feedback_success) - else - flash.errors = l(:label_feedback_fail) - end - render 'test/index' + # format.html { + # if @jfm.errors.empty? + # flash.now.notice = l(:label_feedback_success) + # else + # flash.now.errors = l(:label_feedback_fail) + # end + # render 'test/index' + # } + format.js{ + @save_succ = true if @jfm.errors.empty? } - format.js end end diff --git a/app/views/words/_journal_reply_items.html.erb b/app/views/words/_journal_reply_items.html.erb index 406ead1db..9f5bceeef 100644 --- a/app/views/words/_journal_reply_items.html.erb +++ b/app/views/words/_journal_reply_items.html.erb @@ -3,7 +3,7 @@ <%= image_tag url_to_avatar(reply.user), :class => "avatar-3" %> - <% id = reply.id %> + <% id = 'project_respond_form_'+ reply.id.to_s %> <%= link_to reply.user.name, user_path(reply.user) %>: <%= reply.notes %> <% ids = 'project_respond_form_'+ journal.id.to_s%> @@ -13,7 +13,7 @@ <%= toggle_link l(:label_projects_feedback_respond), id, {:focus => 'project_respond'} %>
-