wycats / merb-plugins

Merb Plugins: Even more modules to hook up your Merb installation

This URL has Read+Write access

merb-plugins / merb_jquery / README
100644 43 lines (25 sloc) 0.677 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
merb-jquery
===========
 
Makes it easy to use jQuery in your application.
 
$ gem install merb_jquery
 
Add
  require 'merb_jquery'
to your init.rb
 
$ rake merb:jquery:install
Installs the latest jQuery to public/javascripts
 
In your layout, inside <head>:
 
<%= jquery %>
 
 
In your views:
 
<% jquery do %>
  $('#foo').something();
<% end %>
 
jquery is a helper method is a shortcut to
 
throw_content :for_query and catch_content :for_jquery
 
You still need to inlude jQuery javascript file manually, for instance,
using merb-assets:
 
# in init.rb
 
dependency "merb-assets", "0.9.10"
 
# in Erb layout
 
<%= js_include_tag "jquery" %>
 
# or in Haml layout
 
= js_include_tag "jquery"