This post is slightly long, please bear up with me. The problem is
little twisted.
I am quoting from the docs:-
http://api.rubyonrails.org/classes/ActionView/Helpers/PrototypeHelper/JavaScriptGenerator/GeneratorMethods.html
>>>>>>>>>>
Helper methods can be used in conjunction with JavaScriptGenerator. When
a helper method is called inside an update block on the page object,
that method will also have access to a page object.
Example:
module ApplicationHelper
def update_time
page.replace_html ''time'', Time.now.to_s(:db)
page.visual_effect :highlight, ''time''
end
end
# Controller action
def poll
render(:update) { |page| page.update_time }
end>>>>>>>>>>
Below is my helper code:-
>>>>>>>>>>
module ContextsHelper
def sort_contexts
page.sortable(''context_list'',
:complete =>visual_effect(:highlight,
''context_list''),
:url => { :action => "sort" },
:handle=>"drag_handle")
end
end>>>>>>>>>>
Following is how I reuse it in my view:
<%= update_page_tag() do |p| p.sort_contexts end %>
and in my controller as
def some_action
render :update do |page|
.....
page.sort_contexts
end
end
The problem is that the output of "sort_contexts" helper is
new Effect.Highlight("context_list",{});
Sortable.create("context_list",
{handle:''drag_handle'',
onUpdate:function(){new Ajax.Request(''/contexts/sort'',
{asynchronous:true, evalScripts:true, onComplete:function(request){new
Effect.Highlight("context_list",{});},
parameters:Sortable.serialize("context_list")})}});
See there is the extra Effect.Highlight as the first line. This is
completely uncalled for.
Please help me solve this issue.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---