Ruby Javascript Generator Templates. Uses the file extension .rjs. Not related to r.js.
Questions tagged [rjs]
213 questions
4
votes
4 answers
Javascript templating without RJS, with JSON
One of the most convenient things about RJS is its ability to render a partial so you have all your view code in one place:
# task/index.html.erb
-
<%= render :partial => 'task', :collection => @tasks %>

go minimal
- 1,693
- 5
- 25
- 42
4
votes
1 answer
Durandal Weyland/Requirejs optimizer with kendo ui dataviz
I'm building an app with Durandal to bundle with PhoneGap. When I'm trying to run the weyland optimizer I'm running into some issues.
The build and optimization runs fine without any errors (I'm using requirejs as optimizer), but when I run the…

aup
- 800
- 7
- 19
4
votes
2 answers
Ajax pop up box using Ruby on Rails
This is a pretty basic question but I can't find a good answer for it. I have a page in my Rails app where there are many objects that can be 'flagged'. Clicking the flag button should display a little box with a confirmation, little form, etc. …

Anon
- 5,103
- 11
- 45
- 58
4
votes
4 answers
How can I get rails to send javascript errors to the log, not alert?
JavaScript errors to an alert box injure my soul. Is there a way to send it to console.log() instead of alert()?

Ryan Florence
- 13,361
- 9
- 46
- 63
4
votes
1 answer
Bug in r.js for recursive function?
I am currently trying to optimize the current jQuery (development version 1.8.1) with r.js.
This happens during asset compilation in a rails project with the gem requirejs-rails.
I think I encountered a bug in the optimizer. Around line 999 in the…

Erik
- 11,944
- 18
- 87
- 126
3
votes
2 answers
how to use if condition in rjs?
I pass parameter with url called var which is containing value 'event'. I want to check this variable in rjs file and load a modal dialog box. Following is my code.
page<<" if (:var== "event") {"
page<< "$j ('#create_evnt_dialog').dialog({
…

Rosh
- 730
- 2
- 12
- 32
3
votes
2 answers
RJS: Check for existing page element?
I have a textfield with the id "foo" that sometimes exists and sometimes not. If it exists I'd like to fill in a certain value.
How do you do this by using RJS (in Rails 2.2)?
I tried this and it doesn't work:
if page[:foo]
page[:foo].value =…

Javier
- 2,491
- 4
- 36
- 57
3
votes
0 answers
How to replace prototype-rails gem when upgrading rails from 3 to 5?
I'm upgrading a rails project from 3.2 to 5.2. The docs in prototype-rails [github][1] say the support is not confirmed for Rails 4.1 and above. But right now, in the process of upgrading I'm still in Rails 4.0.13 and the gem no longer works.
I'm…

vinibol12
- 468
- 4
- 21
3
votes
1 answer
RJS: Ajaxified select_tag
Since I didn't get the expected answer on my last question I'll try to simplify and narrow my question:
How can I build a dropdown-menu that uses AJAX (no submit-button) to call the show action of a certain controller?
The following things are…

Javier
- 2,491
- 4
- 36
- 57
3
votes
2 answers
Ajax flash message in ruby on rails
I'm trying to show a flash message and render it with Ajax, but the message does not seem to be appearing until after I refresh the page.
Here's my create.rjs file:
page.insert_html :top, :feed_items, :partial => 'shared/feed_item', :object =>…

Justin Meltzer
- 13,318
- 32
- 117
- 182
3
votes
1 answer
rails 2 replace_html puts javascript into the page
In my controller I have:
respond_to do |format|
format.js
end
In my rjs:
page.replace_html("source_credential_list", :partial => "source_credential_list", :object => @all_source_credentials)
or
page.replace("source_credential_list",…

Joelio
- 4,621
- 6
- 44
- 80
3
votes
1 answer
Anyone has a link to Rails (2.3.8) RJS Api?
Do any of you know any good reference for the RJS mechanisms in Rails (2.3.8)? I can find a few examples from like 2006/2007 and no actual documentation.

Dmitriy Likhten
- 5,076
- 7
- 36
- 47
3
votes
1 answer
Nested link_to_function / insert_html causes javascript errors
Im using a link_to_function / insert_html to insert a partial into the page. Everything works fine, until i add another link_to_function / insert_html into the partial that is being rendered into the page. All of a sudden the outer link_to_function…

LMH
- 949
- 9
- 22
2
votes
1 answer
Backbone vs. RJS
Being some random rails dev, and getting around all those backbone/underscore javascript stuff…
Backbone seems interesting, but in a functional point of view (I mean the way you can get your data back from the db and your page can be updated), I…

Ben
- 5,030
- 6
- 53
- 94
2
votes
4 answers
Using RJS to Replace Div
I currently have a link which when clicked calls a JavaScript function, which gathers some data and then uses ProtoType to submit a form...
function myFunction(){
data = someobject.getData();
$('myform').request({
parameters: {data:data,…

Paul
- 1,021
- 2
- 12
- 18