Mimic the Confirmation javascript



I’m using some Redbox modal windows in one application.

Som of them are specific and work well, but now I want to implement a
general confirmation winodow, to mimic the javascript confirm function.

It started as an easy approach and now it’s horribly coded and very
difficult to mantain, as I’m passing .action, :method, and some
:parameters, and the general confirmation window sends those actions,
parameters, etc. etc.

But, what I would prefer, a simpler approach, I simply ipen the modal
window and if the user press OK, call the appropiate method/action, no
matter if I’m inside a form tag, a simple link, etc. etc.

Any ideas ?

simple javascript:

this is what I’m calling now, passing some parameters, action, …

<%= link_to_remote_redbox button_tag(‘Confirmar Envío’), :url =>
{:controller => ‘expedients’, :action => ‘confirm’,:id => expedient,
:type => ‘exp’, :action_method => ‘send_exp_to_us’, :message_title =>
“Confirmar envío”, :message_info =>‘Aceptar para enviar los expedientes
al centro de gestión’} %>