python python - 27 days ago 10
Ajax Question

how do add an ajax link to an ActiveAdmin view that will trigger a function

I know how to add a link to an Active Admin. Code is below to add link:

row "Has Attended Orientation" do
link_to('Accept','#')
end


enter image description here

But my requirement is that when a user clicks on
Accept
, it should show a tab to select
YES
or
NO
. If user selects
YES
then it should trigger a function. Could anyone help me, how I can do that?

Answer

Try adding this,

link_to "Accept", { action: :<action name> }, method: :<get or post>, data: { confirm: '<Enter the message you want>' }

I have added explanation enclosed within <>. Please put in code according to your need.