chrismccord / phoenix_haml

Phoenix Template Engine for Haml
MIT License
158 stars 42 forks source link

Functions in attributes #25

Closed DerKobe closed 8 years ago

DerKobe commented 8 years ago

I ran into a brick wall when I tried to get something like this to work: %img{src: image(@current_user, 300)}

image/2 is defined in the view, but I always get the error undefined function image/0.

It's no problem with plain values or functions/0. Btw something like this does also not work: %p{alt: @current_user.name}. With this I get protocol Phoenix.HTML.Safe not implemented for %MyApp.User{__meta__: #Ecto.Schema.Metadata....

DerKobe commented 8 years ago

Ok, it is a Calliope thing and there it is known.

smpallen99 commented 8 years ago

Please use string interpolation. I just successfully tested the following on calliope v0.4.0.

%img{src: "#{image(@current_user, 300)}"}