<% if controller.user? %>
<script src="http://www.google-analytics.com/urchin.js" type="text/
javascript">
</script>
<script type="text/javascript">
_uacct = "UA-999999-9";
urchinTracker();
</script>
<% end %>
I love my google analytics, but to make them work, I have to embed
this stuff in my code. I could code it up as a partial in rhtml but
is that the right answer? Has anyone else thought this through and
come up with a good answer?
Thanks,
Steve
%script{:type=>"text/javascript}
_uacct = "UA-999999-9";
urchinTracker();
Am I missing something obvious?
- Nathan
Perhaps the better question is: Are there limitations regarding what
js constructs work well with Haml?
Steve
%style
\.angry { font-weight: bold; color: #f00; }
would output
<style>
.angry { font-weight: bold; color: #f00; }
</style>
So it's possible, it's just hard to do... which is Haml's policy for
stylistically-incorrect things.
- Nathan
%style !
.angry { font-weight: bold; color: #f00; }
So the ! would tell the parser that the next part was explicit perhaps
and to ignore other operators until the white space changes. The use of
! might not be the best choice as its currently in use of doctype
stuff. Just an idea, possibly not all that well thought out ;)
- Geoff
%style
:plain
.angry { font-weight: bold; color: #f00; }
- Nathan
- Geoff
- Nathan
:css
.angry { font-weight: bold; color: #f00; }
Or even a sass filter.
:sass
.angry
:font-weight bold
:color: #f00
That would output...
<style>
.angry { font-weight: bold; color: #f00; }
</style>
The cool parts about filters are.... you can define your own language
within a Haml template!
-hampton.
- Nathan