diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb
index 4b99224ca..fc723d5d5 100644
--- a/app/controllers/words_controller.rb
+++ b/app/controllers/words_controller.rb
@@ -18,17 +18,10 @@ class WordsController < ApplicationController
list = User.find(refer_user_id).add_jour(User.current, message, refer_user_id)
end
@jour = list.last
- # @user.count_new_jour
- # if a_message.size > 5
- # @message = a_message[-5, 5]
- # else
- # @message = a_message
- # end
- # @message_count = a_message.count
end
end
- # @jours = @user.journals_for_messages.where('m_parent_id IS NULL').reverse
- # @jour = paginateHelper @jours,10
+ jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
+ @jour = paginateHelper jours,10
respond_to do |format|
format.js
@@ -91,7 +84,6 @@ class WordsController < ApplicationController
end
respond_to do |format|
format.js
- #format.api { render_api_ok }
end
end
@@ -204,7 +196,15 @@ class WordsController < ApplicationController
flash[:error] = feedback.errors.full_messages[0]
redirect_to project_feedback_url(params[:id])
end
+ end
+ #给用户留言
+ def leave_user_message
+ @user = User.find(params[:id])
+ if params[:new_form][:user_message].size>0 && User.current.logged? && @user
+ @user.add_jour(User.current, params[:new_form][:user_message])
+ end
+ redirect_to feedback_path(@user)
end
# add by nwb
diff --git a/app/views/users/_user_jours_new.html.erb b/app/views/users/_user_jours_new.html.erb
index 81bbce319..7aa9d97ff 100644
--- a/app/views/users/_user_jours_new.html.erb
+++ b/app/views/users/_user_jours_new.html.erb
@@ -15,6 +15,7 @@
<%= link_to l(:button_reply),'javascript:void(0);',:nhname=>"reply_btn", :class => "ml5 c_purple" %>
+
<% if User.current.admin? || jour.user == User.current%>
<%= link_to(l(:label_newfeedback_delete), {:controller => 'words', :action => 'destroy', :object_id => jour, :user_id => jour.user},
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "ml5 c_purple", :title => l(:button_delete)) %>
diff --git a/app/views/users/user_newfeedback.html.erb b/app/views/users/user_newfeedback.html.erb
index 52fc0aaa2..d594e47e4 100644
--- a/app/views/users/user_newfeedback.html.erb
+++ b/app/views/users/user_newfeedback.html.erb
@@ -5,22 +5,27 @@
-
+ <%= form_for('new_form',:url => leave_user_message_path(@user.id),:method => "post") do |f|%>
+
+
+
+
取消
+
留言
+ <% end%>
-
+
<%if @jour%>
<% @jour.each do |jour|%>
<%= render :partial => 'user_jours_new', :locals => {:jour => jour} %>
<%end%>
<% end%>
+
+
+ <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
+
+
diff --git a/config/routes.rb b/config/routes.rb
index 7c1096303..1536340da 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -791,6 +791,7 @@ RedmineApp::Application.routes.draw do
match 'words/:id/leave_project_message', :to => 'words#leave_project_message'
match 'projects/:id/feedback', :to => 'projects#feedback', :via => :get, :as => 'project_feedback'
match 'project/:id/share', :to => 'projects#share', :as => 'share_show' #share
+ post 'words/:id/leave_user_message', :to => 'words#leave_user_message', :as => "leave_user_message"
post 'join_in/join', :to => 'courses#join', :as => 'join'
delete 'join_in/join', :to => 'courses#unjoin'