Advertisement
Guest User

application-helper.rb

a guest
Jun 5th, 2013
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rails 0.85 KB | None | 0 0
  1. module ApplicationHelper
  2.  
  3.     def can_display_status?(status)
  4.         signed_in? && !current_user.has_blocked?(status.user) || !signed_in?
  5.     end
  6.  
  7.     def status_document_link(status)
  8.         html = ""
  9.         if @status.document && @status.document.attachment?
  10.             html << content_tag(:span, "Attachment", class: "label label-info")
  11.             html << link_to(@status.document.attachment_file_name, @status.document.attachment.url)
  12.             return html.html_safe
  13.         end
  14.     end
  15.  
  16.  
  17.     def avatar_profile_link(user, image_options={}, html_options={})
  18.         link_to(image_tag(user.gravatar_url, image_options), profile_path(user.profile_name), html_options)
  19.     end
  20.  
  21.  
  22.     def page_header(&block)
  23.         content_tag(:div, capture(&block), class: 'page-header')
  24.     end
  25.  
  26.  
  27.     def flash_class(type)
  28.         case type
  29.         when :alert
  30.             "alert-error"
  31.         when :notice
  32.             "alert-success"
  33.         else
  34.             ""
  35.         end
  36.     end
  37. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement