You're better off just writing the JavaScript code yourself. Radiant's tag definitions live in the model layer (essentially) and don't have access to the ActionView helpers. That said, you might be able to do something like this:

tag 'myAjaxTag' do |tag|
 helper = ActionView::Base.new
 helper.send :instance_variable_set, "@request", tag.globals.page.request
helper.link_to_remote 'A', :url => {:action => 'ajaxtest', :controller => 'mycontroller' }
end

However, that's a lot of work just to create a link with an Ajax callback. It would be better practice to create a plain link and then apply the Ajax callback unobtrusively. LowPro's Remote.Link works well for that. Something like this:

## In your JS

Event.addBehavior({
 'a.remote': Remote.Link
});

## In your HTML

<a href="/ajaxtest" class="remote">A</a>

Sean

Pascal Naef wrote:
Hi

I started with Radiant a few days ago and want to use Ajax in the
fronted.

I would like to do it as radius tag so that I can use functionality in
layouts and snippets. Everywhere I searched for possible solution I got
following article: http://www.ruby-forum.com/topic/111927#new


So I tried following:

The Tag module:

module CustomerReferencesTags
  include Radiant::Taggable

  tag 'customerReferences:index' do |tag|
    link_to_remote 'A', :url =>{ :action => 'ajaxtest' }
  end
end

The result of this try was "undefined method "link_to_remote' for #".

Does somebody know the current way to do it in Radiant or knows a good
turtorial?

Thx a lot for help.

Pascal

_______________________________________________
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Reply via email to