interim_stream_hackiness_helper.rb 737 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
module InterimStreamHackinessHelper
  def commenting_disabled?(post)
    return true unless user_signed_in?
    if defined?(@commenting_disabled)
      @commenting_disabled
    elsif defined?(@stream)
      !@stream.can_comment?(post)
    else 
      false
    end
  end

  def publisher_prefill_text
    if params[:prefill].present?
      params[:prefill]
    elsif defined?(@stream)
      @stream.publisher_prefill_text
    else
      nil
    end
  end
22 23

  def from_group(post)
Maxwell Salzberg's avatar
Maxwell Salzberg committed
24
    if defined?(@stream) && params[:controller]== 'soups'
25 26
      @stream.post_from_group(post)
    else
Maxwell Salzberg's avatar
Maxwell Salzberg committed
27
     [] 
28 29 30 31 32 33
    end
  end

  def what_soup_sentence(post)
    from_group(post).map{|x| x.to_s.gsub("_soup", '').gsub('_',' ').titleize}.to_sentence
  end
34
end