I did not find any documentation on the following 2 methods :
/***************************/
def hobo_ajax_response(*args)
results = args.extract_options!
page_path = params[:page_path]
r = params[:render]
if r
ajax_update_response(page_path, r.values, results)
true
else
false
end
end
def ajax_update_response(page_path, render_specs, results={})
@template.send(:_evaluate_assigns_and_ivars)
renderer = Hobo::Dryml.page_renderer(@template, [], page_path)
if page_path
render :update do |page|
page << "var _update = typeof Hobo == 'undefined' ?
Element.update : Hobo.updateElement;"
for spec in render_specs
function = spec[:function] || "_update"
dom_id = spec[:id]
if spec[:part_context]
part_content = renderer.refresh_part(spec[:part_context],
session, dom_id)
page.call(function, dom_id, part_content)
elsif spec[:result]
result = results[spec[:result].to_sym]
page.call(function, dom_id, result)
else
# spec didn't specify any action :-/
end
end
page << renderer.part_contexts_storage if renderer
end
end
/****************************/
Having a limited knowledge of Ruby, I am having trouble going through
the
above. What I have is a form with
update="mydiv"
In the controller there is:
def login
login do
respond_to do |wants|
wants.html { }
wants.js { hobo_ajax_response }
end
end
end
Would like to load a partial that has an edit form for user during
this
call, which would go into 'mydiv'.
I believe the way to do this without using hobo_ajax_response is
by creating an instance of @user in def login ( @user =
current_user ??),
then having a login.rjs file with:
page[:archsignup].replace_html :partial => 'edit', :object =>
@user
and a file '_edit.drml' with my <edit-user /> form in it.
So how would I do the above using hobo_ajax_response?
If the above is not possible, is there a JQuery method I could use?
I read that using JQuery directly would not work, but could be
used to call an action in the controller to render the partial.
Not familiar with JQuery, but assuming this would be
something that could be used similar to
success="$.get-----"
...and create a method in users_controller, something like
def login
login do
respond_to do |wants|
wants.html { }
wants.js
end
end
end
Cheers,
Jet
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/hobousers?hl=en
-~----------~----~----~----~------~----~------~--~---