diff --git a/app/views/wiki_extensions/_comment_form.html.erb b/app/views/wiki_extensions/_comment_form.html.erb index f7bfa02..e0902c5 100644 --- a/app/views/wiki_extensions/_comment_form.html.erb +++ b/app/views/wiki_extensions/_comment_form.html.erb @@ -37,3 +37,4 @@ url = url_for(:controller => 'wiki_extensions', :action => 'add_comment', :id => <%= link_to_function(l(:button_cancel), "$('##{div_id}').hide();") %> +<%= raw(wikitoolbar_for(area_id)) %> diff --git a/app/views/wiki_extensions/_comment_form.pdf.erb b/app/views/wiki_extensions/_comment_form.pdf.erb new file mode 100644 index 0000000..e69de29 diff --git a/lib/wiki_extensions_comments.rb b/lib/wiki_extensions_comments.rb index ec91799..e6ff8d1 100644 --- a/lib/wiki_extensions_comments.rb +++ b/lib/wiki_extensions_comments.rb @@ -32,7 +32,6 @@ module WikiExtensionsComments div_id = "add_comment_form_div#{num}" o = @_controller.send(:render_to_string, {:partial => "wiki_extensions/comment_form", :locals =>{:page => page, :area_id => area_id, :div_id => div_id}}) - o << raw(wikitoolbar_for(area_id)) raw o.html_safe end end diff --git a/lib/wiki_extensions_helper.rb b/lib/wiki_extensions_helper.rb index 9961219..70a65fa 100644 --- a/lib/wiki_extensions_helper.rb +++ b/lib/wiki_extensions_helper.rb @@ -36,30 +36,32 @@ def display_comments_tree(comments_tree, parent_id,page,data,k = 0) unless check ret << '
  • ' - ret << '
    ' + ret << '
    ' if formats.include?(:html) else ret << '
  • ' end - - ret << "
    " - ret << '
    ' - - if k != 25 - reply_link = link_to_function(l(:button_reply), "$('##{form_reply_id}').show();", :class => 'icon icon-comment') - ret << reply_link if User.current.allowed_to?({:controller => 'wiki_extensions', :action => 'reply_comment'}, @project) - end - edit_link = link_to_function(l(:button_edit), "$('##{div_comment_id}').hide();$('##{form_div_id}').show();$('##{form_reply_id}').hide();",:class => 'icon icon-edit wiki_font_size') - ret << edit_link if User.current.allowed_to?({:controller => 'wiki_extensions', :action => 'update_comment'}, @project) or User.current.id == comment.user.id or User.current.admin - if User.current.allowed_to?({:controller => 'wiki_extensions', :action => 'destroy_comment'}, @project) or User.current.admin - del_link = link_to_if_authorized(l(:button_delete), {:controller => 'wiki_extensions', - :action => 'destroy_comment', :id => @project, :comment_id => comment.id}, - :class => "icon icon-del", :confirm => l(:text_are_you_sure)) - ret << del_link if del_link + if formats.include?(:html) + ret << '
    ' + + if k != 25 && User.current.allowed_to?({controller: 'wiki_extensions', action: 'reply_comment'}, @project) + reply_link = link_to_function(l(:button_reply), "$('##{form_reply_id}').show();", :class => 'icon icon-comment') + ret << reply_link + end + + edit_link = link_to_function(l(:button_edit), "$('##{div_comment_id}').hide();$('##{form_div_id}').show();$('##{form_reply_id}').hide();",:class => 'icon icon-edit wiki_font_size') + ret << edit_link if User.current.allowed_to?({:controller => 'wiki_extensions', :action => 'update_comment'}, @project) or User.current.id == comment.user.id or User.current.admin + if User.current.allowed_to?({:controller => 'wiki_extensions', :action => 'destroy_comment'}, @project) or User.current.admin + del_link = link_to_if_authorized(l(:button_delete), {:controller => 'wiki_extensions', + :action => 'destroy_comment', :id => @project, :comment_id => comment.id}, + :class => "icon icon-del", :confirm => l(:text_are_you_sure)) + ret << (del_link || '') + end + + ret << "\n" + ret << "
    \n" end - - ret << "\n" - ret << "
    \n" + ret << '

    ' ret << "#{avatar(comment.user, :size => "20")}" ret << "\n" @@ -72,61 +74,63 @@ def display_comments_tree(comments_tree, parent_id,page,data,k = 0) ret << "

    \n" ret << '
    ' + "\n" ret << textilizable(comment, :comment) - ret << "
    \n" - - ret << '' ret << "
    " ret << display_comments_tree(comments_tree, comment.id,page,data,k) unless check - ret << "\t
  • \n" + ret << "" end end end