Guest User

Untitled

a guest
Oct 23rd, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. module CabinetsHelper
  2. def component(component)
  3. haml_tag :div do
  4. haml_concat component_link_to_function(component)
  5. end
  6. end
  7.  
  8. def component_link_to_function(component)
  9. link_to_function component_image(component), "alert('test')")
  10. end
  11.  
  12. def component_image(component)
  13. capture_haml do
  14. haml_concat image_tag component.image
  15.  
  16. haml_tag :div, :class => "component_border" do
  17. haml_concat image_tag '/images/selected.png', :id => "border_" + dom_id(component), :class => "component_border", :height => component.image_height + 10
  18. end
  19. end
  20. end
  21. end
  22.  
  23. # and in your view
  24. - component( @whatever )
Add Comment
Please, Sign In to add comment