Module: Loudmouth::Controllers::Helpers

Extended by:
ActiveSupport::Concern
Includes:
ActionView::Helpers::SanitizeHelper
Defined in:
lib/extensions/helper.rb

Instance Method Summary collapse

Instance Method Details

#render_comment_form_for(topic, user) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/extensions/helper.rb', line 11

def render_comment_form_for(topic, user)
  unless Loudmouth.treasure_map.has_key?(topic.class.name.underscore.to_sym)
    raise "loudmouth not setup for #{topic.class.name.underscore.downcase.to_sym}"
  end

  render :partial => 'loudmouth/comments/comment_form',
          :locals => { :topic => topic, :user => user, :content => Loudmouth.new_comment_content }
end

#render_comments_for(topic) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/extensions/helper.rb', line 20

def render_comments_for(topic)
  unless Loudmouth.treasure_map.has_key?(topic.class.name.underscore.to_sym)
    raise "loudmouth not setup for #{topic.class.name.underscore.downcase.to_sym}"
  end

  render :partial => 'loudmouth/comments/comment', :collection => topic.comments, :as => :comment
end

#topic_comment_path(topic) ⇒ Object



28
29
30
# File 'lib/extensions/helper.rb', line 28

def topic_comment_path(topic)
  send("#{topic.class.name.underscore}_comments_path", topic)
end