I want display a confirm dialog, If the user presses yes then I want to update that a certain attribute along with another attribute but if yes presses no then I want to update only a single attr. Code So Far
member_action :move_to_research do
puts 'working'
redirect_to admin_credit_appraisal_path, notice: 'working'
end
action_item :move_to_research do
link_to 'sss', move_to_research_admin_credit_appraisal_path, data: { confirm: 'Are you sure?'}
# link_to 'aSasaS', move_to_research_admin_credit_appraisal_path(id: resource.id), class: 'edit', data: { toggle: 'modal', target: '#move_to_research_modal' }
# link_to 'move_to_research', move_to_research_admin_credit_appraisal_path(id: resource.id), class: 'btn', data: { toggle: 'modal' }
# javascript_tag "alert('All is good')", type: 'application/javascript'
# link_to 'Another link with obtrusive JavaScript', '#', onclick: "if (confirm('Are you sure you want to save this thing into the database?')) {
# // Save it!
# console.log('Thing was saved to the database.');
# } else {
# // Do nothing!
# console.log('Thing was not saved to the database.');
# return;
# }"
end
I also tried making an HTML page with a link that sends AJAX request to the server to conditionally update the attributes, but has been unsuccessful