before_filter :authorize, :except => :preview
verify :method => :post, :only => [ :reply, :destroy ], :redirect_to => { :action => :show }
+ verify :xhr => true, :only => :quote
+
helper :attachments
include AttachmentsHelper
{ :action => 'show', :id => @message.parent }
end
+ def quote
+ user = @message.author
+ text = @message.content
+ content = "#{ll(Setting.default_language, :text_user_wrote, user)}\\n> "
+ content << text.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub('"', '\"').gsub(/(\r?\n|\r\n?)/, "\\n> ") + "\\n\\n"
+ render(:update) { |page|
+ page.<< "$('message_content').value = \"#{content}\";"
+ page.show 'reply'
+ page << "Form.Element.focus('message_content');"
+ page << "Element.scrollTo('reply');"
+ page << "$('message_content').scrollTop = $('message_content').scrollHeight - $('message_content').clientHeight;"
+ }
+ end
+
def preview
message = @board.messages.find_by_id(params[:id])
@attachements = message.attachments if message
def link_to_if_authorized(name, options = {}, html_options = nil, *parameters_for_method_reference)
link_to(name, options, html_options, *parameters_for_method_reference) if authorize_for(options[:controller] || params[:controller], options[:action])
end
+
+ # Display a link to remote if user is authorized
+ def link_to_remote_if_authorized(name, options = {}, html_options = nil)
+ url = options[:url] || {}
+ link_to_remote(name, options, html_options) if authorize_for(url[:controller] || params[:controller], url[:action])
+ end
# Display a link to user's account page
def link_to_user(user)
link_to(h(@board.name), {:controller => 'boards', :action => 'show', :project_id => @project, :id => @board}) %>
<div class="contextual">
+ <%= link_to_remote_if_authorized l(:button_quote), { :url => {:action => 'quote', :id => @topic} }, :class => 'icon icon-comment' %>
<%= link_to_if_authorized l(:button_edit), {:action => 'edit', :id => @topic}, :class => 'icon icon-edit' %>
<%= link_to_if_authorized l(:button_delete), {:action => 'destroy', :id => @topic}, :method => :post, :confirm => l(:text_are_you_sure), :class => 'icon icon-del' %>
</div>
<% @replies.each do |message| %>
<a name="<%= "message-#{message.id}" %>"></a>
<div class="contextual">
+ <%= link_to_remote_if_authorized image_tag('comment.png'), { :url => {:action => 'quote', :id => message} }, :title => l(:button_quote) %>
<%= link_to_if_authorized image_tag('edit.png'), {:action => 'edit', :id => message}, :title => l(:button_edit) %>
<%= link_to_if_authorized image_tag('delete.png'), {:action => 'destroy', :id => message}, :method => :post, :confirm => l(:text_are_you_sure), :title => l(:button_delete) %>
</div>
field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
+button_quote: Quote
field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
+button_quote: Quote
field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
+button_quote: Quote
field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
+button_quote: Quote
button_annotate: Annotate
button_update: Update
button_configure: Configure
+button_quote: Quote
status_active: active
status_registered: registered
field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
+button_quote: Quote
field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
+button_quote: Quote
button_annotate: Annoter
button_update: Mettre à jour
button_configure: Configurer
+button_quote: Citer
status_active: actif
status_registered: enregistré
field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
+button_quote: Quote
field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
+button_quote: Quote
field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
+button_quote: Quote
field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
+button_quote: Quote
field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
+button_quote: Quote
field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
+button_quote: Quote
field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
+button_quote: Quote
field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
+button_quote: Quote
field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
+button_quote: Quote
field_parent_title: Parent page\r
label_issue_watchers: Watchers\r
setting_commit_logs_encoding: Commit messages encoding\r
+button_quote: Quote\r
field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
+button_quote: Quote
field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
+button_quote: Quote
field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
+button_quote: Quote
field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
+button_quote: Quote
field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
+button_quote: Quote
field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
+button_quote: Quote
field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
+button_quote: Quote
field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
+button_quote: Quote
enumeration_issue_priorities: 问题优先级
enumeration_doc_categories: 文档类别
enumeration_activities: 活动(时间跟踪)
+button_quote: Quote
map.project_module :boards do |map|
map.permission :manage_boards, {:boards => [:new, :edit, :destroy]}, :require => :member
map.permission :view_messages, {:boards => [:index, :show], :messages => [:show]}, :public => true
- map.permission :add_messages, {:messages => [:new, :reply]}
+ map.permission :add_messages, {:messages => [:new, :reply, :quote]}
map.permission :edit_messages, {:messages => :edit}, :require => :member
map.permission :delete_messages, {:messages => :destroy}, :require => :member
end
.icon-checked { background-image: url(../images/true.png); }
.icon-details { background-image: url(../images/zoom_in.png); }
.icon-report { background-image: url(../images/report.png); }
+.icon-comment { background-image: url(../images/comment.png); }
.icon22-projects { background-image: url(../images/22x22/projects.png); }
.icon22-users { background-image: url(../images/22x22/users.png); }
assert_not_nil assigns(:topic)
end
+ def test_show_with_reply_permission
+ @request.session[:user_id] = 2
+ get :show, :board_id => 1, :id => 1
+ assert_response :success
+ assert_template 'show'
+ assert_tag :div, :attributes => { :id => 'reply' },
+ :descendant => { :tag => 'textarea', :attributes => { :id => 'message_content' } }
+ end
+
def test_show_message_not_found
get :show, :board_id => 1, :id => 99999
assert_response 404
assert_redirected_to 'boards/show'
assert_nil Message.find_by_id(1)
end
+
+ def test_quote
+ @request.session[:user_id] = 2
+ xhr :get, :quote, :board_id => 1, :id => 3
+ assert_response :success
+ assert_select_rjs :show, 'reply'
+ end
end