From 65e255c96ae04955bb119efea00db66a0360dbee Mon Sep 17 00:00:00 2001 From: Victor Costa Date: Wed, 14 May 2014 16:55:50 -0300 Subject: [PATCH] rails3: fix menu for comment actions --- app/helpers/comment_helper.rb | 6 +++--- app/views/comment/_comment_actions.html.erb | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/helpers/comment_helper.rb b/app/helpers/comment_helper.rb index b6907b2..ba19262 100644 --- a/app/helpers/comment_helper.rb +++ b/app/helpers/comment_helper.rb @@ -56,9 +56,9 @@ module CommentHelper def link_for_spam(comment) if comment.can_be_marked_as_spam_by?(user) if comment.spam? - {:link => link_to_function(_('Mark as NOT SPAM'), 'remove_comment(this, %s); return false;' % url_for(:profile => profile.identifier, :mark_comment_as_ham => comment.id).to_json, :class => 'comment-footer comment-footer-link comment-footer-hide')} + {:link => link_to_function(_('Mark as NOT SPAM'), 'remove_comment(this, \'%s\'); return false;' % url_for(:profile => profile.identifier, :mark_comment_as_ham => comment.id), :class => 'comment-footer comment-footer-link comment-footer-hide')} else - {:link => link_to_function(_('Mark as SPAM'), 'remove_comment(this, %s, %s); return false;' % [url_for(:profile => profile.identifier, :controller => 'comment', :action => :mark_as_spam, :id => comment.id).to_json, _('Are you sure you want to mark this comment as SPAM?').to_json], :class => 'comment-footer comment-footer-link comment-footer-hide')} + {:link => link_to_function(_('Mark as SPAM'), 'remove_comment(this, \'%s\', \'%s\'); return false;' % [url_for(:profile => profile.identifier, :controller => 'comment', :action => :mark_as_spam, :id => comment.id), _('Are you sure you want to mark this comment as SPAM?')], :class => 'comment-footer comment-footer-link comment-footer-hide')} end end end @@ -71,7 +71,7 @@ module CommentHelper def link_for_remove(comment) if comment.can_be_destroyed_by?(user) - {:link => link_to_function(_('Remove'), 'remove_comment(this, %s, %s); return false ;' % [url_for(:profile => profile.identifier, :controller => 'comment', :action => :destroy, :id => comment.id).to_json, _('Are you sure you want to remove this comment and all its replies?').to_json], :class => 'comment-footer comment-footer-link comment-footer-hide remove-children')} + {:link => link_to_function(_('Remove'), 'remove_comment(this, \'%s\', \'%s\'); return false ;' % [url_for(:profile => profile.identifier, :controller => 'comment', :action => :destroy, :id => comment.id), _('Are you sure you want to remove this comment and all its replies?')], :class => 'comment-footer comment-footer-link comment-footer-hide remove-children')} end end diff --git a/app/views/comment/_comment_actions.html.erb b/app/views/comment/_comment_actions.html.erb index 52a6f60..1139a72 100644 --- a/app/views/comment/_comment_actions.html.erb +++ b/app/views/comment/_comment_actions.html.erb @@ -2,7 +2,7 @@ <% if !links_submenu.empty? %>
  • - <%= link_to(content_tag(:span, _('Contents menu')), '#', :onclick => "toggleSubmenu(this,'',#{j links_submenu.to_json}); return false", :class => 'menu-submenu-trigger comment-trigger', :url => url) %> + <%= link_to(content_tag(:span, _('Contents menu')), '#', :onclick => "toggleSubmenu(this,'',#{CGI::escapeHTML(links_submenu.to_json)}); return false", :class => 'menu-submenu-trigger comment-trigger', :url => url) %>
  • <% end %> -- libgit2 0.21.2