Displaying 20 results from an estimated 30000 matches similar to: "Ajax inserting a collection of partials"
2006 Apr 01
3
Can I do a redirect in an ajax request?
I''ve got a form on my page, and when the user submits it, sometimes
I''d like to update an element on my page, and sometimes I''d like to
redirect the browser to another url entirely. However if I do
redirect_to, it just updates the element with the results of the
redirect. Is it possible to do what I want, or will I need to use RJS
to do this?
Pat
2011 Dec 16
3
PROBLEN IN AJAX USING RJS
I am using rails 3. I have problem in out put so please tell me my
mistake
routes
-------
entermatch ''/view_article/:user_id/:article_id'' =>
''articles#view_article'', :as => :view_article
resources :users do
resources :articles do
resources :comments
end
end
article controller
------------------
def view_article
@user =
2009 Sep 30
8
Cycle/Partials issue
First off, I''m fairly new to ruby on rails so this may appear simple but
I''m just learning the ropes :)
So I have a simple blog app where a post has many comments. The ''show''
view for posts renders a partial for each comment the post has. The css
class of the containing div element is cycled using cycle(). The partial
code is,
<% div_for(comment, :class
2006 Apr 11
5
RJS adds comment but doesn''t update form
Hi,
When a user adds a comment i want to add the comment to the end of the
comments list using ajax so there is no full page refresh. The code i
have below adds the comment to the database but doesn''t update the
comments div with the new comment.
Can anyone help? This is my first use of rjs templates and i have read
http://www.codyfauser.com/articles/2005/11/20/rails-rjs-templates
2006 Jul 26
3
insert_html inserting fragment twice
Has anyone had trouble with inline RJS insert_html with the latest
version of Rails?
My problem is that insert_html inserts the html fragment twice. For
example,
render :update do |page|
page.insert_html :top, "some_list", "<li>booyow</li>"
end
would render "<li>booyow</li>" twice.
Thanks.
--
Posted via
2006 Apr 07
3
Ajax render a template
In my blog a user can add comments. I want an Ajax call to add the
comment to the bottom of the comments list.
How to i return a comment thats is in the comment template and add it to
the bottom of the page. I have gotten as far as rendering some text
back to the form and the comment doesn''t display until i refresh.
This is my _newcomment.rhtml form to create a new comment
<div
2006 Jul 19
3
render :partial inserting new line in RJS
Struggling a bit with rendering a partial in an RJS template. I''m having
to feed the javascript directly to the page object as couldn''t find a
way to have insert_html work directly on the proxy object returned by
select.
However, that''s not the problem. The code for doing that is below and it
all works fine, except that a new line is being inserted after the
2006 Apr 21
3
rjs in multiple ajax page
Sorry for the long explanation but I''m having trouble integrating rjs into my
form page. Here''s my page:
<div id="posts">
<ul id="post_list"><%= render :partial => ''list_results'', :collection =>
@posts %></ul>
<p><%= link_to_remote(''+'',
:url => {:action =>
2008 Dec 21
1
Form issues : partials + AJAX vs simple JS / separate views + form_fors vs one view and fields_fors
Hi all!
I am coding an application that keeps track of request to create
college courses. An identified user (logically a faculty member)
completes a form indicating the name of the course, the professor in
charge, the course''s code, the date and place, the possible
coprofessors and TAs and the type of website he or she wants to use as
a teaching help (WebCT, Sakai, etc.).
I have two
2005 May 31
1
AJAX & Partials
Hi,
looking to see if I''m on the right track here...
we''re selling widgets to customers, but there are a number of different
type of widgets and each different type of widget has a number of
parameters that the customer can specify, in effect each customer orders
widget''s customised in ways particular to that specific order.
We use STI to store each different widget
2006 May 13
2
Using RJS in views without ajax
Hi!
I can use RJS in views like this (without using ajax):
<%=link_to_function("switch fields",
update_page do |page|
page.insert_html :before, ''date'', date_select(''exhibition'', ''date'')
page.remove ''date''
end) %>
Is there a way to move this RJS code into a function to separate file?
.js files are not parsed
2006 Jul 22
12
Community request - can someone show me REST?
I mentioned this in another thread, but I''ve got a formal request now.
After reading tons of stuff about REST, I don''t really get it. I
need to see an example.
I''d like someone to write up an example blog app with these requirements
- RESTful using the simply_restful plugin (or edge rails)
- allows posting of comments to articles
- has categories for posts
No need
2008 Mar 05
3
having trouble specing an ajax request
Do I need to spec an AR. If yes, what is the best way to spec this.
here is the code -
def index
@deals = Deal.paginate(:all, :conditions =>
prepare_search_conditions, :order
=> ''created_at DESC'', :page => params[:page]
)
if request.xhr?
render :update do |page|
page.replace_html "table", :partial =>
2007 Feb 07
5
Mocking ActiveResource
I want to use ActiveResource in my app. Instead of hitting server
though, I want it to load from a file when I call find. Any clue how
I do that?
Pat
2006 Jan 30
4
What is supposed to happen when you run dispatch.fcgi?
I''ve seen a number of posts where someone says, "What happens if you
just run dispatch.fcgi directly?" Every time I do it, I get a "500:
internal server error" message. I was just curious if that''s what''s
expected running it directly. I assume so, because my apps all work
fine, but that''s always bugged me.
Pat
2009 Nov 09
0
paged partial collection AJAX
I have several places in my app where there is a collection with hundreds of
items to render. Paging in the usual sense (i.e., mislav-will_pagination)
does not make sense. I want to render them all, but the long response time
(often greater than 7 seconds) is not user-friendly. It occurs to me that I
can batch them, sending a batch with a bit of Javascript at the bottom to pull
in the next
2007 Mar 14
5
What''s the new syntax for predicates?
@settings.should allow_publish_ip("127.0.0.1") fails with
undefined method `allow_publish_ip'' for #<#<Class:0x2f8fd48>:0x2f5a968>
@settings.should_allow_publish_ip("127.0.0.1") works fine
This is rspec 0.8.2.
http://rspec.rubyforge.org/documentation/expectations.html says that
matching arbitrary predicates is deprecated and to see
2006 Aug 14
4
Updating a table with Ajax
I''ve been banging my head against the wall trying to update a table
(add/delete rows) using Ajax. It seems simple enough but just doesn''t work
for me. I can get it to work using DIVs instead of a table, but doing the
layout with DIVs is much more cumbersome and I know it works for others with
a table (though I haven''t been able to find an exact example code anywhere).
2006 Jun 27
5
Ajax - Inserting selected elements from request.responseText
After retrieving a URL using an Ajax.Request...
function onComplete (request, json) {
// request.responseText holds the entire page
Only the content contained in elementID = ''source'' is intended for display
At this time, the following code works, but it disturbingly copies the
entire page from the source URL into the target DIV
$(''target'').innerHTML =
2006 Apr 02
2
Problem with RSS feed from Rails Recipes
I''m trying to add an RSS feed to my app, and am going through the
Rails Recipes chapter on doing so. I get the following error when I
request the feed:
undefined method `gmtime'' for #<DateTime: 1963061961/800,0,2299161>
...
7: xml.pubDate CGI.rfc1123_date(@posts.first.created_on)
Any idea what''s up?
Pat