On Tuesday, September 17, 2013 1:43:05 PM UTC-7, patrick jones wrote:
>
> Hello community,
>
> I'm new to app development and I have what is, in my mind, a couple very
> simple yet heretofore unanswered/ambiguously answered questions:
>
> *1. Calling javascript in HAML*
> What is the correct syntax for calling javascript in a HAML header in
> application.html.haml?
>
The haml to include app/assets/javascripts/application.js in a rails3 view
is something like this:
!!! 5
%html
%head
%title= t :title
= stylesheet_link_tag "application"
= javascript_include_tag "application"
= csrf_meta_tag
= content_for :head
%body
Then further js files should be called from application.js... check the
rails guides asset pipeline docs... you'll have a line in there like "//=
require 'masonry.js'"
> *2. Masonry javascript*
> I installed Masonry using Bower. I am confused about two things:
> a. where does the javascript for Masonry live in the Rails app?
> b. if I installed it in Terminal using Bower, how do I get it to the right
> location in the Rails app?
>
looks as if masonry is a rails engine, packaged as a gem. So the js is
automatically on the load path, you don't have to worry about where it is
(it's in the gems location for your app). You should be able to list the js
(e.g. masonry.js) in the application.js manifest. This is the same way you
pull jQuery in... it's packaged in the jquery-rails gem so you don't see it
under the rails root... it's in the gems.
>
> I don't have a diagrammatic map that displays the relationships between
> all of these different things, so apologies if this question is naive.
>
--
You received this message because you are subscribed to the Google Groups
"Haml" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/haml.
For more options, visit https://groups.google.com/groups/opt_out.