diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index e8b25b338..f8b4f926b 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -21,7 +21,7 @@ class ProjectsController < ApplicationController
menu_item :settings, :only => :settings
before_filter :find_project, :except => [ :index, :list, :new, :create, :copy ]
- before_filter :authorize, :except => [:watcherlist, :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy, :member, :focus, :file, :statistics, :feedback]
+ before_filter :authorize, :except => [:watcherlist, :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy, :member, :focus, :file, :statistics, :feedback, :project_respond]
before_filter :authorize_global, :only => [:new, :create]
before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy ]
#by young
@@ -191,6 +191,42 @@ class ProjectsController < ApplicationController
@state = false
end
+ def project_respond
+
+ if params[:project_respond].size>0
+ jour = JournalsForMessage.find(params[:reference_id]) if params[:reference_id]
+ if jour
+ user = jour.user
+ text = jour.notes
+ else
+ user = User.current
+ text = []
+ end
+ # Replaces pre blocks with [...]
+ text = text.to_s.strip.gsub(%r{
((.|\s)*?)
}m, '[...]')
+ reference_content = "> #{ll(Setting.default_language, :text_user_wrote, user)}\n> "
+ reference_content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
+ # reference_message = JournalForMessage.find(params[:reference_id])
+ message = params[:project_respond] + "\n" + reference_content
+
+
+ user.add_jour(User.current, message, user.id)
+ flash[:notice]=l(:label_projects_feedback_respond_success)
+ # if a_message.size > 5
+ # @message = a_message[-5, 5]
+ # else
+ # @message = a_message
+ # end
+ # @message_count = a_message.count
+ end
+
+ respond_to do |format|
+ format.html { redirect_to :back }
+ #format.api { render_api_ok }
+ end
+ # redirect_to project_feedback_path(@project)
+ end
+
def new
@issue_custom_fields = IssueCustomField.sorted.all
@trackers = Tracker.sorted.all
diff --git a/app/views/projects/feedback.html.erb b/app/views/projects/feedback.html.erb
index 23fbda04e..e89eb9c39 100644
--- a/app/views/projects/feedback.html.erb
+++ b/app/views/projects/feedback.html.erb
@@ -1,27 +1,37 @@
<%= l(:label_user_response) %>
+<%= render_flash_messages %>
<% if @jour.size >0 %>
<% for journal in @jour%>
-
- <%= link_to image_tag(url_to_avatar(journal.user), :class => "avatar"), user_path(journal.user), :class => "avatar" %> |
-
-
- <%=link_to journal.user, user_path(journal.user)%>
- 对项目进行了反馈
- |
-
-
- <%= textilizable journal.notes%> |
-
-
- <%= format_time journal.created_on %> |
-
- |
-
- |
-
+
+ <%= link_to image_tag(url_to_avatar(journal.user), :class => "avatar"), user_path(journal.user), :class => "avatar" %> |
+
+
+
+ <%= link_to journal.user, user_path(journal.user)%><%= l(:label_projects_feedback) %> |
+
+
+
+
+ <%= textilizable journal.notes%>
+ |
+
+
+ <%= format_time journal.created_on %> |
+
+ <% ids = 'project_respond_form_'+journal.id.to_s%>
+ <%= toggle_link l(:label_projects_feedback_respond), ids, {:focus => 'project_respond'} %> |
+
+
+
+ style="display: none">
+ <%= render :partial => 'new_respond', :locals => {:journal => journal} %>
+ |
+
+ |
+
<% end %>
diff --git a/config/locales/en.yml b/config/locales/en.yml
index c6467876d..6dea8ac03 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -1330,3 +1330,8 @@ en:
label_layouts_feedback: Messages
label_welcome_participate: participated in
label_welcome_participate_project: projects!
+ label_projects_feedback: responded to the project
+ label_projects_feedback_respond: Respond
+ label_projects_feedback_respond_success: Respond success
+ button_projects_feedback_respond: Respond
+ label_projects_feedback_respond_content: Please input your words
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
index f60ed6bb4..13cf403c6 100644
--- a/config/locales/zh.yml
+++ b/config/locales/zh.yml
@@ -1348,4 +1348,10 @@ zh:
label_user_all_respond: 所有反馈
label_layouts_feedback: 留言
label_welcome_participate: 参与了
- label_welcome_participate_project: 个项目
\ No newline at end of file
+
+ label_welcome_participate_project: 个项目
+ label_projects_feedback: 对项目进行了反馈
+ label_projects_feedback_respond: 回复
+ label_projects_feedback_respond_success: 回复成功
+ button_projects_feedback_respond: 回复
+ label_projects_feedback_respond_content: 请输入回复内容
\ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index ebf2ead7f..39139473a 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -138,7 +138,7 @@ RedmineApp::Application.routes.draw do
# get 'on', :action => 'on', :as => 'on'
get 'file', :action => 'file', :as => 'file'
get 'statistics', :action => 'statistics', :as => 'statistics'
- get 'feedback', :action => 'feedback'
+ get 'feedback', :action => 'feedback', :as => 'project_feedback'
get 'watcherlist', :action=> 'watcherlist'
match 'user_watcherlist', :to => 'projects#watcherlist', :via => :get, :as => "watcherlist" #add by huang
#end
@@ -444,6 +444,7 @@ RedmineApp::Application.routes.draw do
match 'words/add_project_respond', :controller => 'words', :action => 'add_project_respond'
match 'projects/:id/feedback', :to => 'projects#feedback', :via => :get, :as => 'project_feedback'
match 'calls/create_bid', :to => 'bids#create_bid'
+ match 'projects/:id/respond', :to => 'projects#project_respond', :via => :post
## 测试用
# match 'test/index', :controller => 'test', :action => 'index'
# added by young