Merge branch 'develop' of 10.0.47.245:/home/trustie2 into develop

Conflicts:
	config/locales/zh.yml
This commit is contained in:
baiyu 2013-08-28 21:19:55 +08:00
commit b26fec0749
5 changed files with 79 additions and 21 deletions

View File

@ -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{<pre>((.|\s)*?)</pre>}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

View File

@ -1,24 +1,34 @@
<!-- fq -->
<h3><%= l(:label_user_response) %></h3>
<%= render_flash_messages %>
<% if @jour.size >0 %>
<% for journal in @jour%>
<table width="660px" border="0" align="center">
<tr>
<td colspan="2" valign="top" width="50" ><%= link_to image_tag(url_to_avatar(journal.user), :class => "avatar"), user_path(journal.user), :class => "avatar" %></td>
<td><table width="580px" border="0">
<td>
<table width="580px" border="0">
<tr>
<td colspan="2" valign="top"><strong> <%=link_to journal.user, user_path(journal.user)%></strong>
<span class="font_lighter">对项目进行了反馈</span>
</td>
<td colspan="2" valign="top"><strong> <%= link_to journal.user, user_path(journal.user)%></strong><span class="font_lighter"><%= l(:label_projects_feedback) %></span></td>
</tr>
<tr>
<td colspan="2" width="580px" ><p class="font_description"><%= textilizable journal.notes%></p></td>
<td colspan="2" width="580px" >
<p class="font_description">
<%= textilizable journal.notes%>
</p></td>
</tr>
<tr>
<td align="left"><span class="font_lighter"> <%= format_time journal.created_on %></span></td>
<td width="200" align="right" class="a">
</td>
<% ids = 'project_respond_form_'+journal.id.to_s%>
<%= toggle_link l(:label_projects_feedback_respond), ids, {:focus => 'project_respond'} %> </td>
</tr>
<tr>
<td colspan='2'>
<div id=<%= ids%> style="display: none">
<%= render :partial => 'new_respond', :locals => {:journal => journal} %>
</div></td>
</tr>
</table></td>
</tr>

View File

@ -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

View File

@ -1348,4 +1348,10 @@ zh:
label_user_all_respond: 所有反馈
label_layouts_feedback: 留言
label_welcome_participate: 参与了
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: 请输入回复内容

View File

@ -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