Displaying 20 results from an estimated 10000 matches similar to: "Redirect/rendering out of xhr"
2007 Apr 26
2
assert_select with respond_to JS or xhr?
Hi everyone,
I am a bit confused with xhr? and respond_to.
I have the folloing code in my view to update the ''emails'' ID
link_to_remote(image_tag("refresh"), :update => "emails",
:url => { :action => "list_emails" })
in the controller side i have somthing like :
[..]
respond_to do |type|
type.html { render :action
2006 Jul 10
1
:revert => false for Droppables
Right now I am using page.remove and page.insert for some complex nested
moves in RJS. I have my draggables set to revert, but they also revert when
they hit a droppable.
Meaning, the draggable will start reverting for part of a second before the
page.remove kicks in. Is there a way to specify :revert => false for the
drop_receiving_element, or something else to that affect?
--
Respectfully:
2006 Aug 02
0
"RJS Error: TypeError: $(element) has no properties"
i have lots of divs, which are added via link_to_remote. now i want to
delete them with a link_to_remote button for each. i am giving them ids
with the same name and a serialized number. when trying to access them
with javascript/rjs, strange things happen: "RJS Error: TypeError:
$(element) has no properties?. is this a rails, rjs or prototype bug? or
am i missing something?
see my code
2006 May 03
3
Graceful degrading AJAX show/hide
Ok i''ve done a bit of hunting around and I can''t find much
documentation on how ensure an ajax call through an rjs file degrades
with javascript off.
Essentially, if javascript is off, I want to refresh the page and pass
a variable from the controller to the page the user is on. Not use the
rjs file.
At the moment i have this:
<%= link_to_remote("Advanced Search",
2006 May 31
0
Help with xhr request in integration tests
Hello,
The documentation at api.rubyonrails.com for
ActionController::TestProcess#xhr or xml_http_reponse gives method as
the first parameter and action as the second parameter folled by the
parameters hash, etc. But ActionController::Integration::Session#xhr
has a path, followed by the parametes hash, and apparently no alias
for xhr. Of course, the documentation in the AWDwR book would tend to
2006 Jul 12
3
request.xhr? is false after redirecting an AJAX request?
Dear everybody
I''m trying to develop a web application that makes use of AJAX, but also works
if a user has no (or doesn''t want to use) JS. For normal requests, this is
pretty easy. Almost every action ends with
render blahblah, :layout => !request.xhr?
This way, I can use the same action to render a full page (with layout) as
well as rendering an AJAX request (only the
2006 Jun 27
2
Render partials in folders
Right now I have partials in a view folder corresponding with my controller.
ie: controller: example, view: example/_partial.rhtml
and I call it with render :partial => ''partial''
How do I add the partial to another folder and call it?
ie: controller: example, view: example/new_folder/_partial.rhtml
render :partial => ''new_folder/partial'' # does NOT work
2006 Jul 13
2
Iframe upload indicator
I''m using the iframe trick to upload files with form_tag and a target
pointing to the iframe. All is working, but I would like to display an
indicator of the upload. All I want to do is show a hidden animated gif via
Element.show. With form_remote_tag, i could use the :loading and :complete
callbacks to do an Element.show and Element.hide. How do I achieve a similar
effect with form_tag?
2008 Mar 31
1
How to make a ajax (xhr) redirect?
Hi all,
In my application, I want seamless degradability so I use request.xhr?
to check whether a request is an ajax call. However here and there, I
need to use redirect_to - in this case the request is not xhr anymore,
and the check doesn''t work as expected. Is there a way to make xhr-
like redirect (which allow to get to another controller+action)?
Thanks,
- Chuong
2006 Apr 19
1
AJAX - update item forms problem
I have a table showing some records from the database. These records
should be always ordered by some datetime field. The list of items is
changed by AJAX using RJS scripts and edits are done by showing and
hiding an update form under a chosen row. Adding and updating rows works
great but my problem is when the order of items is changed after making
some AJAX datetime updates update forms of
2006 Aug 14
0
rendering RJS template from view
I''m sure I''m missing something obvious, but I''m stumped.
I have a tabbed nav bar with an associated content area that is used
to display query results. Clicking a tab, rebuilds the nav bar with
that tab now highlited, performs the query and renders the results to
a separate div. I''m using an RJS template which calls
page.replace_html with the various
2006 Jun 24
5
request.xhr? vs. respond_to
Searched around this forum, but didn''t find an answer for this question.
Can you help this newbie understand any overlap and/or difference
between request.xhr? and respond_to?
If request.xhr? is true, should I expect it wants.js below?
respond_to do |wants|
wants.html { redirect_to(person_list_url) }
wants.js
wants.xml { render :xml => @person.to_xml(:include
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])
...
2006 Jun 07
1
Upload to DB hang mentioned in wiki
I''m uploading files to a mysql database, using a mediumblob size.
Following the wiki here:
http://wiki.rubyonrails.org/rails/pages/HowtoUploadFiles ,
I got past the first mysql 500kb limitation with the max_allowed_packet = xM
trick, setting it to 1000M.
However, as the person at the very bottom of the wiki notes, I too cannot
upload more than around 10mb.
I also tried the suggested
2005 Dec 15
2
link_to_remote and browser compatibility
link_to_remote generates the javascript: new Ajax.Updater(...). Have I
missed something or doesn''t this handle browsers with javascript support
but without XHR support?
What I''d like to do is:
1. If the browser supports XHR, use XHR
2. If the browser supports javascript (and perhaps even if the XHR
request fails) do a POST via javascript
3. If the browser doesn''t
2005 Dec 17
0
No javascript fallback
AJAX is good for a lot of things, but javascript is not always
available.
I think the new RJS templates are very good:
http://www.codyfauser.com/articles/2005/11/20/rails-rjs-templates
And they could be used to create a simple, automatic no javascript
fallback. An example:
You have a controller called PostsController. There is an action "new".
The view displays a form. The form
2007 Sep 20
2
Rendering a partial from within that partial
I am having trouble rendering a partial called ''names'' through a submit
tag located within that partial. The form data is saving with my current
code. However, the existing data is not loading into the form and the
partial is not being re-rendered upon submission to reveal the changes
to this data.What might I do to fix this?
show.rhtml
<%= javascript_include_tag :defaults
2006 Mar 27
13
Is this a bug in Ajax handling?
When a controller responds to a link_to_remote with a redirect_to, the
link_to_remote gets a success callback, this would seem like a bug to
me, at a minimum it should return a failure?
This is driving me crazy because all the login engines/generators
respond to an authentication error with a redirect_to. The work around
is to change them to all do a
render :layout => false, :status => 500
2006 Jun 01
0
Possible RJS Implementation?
Hi there,
I have a question regarding updating elements of a two different divs with
one click. I have two lists. One list holds items that are entered into a
contest, and the other list holds items that aren''t currently in the
contest. One item can only be in one list at a time.
Each list has a partial that renders the items with corresponding actions.
The items in the current contest
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.