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