Hi, I''m not sure i''m my design is correct, but i have around_filter in the controller, where i want to add a small javascript at the end of the page. Is there someway i can use the javascript_tag from the controller? i though there where a helpers proxy available. /Jon -- 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 -~----------~----~----~----~------~----~------~--~---
Jon Stenqvist wrote:> Hi, > > I''m not sure i''m my design is correct, but i have around_filter in the > controller, where i want to add a small javascript at the end of the > page. Is there someway i can use the javascript_tag from the controller? > i though there where a helpers proxy available.Maybe Im not understanding your situation, but filters are more used for application logic and typical cases like logging, benchmarking etc. Wouldnt it be better to use the layouts folder and stick the javascript in there ? -- 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 -~----------~----~----~----~------~----~------~--~---
Raja Venkataraman wrote:> Jon Stenqvist wrote: >> Hi, >> >> I''m not sure i''m my design is correct, but i have around_filter in the >> controller, where i want to add a small javascript at the end of the >> page. Is there someway i can use the javascript_tag from the controller? >> i though there where a helpers proxy available. > > Maybe Im not understanding your situation, but filters are more used for > application logic and typical cases like logging, benchmarking etc. > Wouldnt it be better to use the layouts folder and stick the javascript > in there ?This will be a plugin that enable auto-refresh with ajax, and the after_filter is starting the javascript-update-check-script for the configured actions. -- 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 -~----------~----~----~----~------~----~------~--~---
On Sun, Oct 5, 2008 at 5:38 AM, Jon Stenqvist <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Raja Venkataraman wrote: >> Jon Stenqvist wrote: >>> Hi, >>> >>> I''m not sure i''m my design is correct, but i have around_filter in the >>> controller, where i want to add a small javascript at the end of the >>> page. Is there someway i can use the javascript_tag from the controller? >>> i though there where a helpers proxy available. >> >> Maybe Im not understanding your situation, but filters are more used for >> application logic and typical cases like logging, benchmarking etc. >> Wouldnt it be better to use the layouts folder and stick the javascript >> in there ? > > This will be a plugin that enable auto-refresh with ajax, and the > after_filter is starting the javascript-update-check-script for the > configured actions.This isn''t really how you''d use the before/after filters. What it sounds like is that you need to be able to trigger js to be called on specific actions? You might consider adding the js code to your application layout view... and use a before filter on the specific actions you want this to run and have that show the corresponding js. For example: before_filter :trigger_js_stuff def trigger_js_stuff @reload_page = true end In your view... <% if @reload_page %> // trigger your js code here <% end %> Good luck! Robby -- Robby Russell Chief Evangelist, Partner PLANET ARGON, LLC design // development // hosting http://www.planetargon.com/ http://www.robbyonrails.com/ aim: planetargon +1 503 445 2457 +1 877 55 ARGON [toll free] +1 815 642 4068 [fax] --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Robby Russell wrote:> On Sun, Oct 5, 2008 at 5:38 AM, Jon Stenqvist > <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: >>> Maybe Im not understanding your situation, but filters are more used for >>> application logic and typical cases like logging, benchmarking etc. >>> Wouldnt it be better to use the layouts folder and stick the javascript >>> in there ? >> >> This will be a plugin that enable auto-refresh with ajax, and the >> after_filter is starting the javascript-update-check-script for the >> configured actions. > > This isn''t really how you''d use the before/after filters. What it > sounds like is that you need to be able to trigger js to be called on > specific actions? You might consider adding the js code to your > application layout view... and use a before filter on the specific > actions you want this to run and have that show the corresponding js. > > For example: > > before_filter :trigger_js_stuff > > def trigger_js_stuff > @reload_page = true > end > > In your view... > > > <% if @reload_page %> > // trigger your js code here > <% end %> > > Good luck! > > RobbyThanks Robby, i just put it on github, please have a look and see if it''s correct usage, http://github.com/jnstq/content_refresher/tree/master. I would like to just javascript_tag @ line 60 on http://github.com/jnstq/content_refresher/tree/master/lib/equipe/content_refresher.rb Jon -- 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 -~----------~----~----~----~------~----~------~--~---