Project

rbjs

0.01
No commit activity in last 3 years
No release in over 3 years
Remote Javascript Builder for Ruby on Rails
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0
 Project Readme

Rbjs is a Ruby DSL that translates 1-to-1 into Javascript

It integrates with Rails 3.1 and 4, and Sinatra

What?

Instead of this (create.js.erb)

<% if @collection %>
  jQuery(<%= j render(@image) %>).appendTo('<%= dom_id @collection %>').hide().show('slide')    
<% else %>
  jQuery(<%= j render(@image) %>).insertAfter('.dropzone').hide().show('slide')
<% end %>

you can write this (create.js.rb)

if @collection
  jQuery(render @image).appendTo(dom_id @collection).hide!.show('slide')    
else
  jQuery(render @image).insertAfter('.dropzone').hide!.show('slide')
end

Why?

Why not?

Installation

Add the line

gem 'rbjs'

to your Gemfile and run

bundle install

Usage

Please refer to the documentation for a quick example and usage guide.