jeudi 26 mai 2016

Rails 3 best_in_place_if how to show confirm alert box before the action gets completed

I am using best_in_place_if for inline editing. Here a column value gets changed just by clicking on the value. Suppose column is status and values are 'yes' and 'no'. So its like a toggle effect. If user clicks on this column, then a call goes to server and it fires a query to toggle the value in database.

I want to show a alert box showing a confirmation message, like we do for delete. If user clicks on yes then fine otherwise do not complete the call.

best_in_place_if(current_user.admin,trip,:is_active, :type => :checkbox, :classes => 'trip_disable')

Aucun commentaire:

Enregistrer un commentaire