Guest User

Untitled

a guest
Jan 23rd, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. module ApplicationHelper
  2. def title(page_title)
  3. content_for(:title) { h(page_title.to_s) }
  4. end
  5.  
  6. def yield_for(content_sym,default = "")
  7. output = content_for(content_sym)
  8. output = default if output.blank?
  9. output
  10. end
  11.  
  12. # Block helper
  13. def block_to_partial(partial_name, options = {}, &block)
  14. options.merge!(:body => capture(&block))
  15. render(:partial => partial_name, :locals => options)
  16. end
  17.  
  18. def block(title, options = {}, &block)
  19. block_to_partial('layouts/block', options.merge(:title => title), &block)
  20. end
  21.  
  22. def article(title, options = {}, &block)
  23. block_to_partial('layouts/article', options.merge(:title => title), &block)
  24. end
  25.  
  26.  
  27.  
  28. end
Add Comment
Please, Sign In to add comment