refresh list when delete type de champ
This commit is contained in:
parent
1ab89b63aa
commit
41c0ca27d9
4 changed files with 3 additions and 19 deletions
|
@ -1,14 +0,0 @@
|
|||
|
||||
var ready = function () {
|
||||
$("#liste_champ").on("ajax:success", "div", function(event, data, status, xhr) {
|
||||
$(event.target).parents('.form-inline').fadeOut("slow", function() {
|
||||
return $(this).remove();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$(document).ready(ready);
|
||||
$(document).on('page:load', ready);
|
||||
|
||||
|
||||
|
|
@ -4,7 +4,7 @@ class Admin::TypesDeChampController < AdminController
|
|||
|
||||
def destroy
|
||||
@procedure.types_de_champ.destroy(params[:id])
|
||||
render json: { message: 'deleted' }, status: 200
|
||||
render 'show', format: :js
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render json: { message: 'Champ not found' }, status: 404
|
||||
end
|
||||
|
@ -14,9 +14,7 @@ class Admin::TypesDeChampController < AdminController
|
|||
|
||||
def update
|
||||
@procedure.update_attributes(update_params)
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
render 'show', format: :js
|
||||
end
|
||||
|
||||
def update_params
|
||||
|
|
|
@ -75,7 +75,7 @@ describe Admin::TypesDeChampController, type: :controller do
|
|||
|
||||
describe '#destroy' do
|
||||
before do
|
||||
delete :destroy, procedure_id: procedure.id, id: type_de_champ_id
|
||||
delete :destroy, procedure_id: procedure.id, id: type_de_champ_id, format: :js
|
||||
end
|
||||
context 'when type de champs does not exist' do
|
||||
let(:type_de_champ_id) { 99999999 }
|
||||
|
|
Loading…
Add table
Reference in a new issue