Sha256: 220caca313ed015737938513c00fd6efb8e9b16f5de295d2f763fc270827e202

Contents?: true

Size: 981 Bytes

Versions: 3

Compression:

Stored size: 981 Bytes

Contents

module Commontator
  module ThreadsHelper    
    def commontable_name(thread)
      config = thread.config
      config.commontable_name.blank? ? \
      thread.commontable.class.name : \
      config.commontable_name
    end
    
    def commontable_id(thread)
      thread.commontable.send(thread.config.commontable_id_method)
    end
    
    def closer_name(thread)
      closer = thread.closer
      config = closer.commontator_config
      config.commontator_name_method.blank? ? config.anonymous_name : \
      closer.send(config.commontator_name_method)
    end
    
    def refresh_thread_actions(thread)
      output = ""
      thread.comments.each do |comment|
        output << "$('#comment_#{comment.id.to_s}_actions_span').html('" + \
                    escape_javascript(
                      render :partial => :actions,
                             :locals => { :comment => comment }) + "');\n\n"
      end
      output.slice(0..-3).html_safe
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
commontator-0.2.4 app/helpers/commontator/threads_helper.rb~
commontator-0.2.0 app/helpers/commontator/threads_helper.rb~
commontator-0.1.46 app/helpers/commontator/threads_helper.rb~