change type de champ view

This commit is contained in:
Tanguy PATTE 2015-11-18 17:03:53 +01:00
parent c4e8c6c989
commit 7e4b26274b
3 changed files with 9 additions and 7 deletions

View file

@ -18,10 +18,12 @@
= ff.object.button_up(index: ff.index)
= ff.object.button_down(index: ff.index)
- unless ff.object.id.nil?
.form-group
%br  
.form-group
%br  
- if ff.object.id.nil?
= f.submit "Ajouter le champ", class: 'btn btn-success', id: :add_type_de_champ
- else
= link_to("", admin_procedure_type_de_champ_path(@procedure, ff.object.id), method: :delete, remote: true, id: "delete_type_de_champ_#{ff.object.id}", class: %w(form-control btn btn-danger fa fa-trash-o) )

View file

@ -1,5 +1,5 @@
= form_for [:admin, @procedure], url: admin_procedure_types_de_champ_path(@procedure) , remote: true do |f|
= render partial: 'fields', locals: { types_de_champ: @procedure.types_de_champ_ordered.decorate, f: f }
%hr
#new_type_de_champ
= render partial: 'fields', locals: { types_de_champ: TypeDeChamp.new.decorate, f: f }
= f.submit "Ajouter un champ", class: 'btn btn-success', id: :add_type_de_champ

View file

@ -25,7 +25,7 @@ feature 'add a new type de champs', js: true do
page.find_by_id('procedure_types_de_champ_attributes_0_libelle').set libelle
page.find_by_id('procedure_types_de_champ_attributes_0_type_champ').set type_champ
page.find_by_id('procedure_types_de_champ_attributes_0_description').set description
click_button 'Ajouter un champ'
click_button 'Ajouter le champ'
wait_for_ajax
procedure.reload
end
@ -46,7 +46,7 @@ feature 'add a new type de champs', js: true do
page.find_by_id('procedure_types_de_champ_attributes_1_libelle').set libelle
select(type_champ, from: 'procedure_types_de_champ_attributes_1_type_champ')
page.find_by_id('procedure_types_de_champ_attributes_1_description').set description
click_button 'Ajouter un champ'
click_button 'Ajouter le champ'
wait_for_ajax
procedure.reload
end