Displaying 20 results from an estimated 20000 matches similar to: "RJS question - Query DOM/CSS from RJS?"
2006 May 12
0
RJS, Safari, Error - DOM exception 7
I''m having nasty cross-browser headache.
Not new to Rails, but quite new to AJAX/RJS.
My app works perfectly in Firefox, but generates
the error in the subject line in Safari.
Pretty simple circumstance, completely reproducible
in all cases:
Any ideas? Relevant code attached.
Layout:
-------
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC
2006 Aug 09
2
Can :before and :success move from view file into .rjs file?
Within the RJS template is there a way to specify when the visual_effect
should occur?
I''m trying not to repeat the :before and :success blind_down
visual_effect statements throughout my views.
It seems like the rjs templates can only take visual effects statements
in the form of
page.visual_effect :blind_up, ''divname''. I can''t figure out how to add
2006 Feb 16
0
RJS Question
Hi,
What would my method call in an rjs template to produce something like:
new Effect.BlindDown($(''commentList'').lastChild);
I know if I just wanted to the blind effect I would:
page.visual_effect :blind_down, "row_#{@new_item.id}"
but how would I call it if I want the ".lastChild instead of passing a particular id?
thanks, scott.
2006 Nov 02
5
RJS error in internet explorer
hey all,
got a rails app i''m finishing up. i have a little ajax on one of my
pages where the person can choose a doctor from a drop down list and if
the doctor isn''t there they can click a link which blinds down a little
form to add a doctor. after they submit that mini-form the page updates
the div which houses the drop-down so the doctor shows up. works very
nicely IN FIREFOX.
2006 Aug 18
3
RJS templates for DOM manipulation
I want to do some DOM manipulation with JavaScript. Specifically I
want to implement zoom in/out in a picture by changing it''s
width/height attributes. Is it possible to do this using RJS or should
I write javascript by hand?
All the examples of RJS I''ve seen write the javascript in the result
of an AJAX remote call. Where are the docs for RJS? All I''ve seen are
blog
2006 Jun 21
2
Using RJS to highlight one LI if using insert_html on an UL?
It seems common to use RJS for quickly adding and highlighting a list
that is having content added to it like this:
http://rafb.net/paste/results/Z3m32g48.html
... where "my_list" would be an UL and the partial would insert a LI.
Given that example, is there an easy way to highlight only the newly
inserted LI instead of the whole UL? The only way I can see to do it is
to give
2006 Mar 27
7
rjs template ? (how to check for existence of a dom element?
In my rjs template I''m using the following line.
page.visual_effect :slideUp, ''comment_error_details'', :duration => 0.5
It works fine if I have created the div with the
id="comment_error_details",
but if I haven''t created the error yet then my whole rjs template fails.
How can I check to see if an element has been created? I could then put
2008 Mar 19
6
Back button behavior has changed again in Safari 3.1, after doing a dom update via ajax/RJS
GAH!
Here is the firefox behavior, which is perfect:
1) View page 1
2) Update some text by using link_to_remote or remote_form_for, along
with an RJS replace or replace_html
3) Navigate to page 2
4) Hit back
5) Page was cached with dom updates, note that the page is show in the
same state as it was left
Safari 3.0 behavior
1..4) repeat
5) Page reloads, ending up in the state where it was left
2006 Apr 17
2
Building Dynamic DOM Element IDs for RJS Templates
My element IDs are constructed using the object id. So . . .
<div id="foo<%= foo.id %>" >
<p><%= link_to_remote "Do Foo", :url =>{:action => "do", :id =>
foo.id} %>
</div>
How do, and can I, build that id in the RJS template?
Also, can anyone recommend a good Ruby syntax book that would help me
out with Rails? I know
2007 Feb 08
1
RJS throwing 'rubycode' exception
All,
In an RJS template, how could I pass ruby variables values to the
javascript without getting the RJS Exception: rubycode? This is what I''m
doing (as an example) and is throwing the exception:
index.rjs
=========
names = ["ruby", "ajax"]
page << "alert(#{names})"
You think that wouldn''t work because its an array, right? Ok, so if I
2006 Apr 22
3
rjs woes, any hints?
I''ve pared my rjs experiment down to what seems a bare minimum. When I click
on my link_to_remote, the rjs executes, returns the correct javascript to
the browser, but it doesn''t update the div I''ve specified. What appears to
be coming back from the controller is:
Element.update("my_form", "hello, rjs");
I''m tearing my hair out.
2006 May 25
2
Newbie AJAX rjs syntax question
I''m brand new to Ruby and to Rails, and I''m running through Pragmatic''s
"Agile Development" V.2 book and am having problems with the rjs files
in their tutorial.
First problem:
page[:cart].replace_html :partial => ''cart'', :object => @cart
This line stopped the AJAX request. The action completed without
trouble, but when it hit
2007 Jun 15
2
Is it still possible to use should_have_rjs
Hi
I''ve come back to a Rails project after about a month doing other
work, and there''s a lot of changes. I was on the 0.7 branch before
and I''ve upgraded to RSpec 1.0.5. I used the spec translator, fixed
the cases where it barfed on unusual line contents, and all my model
and controller specs now pass. But I''m getting 53 failures on my view
specs,
2005 Dec 15
2
Rails 1.0 & RJS Templates
Hello all,
I just successfully updated my dev env to Rails 1.0. I then wanted to
get .rjs templates working and followed Cody''s instructions at
http://www.codyfauser.com/articles/2005/12/02/rails-rjs-templates-plugin
. However, when I try to run ''rake test'' I get the following error:
(in
2006 Jul 18
6
RJS - Insert at top of table?
Quick question regarding RJS and inserting to the top of a table. Here''s
the view I''m working with:
<table id="links-list">
<tr>
<th>Display title</th>
<th>URL</th>
<th>Description</th>
<th>Category</th>
</tr>
<% for link in @links %>
<tr id="link-<%= h link.id
2006 Mar 27
0
Solved: RJS Templates Not automatically evaluating
I had posted a question here and on IRC about an issue I had with RJS
templates not automatically evaluating (I had to put my own
eval(response.responseText) in an :complete).
The issue was that the content type was not being set to
text/javascript, because I was explicitly setting content-type in a
before_filter in my application.rb. I had put that line in a long time
ago to make validator.org
2006 Apr 16
11
RJS templates not found
I am running Rails 1.10 and wanted to check out the RJS templates.
Rails doesn''t seem to find them.
I did issue the rake comment update_javascripts and that did not correct
the problem. RJS is part of 1.1 right?
Any ideas?
Thanks.
--
Posted via http://www.ruby-forum.com/.
2005 Dec 15
0
RJS Templates and the Replace semantics
I have an issue with the way replace_html works in an RJS template.
This is a copy of a post on my blog (http://blog.craz8.com
<http://blog.craz8.com/> ) that describes the problem and my working
solution to the problem.
If I have a collection of things that are output like this:
<div id="things">
<% @things.each do |thing| %>
<%= render :partial =>
2006 Feb 14
2
Inline list editing with RJS: best practices
I wanted to get the community opinion on the best way to use partials and
inline list (<li>) editing.
I have a very common scenario where a list is rendered:
--- index.rhtml ---
<ul>
<%= render :partial => ''item'', @collection => @items %>
</ul>
--- _item.rhtml (simplified) ---
<li id="item_<%= item.id %>">
<div
2005 Dec 19
1
Preserving fallback with RJS
Hi guys,
I really like RJS. I think they''ll replace partials in alot of
instances. Unfortunately, because they''re automatically used like
.rhtml and .rxml and are hard to specifically specify it makes it
messy to preserve fallbacks when using them. For instance, using
partials instead of rjs, my create method might look like:
def create
post = Post.new(params[:post])
...